:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #101828;
  --muted: #6b7280;
  --line: #ded5c5;
  --panel: rgba(255, 250, 240, 0.96);
  --panel-strong: #fffdf7;
  --canvas: #09111f;
  --green: #2f6f4e;
  --yellow: #b8892d;
  --red: #9f3a45;
  --blue: #2563eb;
  --gold: #d4af37;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

html {
  background:
    radial-gradient(circle at 14% 8%, rgba(212, 175, 55, 0.17), transparent 26rem),
    radial-gradient(circle at 90% 16%, rgba(47, 111, 78, 0.18), transparent 30rem),
    var(--canvas);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: #f7f0df;
}

button,
textarea,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.3);
  outline-offset: 3px;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 0 max(34px, env(safe-area-inset-bottom));
}

.loading-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.loading-mark {
  width: 76px;
  height: 76px;
  border-radius: 24px;
  background: linear-gradient(135deg, #101828, #344054);
  box-shadow: var(--shadow);
  animation: breathe 1.2s ease-in-out infinite alternate;
}

@keyframes breathe {
  from {
    transform: scale(0.94);
    opacity: 0.72;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.topbar,
.panel-heading,
.metric-row,
.quick-row,
.quick-capture,
.today-status,
.nav-cluster {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar h1,
.panel-heading h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(2.1rem, 4rem, 4.8rem);
  line-height: 0.96;
  max-width: 720px;
  color: #fff7e8;
}

.panel-heading h2 {
  font-size: 1.25rem;
  line-height: 1.15;
}

.panel-heading.compact h2 {
  font-size: 1.05rem;
}

.eyebrow {
  margin: 0 0 8px;
  color: color-mix(in srgb, var(--gold) 78%, white);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.subtle {
  color: #b7c0cb;
  margin: 14px 0 0;
}

.rating-badge,
.plan-panel,
.focus-panel,
.metric-panel,
.week-panel,
.day-panel,
.quick-panel,
.vault-panel,
.energy-panel,
.coach-panel,
.reflection-panel,
.life-panel,
.quick-capture,
.notice {
  border: 1px solid rgba(16, 24, 40, 0.08);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.rating-badge {
  min-width: 176px;
  justify-content: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  color: var(--ink);
}

.rating-badge span,
.rating-badge strong {
  display: block;
}

.rating-badge span {
  color: #5d6470;
  font-size: 0.8rem;
  font-weight: 700;
}

.rating-badge strong {
  font-size: 1.3rem;
}

.badge-mark,
.capture-mark,
.panel-mark {
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 900;
}

.badge-mark,
.capture-mark {
  width: 42px;
  height: 42px;
  color: white;
  background: var(--tone);
}

.panel-mark {
  min-width: 52px;
  min-height: 36px;
  color: #4f3b0a;
  background: rgba(212, 175, 55, 0.18);
}

.rating-badge.green,
.status-pill.green,
.day-tile.green {
  --tone: var(--green);
}

.rating-badge.yellow,
.status-pill.yellow,
.day-tile.yellow {
  --tone: var(--yellow);
}

.rating-badge.red,
.status-pill.red,
.day-tile.red {
  --tone: var(--red);
}

.status-pill.neutral,
.day-tile.neutral {
  --tone: #667085;
}

.dashboard-grid,
.detail-grid,
.intelligence-grid,
.deep-grid {
  display: grid;
  gap: 18px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.8fr);
}

.dashboard-grid.score-grid {
  grid-template-columns: 1fr;
}

.detail-grid {
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 1.05fr);
}

.intelligence-grid {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  margin-bottom: 18px;
}

.deep-grid {
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr);
  margin-top: 18px;
}

.plan-panel,
.focus-panel,
.metric-panel,
.week-panel,
.day-panel,
.quick-panel,
.vault-panel,
.energy-panel,
.coach-panel,
.reflection-panel,
.life-panel {
  border-radius: 8px;
  padding: 22px;
  color: var(--ink);
}

.plan-panel {
  margin-bottom: 18px;
}

.plan-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
}

.plan-prompts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.plan-prompts label {
  display: grid;
  gap: 8px;
  align-content: start;
}

.plan-prompts span,
.list-summary span,
.plan-footer,
.empty-list {
  color: var(--muted);
  font-weight: 750;
}

.plan-prompts span {
  font-size: 0.78rem;
  text-transform: uppercase;
}

.plan-prompts input,
.todo-form input,
.todo-title {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  padding: 0 13px;
}

.execution-list {
  display: grid;
  gap: 12px;
}

.list-summary {
  display: grid;
  gap: 6px;
  min-height: 74px;
  align-content: center;
  padding: 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(15, 159, 110, 0.1));
  border: 1px solid rgba(37, 99, 235, 0.12);
}

