:root {
  /* ------------------------------------------------------------------
     Atlas Visual Language — single source of truth.
     Dark-Atlas is the dominant theme; light tokens redefine the same
     semantic names in the light @media block. Components consume only
     the semantic --bg/--fg/--accent/--err etc. — never the raw hex.
     If you tune tokens, tune all four CSS files in the same diff.
     ------------------------------------------------------------------ */
  --atlas-petrol:    #153937;
  --atlas-petrol-2:  #102b29;
  --atlas-teal:      #1F4E4A;
  --atlas-teal-2:    #29605B;
  --atlas-ochre:     #E6A24A;
  --atlas-ochre-2:   #C7873A;
  --atlas-sand:      #F2D6A2;
  --atlas-sand-mute: #C9B385;
  --atlas-sage:      #7FA39A;
  --atlas-sage-2:    #6A8C84;
  --atlas-coral:     #D97A5B;
  --atlas-terracotta:#A63D2F;
  --atlas-burnt:     #C65A2E;
  --atlas-clay:      #8C4A2F;

  --atlas-grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.05 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");

  --bg:           var(--atlas-petrol-2);
  --bg-elev:      var(--atlas-petrol);
  --bg-raised:   var(--atlas-teal);
  --bg-input:    var(--atlas-teal);
  --fg:          var(--atlas-sand);
  --fg-muted:    var(--atlas-sand-mute);
  --accent:      var(--atlas-ochre);
  --accent-hov:  var(--atlas-ochre-2);
  --accent-fade: rgba(230, 162, 74, 0.18);
  --user-bg:     var(--atlas-teal-2);
  --oji-bg:      rgba(31, 78, 74, 0.55);
  --border:      rgba(242, 214, 162, 0.10);
  --border-strong: rgba(242, 214, 162, 0.22);
  --warning:     var(--atlas-coral);
  --error:       var(--atlas-terracotta);
  --error-fg:    #F4C9B8;
  --at-cap:      var(--atlas-burnt);
  --focus-ring:  var(--atlas-ochre);

  --secondary:     var(--atlas-sage);
  --secondary-hov: var(--atlas-sage-2);
  --branch-glow:   rgba(230, 162, 74, 0.30);

  --font-ui: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Helvetica Neue", sans-serif;
  --font-headline: ui-serif, "Playfair Display", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 22px;

  --shadow-1: 0 1px 0 rgba(0, 0, 0, 0.25);
  --shadow-2: 0 6px 18px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:           #F6EFE2;
    --bg-elev:      #FBF6EC;
    --bg-raised:    #F2D6A2;
    --bg-input:    #FEFCF8;
    --fg:          #153937;
    --fg-muted:    #4A6E69;
    --accent:      #C7873A;
    --accent-hov:  #A86A26;
    --accent-fade: rgba(199, 135, 58, 0.16);
    --user-bg:     #F2D6A2;
    --oji-bg:      #FBF6EC;
    --border:      rgba(21, 57, 55, 0.12);
    --border-strong: rgba(21, 57, 55, 0.25);
    --error-fg:    #6B1C12;
    --secondary:     #7FA39A;
    --secondary-hov: #6A8C84;
    --branch-glow:   rgba(230, 162, 74, 0.22);
  }
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--atlas-grain);
  background-size: 160px 160px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.9;
}

body { display: flex; flex-direction: column; }

/* Stacking: header MUST out-rank main so the account dropdown (a child of
   header) paints over the dashboard surface. Sibling stacking contexts with
   equal z-index let the later DOM node (main) win — that was the #21
   dropdown-behind-content bug. Ported here from the chat/flow fix. */
header { position: relative; z-index: 10; }
main   { position: relative; z-index: 1; }

/* ------------------ Header ------------------ */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  min-height: 56px;
}

.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand-name {
  font-family: var(--font-headline);
  font-weight: 600;
  letter-spacing: 0.01em;
  font-size: 1.15rem;
  color: var(--fg);
}
.brand-sep { color: var(--fg-muted); }
.brand-sub {
  font-family: var(--font-headline);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--fg-muted);
  letter-spacing: 0.02em;
}
.dot {
  width: 12px;
  height: 12px;
  background: var(--accent);
  display: inline-block;
  clip-path: polygon(50% 0%, 65% 35%, 100% 50%, 65% 65%, 50% 100%, 35% 65%, 0% 50%, 35% 35%);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}
.surface-nav {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  flex-wrap: wrap;
}
.surface-link {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: color 120ms ease, background-color 120ms ease;
}
.surface-link:hover { color: var(--fg); background: var(--accent-fade); }
.surface-link:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.surface-link.is-current {
  color: var(--fg);
  background: var(--accent-fade);
  font-weight: 600;
}

