:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #edf3f8;
  --ink: #182133;
  --muted: #5f6b7b;
  --quiet: #8a95a5;
  --line: #d9e1eb;
  --blue: #2563eb;
  --blue-dark: #1746b5;
  --green: #0f766e;
  --amber: #d97706;
  --red: #dc2626;
  --violet: #6d28d9;
  --shadow: 0 18px 48px rgba(24, 33, 51, 0.10);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.toast {
  position: fixed;
  left: 50%;
  top: 18px;
  z-index: 100;
  display: none;
  max-width: min(420px, calc(100vw - 24px));
  transform: translateX(-50%);
  border: 1px solid rgba(24, 33, 51, 0.12);
  border-radius: 8px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
}

.toast.is-visible {
  display: block;
}

.access-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.14), transparent 34%),
    linear-gradient(315deg, rgba(15, 118, 110, 0.16), transparent 36%),
    var(--bg);
}

.access-panel {
  width: min(720px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  padding: clamp(24px, 5vw, 48px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
}

.brand-access {
  margin-bottom: 38px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-size: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.08;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

.lead {
  max-width: 62ch;
  color: var(--muted);
  font-size: 18px;
}

.access-form {
  margin-top: 28px;
}

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

label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.access-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 12px 14px;
  font-size: 16px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.field-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.check-row {
  min-height: 48px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
  flex: 0 0 auto;
}

.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.access-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 16px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--blue);
  color: white;
}

.btn-primary:hover {
  background: var(--blue-dark);
}

.btn-dark {
  background: var(--ink);
  color: white;
}

.btn-light {
  border-color: var(--line);
  background: white;
  color: var(--ink);
}

.btn-ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

.btn-danger {
  background: #fff1f2;
  border-color: #fecdd3;
  color: var(--red);
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
  font-size: 14px;
  font-weight: 800;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 260px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  padding: 22px;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 34px;
}

.nav-item,
.mobile-nav-item {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.nav-item {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--ink);
}

.nav-item.is-active {
  color: var(--blue);
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.sidebar-footer p {
  color: var(--muted);
  font-size: 13px;
}

.workspace {
  width: min(1280px, calc(100% - 260px));
  margin-left: 260px;
  padding: 28px clamp(18px, 4vw, 44px) 44px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.topbar h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 44px);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.hero-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(24, 33, 51, 0.04);
}

.hero-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
  padding: clamp(20px, 4vw, 34px);
}

.hero-panel p:last-child {
  max-width: 68ch;
  margin-bottom: 0;
  color: var(--muted);
}

.hero-score {
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 18px;
  text-align: center;
}

.hero-score span {
  display: block;
  font-size: 42px;
  line-height: 1;
  font-weight: 800;
}

.hero-score small {
  color: var(--muted);
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.start-guide {
  margin-bottom: 14px;
}

.start-guide-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.guide-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 14px;
}

.guide-step.is-done {
  border-color: rgba(15, 118, 110, 0.28);
  background: #ecfdf5;
}

.guide-step.is-current {
  border-color: rgba(37, 99, 235, 0.42);
  background: #eff6ff;
}

.guide-number {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.guide-step.is-done .guide-number {
  background: var(--green);
}

.guide-step.is-current .guide-number {
  background: var(--blue);
}

.guide-step h4 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.guide-step p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.help-panel {
  margin-bottom: 14px;
}

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

.help-detail,
.explanation-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 14px;
}

.help-detail summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}

.help-detail summary::-webkit-details-marker {
  display: none;
}

