/* ═══════════════════════════════════════════════════════════════
   CM Cockpit — Redesign Layer (v23)
   Aesthetic: refined operational calm + StudySmarter energy.
   8px spacing grid · strong type hierarchy · soft elevation · sidebar shell.
   Loaded AFTER cockpit.css + brand.css.
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* spacing scale (8px grid) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  /* elevation */
  --el-1: 0 1px 2px rgba(35,35,35,.04), 0 1px 3px rgba(35,35,35,.06);
  --el-2: 0 2px 4px rgba(35,35,35,.04), 0 4px 12px rgba(35,35,35,.07);
  --el-3: 0 8px 24px rgba(35,35,35,.10), 0 2px 6px rgba(35,35,35,.06);
  /* polish-v2: radius aligned to CareerKit Design Constitution */
  --radius: 16px; --radius-sm: 12px; --radius-xs: 8px; --radius-pill: 999px;
  /* polish-v2: motion tokens (never >300ms, always ease-out) */
  --mo-fast: 150ms; --mo-base: 200ms; --mo-slow: 300ms;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--sm-stone);
  color: var(--sm-charcoal);
  font-family: var(--sm-font-body);
  -webkit-font-smoothing: antialiased;
}

/* Sidebar = FIXED to viewport so it's always visible, scrolls its own overflow.
   Main content gets a left margin so nothing slides under it. */
.shell { position: relative; }
@media (max-width: 900px) {
  .sidebar { position: static; height: auto; width: 100%; }
  .shell { padding-left: 0 !important; }
}

/* Kill the old SalesOS flex-column body + topbar */
.topbar { display: none !important; }

/* ═══════════ SHELL ═══════════ */
.shell { display: block; padding-left: var(--sidebar-w); min-height: 100vh; }

/* ═══════════ SIDEBAR ═══════════ */
.sidebar {
  background: var(--sm-charcoal);
  color: #EDEBE7;
  display: flex; flex-direction: column;
  padding: var(--s5) var(--s4);
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w); height: 100vh;
  overflow-y: auto; overflow-x: hidden;
  z-index: 50;
  gap: var(--s5);
}
/* Custom scrollbar inside sidebar (subtle, on charcoal) */
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.22); }