/* Account chip (carried over from chat.css for consistency) */
.account-wrap { position: relative; }
.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-raised);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.25rem 0.6rem 0.25rem 0.3rem;
  font-size: 0.85rem;
  cursor: pointer;
  max-width: 240px;
  min-height: 36px;
}
.account-chip:hover { border-color: var(--accent); }
.account-chip:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.account-chip .avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--atlas-ochre);
  color: var(--atlas-petrol);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.account-chip .email-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg-muted);
}
.account-chip .caret {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--fg-muted);
  margin-right: 2px;
}
.account-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
  min-width: 220px;
  padding: 0.4rem;
  z-index: 20;
}
.account-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--fg);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  min-height: 36px;
}
.account-menu button:hover { background: var(--accent-fade); }
.account-menu button:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.account-menu .menu-section {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.account-menu hr { border: none; border-top: 1px solid var(--border); margin: 0.3rem 0; }

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ------------------ Sign-in / access-denied (mirrors chat) ------------------ */
.signin-wrap { margin: auto; text-align: center; padding: 2rem 1.25rem; max-width: 460px; width: 100%; }
.signin-medallion { width: 88px; height: 88px; margin: 0 auto 1.5rem; color: var(--accent); filter: drop-shadow(0 1px 0 rgba(0,0,0,0.2)); }
.signin-headline { font-family: var(--font-headline); font-size: 1.75rem; color: var(--fg); margin: 0 0 0.5rem; letter-spacing: 0.005em; }
.signin-prose { color: var(--fg-muted); margin: 0 0 1.75rem; font-size: 0.95rem; }
.signin-prose strong { color: var(--fg); font-weight: 600; }
.signin-error {
  margin-top: 1.25rem;
  color: var(--error-fg);
  background: rgba(166, 61, 47, 0.18);
  border: 1px solid var(--error);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
}

.access-denied { margin: auto; text-align: center; padding: 2.5rem 1.5rem; max-width: 460px; }
.access-denied .medallion { width: 72px; height: 72px; margin: 0 auto 1.25rem; color: var(--at-cap); }
.access-denied h2 { font-family: var(--font-headline); color: var(--fg); margin: 0 0 0.5rem; font-size: 1.4rem; }
.access-denied p { color: var(--fg-muted); margin: 0 0 1.5rem; }
.access-denied .email-shown { color: var(--fg); font-family: var(--font-mono); font-size: 0.9rem; }
.access-denied button {
  background: var(--accent);
  color: var(--atlas-petrol);
  border: none;
  border-radius: var(--radius-md);
  padding: 0.65rem 1.2rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}
.access-denied button:hover { background: var(--accent-hov); }
.access-denied button:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ------------------ Dashboard wrap ------------------ */
.dashboard-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2rem;
  opacity: 1;
  transition: opacity 220ms ease;
}
.dashboard-wrap.fade-in { animation: oji-fade-in 220ms ease both; }
@keyframes oji-fade-in {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Layout: single column by default; queue + recent side-by-side on wide
   viewports. The recent lane is narrower — its rows are compact (status +
   lifecycle action), so the main queue keeps the room its briefs need. */
.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  min-height: 0;
}
@media (min-width: 900px) {
  .dashboard-wrap { max-width: 1180px; }
  .dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 2rem;
    align-items: start;
  }
}

/* ------------------ Recent lane ------------------ */
.recent-section { display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; }
.recent-list { gap: 0.6rem; }
.recent-empty {
  color: var(--fg-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 0.5rem 0.1rem;
}
.recent-empty p { margin: 0; max-width: 40ch; }

.recent-item { padding: 0.75rem 0.85rem 0.8rem; gap: 0.5rem; }
.recent-item .qi-action-summary { font-size: 0.92rem; }

.recent-note {
  color: var(--fg-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}
.recent-artifact {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  word-break: break-all;
  text-underline-offset: 2px;
}
.recent-artifact:hover { color: var(--accent-hov); }
.recent-artifact:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 4px; }

/* Status chips — filled, mirrors the urgency-chip vocabulary. */
.status-chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-raised);
  color: var(--fg-muted);
  white-space: nowrap;
}
.status-chip.st-approved      { background: var(--accent);          color: var(--atlas-petrol); }
.status-chip.st-dispatched    { background: var(--secondary);       color: var(--atlas-petrol); }
.status-chip.st-in_progress   { background: var(--secondary);       color: var(--atlas-petrol); }
.status-chip.st-completed     { background: var(--atlas-teal-2);    color: var(--fg); }
.status-chip.st-rejected      { background: var(--atlas-terracotta);color: var(--atlas-sand); }
.status-chip.st-edit_requested{ background: var(--atlas-coral);     color: var(--atlas-petrol); }
.status-chip.st-expired       { background: var(--bg-raised);       color: var(--fg-muted); }