.help-detail summary::after {
  content: '+';
  margin-left: auto;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.help-detail[open] summary::after {
  content: '-';
}

.help-detail p,
.explanation-card p,
.help-list p {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.help-detail p:last-child,
.explanation-card p:last-child,
.help-list p:last-child {
  margin-bottom: 0;
}

.explanation-card h4 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 15px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 18px;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.content-grid,
.report-grid,
.decision-layout,
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  padding: clamp(18px, 3vw, 26px);
}

.panel + .panel {
  margin-top: 14px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.task-form,
.settings-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field-submit {
  align-self: end;
}

.field-helper {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.input-suffix {
  position: relative;
}

.input-suffix input {
  padding-right: 54px;
}

.input-suffix span {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chip {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 800;
}

.week-timeline {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.day-card {
  min-height: 128px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
}

.day-card.is-today {
  border-color: var(--blue);
  background: #eff6ff;
}

.day-card.is-complete {
  border-color: rgba(15, 118, 110, 0.28);
  background: #ecfdf5;
}

.day-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.day-hours {
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.day-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.task-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
}

.task-row-title {
  min-width: 0;
}

.task-row-title strong {
  display: block;
  overflow-wrap: anywhere;
}

.task-row-title span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.category-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.task-time,
.task-cost {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 20px;
}

.report-summary {
  background: var(--ink);
  color: white;
}

.report-summary .eyebrow,
.report-summary p {
  color: rgba(255, 255, 255, 0.72);
}

.report-numbers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 22px;
}

.report-number {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 14px;
}

.report-number strong {
  display: block;
  color: white;
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.report-number span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
}

.bar-list,
.insights-list,
.checklist {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  gap: 6px;
}

.bar-row-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.bar-track {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: var(--panel-soft);
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
}

.insight,
.check-item {
  display: flex;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
}

.insight-icon,
.check-icon {
  width: 32px;
  height: 32px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--blue);
}

.insight p,
.check-item p {
  margin-bottom: 0;
  color: var(--muted);
}

.decision-main {
  min-height: 360px;
}

.side-stack {
  display: grid;
  align-self: start;
  gap: 14px;
}

.side-stack .panel + .panel {
  margin-top: 0;
}

.offer-panel {
  align-self: start;
  background: #fff7ed;
  border-color: #fed7aa;
}

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

.mobile-nav {
  display: none;
}

@media (max-width: 1080px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .start-guide-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .help-grid,
  .explanation-grid {
    grid-template-columns: 1fr;
  }

  .content-grid,
  .report-grid,
  .decision-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  body {
    padding-bottom: 78px;
  }

  .sidebar {
    display: none;
  }

  .workspace {
    width: 100%;
    margin-left: 0;
    padding: 18px 12px 34px;
  }

  .topbar {
    display: block;
  }

  .topbar-actions {
    justify-content: flex-start;
    margin-top: 14px;
  }

  .topbar-actions .btn {
    flex: 1 1 auto;
  }

  .hero-panel {
    display: block;
  }

  .hero-score {
    margin-top: 16px;
    min-width: 0;
  }

  .stats-grid,
  .report-numbers {
    grid-template-columns: 1fr;
  }

  .start-guide-grid {
    grid-template-columns: 1fr;
  }

  .guide-step {
    min-height: 0;
  }

  .task-form,
  .settings-form {
    grid-template-columns: 1fr;
  }

  .week-timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-row {
    grid-template-columns: auto 1fr auto;
  }

  .task-cost {
    display: none;
  }

  .mobile-nav {
    position: fixed;
    inset: auto 10px 10px;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
    padding: 6px;
    backdrop-filter: blur(16px);
  }

  .mobile-nav-item {
    min-height: 54px;
    display: grid;
    place-items: center;
    gap: 2px;
    padding: 6px 4px;
    font-size: 11px;
  }

  .mobile-nav-item.is-active {
    background: var(--panel-soft);
    color: var(--blue);
  }

  .access-row,
  .auth-grid,
  .access-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: white;
    color: black;
    padding: 0;
  }

  .sidebar,
  .topbar-actions,
  .mobile-nav,
  .task-form,
  .quick-chips,
  .text-button,
  .btn,
  #view-dashboard,
  #view-log,
  #view-decision,
  #view-settings {
    display: none !important;
  }

  .workspace {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .topbar,
  #view-report {
    display: block !important;
  }

  .panel,
  .hero-panel {
    box-shadow: none;
    page-break-inside: avoid;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
