:root {
  --ink: #17212b;
  --muted: #647386;
  --line: #d9e2ea;
  --paper: #f6f8fb;
  --panel: #ffffff;
  --charcoal: #1d2329;
  --teal: #0f8b8d;
  --teal-dark: #096b6d;
  --gold: #c58b16;
  --rose: #b54c5a;
  --green: #2f855a;
  --blue: #2d6cdf;
  --shadow: 0 16px 38px rgba(20, 33, 43, 0.08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, input, textarea, select { font: inherit; }
h1, h2, h3, h4, p { margin-top: 0; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 272px minmax(0, 1fr); }
aside { background: var(--charcoal); color: white; padding: 22px 18px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.logo { width: 42px; height: 42px; display: grid; place-items: center; background: linear-gradient(135deg, var(--teal), var(--gold)); border-radius: var(--radius); font-weight: 900; }
.brand h1 { font-size: 20px; margin-bottom: 2px; letter-spacing: 0; }
.brand p, .hint { color: var(--muted); font-size: 13px; line-height: 1.45; }
aside .brand p { color: #b9c5cf; }
nav { display: grid; gap: 8px; }
.nav { width: 100%; text-align: left; border: 1px solid transparent; background: transparent; color: #dce6ee; padding: 10px 12px; border-radius: var(--radius); cursor: pointer; }
.nav.active, .nav:hover { background: rgba(255,255,255,0.08); color: white; border-color: rgba(255,255,255,0.12); }

.side-score { margin-top: 18px; padding: 14px; border-radius: var(--radius); background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); display: grid; gap: 10px; }
.side-score span { color: #b9c5cf; font-size: 13px; }
.mini-ring { --score: 0; width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--teal) calc(var(--score) * 1%), rgba(255,255,255,0.13) 0); position: relative; }
.mini-ring::after { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--charcoal); }
.mini-ring strong { position: relative; z-index: 1; font-size: 24px; }
.side-stack { margin-top: 12px; display: grid; gap: 8px; }
.side-action { background: rgba(255,255,255,0.08); color: white; border: 1px solid rgba(255,255,255,0.13); }

main { min-width: 0; padding: 24px; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.topbar h2 { font-size: clamp(28px, 4vw, 42px); line-height: 1.04; margin-bottom: 8px; letter-spacing: 0; }
.topbar p { color: var(--muted); }
.eyebrow { color: var(--teal-dark); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: 0; margin-bottom: 8px; }
.actions, .row, .hero-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
button { border: 0; border-radius: var(--radius); background: var(--teal); color: white; padding: 10px 13px; font-weight: 800; cursor: pointer; min-height: 40px; }
button.secondary { background: white; color: var(--ink); border: 1px solid var(--line); }
button.danger { background: var(--rose); }
button.small { min-height: 34px; padding: 7px 10px; font-size: 13px; }
.sync-pill { min-height: 34px; display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; background: #edf5f5; color: var(--teal-dark); font-size: 12px; font-weight: 900; border: 1px solid #cbe6e6; }

.view { display: none; }
.view.active { display: block; }
.grid, .dashboard-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.panel, .hero-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: 1 / -1; }

.hero-panel { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: stretch; background: linear-gradient(135deg, #f4fbfb 0%, #ffffff 54%, #fff8e9 100%); border-left: 5px solid var(--teal); }
.hero-copy h3 { font-size: clamp(24px, 3.2vw, 40px); line-height: 1.05; margin-bottom: 10px; letter-spacing: 0; }
.hero-copy p:not(.eyebrow) { color: var(--muted); max-width: 780px; line-height: 1.5; }
.readiness-card { display: grid; grid-template-columns: 148px 1fr; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.score-ring { --score: 0; width: 148px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--teal) calc(var(--score) * 1%), #e7eef3 0); position: relative; }
.score-ring::after { content: ""; position: absolute; inset: 14px; border-radius: 50%; background: white; }
.score-ring strong, .score-ring span { position: relative; z-index: 1; }
.score-ring strong { font-size: 40px; line-height: 1; }
.score-ring span { color: var(--muted); font-size: 12px; margin-top: 46px; margin-left: -42px; }
.score-lines { display: grid; gap: 10px; }
.score-lines div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.score-lines div:last-child { border-bottom: 0; padding-bottom: 0; }
.score-lines span { color: var(--muted); font-size: 12px; font-weight: 800; }

.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
.panel-head h3 { margin-bottom: 0; }
.pill { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: #edf5f5; color: var(--teal-dark); font-size: 12px; font-weight: 800; margin: 3px 4px 0 0; white-space: nowrap; }
.pill.gold { background: #fff5df; color: #8a5e08; }
.pill.red { background: #ffecef; color: #9a3040; }
.pill.green { background: #eaf7ef; color: #20613f; }
.pill.blue { background: #edf3ff; color: #174eac; }
label { display: grid; gap: 6px; margin-bottom: 12px; color: var(--muted); font-size: 13px; font-weight: 800; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: white; color: var(--ink); padding: 10px 11px; outline: 0; min-height: 40px; }
textarea { min-height: 170px; resize: vertical; line-height: 1.5; }
.quick-text { min-height: 132px; }
input:focus, textarea:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,139,141,0.14); }
input[type="range"] { padding: 0; min-height: 28px; accent-color: var(--teal); }
output { justify-self: end; color: var(--ink); font-weight: 900; }
.sliders label { grid-template-columns: 1fr auto; align-items: center; }
.sliders input { grid-column: 1 / -1; }
.mini-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini-form.three { grid-template-columns: repeat(3, 1fr); }
.mini-form label { margin-bottom: 0; }

.routine-list { display: grid; gap: 8px; }
.routine-row { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: var(--radius); padding: 9px; background: #fbfcfd; }
.routine-row input { width: 18px; height: 18px; min-height: 18px; accent-color: var(--teal); }
.routine-row strong { font-size: 14px; }
.routine-row span { color: var(--muted); font-size: 12px; }

.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.board h4 { margin-bottom: 8px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0; }
.board-list, .list { display: grid; gap: 9px; }
.list.compact { gap: 7px; margin-top: 10px; }
.task-card, .item { border: 1px solid var(--line); background: #fbfcfd; border-radius: var(--radius); padding: 11px; overflow-wrap: anywhere; }
.task-card strong, .item-title { display: block; font-weight: 900; margin-bottom: 5px; }
.task-card p, .item p { color: var(--muted); font-size: 13px; line-height: 1.4; margin-bottom: 6px; }
.task-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 8px; }
.task-actions button { min-height: 30px; padding: 5px 8px; font-size: 12px; }

.progress-list { display: grid; gap: 10px; }
.progress-row { display: grid; gap: 6px; }
.progress-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 800; }
.bar { height: 9px; border-radius: 999px; background: #e8eef3; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--gold)); border-radius: inherit; }

.switch { display: inline-grid; grid-template-columns: auto 42px; align-items: center; gap: 8px; margin-bottom: 0; }
.switch input { display: none; }
.switch span { width: 42px; height: 24px; border-radius: 999px; background: #dce4ea; position: relative; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: white; box-shadow: 0 2px 4px rgba(0,0,0,.16); transition: transform .16s ease; }
.switch input:checked + span { background: var(--teal); }
.switch input:checked + span::after { transform: translateX(18px); }

.filters { display: grid; grid-template-columns: 1fr 190px; gap: 10px; margin-bottom: 14px; }
.records { display: grid; gap: 10px; }
.record { border: 1px solid var(--line); border-radius: var(--radius); background: #fbfcfd; padding: 12px; }
.record header { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.record h4 { margin: 0; font-size: 16px; }
.record p { color: var(--muted); font-size: 13px; line-height: 1.45; margin-bottom: 0; }

@media (max-width: 1100px) {
  .hero-panel { grid-template-columns: 1fr; }
  .readiness-card { grid-template-columns: 148px 1fr; }
  .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 6; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  aside { position: static; height: auto; }
  nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main { padding: 14px; }
  .topbar { display: grid; }
  .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: 1 / -1; }
  .board, .filters, .mini-form, .mini-form.three, .readiness-card { grid-template-columns: 1fr; }
  .score-ring { width: min(160px, 100%); justify-self: center; }
}