.sb-brand { display: flex; align-items: center; gap: var(--s3); }
.sb-logo {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--sm-lime); color: var(--sm-charcoal);
  font-family: var(--sm-font-heading); font-weight: 800; font-size: 22px;
  display: grid; place-items: center; flex-shrink: 0;
}
.sb-brand-name { font-family: var(--sm-font-heading); font-weight: 800; font-size: 16px; letter-spacing: -.02em; color: #fff; }
.sb-brand-sub { font-family: var(--sm-font-mono); font-size: 9.5px; color: rgba(237,235,231,.45); letter-spacing: .02em; margin-top: 2px; }

.sb-cm { display: flex; flex-direction: column; gap: var(--s2); }
.sb-cm-label { font-family: var(--sm-font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: rgba(237,235,231,.4); }
.sb-cm-select {
  background: rgba(255,255,255,.06); color: #fff;
  border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius-xs);
  padding: 9px 11px; font-family: var(--sm-font-body); font-size: 13px; font-weight: 500;
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23EDEBE7' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.sb-cm-select:focus { outline: none; border-color: var(--sm-lime); }

/* Sidebar nav — override SalesOS .tabs segmented-control look */
.sidebar .tabs.sb-nav,
.sb-nav {
  display: flex; flex-direction: column; gap: 2px;
  background: transparent !important; padding: 0 !important;
  border-radius: 0 !important; box-shadow: none !important; border: none !important;
}
.sb-nav .tab {
  display: flex; align-items: center; gap: var(--s3);
  width: 100%; text-align: left;
  background: transparent; border: none; color: rgba(237,235,231,.72);
  padding: 10px var(--s3); border-radius: var(--radius-xs);
  font-family: var(--sm-font-heading); font-weight: 600; font-size: 13.5px; letter-spacing: -.01em;
  cursor: pointer; transition: background .14s, color .14s; position: relative;
}
.sb-nav .tab .sb-ico { font-size: 13px; width: 18px; opacity: .65; text-align: center; }
.sb-nav .tab .sb-label { flex: 1; }
.sb-nav .tab:hover { background: rgba(255,255,255,.06); color: #fff; }
.sb-nav .tab.active { background: var(--sm-blue); color: #fff; }
.sb-nav .tab.active .sb-ico { opacity: 1; }
.sb-nav .tab.active::after { display: none; }
.sb-nav .badge-count {
  font-family: var(--sm-font-mono); font-size: 10px; font-weight: 500;
  background: rgba(255,255,255,.12); color: #fff;
  padding: 1px 7px; border-radius: 9px; min-width: 18px; text-align: center;
}
.sb-nav .tab.active .badge-count { background: rgba(255,255,255,.22); }
.sb-nav .badge-count.rail-hot { background: var(--sm-hotrod); color: #fff; }

/* Sidebar footer */
.sb-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--s4); }
.sb-gauge { background: rgba(255,255,255,.05); border-radius: var(--radius-sm); padding: var(--s3) var(--s4); }
.sb-gauge-row { display: flex; justify-content: space-between; font-size: 11.5px; color: rgba(237,235,231,.6); margin-bottom: var(--s2); }
.sb-gauge-row b { font-family: var(--sm-font-mono); color: var(--sm-lime); font-weight: 500; }
.sb-gauge-row.sub { margin-bottom: 0; margin-top: var(--s2); font-size: 10.5px; }
.sb-gauge-row.sub b { color: #fff; }
.sb-gauge-bar { height: 6px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; }
.sb-gauge-bar > div { height: 100%; background: linear-gradient(90deg, var(--sm-blue-60), var(--sm-lime)); border-radius: 3px; }
.sb-live { display: flex; align-items: center; gap: var(--s3); }
#live-label { font-family: var(--sm-font-mono); font-size: 11px; font-weight: 500; color: rgba(237,235,231,.6); }
#live-mode:checked ~ #live-label { color: var(--sm-lime); }
.sb-ext { font-size: 12px; color: rgba(237,235,231,.55); font-weight: 500; }
.sb-ext:hover { color: var(--sm-lime); text-decoration: none; }

/* ═══════════ MAIN ═══════════ */
/* Use most of the screen: fluid up to a generous cap, comfortable side padding. */
.main { padding: var(--s6) var(--s7); max-width: 1760px; width: 100%; margin: 0 auto; }
@media (max-width: 1400px) { .main { padding: var(--s5) var(--s5); } }

/* Full width on all pages */
#tab-heute .heute-section { max-width: none; }
#tab-touchpoints .tp-grid { max-width: none; }
/* On very wide screens, queue cards read better at 2-up than one giant row */
@media (min-width: 1500px) {
  #queue-review, #queue-ready, #queue-auto { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
  #queue-bootstrap { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
}

/* Tab panels */
.tab-panel { display: none; }
.tab-panel.active { display: block; }
/* polish-v2: fadeUp clamped to --mo-slow (300ms) + motion-guarded below */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ═══════════ ALERT BANNER ═══════════ */
.timing-banner {
  display: flex; align-items: center; gap: var(--s4);
  background: var(--sm-charcoal); color: #fff;
  border-radius: var(--radius); padding: var(--s4) var(--s5);
  margin-bottom: var(--s6); box-shadow: var(--el-2); border: none;
  position: relative; overflow: hidden;
}
.timing-banner::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--sm-hotrod);
}
.timing-banner .bell { font-size: 18px; }
.timing-banner .banner-text { flex: 1; font-size: 13.5px; line-height: 1.5; }
.timing-banner .banner-text b { font-family: var(--sm-font-heading); font-weight: 700; }
.timing-banner .banner-meta { color: rgba(255,255,255,.55); }
.timing-banner .banner-actions { display: flex; gap: var(--s2); }

/* ═══════════ HEUTE / QUEUE ═══════════ */
.heute-section { padding: 0; max-width: none; }

/* Bulk bar → hero strip */
.bulk-bar {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s4);
  background: linear-gradient(110deg, var(--sm-blue) 0%, var(--sm-blue-60) 100%);
  color: #fff; border-radius: var(--radius); padding: var(--s5) var(--s5);
  margin-bottom: var(--s6); box-shadow: var(--el-2); border: none;
  font-size: 14px;
}
.bulk-bar b { font-family: var(--sm-font-heading); font-weight: 700; }
.bulk-bar .btn-bulk {
  background: var(--sm-lime); color: var(--sm-charcoal); border: none;
  font-family: var(--sm-font-heading); font-weight: 700; font-size: 13px;
  padding: 12px 20px; border-radius: var(--radius-xs); cursor: pointer; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(198,250,2,.4); transition: transform .12s;
}
.bulk-bar .btn-bulk:hover { transform: translateY(-1px); background: #d4ff3a; }

/* Section headers */
.queue-group-h {
  display: flex; align-items: center; gap: var(--s2);
  font-family: var(--sm-font-heading); font-weight: 700; font-size: 13px;
  letter-spacing: -.01em; text-transform: none; color: var(--sm-charcoal);
  padding: 0; border: none; margin: var(--s6) 0 var(--s3);
}
.queue-group-h .count {
  font-family: var(--sm-font-mono); font-size: 11px; font-weight: 500;
  background: var(--sm-stone-200); color: var(--sm-grey-600);
  padding: 2px 9px; border-radius: 9px; margin-left: var(--s1);
}
.queue-group-h .count.urgent { background: rgba(255,92,65,.14); color: #a02d18; }
.queue-group-h .count.ready { background: rgba(198,250,2,.25); color: #3d5800; }

/* Cards */
.q-card {
  display: grid; grid-template-columns: 44px 1fr auto; gap: var(--s4); align-items: start;
  background: #fff; border: 1px solid var(--sm-stone-200); border-left: 3px solid var(--sm-stone-400);
  border-radius: var(--radius); padding: var(--s4) var(--s5);
  margin-bottom: var(--s3); box-shadow: var(--el-1);
  transition: box-shadow .16s, transform .1s, border-color .16s;
}
.q-card:hover { box-shadow: var(--el-2); transform: translateY(-1px); }
.q-card.ready { border-left-color: var(--sm-lime); }
.q-card.urgent { border-left-color: var(--sm-hotrod); }
/* polish-v2: auto-handled = full opacity, flat surface, 2px lime accent (never dim content) */
.q-card.auto { opacity: 1; box-shadow: none; border-left: 2px solid var(--sm-lime); background: #fff; }
.q-card.auto:hover { box-shadow: var(--el-1); }
.auto-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--sm-font-mono); font-size: 10.5px; font-weight: 500; line-height: 1.5;
  background: rgba(198,250,2,.18); color: #3d5800;
  padding: 2px 8px; border-radius: var(--radius-sm);
}
.auto-chip::before { content: "✓"; font-size: 10px; }
/* polish-v2: disclosure group so auto-handled items can sit collapsed behind a toggle */
.q-group-collapsed { display: none; }
.q-group-collapsed.open { display: block; }

.q-icon {
  width: 44px; height: 44px; border-radius: 12px; background: var(--sm-stone);
  display: grid; place-items: center; font-size: 19px;
}
.q-icon.ready { background: rgba(198,250,2,.16); }
.q-icon.urgent { background: rgba(255,92,65,.12); }
.q-icon.auto { background: rgba(198,250,2,.12); }

.q-body { min-width: 0; }
.q-body .q-title {
  font-family: var(--sm-font-heading); font-weight: 700; font-size: 14.5px;
  letter-spacing: -.015em; line-height: 1.35; color: var(--sm-charcoal); margin-bottom: var(--s2);
}
.q-body .q-meta {
  display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center;
  font-family: var(--sm-font-mono); font-size: 11px; color: var(--sm-grey-500); margin-bottom: var(--s2);
}
.q-body .q-meta > span:not(:last-child)::after { content: ""; }
.q-body .q-prop { font-size: 12.5px; line-height: 1.55; color: var(--sm-grey-600); margin-bottom: var(--s2); }

.q-body .q-pipe {
  margin-top: var(--s3); font-family: var(--sm-font-mono); font-size: 10.5px;
  background: var(--sm-stone); border-radius: var(--radius-xs); padding: var(--s2) var(--s3);
  display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); align-items: center; color: var(--sm-grey-600);
}
.q-body .q-pipe b { font-family: var(--sm-font-heading); color: var(--sm-grey-500); font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em; }
.q-body .q-pipe .pipe-step { background: #fff; border: 1px solid var(--sm-stone-200); padding: 2px 8px; border-radius: 5px; }
.q-body .q-pipe .pipe-step.tool { background: rgba(19,0,255,.06); color: var(--sm-blue); border-color: rgba(19,0,255,.16); }
.q-body .q-pipe .pipe-step.out { background: rgba(198,250,2,.18); color: #3d5800; border-color: rgba(198,250,2,.4); }
.q-body .q-pipe .pipe-arrow { color: var(--sm-stone-dark); }

.q-actions { display: flex; flex-direction: column; gap: var(--s2); align-items: flex-end; }
.q-conf {
  font-family: var(--sm-font-mono); font-size: 12px; font-weight: 500;
  padding: 3px 9px; border-radius: 8px; background: var(--sm-stone-200); color: var(--sm-grey-600);
}
.q-conf.high { background: rgba(198,250,2,.22); color: #3d5800; }
.q-conf.low { background: rgba(255,92,65,.16); color: #a02d18; }

/* Buttons */
.btn-primary, .btn-secondary {
  font-family: var(--sm-font-heading); font-weight: 600; font-size: 13px; letter-spacing: -.01em;
  border-radius: var(--radius-xs); padding: 9px 16px; cursor: pointer; white-space: nowrap;
  /* polish-v2: explicit props (no 'transition: all') */
  transition: background var(--mo-fast) ease-out, border-color var(--mo-fast) ease-out, box-shadow var(--mo-fast) ease-out, transform var(--mo-fast) ease-out, color var(--mo-fast) ease-out;
}
.btn-primary { background: var(--sm-blue); color: #fff; border: 1px solid var(--sm-blue); }
.btn-primary:hover { background: var(--sm-blue-80); border-color: var(--sm-blue-80); box-shadow: 0 2px 8px rgba(19,0,255,.25); }
.btn-secondary { background: #fff; color: var(--sm-charcoal); border: 1px solid var(--sm-stone-400); }
.btn-secondary:hover { background: var(--sm-stone); border-color: var(--sm-stone-dark); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* Inline draft preview on cards */
.q-body [style*="border-left:3px solid #1300FF"],
.q-body [style*="border-left:3px solid var(--sm-blue)"] { border-radius: var(--radius-xs) !important; }

/* ═══════════ POSTEINGANG ═══════════ */
.dial-toolbar {
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  background: #fff; border: 1px solid var(--sm-stone-200); border-radius: var(--radius);
  padding: var(--s3) var(--s4); margin-bottom: var(--s4); box-shadow: var(--el-1);
}
.filter-sel {
  border: 1px solid var(--sm-stone-300, var(--sm-stone-400)); border-radius: var(--radius-xs);
  padding: 7px 12px; font-family: var(--sm-font-body); font-size: 12.5px; background: #fff; cursor: pointer;
}
.dial-view-table { gap: var(--s4) !important; }
.inbox-rail { background: #fff; border: 1px solid var(--sm-stone-200); border-radius: var(--radius); padding: var(--s3); box-shadow: var(--el-1); height: fit-content; }
.inbox-rail-h { font-family: var(--sm-font-heading); font-weight: 700; font-size: 12px; color: var(--sm-charcoal); padding: var(--s2) var(--s2) var(--s3); }
.center-table#mail-reader { background: #fff; border: 1px solid var(--sm-stone-200); border-radius: var(--radius); box-shadow: var(--el-1); }
.detail-pane { background: #fff; border: 1px solid var(--sm-stone-200); border-radius: var(--radius); box-shadow: var(--el-1); }
.rail-cat { border-radius: var(--radius-xs) !important; }
.rail-cat.active { background: var(--primary-50) !important; box-shadow: inset 3px 0 0 var(--sm-blue); }

/* ═══════════ KANBAN ═══════════ */
.kanban-grid { gap: var(--s4); }
.kanban-col { background: var(--sm-stone); border-radius: var(--radius); padding: var(--s3); border: none; }
.kanban-col-h { font-family: var(--sm-font-heading); font-weight: 700; font-size: 13px; padding: var(--s2) var(--s2) var(--s3); }
.kanban-card { background: #fff; border: 1px solid var(--sm-stone-200); border-radius: var(--radius-sm); padding: var(--s3); margin-bottom: var(--s2); box-shadow: var(--el-1); transition: box-shadow .14s; }
.kanban-card:hover { box-shadow: var(--el-2); }

/* ═══════════ TOUCHPOINTS ═══════════ */
.tp-grid { gap: var(--s4); padding: 0; }
.tp-card { background: #fff; border: 1px solid var(--sm-stone-200); border-radius: var(--radius); padding: var(--s5); box-shadow: var(--el-1); gap: var(--s3); }
.tp-card:hover { box-shadow: var(--el-3); transform: translateY(-2px); }
.tp-card .tp-icon { font-size: 26px; }
.tp-card .tp-title { font-family: var(--sm-font-heading); font-weight: 700; font-size: 15px; letter-spacing: -.015em; }

/* ═══════════ MANAGER / TEAM ═══════════ */
.mgr-grid { gap: var(--s4); }
.mgr-card { background: #fff; border: 1px solid var(--sm-stone-200); border-radius: var(--radius); padding: var(--s5); box-shadow: var(--el-1); }
.mgr-card-h { font-family: var(--sm-font-heading); font-weight: 700; font-size: 15px; letter-spacing: -.015em; margin-bottom: var(--s4); }
.mgr-table { font-size: 12.5px; }
.mgr-table th { font-family: var(--sm-font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--sm-grey-500); font-weight: 500; padding-bottom: var(--s2); }
.mgr-table td { padding: var(--s2) 0; }
.pill { font-family: var(--sm-font-mono); font-size: 10.5px; font-weight: 500; padding: 2px 8px; border-radius: 8px; }
.pill.ok { background: rgba(198,250,2,.22); color: #3d5800; }
.pill.warn { background: rgba(255,92,65,.16); color: #a02d18; }

/* ═══════════ AUDIT TABLE ═══════════ */
#audit-table { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--el-1); border: 1px solid var(--sm-stone-200); }
#audit-table th { font-family: var(--sm-font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; background: var(--sm-stone); padding: var(--s3); }
.vt-btn { font-family: var(--sm-font-heading); font-weight: 600; font-size: 12px; border-radius: var(--radius-xs); border: 1px solid var(--sm-stone-400); background: #fff; padding: 7px 13px; cursor: pointer; }
.vt-btn.active { background: var(--sm-charcoal); color: #fff; border-color: var(--sm-charcoal); }

/* Muted helper used widely */
.muted, .ml-auto { color: var(--sm-grey-500); }
.ml-auto { margin-left: auto; font-family: var(--sm-font-mono); font-size: 11.5px; }

/* Floating help button */
.kbd-fab { background: var(--sm-charcoal); color: #fff; box-shadow: var(--el-3); }

/* ═══════════════════════════════════════════════════════════════
   polish-v2: SEMANTIC STATUS CLASSES (shared contract)
   Consumed by js + html agents to replace inline status hex.
   (Existing .pill.ok/.pill.warn + .q-conf.high/.low stay intact above.)
   ═══════════════════════════════════════════════════════════════ */
.st {
  font-family: var(--sm-font-mono); font-size: 10.5px; font-weight: 500;
  padding: 2px 8px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; gap: 4px; line-height: 1.5;
}
.st-ok      { background: rgba(198,250,2,.18); color: #3d5800; }
.st-warn    { background: rgba(217,119,6,.13); color: #92560e; }
.st-err     { background: rgba(255,92,65,.14); color: #a02d18; }
.st-info    { background: rgba(19,0,255,.07); color: var(--sm-blue); }
.st-neutral { background: var(--sm-stone-200); color: var(--sm-grey-600); }

/* ═══════════════════════════════════════════════════════════════
   polish-v2: FOCUS — visible keyboard focus on every interactive target
   ═══════════════════════════════════════════════════════════════ */
:focus-visible { outline: 2px solid var(--sm-blue); outline-offset: 2px; }
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.sb-nav .tab:focus-visible,
.tab:focus-visible,
.q-card:focus-visible,
.rail-cat:focus-visible,
select:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--sm-blue); outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   polish-v2: EMPTY STATE component
   ═══════════════════════════════════════════════════════════════ */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: var(--s2); padding: var(--s7) var(--s5);
}
.empty-ico {
  font-size: 40px; line-height: 1; margin-bottom: var(--s2);
  color: var(--sm-lime);
  filter: drop-shadow(0 1px 4px rgba(198,250,2,.35));
}
.empty-title { font-family: var(--sm-font-body); font-size: 15px; font-weight: 600; color: var(--sm-charcoal); }
.empty-sub   { font-size: 13px; color: var(--sm-grey-500); max-width: 38ch; line-height: 1.5; }
.empty-cta   { margin-top: var(--s3); }
/* Make the existing empty placeholder use the component look */
.detail-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s2); color: var(--sm-grey-500); }

/* ═══════════════════════════════════════════════════════════════
   polish-v2: TABLES — tabular numerics, sticky headers, row hover
   ═══════════════════════════════════════════════════════════════ */
.num { font-variant-numeric: tabular-nums; font-family: var(--sm-font-mono); text-align: right; }
.mgr-table th,
#audit-table th,
.perf-table th {
  position: sticky; top: 0; z-index: 2;
  background: var(--sm-stone);
}
.mgr-table tbody tr:hover,
#audit-table tbody tr:hover,
.perf-table tbody tr:hover { background: var(--sm-stone); }

/* ═══════════════════════════════════════════════════════════════
   polish-v2: GAMIFICATION — Tagesziel ring, day-clear card, streak chip, confetti
   ═══════════════════════════════════════════════════════════════ */
.goal-ring {
  --goal-pct: 0%;
  width: 76px; height: 76px; border-radius: 50%; flex-shrink: 0;
  background:
    conic-gradient(var(--sm-lime) var(--goal-pct), rgba(255,255,255,.10) var(--goal-pct) 100%);
  display: grid; place-items: center;
  position: relative;
}
.goal-ring::after {
  content: ""; position: absolute; inset: 7px; border-radius: 50%;
  background: var(--sm-charcoal);
}
.goal-ring .goal-label {
  position: relative; z-index: 1; text-align: center;
  font-family: var(--sm-font-mono); font-size: 14px; font-weight: 500; color: #fff; line-height: 1.1;
}
.goal-ring .goal-label small { display: block; font-size: 8.5px; color: rgba(237,235,231,.55); margin-top: 1px; }

.day-clear-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s2);
  background: linear-gradient(160deg, rgba(198,250,2,.16), rgba(198,250,2,.04));
  border: 1px solid rgba(198,250,2,.4); border-left: 3px solid var(--sm-lime);
  border-radius: var(--radius); padding: var(--s6) var(--s5); box-shadow: var(--el-1);
}
.day-clear-card .dc-glyph { font-size: 38px; color: #3d5800; }
.day-clear-card .dc-title { font-family: var(--sm-font-heading); font-weight: 700; font-size: 17px; letter-spacing: -.02em; color: var(--sm-charcoal); }
.day-clear-card .dc-sub { font-size: 13px; color: var(--sm-grey-600); }

.streak-chip {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-family: var(--sm-font-mono); font-size: 11px; font-weight: 500;
  background: rgba(198,250,2,.10); color: var(--sm-lime);
  padding: 3px 9px; border-radius: var(--radius-pill);
}
.streak-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--sm-lime); }

.confetti {
  position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 200;
}
.confetti i {
  position: absolute; top: -12px; width: 8px; height: 8px; border-radius: 1px;
  background: var(--sm-lime); opacity: 0;
}
.confetti i:nth-child(3n)   { background: var(--sm-blue); }
.confetti i:nth-child(3n+1) { background: var(--sm-hotrod); }

/* ═══════════════════════════════════════════════════════════════
   polish-v2: TUTORIAL coachmarks (js-driven first-run tour)
   ═══════════════════════════════════════════════════════════════ */
.coach-backdrop {
  position: fixed; inset: 0; background: rgba(35,35,35,.55);
  z-index: 300;
}
.coach-pop {
  position: fixed; z-index: 301; max-width: 320px;
  background: #fff; border-radius: var(--radius); box-shadow: var(--el-3);
  padding: var(--s4) var(--s4) var(--s3); border: 1px solid var(--sm-stone-200);
}
.coach-pop .coach-title { font-family: var(--sm-font-heading); font-weight: 700; font-size: 14px; letter-spacing: -.01em; margin-bottom: var(--s2); color: var(--sm-charcoal); }
.coach-pop .coach-body { font-size: 13px; line-height: 1.5; color: var(--sm-grey-600); }
.coach-pop .coach-arrow {
  position: absolute; width: 12px; height: 12px; background: #fff;
  border: 1px solid var(--sm-stone-200); border-right: none; border-bottom: none;
  transform: rotate(45deg);
}
.coach-step-dots { display: flex; gap: 6px; }
.coach-step-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--sm-stone-400); }
.coach-step-dots i.on { background: var(--sm-blue); }
.coach-actions { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: var(--s3); }

/* ═══════════════════════════════════════════════════════════════
   polish-v2: TOAST tray (shared contract data-testid="toast-tray")
   ═══════════════════════════════════════════════════════════════ */
.toast-tray { position: fixed; bottom: var(--s5); right: var(--s5); display: flex; flex-direction: column; gap: var(--s2); z-index: 250; }
.done-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--sm-font-mono); font-size: 10.5px; font-weight: 500; line-height: 1.5;
  background: rgba(198,250,2,.18); color: #3d5800; padding: 2px 8px; border-radius: var(--radius-sm);
}

/* ═══════════════════════════════════════════════════════════════
   polish-v2: MOTION GUARD — all transform/keyframe motion only when allowed.
   Under prefers-reduced-motion (default/reduce): opacity fades only, no transforms.
   ═══════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: no-preference) {
  .tab-panel.active { animation: fadeUp var(--mo-slow) ease-out; }
  .q-card { transition: box-shadow var(--mo-base) ease-out, transform var(--mo-fast) ease-out, border-color var(--mo-base) ease-out; }
  .q-card:hover { transform: translateY(-1px); }
  .bulk-bar .btn-bulk { transition: transform var(--mo-fast) ease-out, background var(--mo-fast) ease-out; }
  .bulk-bar .btn-bulk:hover { transform: translateY(-1px); }
  .tp-card:hover { transform: translateY(-2px); }
  .confetti i { animation: confettiFall 1300ms ease-out forwards; }
  @keyframes confettiFall {
    0%   { opacity: 1; transform: translateY(0) rotate(0deg); }
    100% { opacity: 0; transform: translateY(108vh) rotate(540deg); }
  }
}
/* Reduced-motion / default: kill transforms, keep gentle opacity fade only */
@media (prefers-reduced-motion: reduce) {
  .tab-panel.active { animation: none; }
  .q-card:hover, .bulk-bar .btn-bulk:hover, .tp-card:hover { transform: none; }
  .confetti { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE
   ═══════════════════════════════════════════════════════════════ */
/* Tablet tier — sidebar collapses to a horizontal strip, content keeps full width */
@media (max-width: 900px) and (min-width: 761px) {
  .shell { padding-left: 0; }
  .sidebar { position: static; height: auto; width: 100%; flex-direction: column; overflow-y: visible; }
  .sb-nav { flex-direction: row; overflow-x: auto; }
  .sb-nav .tab { white-space: nowrap; }
  .sb-foot { margin-top: var(--s4); }
  .main { padding: var(--s4); width: 100%; }
}

/* polish-v2: real PHONE tier — fixed bottom tab-bar, no charcoal void */
.mobile-appbar, .mobile-tabbar { display: none; }
@media (max-width: 760px) {
  body { background: var(--sm-stone); }
  .sidebar { display: none !important; }
  .shell { padding-left: 0 !important; display: block; }
  .main {
    width: 100%; max-width: none; margin: 0;
    padding: var(--s4);
    padding-top: calc(52px + var(--s3));
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  /* Top app bar */
  .mobile-appbar {
    display: flex; align-items: center; gap: var(--s3);
    position: fixed; top: 0; left: 0; right: 0; z-index: 60;
    height: 52px; padding: 0 var(--s4);
    background: var(--sm-charcoal); color: #fff;
    box-shadow: 0 1px 0 rgba(0,0,0,.2);
  }
  .mobile-appbar .ma-logo {
    width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
    background: var(--sm-lime); color: var(--sm-charcoal);
    font-family: var(--sm-font-heading); font-weight: 800; font-size: 16px;
    display: grid; place-items: center;
  }
  .mobile-appbar .ma-title { font-family: var(--sm-font-heading); font-weight: 700; font-size: 14px; letter-spacing: -.02em; }
  .mobile-appbar .ma-cm { margin-left: auto; }

  /* Bottom tab bar (html agent supplies .mobile-tabbar with 5 buttons) */
  .mobile-tabbar {
    display: flex; align-items: stretch;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: calc(64px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--sm-charcoal);
    box-shadow: 0 -1px 0 rgba(0,0,0,.2);
  }
  .mobile-tabbar .mt-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    background: transparent; border: none; cursor: pointer;
    color: rgba(237,235,231,.62);
    font-family: var(--sm-font-heading); font-weight: 600; font-size: 10px; letter-spacing: -.01em;
  }
  .mobile-tabbar .mt-btn .mt-ico { font-size: 18px; line-height: 1; }
  .mobile-tabbar .mt-btn.active { color: var(--sm-lime); }
  .mobile-tabbar .mt-btn .mt-badge {
    position: absolute; transform: translate(14px, -10px);
    font-family: var(--sm-font-mono); font-size: 9px; font-weight: 500;
    background: var(--sm-hotrod); color: #fff; padding: 0 5px; border-radius: var(--radius-pill); min-width: 16px; text-align: center;
  }

  /* Keep multi-column app regions from collapsing to an empty strip */
  .dial-view-table, .kanban-wrap, .mgr-grid, .tp-grid { grid-template-columns: 1fr !important; }
  #queue-review, #queue-ready, #queue-auto, #queue-bootstrap { grid-template-columns: 1fr !important; }
  .q-card { grid-template-columns: 36px 1fr; }
  .q-actions { grid-column: 1 / -1; flex-direction: row; align-items: center; }
}
