:root {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Arial, sans-serif;
  color: #152b24;
  background: #f5f7f6;
  font-synthesis: none;
  --green: #12b76a;
  --green-dark: #07834d;
  --green-soft: #e8f8ee;
  --border: #e1e9e4;
  --muted: #718078;
  --ink: #152b24;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid #95e4bd; outline-offset: 2px; }

.app-shell { min-height: 100vh; }
.topbar {
  height: 72px; padding: 0 30px; display: flex; align-items: center; gap: 20px;
  background: #fff; border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; color: #0b7549; font-size: 23px; font-weight: 800; letter-spacing: -1.3px; white-space: nowrap; }
.brand-mark { width: 28px; height: 28px; display: inline-grid; place-items: center; background: var(--green); color: #fff; border-radius: 9px; font-size: 20px; font-weight: 800; line-height: 1; }
.topbar-rule { height: 26px; width: 1px; background: var(--border); }
.topbar-title { font-size: 15px; font-weight: 760; color: #273c32; white-space: nowrap; }
.topbar-title span { color: var(--muted); font-weight: 500; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.local-note, .data-count { font-size: 12px; font-weight: 650; color: #52645b; padding: 8px 11px; border: 1px solid var(--border); border-radius: 99px; background: #fbfdfb; }
.local-note { display: flex; align-items: center; gap: 7px; }
.local-dot { width: 7px; height: 7px; background: var(--green); border-radius: 50%; }

.layout { display: grid; grid-template-columns: minmax(700px, 1fr) 428px; gap: 20px; padding: 22px; height: max(820px, calc(100vh - 72px)); }
.workspace, .preview { min-width: 0; background: #fff; border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 8px 30px #153b2910; }
.workspace { display: flex; flex-direction: column; overflow: hidden; min-height: 0; overflow-anchor: none; }
.workspace-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; padding: 25px 27px 18px; }
h1, h2, h3, p { margin: 0; }
.workspace-header h1 { font-size: 24px; letter-spacing: -.65px; line-height: 1.2; }
.workspace-header p, .preview-header p { color: var(--muted); font-size: 13px; margin-top: 6px; line-height: 1.45; }
.workspace-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.expand-all { color: var(--green-dark); background: #fff; border: 1px solid #cfe6d7; font-size: 11px; font-weight: 750; padding: 8px 11px; border-radius: 8px; white-space: nowrap; }
.expand-all:hover { background: #effaf2; }
.source-badge { color: #0b8751; background: #eaf8ef; border: 1px solid #d1edda; font-size: 11px; font-weight: 750; padding: 8px 11px; border-radius: 8px; white-space: nowrap; }
.toolbar { padding: 0 27px 19px; display: flex; align-items: center; gap: 12px; }
.search-box { display: flex; align-items: center; height: 43px; padding: 0 12px; gap: 10px; flex: 1; min-width: 190px; background: #fff; border: 1px solid #d9e4dc; border-radius: 11px; box-shadow: 0 1px 3px #173a240b; }
.search-box:focus-within { border-color: #46c68b; box-shadow: 0 0 0 3px #daf7e6; }
.search-box svg { flex: none; width: 17px; height: 17px; fill: none; stroke: #7a8b80; stroke-width: 2; stroke-linecap: round; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.search-box input:focus-visible { outline: 0; }
.search-box input::placeholder { color: #9ba8a0; }
.search-box kbd { color: #97a49b; font-size: 10px; border: 1px solid var(--border); border-radius: 5px; padding: 3px 5px; white-space: nowrap; }
.filter-group { display: flex; align-items: center; gap: 3px; padding: 3px; background: #f4f7f5; border-radius: 10px; }
.filter { border: 0; background: transparent; color: #748279; border-radius: 8px; padding: 8px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.filter.is-active { color: #0c7045; background: #fff; box-shadow: 0 1px 5px #16382818; }
.tree-heading { display: grid; grid-template-columns: minmax(0, 1fr) 318px; gap: 10px; padding: 11px 27px; background: #f8faf8; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); color: #91a098; font-size: 10px; font-weight: 800; letter-spacing: 1px; }
.tree-scroll { position: relative; flex: 1; min-height: 0; overflow: auto; background: #fff; scrollbar-color: #d4dfd8 transparent; }
.tree-spacer { width: 1px; opacity: 0; }
.tree-rows { position: absolute; top: 0; left: 0; right: 0; }
.tree-row { width: 100%; height: 51px; display: grid; grid-template-columns: minmax(0, 1fr) 318px; align-items: center; gap: 10px; padding: 0 17px 0 27px; border-bottom: 1px solid #f1f4f1; color: #31483b; }
.tree-row:hover { background: #f8fcf9; }
.tree-row.is-current { background: #f0faf3; box-shadow: inset 3px 0 var(--green); }
.tree-row.is-category .node-name { font-weight: 760; }
.node-area { min-width: 0; display: flex; align-items: center; padding-left: min(calc(var(--depth) * 17px), 130px); }
.expand { width: 22px; height: 25px; display: inline-flex; align-items: center; justify-content: center; flex: none; margin-right: 2px; border: 0; background: transparent; color: #84958a; font-size: 12px; font-weight: 800; }
.expand:hover { color: var(--green-dark); }
.node-symbol { width: 22px; height: 22px; flex: none; display: inline-grid; place-items: center; margin-right: 8px; border-radius: 7px; font-size: 11px; font-weight: 800; color: #759185; background: #eef4f0; }
.is-category .node-symbol { color: #15915b; background: #e6f7ec; }
.node-select { display: block; min-width: 0; max-width: 100%; border: 0; background: transparent; text-align: left; padding: 0; color: inherit; }
.node-name { display: block; font-size: 12.5px; line-height: 1.25; font-weight: 590; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-path { color: #95a59b; display: block; font-size: 10.5px; line-height: 1.2; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-tags { display: flex; gap: 5px; justify-content: flex-start; min-width: 0; }
.tag { min-width: 0; border: 1px solid #e1e9e3; background: #fff; color: #708179; border-radius: 7px; padding: 6px 7px; font-size: 10.5px; font-weight: 740; white-space: nowrap; }
.tag:hover { border-color: #77d8a4; }
.tag:disabled { cursor: default; border-color: #e1e9e3; }
.tag.is-positive { background: #e7f8ed; border-color: #bde9cd; color: #0d8750; }
.tag.is-quiet { background: #f3f5f3; color: #809088; }
.tag.is-scope { color: #397356; }
.tag.is-mode { color: #617769; }
.tree-empty { padding: 52px 24px; text-align: center; color: var(--muted); font-size: 13px; }

.detail { min-height: 158px; padding: 18px 27px 19px; border-top: 1px solid var(--border); background: #fff; }
.detail-eyebrow { color: #94a39a; font-size: 10px; font-weight: 800; letter-spacing: .85px; text-transform: uppercase; margin-bottom: 7px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.detail-head > div { min-width: 0; flex: 1; }
.detail h3 { font-size: 17px; letter-spacing: -.3px; }
.detail-path { margin-top: 5px; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.send-phone { flex: none; padding: 10px 13px; color: #fff; border: 1px solid var(--green); border-radius: 9px; background: var(--green); font-size: 11.5px; font-weight: 800; }
.send-phone:hover { background: var(--green-dark); }
.send-phone:disabled { cursor: not-allowed; background: #b8c7bd; border-color: #b8c7bd; }
.detail-meta { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 15px; }
.detail-meta span { padding: 7px 9px; background: #f6f9f7; border: 1px solid #e8efe9; border-radius: 7px; color: #5a6f62; font-size: 11px; font-weight: 680; }

.preview { padding: 25px 20px 18px; display: flex; flex-direction: column; align-items: center; min-height: 0; background: linear-gradient(#fff, #fbfdfb); }
.preview-header { width: 100%; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 0 5px; }
.preview-header h2 { font-size: 18px; letter-spacing: -.3px; }
.device-label { border: 1px solid #d9e6dc; background: #f5faf6; color: #5c7966; border-radius: 7px; padding: 7px 9px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.phone-area { flex: 1; width: 100%; min-height: 0; display: flex; justify-content: center; align-items: flex-start; padding: 15px 0 5px; }
.phone-frame { width: 335px; height: 650px; flex: none; padding: 9px; border-radius: 50px; background: #19221c; box-shadow: 0 2px 3px #fff8 inset, 0 18px 38px #1f362d2b, 0 3px 5px #18231c44; border: 2px solid #36433a; }
.phone-glass { position: relative; height: 100%; overflow: hidden; border-radius: 40px; background: #fff; display: flex; flex-direction: column; }
.phone-status { height: 42px; flex: none; padding: 11px 20px 0; display: flex; justify-content: space-between; align-items: flex-start; color: #132b1e; font-size: 11px; font-weight: 800; }
.dynamic-island { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 99px; height: 23px; border-radius: 18px; background: #19211c; }
.status-icons { letter-spacing: -1px; font-size: 12px; }
.home-indicator { position: absolute; bottom: 7px; left: 50%; transform: translateX(-50%); width: 110px; height: 4px; border-radius: 9px; background: #18211c; z-index: 5; }
.phone-content { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.mobile-header { flex: none; padding: 7px 22px 0; }
.mobile-title { margin-top: 7px; font-size: 22px; letter-spacing: -.85px; line-height: 1.13; color: #183127; }
.mobile-subtitle { margin-top: 7px; color: #7d8c81; font-size: 11.5px; line-height: 1.45; }
.mobile-body { flex: 1; min-height: 0; overflow-y: auto; overflow-anchor: none; padding: 19px 22px 14px; scrollbar-width: thin; }
.mobile-search { height: 43px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1.5px solid #65bd8d; border-radius: 11px; background: #fff; box-shadow: 0 3px 10px #0b754914, 0 0 0 3px #12b76a08; transition: border-color 160ms, box-shadow 160ms; }
.mobile-search:focus-within { border-color: #0ca25c; box-shadow: 0 0 0 3px #12b76a22, 0 3px 10px #0b754914; }
.mobile-search svg { width: 19px; height: 19px; fill: none; stroke: #0d9255; stroke-width: 2; flex: none; }
.mobile-search input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 12px; color: var(--ink); }
.mobile-search input:focus-visible { outline: 0; }
.mobile-search input::placeholder { color: #527263; font-weight: 500; opacity: 1; }
.section-label { margin: 21px 0 9px; color: #8a9a90; text-transform: uppercase; font-size: 10px; font-weight: 800; letter-spacing: .65px; }
.mobile-result { width: 100%; min-height: 42px; display: flex; align-items: center; justify-content: space-between; text-align: left; gap: 8px; padding: 8px 2px; border: 0; border-bottom: 1px solid #edf2ee; background: #fff; color: #254632; font-size: 12px; font-weight: 670; }
.mobile-result small { color: #9caba0; font-size: 18px; }
.result-intent { display: block; margin-top: 3px; font-size: 10px; font-weight: 500; font-style: normal; color: #73877a; }
.mobile-result:hover { color: #0e9858; }
.chip-cloud { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.cloud-chip { border: 1px solid #dce6df; background: #fff; color: #4e6757; border-radius: 10px; padding: 9px 11px; display: inline-flex; align-items: center; gap: 7px; min-height: 34px; max-width: 100%; font-size: 11px; line-height: 1.25; font-weight: 730; text-align: left; box-shadow: 0 1px 2px #18362508; }
.cloud-chip:hover { border-color: #72d59f; }
.add-recommendations { margin: 2px 0 7px; width: 100%; border: 1px solid #a9dfbe; border-radius: 10px; background: #eefaf2; color: #07834c; padding: 10px 8px; font-size: 11px; font-weight: 750; }
.add-recommendations:hover { background: #dff5e7; }
.add-recommendations:disabled { cursor: default; background: #eefaf2; }
.coverage-details { margin-top: 14px; color: #66836f; font-size: 10px; line-height: 1.5; }
.coverage-details summary { cursor: pointer; padding: 8px 0; }
.coverage-list { display: flex; gap: 6px; flex-wrap: wrap; padding: 5px 0 12px; }
.coverage-list .cloud-chip { font-size: 10px; padding: 6px 8px; }
.search-hint { margin-top: 9px; color: #0b8650; font-size: 10px; }
.search-interpretations { margin-top: 14px; padding: 10px; border: 1px solid #e1e9e3; border-radius: 10px; background: #f8faf8; font-size: 11px; }
.search-interpretations summary { cursor: pointer; color: #61796a; }
.interpretation-choice { display: flex; justify-content: space-between; gap: 10px; width: 100%; padding: 10px 0; border: 0; border-bottom: 1px solid #e5ece7; background: transparent; color: #254632; text-align: left; font-weight: 650; }
.interpretation-choice:last-child { border-bottom: 0; }
.interpretation-choice span { color: #73877a; font-weight: 400; }
.source-badge { text-decoration: none; }
.cloud-chip .chip-icon { color: #0da260; font-size: 16px; font-weight: 700; line-height: .8; }
.cloud-chip.is-selected { background: #e7f8ed; color: #08784a; border-color: #a8e3bf; }
.cloud-chip.is-selected .chip-icon { font-size: 13px; }
.selected-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }
.selected-pill { border: 0; background: #eaf8ee; color: #0d8550; padding: 7px 8px; border-radius: 7px; font-size: 10.5px; font-weight: 760; }
.selected-pill span { margin-left: 6px; font-weight: 800; }
.covered-note { margin-top: 10px; font-size: 10.5px; line-height: 1.35; color: #708579; }
.preview-caption { width: 100%; text-align: center; color: #9aa99e; font-size: 11px; line-height: 1.4; padding: 6px 0 0; }

@media (max-width: 1250px) {
  .layout { grid-template-columns: minmax(600px, 1fr) 380px; gap: 12px; padding: 12px; }
  .tree-heading, .tree-row { grid-template-columns: minmax(0, 1fr) 290px; }
  .phone-frame { width: 315px; height: 625px; }
  .topbar { padding: 0 17px; }
}
@media (max-width: 1020px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .workspace { height: 740px; min-height: 740px; }
  .preview { min-height: 795px; }
  .phone-frame { width: 335px; height: 650px; }
}
@media (max-height: 800px) and (min-width: 1021px) {
  .layout { height: max(740px, calc(100vh - 72px)); }
  .phone-frame { width: 280px; height: 520px; border-radius: 42px; padding: 7px; }
  .phone-glass { border-radius: 34px; }
  .mobile-header { padding: 3px 16px 0; }
  .mobile-title { font-size: 19px; }
  .mobile-subtitle { font-size: 10px; }
  .mobile-body { padding: 12px 16px 10px; }
  .mobile-search { height: 36px; }
  .mobile-result { min-height: 37px; }
  .section-label { margin-top: 15px; }
  .cloud-chip { padding: 7px 8px; font-size: 10px; min-height: 30px; }
}
@media (max-width: 680px) {
  .topbar { height: 62px; gap: 10px; }
  .topbar-rule, .topbar-title, .data-count { display: none; }
  .local-note { font-size: 10px; padding: 7px 9px; }
  .layout { padding: 8px; }
  .workspace { height: 735px; min-height: 735px; }
  .workspace-header { padding: 19px 15px 14px; }
  .workspace-header h1 { font-size: 20px; }
  .workspace-header p { font-size: 11px; }
  .source-badge { display: none; }
  .toolbar { flex-wrap: wrap; padding: 0 15px 14px; }
  .filter-group { width: 100%; }
  .filter { flex: 1; font-size: 10px; padding: 8px 6px; }
  .tree-heading, .tree-row { grid-template-columns: minmax(0, 1fr) 110px; }
  .tree-heading { padding: 10px 13px; }
  .tree-row { padding: 0 8px 0 10px; }
  .node-area { padding-left: min(calc(var(--depth) * 12px), 55px); }
  .row-tags .tag:not(:first-child) { display: none; }
  .detail { padding: 15px; }
  .detail h3 { font-size: 15px; }
  .detail-meta { gap: 5px; }
  .preview { padding: 18px 10px; }
  .phone-frame { max-width: 100%; }
}

/* A real phone opens the registration flow directly. */
@media (max-width: 680px) {
  body { background: #fff; }
  .topbar, .workspace, .preview-header, .preview-caption,
  .phone-status, .home-indicator { display: none; }
  .app-shell, .layout { height: 100dvh; min-height: 0; }
  .layout { display: block; padding: 0; }
  .preview { height: 100%; min-height: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: #fff; }
  .phone-area { height: 100%; padding: 0; }
  .phone-frame { width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: #fff; }
  .phone-glass { border-radius: 0; padding-top: env(safe-area-inset-top); }
  .mobile-header { padding-top: 16px; }
  .mobile-title { font-size: 28px; }
  .mobile-subtitle { font-size: 14px; }
  .section-label { font-size: 11px; }
  .mobile-search { min-height: 48px; }
  .mobile-search input { font-size: 16px; }
  .mobile-result { min-height: 48px; font-size: 14px; }
  .cloud-chip { min-height: 44px; padding: 11px 13px; font-size: 13px; }
  .covered-note, .add-recommendations { font-size: 12px; }
}

/* Compact selection flow, shared by the simulator and real phones. */
.mobile-header { padding: 12px 18px 0; }
.mobile-title { margin-top: 0; font-size: 21px; letter-spacing: -.6px; }
.mobile-subtitle { margin-top: 5px; font-size: 11px; line-height: 1.4; }
.mobile-body { padding: 12px 18px 22px; }
.selection-summary { flex: none; margin: 12px 18px 0; border: 1px solid #cde8d8; border-radius: 10px; background: #eef8f2; overflow: hidden; }
.selection-toolbar { display: flex; align-items: flex-start; gap: 8px; flex: none; margin: 12px 18px 0; }
.selection-toolbar .selection-summary { flex: 1; min-width: 0; margin: 0; }
.selection-toolbar .selection-summary strong { min-width: 0; }
.selection-clear { flex: 0 0 auto; min-height: 38px; padding: 8px 10px; border: 1px solid #dce7df; border-radius: 10px; background: #fff; color: #6b756e; font-size: 11px; font-weight: 600; }
.selection-clear:hover { color: #a23636; border-color: #e3b8b8; background: #fff8f8; }
@media (max-height: 800px) and (min-width: 1021px) {
  .selection-toolbar .selection-edit { display: none; }
}
.selection-summary > summary { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 8px 10px; cursor: pointer; list-style: none; color: #17754a; font-size: 11px; }
.selection-summary > summary::-webkit-details-marker { display: none; }
.selection-check { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; background: #d5f1e1; }
.selection-edit { margin-left: auto; font-weight: 500; font-size: 10px; }
.selection-chevron { transition: transform 180ms; }
.selection-summary[open] .selection-chevron { transform: rotate(180deg); }
.selection-list { display: grid; gap: 6px; padding: 0 8px 8px; max-height: 160px; overflow-y: auto; }
.selection-summary:not([open]) .selection-list { display: none; }
.selection-list > .cloud-chip { width: 100%; box-shadow: none; min-height: 34px; font-size: 11px; padding: 8px 10px; }
.selection-list .chip-remove { margin-left: auto; font-size: 16px; font-weight: 400; }
.selection-list .coverage-details { margin-top: 2px; }
.suggestions-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 14px 0 8px; min-height: 24px; font-size: 9px; font-weight: 800; letter-spacing: .5px; color: #75877c; }
.suggestions-heading > button { border: 0; background: transparent; color: #07834d; padding: 5px 0 5px 8px; font-size: 10px; font-weight: 700; letter-spacing: 0; }
.recommendation-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.recommendation-list > .cloud-chip { width: 100%; min-height: 36px; flex-direction: row-reverse; justify-content: space-between; padding: 9px 11px; border-radius: 9px; box-shadow: none; font-size: 11px; }
.selection-flight { position: fixed; z-index: 1000; pointer-events: none; transform-origin: top left; display: flex; align-items: center; padding: 8px 11px; border: 1px solid #a8e3bf; border-radius: 9px; color: #08784a; background: #e7f8ed; font-size: 12px; box-shadow: 0 5px 16px #153b2920; }
@media (max-width: 680px) {
  .mobile-header { padding-top: 18px; }
  .mobile-body { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .mobile-title { font-size: 24px; }
  .mobile-subtitle { font-size: 12px; }
  .selection-summary > summary { min-height: 42px; font-size: 12px; }
  .selection-clear { min-height: 42px; }
  .selection-edit, .suggestions-heading > button { font-size: 11px; }
  .suggestions-heading { font-size: 10px; }
  .recommendation-list > .cloud-chip, .selection-list > .cloud-chip { min-height: 44px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .selection-chevron { transition: none; }
}