.todo-list {
  display: grid;
  gap: 8px;
}

.todo-row,
.todo-form,
.plan-footer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.todo-row {
  min-height: 52px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
}

.todo-row.done .todo-title {
  color: var(--muted);
  text-decoration: line-through;
}

.todo-check,
.todo-delete {
  border: 1px solid var(--line);
  background: #fffdf7;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.todo-check {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  color: #fff;
}

.todo-check[aria-pressed="true"] {
  border-color: var(--green);
  background: var(--green);
}

.todo-title {
  border-color: transparent;
  background: #f6efe1;
  font-weight: 800;
  line-height: 1.25;
  min-width: 0;
  resize: vertical;
  padding: 12px 13px;
}

.todo-delete {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  color: var(--muted);
}

.todo-form {
  margin-top: 2px;
}

.plan-score {
  min-width: 84px;
  min-height: 58px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #4f3b0a;
  background: rgba(212, 175, 55, 0.18);
  font-weight: 900;
}

.plan-score span,
.plan-score small {
  display: block;
  line-height: 1;
}

.plan-score span {
  font-size: 1.25rem;
}

.plan-score small {
  color: var(--muted);
  font-size: 0.75rem;
}

.plan-footer {
  justify-content: space-between;
  margin-top: 14px;
  font-size: 0.86rem;
}

.phase-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.phase-strip span {
  min-height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #5d4a12;
  background: rgba(212, 175, 55, 0.16);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.confirm-plan {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(212, 175, 55, 0.24);
  border-radius: 8px;
  background: rgba(212, 175, 55, 0.09);
}

.confirm-plan span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.confirm-plan-button {
  min-height: 42px;
  border: 1px solid #1f1a0d;
  border-radius: 8px;
  background: #1f1a0d;
  color: #f7d778;
  cursor: pointer;
  padding: 0 14px;
  font-weight: 900;
}

.todo-block {
  display: grid;
  gap: 8px;
}

.todo-block-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.todo-block-heading span,
.todo-block-heading small {
  font-weight: 900;
}

.todo-block-heading span {
  color: #2d2617;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.todo-block-heading small {
  color: var(--muted);
  font-size: 0.78rem;
}

.non-negotiable-list .todo-row {
  border-color: rgba(212, 175, 55, 0.38);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(255, 253, 247, 0.95));
}

.energy-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.9fr);
  gap: 18px;
}

.energy-slots,
.slider-stack {
  display: grid;
  gap: 12px;
}

.energy-row,
.slider-stack label {
  display: grid;
  gap: 8px;
}

.energy-row > span,
.slider-stack span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.energy-row > div {
  display: flex;
  gap: 7px;
}

.energy-dot {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.energy-dot.active,
.mode-button.active,
.reset-chip.active {
  border-color: var(--gold);
  background: #201a0d;
  color: #f7d778;
}

.slider-stack input {
  width: 100%;
  accent-color: var(--gold);
}

.slider-stack strong {
  color: var(--ink);
}

.mode-actions,
.reset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.mode-button,
.reset-chip {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  cursor: pointer;
  padding: 0 12px;
  font-weight: 850;
}

.coach-panel p {
  margin: 0 0 12px;
  color: #4b5563;
  line-height: 1.55;
}

.coach-panel > strong {
  display: block;
  color: #171717;
  margin-bottom: 2px;
}

.reflection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.reflection-grid label {
  display: grid;
  gap: 8px;
}

.reflection-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.reflection-grid textarea {
  min-height: 94px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  padding: 12px;
}

.life-map {
  display: grid;
  grid-template-columns: repeat(26, 1fr);
  gap: 5px;
}

.life-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: #d9d3c7;
  border: 1px solid rgba(16, 24, 40, 0.05);
}

.life-cell.green {
  background: var(--green);
}

.life-cell.yellow {
  background: var(--yellow);
}

.life-cell.red {
  background: var(--red);
}

.life-cell.future {
  background: #ece6d8;
}

.life-cell.current {
  outline: 2px solid #111827;
  outline-offset: 2px;
}

.life-legend {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.panel-heading {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.score-ring {
  --progress: 0deg;
  width: 96px;
  height: 96px;
  flex: 0 0 96px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--panel-strong) 0 58%, transparent 59%),
    conic-gradient(var(--gold) var(--progress), #e9e1d3 0deg);
  position: relative;
}

.score-ring strong {
  font-size: 2rem;
  line-height: 1;
}

.score-ring span {
  margin-top: 34px;
  margin-left: 34px;
  color: var(--muted);
  font-weight: 800;
  position: absolute;
}

.today-status {
  justify-content: space-between;
  margin-bottom: 18px;
  color: var(--muted);
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--tone);
  background: color-mix(in srgb, var(--tone) 12%, white);
  border: 1px solid color-mix(in srgb, var(--tone) 24%, white);
  font-weight: 800;
  font-size: 0.82rem;
}