.queue-section { display: flex; flex-direction: column; gap: 0.75rem; }

.queue-head {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.section-title {
  font-family: var(--font-headline);
  font-size: 1.35rem;
  color: var(--fg);
  margin: 0;
  letter-spacing: 0.005em;
}
.queue-count {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--fg-muted);
}
.poll-status {
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fg-muted);
  opacity: 0.5;
  transition: background-color 200ms ease, opacity 200ms ease;
}
.poll-status.is-live { background: var(--secondary); opacity: 0.9; }
.poll-status.is-stale { background: var(--fg-muted); opacity: 0.4; }
.poll-status.is-error { background: var(--at-cap); opacity: 0.9; }

/* Error strip — sits above the list when polling fails. */
.error-strip {
  background: rgba(198, 90, 46, 0.16);
  border: 1px solid var(--at-cap);
  color: var(--error-fg);
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
}

/* Thinking strip — reused vocabulary from chat for loading state. */
.thinking-strip {
  padding: 0 0.25rem;
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  opacity: 0;
  transition: height 180ms ease, opacity 180ms ease, padding 180ms ease;
}
.thinking-strip.is-active {
  height: 22px;
  padding: 0.25rem 0.25rem;
  opacity: 1;
}
.thinking-strip .shape {
  width: 8px;
  height: 8px;
  background: var(--atlas-ochre);
  opacity: 0.3;
  animation: oji-thinking-pulse 1.4s ease-in-out infinite;
}
.thinking-strip .shape.s-triangle {
  background: transparent;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 9px solid var(--atlas-ochre);
}
.thinking-strip .shape.s-diamond { transform: rotate(45deg); animation-delay: 0.18s; }
.thinking-strip .shape.s-circle { border-radius: 50%; animation-delay: 0.36s; }
@keyframes oji-thinking-pulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1.0; }
}

/* ------------------ Queue list ------------------ */
.queue-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.queue-item {
  background: var(--oji-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.95rem 1.05rem 1rem;
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: border-color 160ms ease;
}
.queue-item:focus-within { border-color: var(--border-strong); }
.queue-item.is-dispatching { opacity: 0.65; pointer-events: none; }

.qi-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.qi-agent {
  font-family: var(--font-headline);
  font-size: 1.05rem;
  color: var(--fg);
  letter-spacing: 0.01em;
}
.qi-source {
  font-size: 0.78rem;
  color: var(--fg-muted);
  font-family: var(--font-mono);
}
.qi-time {
  font-size: 0.78rem;
  color: var(--fg-muted);
  margin-left: auto;
  font-family: var(--font-mono);
}

/* Urgency chips — filled geometric, no outlines. */
.qi-urgency {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  padding: 0.15rem 0.55rem 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--bg-raised);
}
.qi-urgency .shape { width: 10px; height: 10px; display: inline-block; flex-shrink: 0; }
.qi-urgency .shape.s-circle { background: var(--secondary); border-radius: 50%; }
.qi-urgency .shape.s-diamond { background: var(--accent); transform: rotate(45deg); }
.qi-urgency .shape.s-triangle {
  background: transparent;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 11px solid var(--at-cap);
}
.qi-urgency.is-high { color: var(--fg); }

.qi-action-summary {
  color: var(--fg);
  font-weight: 500;
  line-height: 1.45;
}

