/* Shared workspace system: quiet surfaces, blue actions, consistent density. */
:root, [data-theme="light"] {
  --bg: #f5f7fb; --surface: #fff; --surface2: #eff3f8;
  --line: #e0e6ee; --line2: #c5cfdc; --text: #18212f; --muted: #556274;
  --indigo: #1967d2; --indigo-text: #185abc; --indigo-line: #b9d3f8; --indigo-soft: #eaf2ff; --on-indigo: #fff;
  --primary-bg: #1967d2; --primary-text: #fff; --link: #185abc;
  --track: #e9eef5; --track2: #d3e3fd; --track3: #8ab4f8;
  --chip: #eef2f6; --chip-text: #46556a; --shadow: rgba(30,55,90,.16);
  --green-bg: #e6f4ea; --green-text: #137333; --red-bg: #fce8e6; --red-text: #b3261e;
  --amber-bg: #fef3dc; --amber-text: #865600; --amber-line: #edcf95; --amber-surface: #fffbf2;
  --sb-bg: #f7f9fc; --sb-card: #edf1f7; --sb-line: #e2e7ee; --sb-text: #253348; --sb-muted: #4b5a6d; --sb-dim: #576577;
  --sb-active: #dceafe; --sb-active-text: #174ea6; --sb-accent: #1967d2; --sb-on-accent: #fff;
  --inv-bg: #eaf2ff; --inv-text: #17375e; --inv-muted: #415c80; --inv-track: #d3e3fd;
  --sc-bg: #eef5ff; --sc-card: #fff; --sc-card2: #e0ecff; --sc-line: #d8e5f6; --sc-line2: #c1d6f2;
  --sc-text: #193252; --sc-muted: #50627a; --sc-dim: #576577; --sc-soft: #3d587b;
  --sc-accent: #1967d2; --sc-on-accent: #fff; --sc-link: #185abc;
}
/* Dark: neutral graphite base with clear elevation steps and a vivid (not pastel) blue signal. */
[data-theme="dark"] {
  --bg: #0f1218; --surface: #171b23; --surface2: #1e232d; --line: #2a303c; --line2: #3b4352;
  --text: #eef1f6; --muted: #a4adbd; --indigo: #5e9bff; --indigo-text: #8fbaff;
  --indigo-line: #2f4a78; --indigo-soft: #1a2a45; --on-indigo: #061226;
  --primary-bg: #5e9bff; --primary-text: #061226; --link: #8fbaff;
  --track: #232a36; --track2: #26406b; --track3: #4f86e6; --chip: #222834; --chip-text: #c6cedb;
  --shadow: rgba(0,0,0,.55);
  --green-bg: #12301f; --green-text: #5fd28f; --red-bg: #3a1a1a; --red-text: #ff8a80;
  --amber: #f5b04c; --amber-bg: #33270f; --amber-text: #f6c35b; --amber-line: #5c4718; --amber-surface: #1f1a0f;
  --blue-bg: #1a2a45; --blue-text: #8fbaff;
  --sb-bg: #0b0e13; --sb-card: #161a22; --sb-line: #232935; --sb-text: #e8ecf3; --sb-muted: #b1bac8; --sb-dim: #8f99a9;
  --sb-active: #1b2b48; --sb-active-text: #cfe0ff; --sb-accent: #5e9bff; --sb-on-accent: #061226;
  --inv-bg: #1a2a45; --inv-text: #e6efff; --inv-muted: #b0c4e6; --inv-track: #2f4a78;
  --sc-bg: #121826; --sc-card: #182032; --sc-card2: #1f2b44; --sc-line: #2a3550; --sc-line2: #3a4a6c;
  --sc-text: #e6efff; --sc-muted: #b0bfd8; --sc-dim: #95a3bc; --sc-soft: #c3d0e6;
  --sc-accent: #5e9bff; --sc-on-accent: #061226; --sc-link: #8fbaff;
}
[data-theme="dark"] dialog::backdrop { background: rgba(0,0,0,.6); }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; font-size: 14px; line-height: 1.55; }
h1, h2, .serif, .brand span, .op-empty h3 { font-family: inherit; font-weight: 600; letter-spacing: -.025em; }
h1 { font-size: 30px; line-height: 1.2; }
h2 { font-size: 20px; line-height: 1.35; }
h3 { font-size: 15px; }
button, input, select, textarea { font-family: inherit; }
button, a, input, textarea, select, summary { -webkit-tap-highlight-color: transparent; }
button, a, input, textarea, select, summary { touch-action: manipulation; }
button { transition: background-color .15s, border-color .15s, box-shadow .15s; }
::selection { background: var(--indigo-soft); color: var(--indigo-text); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--indigo); }
.sidebar { width: 240px; padding: 26px 14px 16px; gap: 18px; border-right: 1px solid var(--line); }
.brand { padding: 0 12px; gap: 11px; }
.brand span { font-size: 25px; letter-spacing: -1px; font-weight: 650; }
.brand-dot { fill: #34a853; }
.workspace-avatar { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 32px; height: 32px; border: 1px solid var(--indigo-line); border-radius: 10px; background: var(--indigo-soft); color: var(--indigo-text); font-size: 14px; font-weight: 600; }
button.workspace-avatar { cursor: pointer; border-radius: 50%; width: 36px; height: 36px; }
#tabs { gap: 4px; }
#tabs button { min-height: 44px; border-radius: 8px; font-size: 13px; padding: 11px 13px; }
#tabs button.active { box-shadow: inset 3px 0 var(--indigo); }
#tabs .ico { width: 19px; height: 19px; stroke-width: 1.8; }
.dock { border-radius: 10px; padding: 12px; font-size: 12px; background: var(--surface); gap: 8px; }
.dock-all { color: var(--link); }
.sidebar-foot { border-top: 1px solid var(--line); padding: 10px 0 0; }
/* Bottom-left trigger for the secondary menu (AI usage, Settings, theme, help). */
.more-toggle { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 13px; border: 0; border-radius: 8px; background: none; color: var(--sb-muted); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.more-toggle:hover, .more-toggle[aria-expanded="true"] { background: var(--sb-card); color: var(--sb-text); }
.more-toggle.active { background: var(--sb-active); color: var(--sb-active-text); font-weight: 600; box-shadow: inset 3px 0 var(--indigo); }
.more-toggle:focus-visible { outline: 2px solid var(--indigo); outline-offset: 1px; }
.more-toggle .workspace-avatar { width: 30px; height: 30px; border-radius: 50%; font-size: 13px; }
.more-toggle-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.more-toggle-text > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--text); }
.more-who { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.more-who .workspace-avatar { border-radius: 50%; }
.more-who-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.more-who-text b, .more-who-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.more-who-text small { color: var(--muted); font-size: 11px; }
.more-toggle-text .engine { font-size: 11px; font-weight: 400; color: var(--muted); min-width: 0; }
.more-toggle-chevron { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.more-toggle[aria-expanded="false"] .more-toggle-chevron { transform: rotate(180deg); }
.more-menu { position: fixed; z-index: 60; display: flex; flex-direction: column; padding: 6px; max-height: calc(100dvh - 24px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 48px var(--shadow); animation: more-menu-up .14s ease-out; }
.more-menu[data-side="down"] { animation-name: more-menu-down; }
.more-menu.hidden { display: none; }
@keyframes more-menu-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes more-menu-down { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .more-menu { animation: none; } .more-toggle-chevron { transition: none; } }
.more-item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; text-decoration: none; cursor: pointer; }
.more-item span:first-of-type { flex: 1; }
.more-item .ico { width: 18px; height: 18px; color: var(--muted); }
.more-item:hover, .more-item:focus-visible { background: var(--surface2); outline: none; }
.more-item:focus-visible { box-shadow: inset 0 0 0 2px var(--indigo); }
.more-item[aria-current="page"] { color: var(--indigo-text); font-weight: 600; }
.more-item[aria-current="page"] .ico { color: var(--indigo-text); }
.more-item kbd, .more-item > span[aria-hidden] { color: var(--muted); font-size: 12px; }
.more-sep { height: 1px; margin: 5px 4px; background: var(--line); }
.more-theme { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 4px 4px 10px; font-size: 13px; color: var(--muted); }
.theme-switch { padding: 2px; background: var(--surface); }
.theme-switch button { height: 30px; width: 38px; }
.theme-switch button[aria-pressed="true"] { background: var(--indigo-soft); color: var(--indigo-text); }
.workspace-shell { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.workspace-bar { display: flex; align-items: center; gap: 24px; justify-content: space-between; flex-shrink: 0; height: 68px; padding: 0 30px; background: var(--surface); border-bottom: 1px solid var(--line); }
.workspace-location { display: flex; align-items: center; gap: 12px; font-size: 12px; white-space: nowrap; }
.workspace-trail { min-width: 0; }
.workspace-trail ol { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 8px; min-width: 0; }
.workspace-trail li { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.workspace-trail li + li::before { content: "/"; margin-right: 8px; color: var(--muted); }
.workspace-trail a { color: var(--link); text-decoration: none; font-weight: 500; border-radius: 4px; }
.workspace-trail a:hover { text-decoration: underline; }
.workspace-trail [aria-current="page"] { font-weight: 600; max-width: 42ch; }
.trail-back { display: none; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 8px; border: none; border-radius: 8px; color: var(--muted); background: none; cursor: pointer; font-size: 24px; }
.icon-button:hover { background: var(--surface2); color: var(--text); }
.icon-button svg, .workspace-search svg, .search-dialog-top > svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.workspace-search { display: flex; align-items: center; gap: 10px; width: min(380px, 40%); min-height: 40px; padding: 0 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; text-align: left; }
.workspace-search:hover { border-color: var(--line2); background: var(--surface2); }
.workspace-search kbd { margin-left: auto; }
kbd { border: 1px solid var(--line2); border-radius: 4px; padding: 1px 5px; font-family: inherit; font-size: 11px; line-height: 1.5; color: var(--muted); background: var(--surface); white-space: nowrap; }
.workspace-tools { display: flex; gap: 18px; align-items: center; }
.local-status { display: flex; gap: 7px; align-items: center; font-size: 11px; color: var(--muted); white-space: nowrap; }
.local-status .dot { width: 6px; height: 6px; }
main { flex: 1; padding: 30px 30px 20px; }
.tab { max-width: 1480px; gap: 22px; }
.head { align-items: center; gap: 14px; }
.head-text { gap: 5px; }
.head-text > .muted, .head-text p { font-size: 13px; max-width: 80ch; }
.eyebrow { font-size: 10px; letter-spacing: .08em; }
.head .eyebrow { color: var(--muted); }
.card { border-radius: 12px; padding: 20px; gap: 16px; box-shadow: 0 1px 2px rgba(25,45,75,.025); }
.scene { border-radius: 16px; }
.btn { min-height: 40px; padding: 0 16px; font-size: 13px; font-weight: 600; border-radius: 7px; }
.btn.small { border-radius: 6px; }
.btn:hover { filter: none; box-shadow: 0 1px 3px var(--shadow); }
.btn.secondary { border-color: var(--line2); }
.btn.ghost:hover { box-shadow: none; background: var(--surface2); }
.btn.amber, .btn.btn-accent { background: var(--indigo); color: var(--on-indigo); }
.btn.amber:hover, .btn.btn-accent:hover { color: var(--on-indigo); }
input[type=text], input[type=email], input[type=url], input[type=date], input[type=password], input[type=search], select, textarea { border-radius: 7px; font-size: 14px; min-height: 44px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
label { color: var(--text); font-weight: 500; }
.field-hint, label .small { font-weight: 400; }
.seg-ctl { border-radius: 9px; padding: 3px; background: var(--surface2); }
.seg-ctl button { border-radius: 6px; font-size: 12px; font-weight: 500; }
.seg-ctl button[aria-pressed="true"] { background: var(--surface); color: var(--indigo-text); box-shadow: 0 1px 3px var(--shadow); }
.chip { font-size: 11px; padding: 3px 9px; font-weight: 500; }
.banner { border-radius: 8px; font-size: 13px; }
.home-top { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr); }
.next-card { border: 1px solid var(--indigo-line); padding: 22px; }
.step-title { font-size: 19px; line-height: 1.35; }
.ring-num { font: 600 25px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.stages { gap: 4px; }
.stages li { border-radius: 6px; }
.stages li span { font-size: 10px; }
.stages b { font-family: inherit; font-weight: 600; }
.pf-layout { grid-template-columns: 210px minmax(0, 1fr); }
.pf-rail { padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.pf-rail button { border-radius: 6px; font-size: 12px; }
.rail-head { font-size: 10px; letter-spacing: .06em; }
.pf-section { padding: 18px 22px 8px; }
.pf-search input { border-radius: 7px; }
.fact > summary { border-radius: 6px; }
.fact-main b { font-size: 14px; }
.ad-composer { border-radius: 12px; }
.rv-panel { padding: 0; gap: 0; }
.ad-tips { border-radius: 8px; }
.ad-stat { border-radius: 10px; border-color: var(--line); background: var(--surface); }
.ad-stat b { font-weight: 600; font-size: 25px; letter-spacing: -.03em; }
.dropzone { border-radius: 10px; background: var(--bg); border-color: var(--indigo-line); }
.dropzone:hover, .dropzone.drag { border-color: var(--indigo); background: var(--indigo-soft); }
.op-compose-icon, .op-empty-icon { border-radius: 10px; }
.op-detail-nav { padding: 3px; border-radius: 8px; }
.gauge-wrap { border-radius: 12px; }
.rv-edit, .rv-box { border-radius: 10px; }
.rv-panel { border-width: 1px; }
.rv-bar { background: var(--surface2); }
.notice { border-radius: 10px; box-shadow: 0 4px 24px var(--shadow); }
[data-theme="dark"] .notice .nact { background: var(--indigo); color: var(--on-indigo); }
.drop-veil div { font-family: inherit; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 200; padding: 10px 18px; border-radius: 6px; background: var(--primary-bg); color: var(--primary-text); }
.skip-link:focus { top: 12px; }
main:focus { outline: none; }
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 70px var(--shadow); padding: 0; }
dialog::backdrop { background: rgba(14,28,47,.4); backdrop-filter: blur(3px); }
.search-dialog { width: min(640px, calc(100% - 32px)); margin-top: min(15vh, 120px); }
.search-dialog-top { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); color: var(--muted); }
.search-dialog-top input { flex: 1; min-width: 0; background: transparent; border: 0; border-radius: 0; color: var(--text); padding: 8px 0; }
.search-dialog-top input:focus { outline: none; }
.search-dialog-top:focus-within { box-shadow: inset 0 -2px var(--indigo); }
.search-results { max-height: min(50vh, 440px); overflow: auto; padding: 8px; overscroll-behavior: contain; }
.search-group { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 12px 5px; }
.search-result { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; border: 0; border-radius: 8px; padding: 10px 12px; text-align: left; background: none; color: var(--text); cursor: pointer; font: inherit; }
.search-result:hover, .search-result:focus-visible { background: var(--indigo-soft); outline-offset: -2px; }
.search-result > svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.search-result-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; }
.search-result-copy b { font-weight: 500; overflow-wrap: anywhere; }
.search-result-copy small { font-size: 11px; color: var(--muted); }
.search-result > span:last-child:not(.search-result-copy) { color: var(--muted); }
.search-empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.search-dialog-foot { display: flex; gap: 12px; flex-wrap: wrap; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 10px; color: var(--muted); }
.search-dialog-foot kbd { margin-inline: 2px; }
.help-dialog { width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 26px; }
.help-dialog > * + * { margin-top: 18px; }
.help-dialog h2 { flex: 1; }
.help-steps { padding-left: 22px; }
.help-steps li { padding: 5px 0 10px 6px; }
.help-steps b, .help-steps span { display: block; }
.help-steps span { color: var(--muted); font-size: 13px; margin-top: 4px; }
.shortcut-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; }
@media (min-width: 861px) {
  .layout.nav-collapsed .sidebar { width: 76px; padding-inline: 12px; }
  .nav-collapsed .brand { padding: 0 9px; }
  .nav-collapsed .brand span, .nav-collapsed #tabs span, .nav-collapsed .dock, .nav-collapsed .more-toggle-text, .nav-collapsed .more-toggle-chevron { display: none; }
  .nav-collapsed .more-toggle { justify-content: center; padding-inline: 0; }
  .nav-collapsed #tabs { margin-top: 22px; }
  .nav-collapsed #tabs button { justify-content: center; padding-inline: 0; }
}
@media (max-width: 1200px) {
  .workspace-bar { gap: 16px; padding-inline: 22px; }
  .local-status { display: none; }
  .workspace-trail li[aria-current="page"] { display: none; }
  .trail-back { display: inline; }
  .workspace-search { width: min(380px, 55%); }
  main { padding-inline: 22px; }
  .home-top { grid-template-columns: 1fr 1fr; }
  .home-top .next-card { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .sidebar { width: 100%; padding: 12px 16px 6px; gap: 10px; border: 0; }
  .sidebar-foot { padding: 0; border: 0; }
  .more-toggle { width: 44px; min-height: 44px; padding: 0; justify-content: center; }
  .more-toggle .workspace-avatar { width: 32px; height: 32px; }
  .more-toggle-text, .more-toggle-chevron { display: none; }
  .more-toggle.active { box-shadow: inset 0 -2px var(--indigo); }
  #tabs button { padding: 10px 12px; }
  #tabs button.active { box-shadow: inset 0 -2px var(--indigo); }
  .workspace-bar { height: 52px; padding: 0 16px; gap: 12px; }
  #sidebar-toggle { display: none; }
  .workspace-search { width: auto; flex: 1; max-width: 340px; min-height: 34px; }
  .workspace-tools { display: none; }
  main { padding: 20px 16px 12px; }
  h1, .tab > .head h1 { font-size: 26px; }
  .tab { gap: 14px; }
  .head-text p { font-size: 12px; }
  .head .row { gap: 8px; }
  .head .btn { min-height: 40px; }
  .pf-layout { grid-template-columns: minmax(0, 1fr); }
  .pf-rail { background: none; border: 0; padding: 3px 0; border-radius: 0; }
  .pf-rail button { border-radius: 20px; }
  .ad-stat b { font-size: 22px; }
  .card { padding: 16px; }
  .ad-composer { padding: 0; }
  .rv-panel { padding: 0; gap: 0; }
  #tab-add:has(.ad-workspace[data-view="review"]) > #ad-status { display: none; }
  .rv-head { padding: 16px; gap: 10px; }
  .rv-summary { font-size: 13px; }
  .rv-list { padding-inline: 16px; }
  .rv-bar { padding: 10px 14px; gap: 6px; }
  .rv-bar > .row { gap: 8px; }
  .rv-bar .btn { font-size: 12px; padding-inline: 12px; }
  .home-top { gap: 12px; }
  .ad-workspace, .op-workspace { gap: 10px; }
  #tab-opps > .head { flex-wrap: nowrap; }
  #tab-opps > .head .head-text { flex: 1; min-width: 0; }
  #tab-opps > .head .eyebrow { display: none; }
  #tab-opps > .head .btn { padding-inline: 12px; font-size: 12px; }
}
@media (max-width: 480px) {
  .workspace-search kbd { display: none; }
  .workspace-search { font-size: 11px; }
  .workspace-location { font-size: 11px; }
  .home-top { grid-template-columns: minmax(0, 1fr); }
  .home-top .next-card { grid-column: auto; }
  .head { gap: 10px; }
  .search-dialog-foot > span:last-child { display: none; }
  .help-dialog { padding: 20px; }
  #tab-opps > .head h1 { font-size: 19px; }
  #tab-opps > .head .btn { gap: 5px; padding-inline: 10px; font-size: 11px; }
  #tab-opps > .head .btn svg { width: 15px; }
}
@media (max-height: 720px) and (min-width: 861px) {
  .sidebar { gap: 12px; padding-top: 18px; }
  .dock .sb-dim { display: none; }
  .workspace-bar { height: 56px; }
}

/* Compact screen headers: one line for the title and its summary, so content starts high on every screen.
   The eyebrow and the date above the title repeat what the navigation already says, so they go. */
main { padding-top: 18px; }
.tab { gap: 14px; }
.tab > .head { gap: 12px; min-height: 40px; }
.tab > .head .head-text { flex: 1 1 320px; min-width: 0; flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 12px; row-gap: 2px; }
.tab > .head .head-text > :has(+ h1) { display: none; }
.tab > .head h1 { font-size: 22px; line-height: 1.25; }
.tab > .head .head-text > .muted, .tab > .head .head-text p { font-size: 13px; margin: 0; }
.tab > .head .btn { min-height: 36px; }
@media (max-width: 860px) {
  main { padding-top: 14px; }
  .tab { gap: 10px; }
  .tab > .head { min-height: 0; }
  .tab > .head h1 { font-size: 19px; }
  .tab > .head .head-text > .muted, .tab > .head .head-text p { font-size: 12px; }
}
