/* JAVLIN OS — Proposal D · Unified. Only .shell-d overrides of shared classes and D-only .d-* classes.
   Tokens come from ../shared/tokens.css; radius 4/6 px, no gradients, nothing under 13 px, phone targets >= 48 px.
   Orange is only the active-navigation marker (base.css); blue is the action colour. Nothing scrolls sideways at 375 px. */

/* ───── shell ───── */
.shell-d .main { min-width: 0; }
.shell-d .top { padding: 0 24px; }
.shell-d .content { min-width: 0; }
.shell-d .subnav { flex-wrap: wrap; overflow: visible; }
.shell-d .btn { max-width: 100%; }
.shell-d .side-nav a { gap: 10px; }
.shell-d .side-nav a .count { margin-left: auto; }
.d-nav-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-d .side-nav a .d-co-tag { margin-left: auto; }
.shell-d .side-nav a .count + .d-co-tag { margin-left: 6px; }
.d-co-tag { display: inline-flex; align-items: center; flex: none; padding: 1px 6px; border-radius: var(--r); background: var(--navy-600); color: var(--navy-200); font: 600 13px var(--mono); line-height: 1.4; white-space: nowrap; }

/* sidebar footer */
.shell-d .side-foot { gap: 8px; }
.shell-d .side-foot a.d-person { display: flex; align-items: center; gap: 8px; min-height: 36px; color: #fff; font-weight: 600; }
.shell-d .side-foot a { display: inline-flex; align-items: center; gap: 6px; }
.d-preview-btn { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 4px 8px; border: 1px solid var(--navy-400); border-radius: var(--r); background: transparent; color: var(--navy-200); font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; }
.d-preview-btn:hover { background: var(--navy-600); color: #fff; }
.d-preview-btn.on { background: var(--navy-rail); color: #fff; }
.d-preview-state { margin-left: auto; font-family: var(--mono); }

/* company switcher (two-company preview) */
.shell-d .d-org { padding: 0; }
.d-org-btn { position: relative; display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 44px; padding: 8px 32px 8px 10px; border: 0; background: transparent; color: #fff; font-size: 13px; line-height: 1.3; text-align: left; cursor: pointer; }
.d-org-btn small { color: var(--navy-300); }
.d-org-btn .ic { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.d-org-btn:hover { background: var(--navy-600); }
.d-org-list { display: flex; flex-direction: column; gap: 2px; padding: 4px; border-top: 1px solid var(--navy-400); }
.d-org-list button { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 8px; border: 0; border-radius: var(--r); background: transparent; color: var(--navy-200); font-size: 13px; text-align: left; cursor: pointer; }
.d-org-list button small { margin-left: auto; color: var(--navy-300); }
.d-org-list button:hover, .d-org-list button.on { background: var(--navy-rail); color: #fff; }

/* ───── the scope control (top bar) ───── */
.d-scope { display: inline-flex; align-items: center; gap: 10px; flex: 0 1 480px; min-width: 320px; max-width: 480px; height: 44px; padding: 0 12px; border-radius: var(--r); font: inherit; text-align: left; }
button.d-scope { cursor: pointer; }
.d-scope-t { display: flex; flex-direction: column; justify-content: center; flex: 1; min-width: 0; line-height: 1.2; }
.d-scope-l1 { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; overflow: hidden; }
.d-scope-l1 .stamp { min-height: 18px; padding: 0 6px; text-transform: none; letter-spacing: 0; line-height: 1.35; }
.d-scope-l2 { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 15px; font-weight: 700; }
.d-scope-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-scope-company { background: var(--navy); border: 1px solid var(--navy); color: #fff; }
.d-scope-company .d-scope-l1 { color: var(--navy-200); }
.d-scope-company .d-scope-l2 { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-scope-company > .ic { color: #fff; }
.d-scope-company:hover { background: var(--navy-rail); }
.d-scope-project { background: var(--blue-tint); border: 1px solid var(--blue); border-left-width: 4px; color: var(--ink); }
.d-scope-project .d-scope-l1 { color: var(--blue-dark); }
.d-scope-project > .ic { color: var(--blue-dark); }
button.d-scope-project:hover { box-shadow: inset 0 0 0 1px var(--blue); }
.d-scope-site { cursor: default; }
.d-scope-site .d-scope-l1 .ic { color: var(--blue-dark); }
.d-code { display: inline-flex; align-items: center; flex: none; padding: 1px 6px; border-radius: var(--r); background: var(--navy); color: #fff; font: 600 13px var(--mono); line-height: 1.35; white-space: nowrap; }

/* ───── page head: scope stamp + breadcrumb ───── */
.d-head .eyebrow { margin-bottom: 6px; }
.d-head-main { min-width: 0; max-width: 100%; }
.d-sep, .d-crumb-sep { color: var(--steel); }
.d-crumbs { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
.d-stamp { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 26px; padding: 2px 8px; border-radius: var(--r); font-size: 13px; font-weight: 600; }
.d-stamp-company { background: var(--navy); color: #fff; letter-spacing: .02em; }
.d-stamp-project { background: var(--blue-tint); border: 1px solid var(--blue); border-left-width: 4px; color: var(--ink); }
.d-stamp-l { color: var(--blue-dark); letter-spacing: .04em; white-space: nowrap; }
.d-stamp-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--ink); }
.d-stamp-site .ic { color: var(--blue-dark); }
.d-back { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; margin-bottom: 4px; font-size: 14px; font-weight: 600; }
.d-panel-n { display: inline-flex; align-items: center; min-height: 22px; padding: 0 6px; border: 1px solid var(--line); border-radius: var(--r); font: 600 13px var(--mono); color: var(--steel); }
.d-status-text { color: var(--steel); font-size: 14px; }
.d-actions-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.d-proto-btn { border-style: dashed; color: var(--steel); }
.d-field-err { color: var(--red); font-weight: 600; }
.d-check { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; font-size: 15px; cursor: pointer; }
.d-check input { width: 20px; height: 20px; }
.d-empty-a { margin-top: 12px; }
.d-break { word-break: break-all; overflow-wrap: anywhere; }
.d-stub { border-style: dashed; border-color: var(--navy-200); }

/* ───── home tiles ───── */
.d-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.d-tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.d-tile { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-height: 96px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); color: var(--ink); min-width: 0; }
.d-tile:hover { border-color: var(--blue); background: var(--navy-50); color: var(--ink); text-decoration: none; }
.d-tile > .ic { color: var(--blue); }
.d-tile-l { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.d-tile-s { font-size: 14px; color: var(--steel); overflow-wrap: anywhere; }

/* ───── launch card + hand-off ───── */
.d-launch { display: flex; flex-direction: column; gap: 10px; padding: 16px 20px; border: 1px solid var(--navy-200); border-radius: var(--r-lg); background: var(--panel); }
.d-launch-h { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.d-launch-h > .ic { color: var(--navy); }
.d-launch-p { color: var(--steel); }
.d-prot { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 2px 8px; border: 1px solid var(--navy-200); border-radius: var(--r); background: var(--navy-50); color: var(--navy); font: 600 13px var(--mono); white-space: nowrap; }
.d-prot-linked { border-color: var(--line); background: var(--muted-tint); color: var(--steel); }
.d-launch-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; font-size: 14px; }
.d-launch-dl dt { color: var(--steel); font-weight: 600; }
.d-launch-dl dd { overflow-wrap: anywhere; }
.d-launch-f { display: flex; flex-wrap: wrap; gap: 8px; }
.d-handoff-ctx td { overflow-wrap: anywhere; }
.d-ol { display: flex; flex-direction: column; gap: 6px; padding: 14px 20px 14px 42px; list-style: decimal; }
.d-ul { display: flex; flex-direction: column; gap: 4px; padding: 14px 20px 14px 40px; list-style: disc; }
.d-handoff-foot { padding-top: 12px; border-top: 1px dashed var(--navy-200); font-size: 13px; color: var(--steel); }

/* ───── home blocks ───── */
.d-resolve-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 14px 20px; }
.d-resolve-n { font: 600 26px/1.1 var(--mono); }
.d-resolve-links { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 14px; }
.d-resolve-line .grow + a { font-weight: 600; }

/* ───── overlays: sheets, scope switcher, palette ───── */
.d-overlay { position: fixed; inset: 0; z-index: 85; display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; background: rgba(16, 26, 53, .5); }
.d-sheet { display: flex; flex-direction: column; width: min(560px, 100%); max-height: 85vh; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); box-shadow: 0 16px 48px rgba(16, 26, 53, .3); }
.d-sheet-h { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 20px; border-bottom: 1px solid var(--line-soft); }
.d-sheet-h h2 { flex: 1; min-width: 0; font-size: 18px; }
.d-sheet-x { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 48px; height: 48px; border: 0; border-radius: var(--r); background: none; color: var(--steel); cursor: pointer; }
.d-sheet-x:hover { background: var(--navy-50); color: var(--ink); }
.d-sheet-b { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px; overflow-y: auto; }
.d-sheet-f { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line-soft); }
.d-sheet-scope { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; font-size: 14px; }
.d-sheet-scope dt { color: var(--steel); font-weight: 600; }
.d-sheet-scope dd { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.d-sheet-lines { border: 1px solid var(--line-soft); border-radius: var(--r); }
.d-sheet-lines li { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); font-size: 14px; overflow-wrap: anywhere; }
.d-sheet-lines li:last-child { border-bottom: 0; }
.d-sheet-b .field input, .d-sheet-b .field select { width: 100%; }
.d-sheet-b textarea, .d-reason textarea { width: 100%; min-height: 88px; padding: 10px 12px; border: 1px solid var(--navy-200); border-radius: var(--r); font: 400 15px var(--sans); color: var(--ink); resize: vertical; }
.d-reason-n { margin-top: -6px; font-size: 13px; color: var(--steel); }
.d-sheet-sig { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--steel); }
.d-sheet-note { font-size: 14px; color: var(--steel); }
.d-sheet-f .btn[disabled] { pointer-events: none; }

.d-overlay-scope { justify-content: flex-start; padding: calc(var(--top-h) + 4px) 16px 16px calc(var(--side-w) + 24px); background: rgba(16, 26, 53, .25); }
.d-switch { width: min(440px, 100%); }
.d-switch-q { margin-bottom: 4px; }
.d-switch-l { padding-top: 4px; font-size: 13px; font-weight: 600; letter-spacing: .06em; color: var(--steel); }
.d-switch-list { display: flex; flex-direction: column; gap: 4px; }
.d-switch-item { display: flex; align-items: center; gap: 6px; }
.d-switch-row { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; min-height: 48px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.d-switch-row:hover { background: var(--navy-50); }
.d-switch-row.on { border-color: var(--blue); background: var(--blue-tint); }
.d-switch-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-pin { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 48px; height: 48px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); color: var(--steel); cursor: pointer; }
.d-pin.on { border-color: var(--blue); background: var(--blue-tint); color: var(--blue); }
.d-switch-f { justify-content: flex-start; font-size: 13px; color: var(--steel); }

.d-palette .palette-list .d-hit { padding: 6px 10px; border-bottom: 0; border-radius: var(--r); }
.d-palette .palette-list .d-hit small { margin-left: 0; }
.d-pal-g { padding: 8px 10px 2px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--steel); }
.d-pal-scope { padding: 6px 16px; border-bottom: 1px solid var(--line-soft); font-size: 13px; color: var(--steel); }
.d-pal-widen { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; margin-top: 4px; padding: 6px 10px; border: 1px dashed var(--navy-200); border-radius: var(--r); background: var(--panel); color: var(--blue); font-weight: 600; cursor: pointer; }

/* ───── search results ───── */
.d-hit { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 20px; border-bottom: 1px solid var(--line-soft); color: var(--ink); }
.d-hit:hover, .d-hit.sel { background: var(--blue-tint); color: var(--ink); text-decoration: none; }
.d-hit > .ic { color: var(--steel); }
.d-hit-l { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.d-hit-l small { display: block; color: var(--steel); }
.d-hits-h { padding: 12px 20px 4px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--steel); }
.d-hits-more { padding: 6px 20px 10px; font-size: 13px; }

/* ───── To resolve ───── */
.d-inbox-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.d-inbox-total { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 15px; }
.d-inbox-total strong { font: 600 22px var(--mono); }
.d-inbox-rows li { flex-wrap: wrap; }
.d-age { flex: none; width: 64px; text-align: right; color: var(--steel); }
.d-choose li { padding: 0; }
.d-choose-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 20px; color: var(--ink); }
.d-choose-row:hover { background: var(--blue-tint); color: var(--ink); text-decoration: none; }

/* ───── filter chips ───── */
.d-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.d-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px; border: 1px solid var(--navy-200); border-radius: var(--r); background: var(--panel); color: var(--ink); font-size: 14px; font-weight: 600; }
.d-chip:hover { background: var(--navy-50); color: var(--ink); text-decoration: none; }
.d-chip.on { border-color: var(--navy); background: var(--navy); color: #fff; }
.d-chip-n { font: 600 13px var(--mono); color: var(--steel); }
.d-chip.on .d-chip-n { color: var(--navy-200); }

/* ───── Tools (phone module directory) ───── */
.d-tools-g { display: flex; flex-direction: column; gap: 8px; }
.d-tools-h { font-size: 13px; font-weight: 600; letter-spacing: .08em; color: var(--steel); }
.d-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.d-tool { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 96px; min-width: 0; padding: 12px 6px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); color: var(--ink); font-size: 14px; font-weight: 600; text-align: center; }
.d-tool:hover { border-color: var(--blue); color: var(--ink); text-decoration: none; }
.d-tool > .ic { color: var(--blue); }
.d-tool-l { overflow-wrap: anywhere; }
.d-tool .d-co-tag { position: absolute; top: 6px; right: 6px; }

/* ───── Me ───── */
.d-me-proto { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px 20px; }

/* ───── phone-only chrome (hidden on desktop) ───── */
.d-top-back, .d-top-mark, .d-top-search { display: none; }
.d-proto-foot { display: none; margin-top: 8px; padding-top: 12px; border-top: 1px dashed var(--navy-200); font: 500 13px var(--mono); color: var(--steel); }

/* ───── worker stage (desktop frame around the phone) ───── */
.d-wstage-shell .wstage-top a { color: var(--navy-200); }
.d-wcompare { font-size: 13px; white-space: nowrap; }
.d-wlang { display: inline-flex; flex: none; margin-left: auto; overflow: hidden; border: 1px solid var(--navy-400); border-radius: var(--r); }
.d-wlang button { min-width: 48px; min-height: 48px; padding: 0 10px; border: 0; background: transparent; color: var(--navy-200); font-size: 15px; font-weight: 700; cursor: pointer; }
.d-wlang button.on { background: #fff; color: var(--navy); }

/* ───── 769–1100 px: nothing collapses; the prototype tag moves to the page footer ───── */
@media (max-width: 1100px) {
  .shell-d .top .proto-tag { display: none; }
  .shell-d .d-proto-foot { display: block; }
}

/* ───── phone (768 px and narrower) ───── */
@media (max-width: 768px) {
  .shell-d .side { display: none; }
  .shell-d .main { margin-left: 0; }
  .shell-d .top { padding: 0 4px; gap: 4px; }
  .shell-d .top .grow, .shell-d .d-kbd { display: none; }
  .shell-d .d-top-back, .shell-d .d-top-mark, .shell-d .d-top-search { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 48px; height: 48px; border-radius: var(--r); color: var(--ink); }
  .shell-d .d-top-mark img { width: auto; height: 28px; }
  .shell-d .d-scope { flex: 1 1 auto; min-width: 0; max-width: none; height: 48px; padding: 0 10px; }
  .shell-d .d-head .eyebrow > .d-stamp + .d-sep { display: none; }
  .shell-d .tabbar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .shell-d .tabbar a { position: relative; min-height: calc(64px - env(safe-area-inset-bottom, 0px)); }
  .d-tab-badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 20px; height: 20px; padding: 0 5px; font-size: 13px; }
  .shell-d .btn { white-space: normal; text-align: center; }
  .shell-d .btn-sm { min-height: 48px; }
  .shell-d .src { white-space: normal; }
  .shell-d .tbl td.act { flex-wrap: wrap; white-space: normal; }
  .shell-d .page-actions { width: 100%; }
  .d-tiles, .d-tiles-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .d-tools { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .d-chip { min-height: 48px; }
  .d-inbox-rows .rows-main { flex: 1 1 100%; order: 2; }
  .d-inbox-rows .btn { order: 3; margin-left: auto; }
  .d-launch { padding: 14px 16px; }
  .d-launch-dl { grid-template-columns: minmax(0, 1fr); }
  .d-launch-f .btn { width: 100%; }
  .d-overlay, .d-overlay-scope { align-items: flex-end; padding: 0; }
  .d-sheet, .d-switch { width: 100%; max-height: 85vh; border-bottom: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .d-sheet-h { padding-left: 16px; }
  .d-sheet-b { padding: 14px 16px; }
  .d-sheet-f { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .d-sheet-f .btn { flex: 1 1 auto; min-height: 48px; }
  .d-sheet-scope { grid-template-columns: minmax(0, 1fr); }
  .d-hit { padding: 8px 16px; }
  .d-hits-h { padding-left: 16px; padding-right: 16px; }
  .d-choose-row { padding: 10px 16px; }
  .d-me-proto { padding: 14px 16px; }
  .d-wcompare { display: none; }
}