.qi-rationale {
  color: var(--fg-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
.qi-rationale-label,
.qi-brief-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 0.2rem;
}

.qi-brief {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.8rem;
  color: var(--fg);
  font-size: 0.93rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.qi-brief-toggle {
  align-self: flex-start;
  background: transparent;
  color: var(--accent);
  border: none;
  padding: 0.2rem 0;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.qi-brief-toggle:hover { color: var(--accent-hov); }
.qi-brief-toggle:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 4px; }

/* ------------------ Action row ------------------ */
.qi-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 0.3rem;
}

.qi-btn {
  background: var(--bg-raised);
  color: var(--fg);
  border: none;
  border-radius: var(--radius-md);
  padding: 0.5rem 0.95rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 38px;
  transition: background-color 120ms ease, color 120ms ease;
}
.qi-btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.qi-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.qi-btn.is-approve {
  background: var(--accent);
  color: var(--atlas-petrol);
}
.qi-btn.is-approve:hover:not(:disabled) { background: var(--accent-hov); }

.qi-btn.is-edit {
  background: var(--secondary);
  color: var(--atlas-petrol);
}
.qi-btn.is-edit:hover:not(:disabled) { background: var(--secondary-hov); }

.qi-btn.is-reject {
  background: var(--atlas-terracotta);
  color: var(--atlas-sand);
}
.qi-btn.is-reject:hover:not(:disabled) { background: #8C3225; }

/* Inline confirm pair — replaces the action row mid-flight. */
.qi-confirm {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.3rem;
  flex-wrap: wrap;
}
.qi-confirm-prompt {
  color: var(--fg);
  font-size: 0.9rem;
  margin-right: 0.25rem;
}
.qi-confirm .qi-btn.is-confirm { background: var(--accent); color: var(--atlas-petrol); }
.qi-confirm .qi-btn.is-confirm:hover:not(:disabled) { background: var(--accent-hov); }
.qi-confirm .qi-btn.is-confirm.is-danger { background: var(--atlas-terracotta); color: var(--atlas-sand); }
.qi-confirm .qi-btn.is-confirm.is-danger:hover:not(:disabled) { background: #8C3225; }
.qi-confirm .qi-btn.is-cancel { background: transparent; color: var(--fg-muted); border: 1px solid var(--border-strong); }
.qi-confirm .qi-btn.is-cancel:hover:not(:disabled) { color: var(--fg); border-color: var(--accent); }

/* Inline edit-request textarea */
.qi-edit-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.3rem;
}
.qi-edit-form label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.qi-edit-input {
  resize: vertical;
  min-height: 70px;
  max-height: 240px;
  background: var(--bg-input);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.75rem;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.45;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.qi-edit-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-fade);
}
.qi-edit-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.qi-row-error {
  color: var(--error-fg);
  background: rgba(166, 61, 47, 0.15);
  border: 1px solid var(--error);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.7rem;
  font-size: 0.88rem;
}

/* Lifecycle action buttons (recent lane). */
.qi-btn.is-dispatch { background: var(--secondary); color: var(--atlas-petrol); }
.qi-btn.is-dispatch:hover:not(:disabled) { background: var(--secondary-hov); }
.qi-btn.is-complete { background: var(--accent); color: var(--atlas-petrol); }
.qi-btn.is-complete:hover:not(:disabled) { background: var(--accent-hov); }

/* Inline "mark completed" outcome form — summary (required) + artifact ref. */
.qi-outcome-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-top: 0.3rem;
}
.qi-outcome-form label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.qi-artifact-input {
  background: var(--bg-input);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.qi-artifact-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-fade);
}

/* ------------------ Empty state ------------------ */
.empty-state {
  margin: 2.5rem auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--fg-muted);
}
.empty-state .medallion { width: 64px; height: 64px; color: var(--accent); opacity: 0.85; }
.empty-state .empty-headline { font-family: var(--font-headline); font-size: 1.2rem; color: var(--fg); margin: 0; }
.empty-state .empty-prose { font-size: 0.95rem; max-width: 36ch; margin: 0; }

.hidden { display: none !important; }

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ------------------ Reduced motion ------------------ */
@media (prefers-reduced-motion: reduce) {
  .thinking-strip .shape,
  .thinking-strip .shape.s-diamond,
  .thinking-strip .shape.s-circle {
    animation: none;
    opacity: 0.7;
  }
  .dashboard-wrap.fade-in { animation: none; }
  .queue-item, .qi-btn, .poll-status { transition: none; }
}

/* ------------------ Mobile ≤480px ------------------ */
@media (max-width: 480px) {
  header { padding: 0.6rem 0.85rem; padding-top: calc(0.6rem + env(safe-area-inset-top, 0px)); }
  .brand-name { font-size: 1.05rem; }
  .brand-sub { font-size: 0.85rem; }
  .account-chip { max-width: 140px; }
  .account-chip .email-text { font-size: 0.8rem; }
  .surface-link { font-size: 0.8rem; padding: 0.25rem 0.45rem; }
  .dashboard-wrap { padding: 0.85rem 0.65rem 1.5rem; }
  .section-title { font-size: 1.15rem; }
  .queue-item { padding: 0.8rem 0.85rem; }
  .qi-actions { gap: 0.4rem; }
  .qi-btn { padding: 0.5rem 0.7rem; font-size: 0.88rem; flex: 1 1 auto; }
  .qi-time { width: 100%; margin-left: 0; }
  .signin-headline { font-size: 1.4rem; }
}
