:root {
  color-scheme: dark;
  --bg: #0f1419;
  --panel: #1a2029;
  --panel-soft: #151b23;
  --line: rgba(255, 255, 255, .09);
  --text: #f5f7fa;
  --muted: #8b96a8;
  --accent: #5b9cd6;
  --active: #3ea680;
  --overdue: #d15656;
  --queued: #6b7383;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 280px; background: #080b10; }
body { min-height: 780px; margin: 0; color: var(--text); background: radial-gradient(circle at 50% 18%, #1d3347 0, #101822 35%, #080b10 72%); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip: rect(0,0,0,0); overflow: hidden; white-space: nowrap; border: 0; }

.preview-stage { min-height: 780px; display: grid; place-items: center; align-content: center; gap: 16px; padding: 24px; }
.preview-meta { width: min(400px, calc(100vw - 32px)); display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #93a2b3; font-size: 11px; letter-spacing: .02em; }
.preview-meta span { display: flex; align-items: center; gap: 7px; }
.preview-meta a { color: #a9bdd0; text-decoration: none; }
.preview-meta a:hover { color: white; }
.status-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--active); box-shadow: 0 0 10px #3ea680aa; }

.fastack-window { position: relative; width: 400px; height: 680px; max-width: calc(100vw - 32px); overflow: hidden; border: 1px solid rgba(255,255,255,.14); border-radius: 16px; background: rgba(15,20,25,.985); box-shadow: 0 28px 90px #000b, 0 0 0 1px #0008; transition: width .24s ease, height .24s ease; }
.fastack-window[data-size="standard"] { width: 340px; height: 560px; }
.fastack-window[data-size="compact"] { width: 300px; height: 420px; }

.global-topbar { position: absolute; inset: 0 0 auto; z-index: 50; height: 46px; display: grid; grid-template-columns: 68px minmax(132px,1fr) 68px; align-items: center; gap: 2px; padding: 0 8px; background: rgba(15,20,25,.97); border-bottom: 1px solid var(--line); }
.global-nav-left, .global-nav-right, .global-nav-items { display: flex; align-items: center; gap: 2px; }
.global-nav-items { justify-content: center; min-width: 0; }
.global-nav-right { justify-content: flex-end; }
.global-topbar button { display: grid; width: 32px; height: 32px; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 8px; color: #aeb8c7; background: transparent; cursor: pointer; }
.global-topbar button:hover, .global-topbar button:focus-visible, .global-topbar button.is-active { color: white; background: rgba(91,156,214,.24); border-color: rgba(91,156,214,.5); outline: none; }
.global-topbar button.is-running { color: white; background: rgba(62,166,128,.25); border-color: rgba(62,166,128,.68); }
.nav-icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.app-viewport { position: absolute; inset: 46px 0 0; overflow: hidden; }
.app-view { position: absolute; inset: 0; display: none; min-width: 0; background: rgba(15,20,25,.96); }
.app-view.is-visible { display: block; animation: view-in .16s ease both; }
@keyframes view-in { from { opacity: .35; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.task-stack { position: relative; height: 100%; overflow: hidden; padding: 12px; }
.task-card { position: absolute; top: var(--top-large); left: 12px; right: 12px; height: 180px; padding: 20px 18px; overflow: hidden; border: 1px solid rgba(255,255,255,.13); border-radius: 14px; color: white; cursor: pointer; box-shadow: 0 5px 22px rgba(0,0,0,.55); transition: top .22s ease, height .22s ease, transform .16s ease, filter .14s ease, box-shadow .16s ease; }
.task-card:hover { filter: brightness(1.05); transform: translateY(-2px); }
.task-card.is-selected { height: 300px; box-shadow: 0 12px 38px rgba(0,0,0,.72), 0 0 0 1px rgba(255,255,255,.08); }
.task-card[data-status="active"] { background: #3a9a78; }
.task-card[data-status="overdue"] { background: #c95050; }
.task-card[data-status="upcoming"] { background: #646c7c; }
.task-card-header { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: 12px; margin-bottom: 14px; }
.task-card h2 { margin: 0; overflow: hidden; color: white; font-size: 19px; font-weight: 740; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.task-status { padding-top: 2px; color: white; font-size: 13px; font-weight: 700; text-align: right; text-transform: lowercase; }
.task-status.is-timer { animation: pulse 1.2s ease-in-out infinite alternate; font-variant-numeric: tabular-nums; }
@keyframes pulse { to { opacity: .48; } }
.task-details { display: grid; grid-template-columns: 86px minmax(0,1fr); gap: 6px 10px; margin: 0; font-size: 11px; line-height: 1.35; }
.task-details dt { color: rgba(255,255,255,.72); font-weight: 700; }
.task-details dd { margin: 0; overflow: hidden; color: white; text-overflow: ellipsis; white-space: nowrap; }
.task-card:not(.is-selected) .task-card-header { position: absolute; top: 88px; left: 18px; right: 18px; margin: 0; }
.task-card:not(.is-selected) .task-details { display: none; }
.stack-empty { height: calc(100% - 24px); margin: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; color: #d7e0eb; text-align: center; background: #111820; }
.stack-empty strong { color: white; font-size: 16px; }
.stack-empty p { margin: 8px 0 16px; color: #aab7c6; font-size: 11px; }
.stack-empty button, .page-header-action, .button-primary { padding: 8px 12px; border: 0; border-radius: 8px; color: white; background: var(--accent); cursor: pointer; font-weight: 650; }

.page-header { display: flex; height: 50px; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.page-heading { min-width: 0; }
.page-heading h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: 0; }
.page-header-action { min-height: 30px; padding: 6px 10px; font-size: 10px; }
.page-header-action.quiet { color: #c9d3de; background: #242d38; border: 1px solid var(--line); }
.scroll-body { height: calc(100% - 50px); overflow: auto; padding: 12px; scrollbar-width: none; }
.scroll-body::-webkit-scrollbar { display: none; }

.range-tabs { display: flex; gap: 3px; }
.range-tab { padding: 6px 8px; border: 1px solid transparent; border-radius: 7px; color: #aeb8c7; background: transparent; cursor: pointer; font-size: 9px; }
.range-tab:hover, .range-tab.is-active { color: white; background: rgba(91,156,214,.24); border-color: rgba(91,156,214,.5); }
.kpi-row { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; }
.kpi, .insight-card, .chart-block, .settings-card { min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: rgba(26,32,41,.94); box-shadow: 0 4px 18px rgba(0,0,0,.3); }
.kpi { padding: 12px 6px; text-align: center; }
.kpi strong { display: block; color: white; font-size: 17px; font-weight: 650; }
.kpi span { color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.search-field { display: block; margin: 10px 0; }
.search-field input { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; outline: none; color: white; background: #111820; font-size: 10px; }
.search-field input:focus { border-color: #5b9cd6aa; box-shadow: 0 0 0 2px #5b9cd622; }
.insight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.insight-card { padding: 11px; }
.insight-card > span, .chart-block > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 8px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; }
.insight-card strong { font-size: 11px; }
.insight-card p { margin: 5px 0 0; color: #aeb8c7; font-size: 9px; line-height: 1.4; }
.chart-block { margin-top: 8px; padding: 12px; }
.bar-row { display: grid; grid-template-columns: 54px 1fr 28px; align-items: center; gap: 8px; margin: 8px 0; font-size: 9px; }
.bar-row em { color: #c4ceda; font-style: normal; }
.bar-row i { height: 5px; overflow: hidden; border-radius: 4px; background: #27313d; }
.bar-row i::after { content: ""; display: block; width: var(--value); height: 100%; border-radius: inherit; background: var(--accent); }
.bar-row b { color: #c4ceda; font-weight: 500; text-align: right; }

.sop-list { display: grid; gap: 7px; }
.sop-row, .task-list-card { width: 100%; border: 1px solid var(--line); border-radius: 10px; color: white; background: rgba(26,32,41,.94); box-shadow: 0 4px 18px rgba(0,0,0,.3); cursor: pointer; text-align: left; }
.sop-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px; }
.sop-row span { min-width: 0; }
.sop-row strong, .sop-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sop-row strong { font-size: 11px; }
.sop-row small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.sop-row em { flex: none; color: #9cabb9; font-size: 9px; font-style: normal; }
.sop-row:hover, .task-list-card:hover { border-color: rgba(91,156,214,.7); }

.task-lists-stack { display: grid; align-content: start; gap: 9px; }
.task-list-card { padding: 14px; }
.task-list-card.is-active { border-color: rgba(91,156,214,.7); box-shadow: 0 0 0 2px rgba(91,156,214,.12), 0 5px 22px rgba(24,83,132,.25); }
.list-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.list-card-top strong { font-size: 13px; }
.list-card-top em { padding: 3px 6px; border-radius: 99px; color: #8290a3; background: rgba(255,255,255,.05); font-size: 8px; font-style: normal; text-transform: uppercase; }
.list-count { display: block; margin: 7px 0; color: #9ba8b8; font-size: 9px; }
.list-preview { color: #d4dce5; font-size: 10px; line-height: 1.6; }

.settings-form { display: grid; align-content: start; gap: 8px; }
.settings-card { padding: 13px; }
.settings-card h2, .settings-card strong { margin: 0; color: white; font-size: 11px; }
.settings-card p, .settings-card small { display: block; margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.size-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; margin-top: 11px; }
.size-options button { min-width: 0; padding: 8px 3px; border: 1px solid var(--line); border-radius: 7px; color: #c5cfda; background: #111820; cursor: pointer; font-size: 8px; }
.size-options button span { display: block; margin-top: 4px; color: #7f8a98; font-size: 7px; }
.size-options button.is-selected { border-color: #5b9cd6; color: white; background: #1d3448; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch { position: relative; flex: none; }
.switch input { position: absolute; opacity: 0; }
.switch i { display: block; width: 31px; height: 18px; padding: 2px; border-radius: 20px; background: #3a4350; cursor: pointer; transition: background .16s; }
.switch i::after { content: ""; display: block; width: 14px; height: 14px; border-radius: 50%; background: white; transition: transform .16s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(13px); }
.shortcut-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 4px; margin-top: 8px; color: #aeb8c7; font-size: 9px; }
kbd { min-width: 21px; padding: 4px 6px; border: 1px solid #3b4654; border-radius: 5px; color: #dce4ed; background: #0e141b; font: 8px ui-monospace, SFMono-Regular, Menlo, monospace; text-align: center; }

.modal-layer { position: absolute; inset: 46px 0 0; z-index: 40; background: rgba(15,20,25,.995); }
.task-composer { display: grid; grid-template-rows: auto minmax(0,1fr) auto; height: 100%; }
.task-composer > header { display: grid; grid-template-columns: 32px minmax(0,1fr) auto; align-items: center; gap: 9px; min-height: 58px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.task-composer header span strong, .task-composer header span small { display: block; }
.task-composer header span strong { font-size: 16px; }
.task-composer header span small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.task-composer header em { padding: 4px 7px; border-radius: 99px; color: #b5c3d0; background: #242d38; font-size: 8px; font-style: normal; }
.icon-button { width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 8px; color: #cdd5df; background: #202832; cursor: pointer; }
.composer-body { overflow: auto; padding: 12px; scrollbar-width: none; }
.composer-body > label, .quick-fields label { display: grid; gap: 6px; margin-bottom: 12px; color: #dbe3eb; font-size: 10px; font-weight: 600; }
.composer-body label small { color: var(--muted); font-weight: 400; }
.composer-body input, .composer-body textarea { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; outline: none; color: white; background: #111820; font-size: 11px; resize: vertical; }
.composer-body input:focus, .composer-body textarea:focus { border-color: #5b9cd6aa; box-shadow: 0 0 0 2px #5b9cd622; }
.quick-fields { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }
.quick-fields label:last-child { grid-template-columns: 1fr auto; }
.quick-fields label:last-child > :first-child { grid-column: 1/-1; }
.quick-fields label:last-child span { align-self: center; color: var(--muted); font-size: 8px; }
.composer-body details { margin-bottom: 8px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.composer-body summary { display: flex; justify-content: space-between; gap: 12px; cursor: pointer; font-size: 10px; }
.composer-body summary small { color: var(--muted); }
.composer-body details p, .check-row { color: var(--muted); font-size: 9px; line-height: 1.5; }
.check-row { display: block !important; margin: 10px 0 0 !important; }
.check-row input { width: auto; margin-right: 7px; }
.task-composer > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.button-ghost { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; color: #c4ced8; background: transparent; cursor: pointer; }
.button-primary { font-size: 10px; }

.toast { position: absolute; z-index: 80; left: 50%; bottom: 14px; max-width: calc(100% - 28px); padding: 8px 12px; border: 1px solid #ffffff1f; border-radius: 8px; color: #ecf2f7; background: #222c37f2; box-shadow: 0 6px 22px #0008; font-size: 10px; opacity: 0; pointer-events: none; transform: translate(-50%,8px); transition: opacity .16s, transform .16s; white-space: nowrap; }
.toast.is-visible { opacity: 1; transform: translate(-50%,0); }

.command-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.command-strip button { display: flex; align-items: center; gap: 6px; padding: 6px 9px 6px 6px; border: 1px solid #ffffff18; border-radius: 8px; color: #9eacbb; background: #0d131be6; cursor: pointer; font-size: 10px; }
.command-strip button:hover { color: white; border-color: #5b9cd680; }
.command-strip kbd { padding: 3px 5px; }

.fastack-window[data-size="compact"] .global-topbar { grid-template-columns: 60px minmax(116px,1fr) 60px; padding-inline: 5px; }
.fastack-window[data-size="compact"] .global-topbar button { width: 28px; }
.fastack-window[data-size="standard"] .task-card { top: var(--top-standard); height: 145px; }
.fastack-window[data-size="standard"] .task-card.is-selected { height: 250px; }
.fastack-window[data-size="standard"] .task-card:not(.is-selected) .task-card-header { top: 78px; }
.fastack-window[data-size="compact"] .task-card { top: var(--top-compact); left: 9px; right: 9px; height: 110px; padding: 14px; }
.fastack-window[data-size="compact"] .task-card.is-selected { height: 185px; }
.fastack-window[data-size="compact"] .task-card h2 { font-size: 15px; }
.fastack-window[data-size="compact"] .task-details { grid-template-columns: 68px 1fr; font-size: 9px; gap: 4px 8px; }
.fastack-window[data-size="compact"] .task-card:not(.is-selected) .task-card-header { top: 61px; left: 14px; right: 14px; }
.fastack-window[data-size="compact"] .insight-grid { grid-template-columns: 1fr; }
.fastack-window[data-size="compact"] .kpi-row { grid-template-columns: 1fr 1fr; }

@media (max-width: 460px) {
  body, .preview-stage { min-height: 690px; }
  .preview-stage { padding: 16px; align-content: start; }
  .fastack-window { width: min(400px, calc(100vw - 24px)); height: 600px; }
  .preview-meta { width: min(400px, calc(100vw - 24px)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
