:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f4f1e8;
  background: #07090d;
  font-synthesis: none;
  text-rendering: geometricPrecision;
  --bg: #07090d;
  --panel: #101319;
  --panel-2: #151922;
  --line: #252a34;
  --line-soft: #1b2028;
  --muted: #8d95a5;
  --text: #f4f1e8;
  --gold: #d7b66f;
  --green: #4ade80;
  --red: #fb7185;
  --blue: #60a5fa;
  --orange: #f59e0b;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 70% 0%, rgba(215,182,111,.08), transparent 36%), var(--bg); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
textarea { resize: vertical; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0,1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 224px; padding: 22px 16px; border-right: 1px solid var(--line); background: rgba(8,10,14,.92); backdrop-filter: blur(18px); z-index: 30; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(215,182,111,.5); border-radius: 12px; background: linear-gradient(145deg, rgba(215,182,111,.16), rgba(215,182,111,.03)); color: var(--gold); font-weight: 900; font-size: 20px; float: left; margin-right: 11px; }
.brand-copy { height: 48px; display: flex; flex-direction: column; justify-content: center; }
.brand-copy strong { font-size: 15px; letter-spacing: .04em; }
.brand-copy small { color: var(--muted); margin-top: 2px; }
.side-nav { display: grid; gap: 7px; margin-top: 34px; }
.side-nav button { border: 1px solid transparent; background: transparent; color: #9ea6b5; text-align: left; padding: 11px 12px; border-radius: 9px; display: flex; align-items: center; gap: 11px; }
.side-nav button span { width: 20px; text-align: center; font-size: 18px; }
.side-nav button:hover { background: #12161d; color: var(--text); }
.side-nav button.active { background: rgba(215,182,111,.10); border-color: rgba(215,182,111,.22); color: var(--gold); }
.sidebar-foot { position: absolute; bottom: 24px; left: 20px; right: 20px; color: #6f7785; font-size: 11px; display: flex; align-items: center; gap: 8px; }
.signal-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 14px rgba(74,222,128,.7); display: inline-block; flex: 0 0 auto; }

.main-panel { grid-column: 2; min-width: 0; padding: 26px clamp(18px,3vw,42px) 60px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; max-width: 1420px; margin: 0 auto 24px; }
.topbar h1 { margin: 3px 0 0; font-size: clamp(25px,3vw,38px); line-height: 1.05; letter-spacing: -.04em; }
.eyebrow { margin: 0; color: var(--gold); font-size: 10px; letter-spacing: .18em; font-weight: 800; }
.date-block { display: flex; flex-direction: column; text-align: right; color: var(--muted); font-size: 12px; gap: 7px; }
.date-block strong { color: var(--gold); font-size: 13px; letter-spacing: .16em; }

.panel { background: linear-gradient(180deg, rgba(18,22,29,.97), rgba(13,16,22,.97)); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 16px 60px rgba(0,0,0,.17); }
.page-grid, .stack-page, .log-layout, .context-layout { max-width: 1420px; margin: 0 auto; }
.command-grid { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(330px,.75fr); gap: 16px; }
.project-hero { padding: 23px; }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; color: var(--green); border: 1px solid rgba(74,222,128,.25); background: rgba(74,222,128,.06); border-radius: 999px; font-size: 10px; letter-spacing: .12em; font-weight: 800; padding: 6px 9px; }
.hero-top h2 { font-size: clamp(25px,3vw,42px); margin: 13px 0 4px; letter-spacing: -.04em; }
.hero-top p { margin: 0; color: var(--muted); }
.progress-ring { width: 108px; height: 108px; flex: 0 0 108px; border-radius: 50%; background: conic-gradient(var(--gold) var(--progress), #252a34 0); display: grid; place-items: center; }
.progress-ring > div { width: 88px; height: 88px; border-radius: 50%; background: #101319; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.progress-ring strong { font-size: 22px; }
.progress-ring span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .12em; }
.objective-box { margin-top: 22px; padding: 17px 18px; background: linear-gradient(90deg, rgba(215,182,111,.10), rgba(215,182,111,.025)); border-left: 3px solid var(--gold); border-radius: 0 11px 11px 0; }
.objective-box span { color: var(--gold); font-size: 9px; letter-spacing: .15em; font-weight: 800; display: block; margin-bottom: 8px; }
.objective-box strong { font-size: 16px; line-height: 1.55; font-weight: 650; }
.hero-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.hero-meta > div { padding: 14px 15px; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(255,255,255,.015); }
.hero-meta span, .project-card-data span { color: var(--muted); display: block; font-size: 9px; text-transform: uppercase; letter-spacing: .11em; margin-bottom: 6px; }
.hero-meta strong { font-size: 12px; line-height: 1.5; font-weight: 600; }

.next-action { padding: 21px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-heading h3 { margin: 5px 0 0; font-size: 19px; }
.icon-button { border: 1px solid var(--line); background: #151922; color: var(--text); width: 34px; height: 34px; border-radius: 9px; font-size: 18px; }
.action-title { display: flex; gap: 10px; align-items: center; margin-top: 26px; }
.action-title h4 { font-size: 20px; margin: 0; letter-spacing: -.02em; }
.task-state { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.task-state.active { background: var(--gold); box-shadow: 0 0 12px rgba(215,182,111,.6); }
.task-state.blocked { background: var(--red); }
.next-action > p { color: #b4bac6; line-height: 1.6; font-size: 13px; }
.action-specs { display: grid; grid-template-columns: 1fr 1.4fr; gap: 9px; margin: 17px 0; }
.action-specs span { border: 1px solid var(--line-soft); padding: 11px; border-radius: 9px; color: #c6cbd4; font-size: 12px; }
.action-specs b { color: var(--muted); display: block; text-transform: uppercase; font-size: 8px; letter-spacing: .12em; margin-bottom: 5px; }
.stop-box { background: rgba(251,113,133,.055); border: 1px solid rgba(251,113,133,.18); padding: 12px; border-radius: 9px; margin-bottom: 15px; }
.stop-box b { display: block; color: var(--red); font-size: 9px; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 5px; }
.stop-box span { font-size: 11px; color: #c7cbd3; line-height: 1.5; }
.primary-button, .secondary-button, .danger-button { border-radius: 9px; padding: 11px 14px; font-weight: 750; border: 1px solid transparent; }
.primary-button { width: 100%; background: var(--gold); color: #14100a; }
.primary-button:hover { filter: brightness(1.06); }
.secondary-button { background: #161a22; border-color: var(--line); color: #d6dae1; }
.secondary-button:hover { border-color: #404754; }
.danger-button { background: rgba(251,113,133,.08); border-color: rgba(251,113,133,.23); color: #fda4af; }
.compact { width: auto; padding: 9px 13px; }

.metrics-row { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.metric { padding: 16px; display: flex; flex-direction: column; min-height: 110px; }
.metric > span { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: 9px; }
.metric strong { font-size: 27px; margin-top: 11px; letter-spacing: -.03em; }
.metric small { margin-top: auto; color: #717987; }
.focus-panel, .guardrail-panel, .reuse-panel { padding: 20px; }
.focus-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 8px; }
.focus-list li { display: flex; align-items: center; gap: 11px; border-bottom: 1px solid var(--line-soft); padding: 8px 0 12px; }
.focus-list li span { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; background: rgba(215,182,111,.09); color: var(--gold); font-size: 11px; font-weight: 800; }
.focus-list p { margin: 0; font-size: 13px; }
.guardrail-list { list-style: none; padding: 0; margin: 17px 0; display: grid; gap: 11px; }
.guardrail-list li { display: flex; gap: 9px; color: #c4c9d2; font-size: 12px; line-height: 1.45; }
.guardrail-list li span { color: var(--green); }
.fallback { border-top: 1px solid var(--line); padding-top: 14px; }
.fallback b { color: var(--orange); font-size: 9px; text-transform: uppercase; letter-spacing: .12em; }
.fallback p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.reuse-panel { grid-column: 1 / -1; }
.reuse-panel h3 { margin: 5px 0 7px; }
.reuse-panel > p { color: var(--muted); line-height: 1.55; max-width: 900px; }
.cycle-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 15px; }
.cycle-line span { border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; font-size: 11px; }
.cycle-line i { color: var(--gold); font-style: normal; }

.stack-page { display: grid; gap: 16px; }
.section-intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.section-intro p { color: var(--muted); margin: 0; max-width: 690px; line-height: 1.55; }
.project-card-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.project-card { padding: 21px; }
.project-card.selected { border-color: rgba(215,182,111,.48); box-shadow: inset 0 0 0 1px rgba(215,182,111,.1), 0 20px 70px rgba(0,0,0,.25); }
.project-card-head { display: flex; justify-content: space-between; align-items: center; }
.project-card-head > b { color: #656d7a; letter-spacing: .16em; font-size: 10px; }
.project-status { border-radius: 999px; padding: 5px 8px; font-size: 9px; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; border: 1px solid var(--line); color: var(--muted); }
.project-status.active { color: var(--green); border-color: rgba(74,222,128,.25); background: rgba(74,222,128,.06); }
.project-status.queued { color: var(--blue); border-color: rgba(96,165,250,.2); }
.project-status.complete { color: var(--gold); }
.project-card h2 { margin: 16px 0 7px; font-size: 24px; letter-spacing: -.03em; }
.project-card > p { color: var(--muted); min-height: 42px; font-size: 12px; line-height: 1.55; }
.thin-progress { height: 4px; background: #222730; border-radius: 99px; overflow: hidden; margin: 16px 0; }
.thin-progress span { display: block; height: 100%; background: linear-gradient(90deg,var(--gold),#f7dc9b); }
.project-card-data { display: grid; gap: 11px; margin-bottom: 17px; }
.project-card-data > div { border-top: 1px solid var(--line-soft); padding-top: 10px; }
.project-card-data strong { font-size: 11px; line-height: 1.45; color: #c8ccd4; }
.project-card .secondary-button { width: 100%; }

.weekly-header { padding: 21px; display: flex; justify-content: space-between; gap: 24px; align-items: center; }
.weekly-header h2 { margin: 6px 0 0; max-width: 900px; font-size: 20px; line-height: 1.45; }
.week-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.task-table { overflow: hidden; }
.task-row { display: grid; grid-template-columns: 100px minmax(300px,1.6fr) 80px minmax(120px,.65fr) 120px; gap: 15px; align-items: start; padding: 17px 18px; border-bottom: 1px solid var(--line-soft); }
.task-row:last-child { border-bottom: none; }
.task-row.done { opacity: .62; }
.task-head { color: #69717f; font-size: 9px; text-transform: uppercase; letter-spacing: .12em; background: #0d1015; padding-top: 11px; padding-bottom: 11px; }
.task-copy h3 { margin: 0 0 5px; font-size: 14px; }
.task-copy > p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.task-copy details { margin-top: 9px; color: var(--muted); font-size: 10px; }
.task-copy summary { cursor: pointer; color: var(--gold); }
.task-copy details b { display: block; margin-top: 9px; color: #c8cdd5; }
.task-copy details p { margin: 4px 0; line-height: 1.45; }
.task-row > strong, .task-row > span { font-size: 11px; color: #c0c5ce; line-height: 1.5; }
.task-row select { background: #11151b; color: #dce0e6; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 11px; width: 100%; }
.task-badge { display: inline-block; border-radius: 999px; padding: 5px 8px; border: 1px solid var(--line); font-size: 8px; text-transform: uppercase; letter-spacing: .1em; }
.task-badge.active { color: var(--gold); border-color: rgba(215,182,111,.3); }
.task-badge.blocked { color: var(--red); border-color: rgba(251,113,133,.3); }
.task-badge.done { color: var(--green); border-color: rgba(74,222,128,.25); }
.rule-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.rule-card { padding: 18px; }
.rule-card > span { color: var(--gold); font-size: 9px; letter-spacing: .13em; font-weight: 800; }
.rule-card p { color: var(--muted); line-height: 1.55; margin-bottom: 0; }

.log-layout { display: grid; grid-template-columns: 360px minmax(0,1fr); gap: 18px; align-items: start; }
.log-composer { position: sticky; top: 24px; padding: 20px; }
.log-composer h2 { margin: 7px 0 10px; font-size: 21px; }
.log-composer textarea, .form-grid textarea, .form-grid input { width: 100%; color: var(--text); background: #0c0f14; border: 1px solid var(--line); border-radius: 9px; padding: 11px; outline: none; }
.log-composer textarea { min-height: 150px; line-height: 1.5; }
.log-composer textarea:focus, .form-grid textarea:focus, .form-grid input:focus { border-color: rgba(215,182,111,.55); }
.composer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.timeline { display: grid; gap: 12px; }
.timeline-item { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 10px; }
.timeline-item .panel { padding: 15px; }
.timeline-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #141922; border: 1px solid var(--line); color: var(--muted); margin-top: 7px; font-weight: 900; }
.timeline-icon.ship { color: var(--green); border-color: rgba(74,222,128,.25); }
.timeline-icon.blocker { color: var(--red); border-color: rgba(251,113,133,.3); }
.timeline-icon.activation { color: var(--gold); }
.timeline-meta { display: flex; justify-content: space-between; gap: 10px; }
.timeline-meta b { color: var(--gold); font-size: 10px; letter-spacing: .12em; }
.timeline-meta span { color: #6e7683; font-size: 10px; }
.timeline-item p { margin: 9px 0 0; color: #c3c8d0; font-size: 12px; line-height: 1.55; }

.context-layout { display: grid; grid-template-columns: 360px minmax(0,1fr); gap: 16px; }
.context-explain { padding: 21px; }
.context-explain h2 { font-size: 24px; margin: 8px 0 10px; line-height: 1.25; }
.context-explain > p { color: var(--muted); line-height: 1.6; font-size: 12px; }
.context-rules { display: grid; gap: 8px; margin: 18px 0; }
.context-rules div { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line-soft); padding: 9px 10px; border-radius: 8px; }
.context-rules b { color: var(--gold); font-size: 9px; letter-spacing: .1em; }
.context-rules span { color: var(--muted); font-size: 10px; }
.packet-panel { padding: 20px; min-width: 0; }
.packet-panel pre { margin: 16px 0 0; max-height: 620px; overflow: auto; white-space: pre-wrap; background: #090c10; border: 1px solid var(--line-soft); border-radius: 10px; padding: 15px; color: #b9c0cb; font: 11px/1.62 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; }
.data-tools { grid-column: 1 / -1; padding: 19px; }
.data-tools h3 { margin: 0 0 5px; }
.data-tools p { color: var(--muted); margin: 0 0 13px; font-size: 12px; }
.data-tools > div { display: flex; gap: 8px; flex-wrap: wrap; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(6px); z-index: 100; display: grid; place-items: center; padding: 18px; }
.modal { width: min(680px,100%); max-height: 90vh; overflow: auto; padding: 21px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.modal-head h2 { margin: 5px 0 0; }
.form-grid { display: grid; gap: 13px; }
.form-grid label { color: #9da5b2; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; display: grid; gap: 7px; }
.form-grid textarea { min-height: 74px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 4px; }
.form-actions .primary-button { width: auto; }
.empty-state { padding: 22px 0; color: var(--muted); }
.empty-state strong { color: #d7dbe1; }
.empty-state p { font-size: 12px; }
.empty-state.padded { padding: 30px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 200; background: #e5c77f; color: #17120b; border-radius: 10px; padding: 12px 15px; font-weight: 800; box-shadow: 0 18px 50px rgba(0,0,0,.35); font-size: 12px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.bottom-nav { display: none; }

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 84px minmax(0,1fr); }
  .sidebar { width: 84px; padding: 18px 10px; }
  .brand-mark { float: none; margin: 0 auto; }
  .brand-copy, .sidebar-foot { display: none; }
  .side-nav button { justify-content: center; padding: 11px 8px; font-size: 0; }
  .side-nav button span { font-size: 19px; }
  .command-grid { grid-template-columns: minmax(0,1fr) 330px; }
  .project-card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .main-panel { padding: 18px 14px 92px; }
  .topbar { align-items: center; margin-bottom: 17px; }
  .date-block span { display: none; }
  .command-grid, .log-layout, .context-layout { grid-template-columns: 1fr; }
  .metrics-row { grid-template-columns: repeat(2,1fr); }
  .project-hero, .next-action, .focus-panel, .guardrail-panel, .reuse-panel { padding: 17px; }
  .hero-meta { grid-template-columns: 1fr; }
  .progress-ring { width: 92px; height: 92px; flex-basis: 92px; }
  .progress-ring > div { width: 74px; height: 74px; }
  .progress-ring strong { font-size: 19px; }
  .project-card-grid { grid-template-columns: 1fr; }
  .weekly-header { align-items: flex-start; flex-direction: column; }
  .task-table { overflow-x: auto; }
  .task-row { min-width: 790px; }
  .rule-grid { grid-template-columns: 1fr; }
  .log-composer { position: static; }
  .data-tools { grid-column: auto; }
  .bottom-nav { position: fixed; display: grid; grid-template-columns: repeat(5,1fr); left: 10px; right: 10px; bottom: max(9px,env(safe-area-inset-bottom)); z-index: 80; background: rgba(13,16,22,.94); border: 1px solid var(--line); backdrop-filter: blur(18px); border-radius: 15px; padding: 6px; box-shadow: 0 18px 60px rgba(0,0,0,.55); }
  .bottom-nav button { border: none; background: transparent; color: #707887; display: grid; justify-items: center; gap: 1px; padding: 6px 2px; border-radius: 9px; }
  .bottom-nav button span { font-size: 17px; }
  .bottom-nav button small { font-size: 8px; }
  .bottom-nav button.active { background: rgba(215,182,111,.11); color: var(--gold); }
  .toast { left: 14px; right: 14px; bottom: 86px; text-align: center; }
}

@media (max-width: 520px) {
  .topbar h1 { font-size: 27px; }
  .date-block strong { font-size: 11px; }
  .hero-top { gap: 12px; }
  .hero-top h2 { font-size: 27px; }
  .hero-top p { font-size: 12px; }
  .progress-ring { width: 82px; height: 82px; flex-basis: 82px; }
  .progress-ring > div { width: 66px; height: 66px; }
  .progress-ring strong { font-size: 17px; }
  .objective-box strong { font-size: 14px; }
  .metrics-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric { min-height: 96px; padding: 13px; }
  .metric strong { font-size: 22px; }
  .section-intro { align-items: flex-start; flex-direction: column; }
  .section-intro .primary-button { width: 100%; }
  .project-card { padding: 17px; }
  .two-col { grid-template-columns: 1fr; }
  .composer-actions { grid-template-columns: 1fr; }
  .context-explain h2 { font-size: 21px; }
}