.habit-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.habit-button {
  min-height: 94px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

.habit-button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.1);
}

.habit-button.complete {
  border-color: color-mix(in srgb, var(--accent) 45%, white);
  background: color-mix(in srgb, var(--accent) 10%, white);
}

.habit-icon {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, white);
  font-size: 0.76rem;
  font-weight: 950;
}

.habit-button strong,
.habit-button small {
  display: block;
}

.habit-button strong {
  line-height: 1.15;
}

.habit-button small {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 650;
}

.metric-stack {
  display: grid;
  gap: 16px;
}

.metric-row {
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
}

.metric-row strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.meter {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9e1d3;
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--yellow), var(--green));
}

.week-panel {
  margin: 18px 0;
}

.detail-grid + .metric-panel {
  margin-top: 18px;
}

.nav-cluster {
  gap: 8px;
}

.icon-button,
.text-button,
.ghost-button {
  border: 1px solid var(--line);
  background: #fffdf7;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 850;
}

.icon-button {
  min-width: 40px;
  padding: 0 10px;
}

.text-button,
.ghost-button {
  gap: 8px;
  padding: 0 14px;
}

.ghost-button {
  min-height: 36px;
  background: rgba(255, 255, 255, 0.72);
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(92px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.day-tile {
  min-height: 118px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  padding: 14px;
  cursor: pointer;
}

.day-tile.active {
  border-color: var(--tone);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--tone) 50%, white);
}

.day-tile span,
.day-tile small {
  color: var(--muted);
  font-weight: 800;
}

.day-tile strong {
  font-size: 2rem;
  color: var(--tone);
}

.tracker-table {
  display: grid;
  gap: 8px;
  overflow-x: auto;
}

.tracker-header,
.tracker-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.5fr) repeat(7, minmax(48px, 0.5fr));
  align-items: center;
  gap: 8px;
  min-width: 650px;
}

.tracker-header {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.tracker-label {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 8px;
  background: #f6efe1;
  font-weight: 800;
}

.tracker-cell {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #fffdf7;
  color: #fff;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 950;
}

.tracker-cell.complete {
  border-color: var(--accent);
  background: var(--accent);
}

.day-panel textarea {
  width: 100%;
  min-height: 168px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--ink);
  background: #fffdf7;
}

.note-footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.quick-list {
  display: grid;
  gap: 10px;
}

.vault-panel {
  grid-column: 1 / -1;
}

.quick-row {
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 8px 10px 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  font-weight: 800;
}

.quick-row > div {
  display: flex;
  gap: 8px;
}

.vault-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.vault-actions input {
  display: none;
}

.quick-capture,
.notice {
  gap: 14px;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 18px;
}

.quick-capture {
  justify-content: space-between;
}

.quick-capture.saved,
.quick-capture.already-saved {
  --tone: var(--green);
  border-color: rgba(15, 159, 110, 0.35);
  background: rgba(236, 253, 245, 0.94);
}

.quick-capture.error,
.notice.error {
  --tone: var(--red);
  border-color: rgba(208, 68, 55, 0.35);
  background: rgba(254, 242, 242, 0.94);
}

.quick-capture div {
  display: grid;
  gap: 3px;
  flex: 1;
}

.quick-capture span {
  color: var(--muted);
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 24px, 720px);
  }

  .topbar,
  .dashboard-grid,
  .intelligence-grid,
  .deep-grid,
  .plan-layout,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .plan-prompts {
    grid-template-columns: 1fr;
  }

  .energy-grid,
  .reflection-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .top-actions {
    flex-wrap: wrap;
  }

  .rating-badge {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .topbar h1 {
    font-size: 2.55rem;
  }

  .focus-panel,
  .plan-panel,
  .energy-panel,
  .coach-panel,
  .reflection-panel,
  .life-panel,
  .metric-panel,
  .week-panel,
  .day-panel,
  .quick-panel,
  .vault-panel {
    padding: 16px;
  }

  .panel-heading {
    align-items: flex-start;
  }

  .habit-list {
    grid-template-columns: 1fr;
  }

  .habit-button {
    min-height: 82px;
  }

  .score-ring {
    width: 82px;
    height: 82px;
    flex-basis: 82px;
  }

  .score-ring strong {
    font-size: 1.7rem;
  }

  .week-strip {
    grid-template-columns: repeat(7, 96px);
  }

  .quick-capture {
    display: grid;
  }

  .confirm-plan {
    display: grid;
  }
}
