:root {
  /* Color tokens live in theme.css (light default; data-theme="dark" reserved). */
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1100px 520px at 8% -12%, #e7efe9 0%, transparent 55%),
    radial-gradient(900px 480px at 100% 0%, #f0e8dc 0%, transparent 52%),
    linear-gradient(180deg, #f7f4ee 0%, var(--bg) 42%, #efebe3 100%);
  color: var(--text);
  font-family: var(--sans);
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.subtitle {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

.controls {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

select, button {
  font: inherit;
}

select {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  min-width: 10rem;
}

button {
  background: var(--btn-bg, #1c1915);
  color: #f7f4ee;
  border: 0;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-weight: 600;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: var(--btn-bg-hover);
}

button:active:not(:disabled) {
  background: var(--btn-bg-pressed);
}

button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

button:disabled {
  background: var(--btn-bg-disabled);
  color: var(--btn-fg-disabled);
  cursor: not-allowed;
  opacity: 0.85;
}

.ghost {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.6rem 0.2rem;
}

.ghost:hover { color: var(--text); }

.ghost.nav-details {
  color: var(--muted);
  font-size: 0.82rem;
}

.hero {
  padding: 1.75rem 0 1.25rem;
}

.hero h1 {
  margin: 0 0 0.35rem;
  font-size: 1.85rem;
  font-weight: 600;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.summary {
  margin: 0.9rem 0 0;
  max-width: 46rem;
  font-size: 1.08rem;
  line-height: 1.55;
}

.recs {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}

.recs-primary {
  display: grid;
  gap: 0.75rem;
}

.recs-more {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
  padding: 0.65rem 0.9rem;
}

.recs-more summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  list-style-position: outside;
}

.recs-more summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.recs-secondary {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.rec-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--bg-soft, #f3efe6) 0%, var(--bg-elev) 100%);
  padding: 1rem 1.1rem;
  animation: rise 0.4s ease both;
  color: var(--text);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.rec-card h3 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
}

.rec-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.95rem;
}

.recs-head {
  margin-bottom: 0.65rem;
}

.recs-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.recs-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.rec-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.9rem;
  align-items: center;
}

.rec-actions button[data-action="approve"] {
  background: var(--btn-bg, #1c1915);
  color: #f7f4ee;
  border: 0;
}

.rec-actions button[data-action="approve"]:hover:not(:disabled) {
  background: var(--btn-bg-hover);
}

.rec-actions button[data-action="approve"]:active:not(:disabled) {
  background: var(--btn-bg-pressed);
}

.rec-actions button[data-action="approve"]:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.rec-actions button[data-action="approve"]:disabled {
  background: var(--btn-bg-disabled);
  color: var(--btn-fg-disabled);
}

.rec-actions button.reject,
.rec-actions button[data-action="reject"] {
  background: var(--btn-outline-bg);
  color: var(--btn-outline-fg);
  border: 1px solid var(--btn-outline-border);
}

.rec-actions button.reject:hover:not(:disabled),
.rec-actions button[data-action="reject"]:hover:not(:disabled) {
  background: var(--btn-outline-hover-bg);
  border-color: var(--accent);
}

.rec-actions button.reject:active:not(:disabled),
.rec-actions button[data-action="reject"]:active:not(:disabled) {
  background: var(--btn-outline-pressed-bg);
}

.rec-actions button.reject:focus-visible,
.rec-actions button[data-action="reject"]:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.rec-actions button.reject:disabled,
.rec-actions button[data-action="reject"]:disabled {
  color: var(--muted);
  border-color: var(--line);
  background: var(--bg-soft);
  opacity: 0.85;
}

.rec-feedback {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--risk);
}

.rec-card.is-resolving {
  opacity: 0.72;
}

.rec-card.is-completed {
  border-color: var(--good);
  background: linear-gradient(180deg, #e8f3ec 0%, var(--bg-elev) 100%);
}

.rec-card.is-completed .rec-type {
  color: var(--good);
}

.recs-completed {
  margin: 0.5rem 0 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
  color: var(--good);
  font-size: 0.92rem;
}

.rec-meta {
  margin-top: 0.55rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.inline-feedback {
  flex: 1 1 100%;
  margin: 0.35rem 0 0;
  color: var(--risk);
  font-size: 0.9rem;
}

.see-details {
  margin: 1.25rem 0 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-elev);
  padding: 0.75rem 1rem 1rem;
}

.see-details > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.35rem 0;
}

.see-details > summary:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

.see-details .panel {
  margin-top: 1rem;
}

.nested-details {
  margin-top: 0.85rem;
}

.year-strip {
  margin-top: 0.25rem;
}

.rec-type {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.rec-card.rec-risk .rec-type { color: var(--risk); }
.rec-card.rec-opportunity .rec-type { color: var(--good); }
.rec-card.rec-reminder .rec-type { color: var(--watch); }
.rec-card.rec-forecast .rec-type { color: var(--accent); }

.panel-head.secondary {
  margin-top: 1.1rem;
  margin-bottom: 0.5rem;
}

.panel-head.secondary h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.goal-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.goal-form input,
.goal-form select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
  font: inherit;
}

.goal-form input[type="text"] { flex: 1 1 160px; }
.goal-form input[type="number"] { width: 110px; }

.event-form {
  align-items: flex-start;
}

.event-form input[type="date"] {
  flex: 0 1 150px;
}

.event-form select {
  flex: 1 1 180px;
  min-width: 160px;
}

.event-form button[type="submit"] {
  flex: 0 0 auto;
}

.event-impact,
.event-error,
.event-confirm {
  flex: 1 1 100%;
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.event-impact {
  color: var(--muted);
}

.event-impact[data-tone="good"] {
  color: var(--good);
}

.event-impact[data-tone="watch"] {
  color: var(--watch);
}

.event-impact[data-tone="info"] {
  color: var(--muted);
}

.event-error {
  color: var(--risk);
}

.event-confirm {
  color: var(--good);
  margin: 0.5rem 0 0.25rem;
}

.event-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

@media (max-width: 720px) {
  .event-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .event-form input,
  .event-form select,
  .event-form button {
    flex: 1 1 100%;
    width: 100%;
    min-height: 44px;
    font-size: 1rem;
  }

  .event-form button {
    margin-top: 0.15rem;
  }

  .goal-form input,
  .goal-form select,
  .goal-form button {
    min-height: 44px;
  }

  .recs-primary button,
  .recs-secondary button,
  .empty button,
  .see-details > summary {
    min-height: 44px;
  }

  .event {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.85rem 0;
  }

  .panel {
    padding: 1rem;
  }
}

.insights, .scenarios {
  display: grid;
  gap: 0.75rem;
}

.insight-card, .scenario-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  background: var(--bg);
}

.insight-card h3, .scenario-card .name {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.insight-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.amt.good { color: var(--good); }
.amt.watch { color: var(--watch); }

.empty {
  margin-top: 0.5rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-elev);
  max-width: 36rem;
}

.empty h2 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
}

.empty p {
  margin: 0 0 1rem;
  color: var(--muted);
  line-height: 1.5;
}

.strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 0.5rem 0 1rem;
}

.strip article {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.95rem 1rem;
}

.strip-more {
  margin: 0 0 1.25rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
  padding: 0.65rem 0.9rem;
}

.strip-more summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.88rem;
}

.strip-more-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.strip-more-grid article {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0.35rem 0;
}

.strip-label {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.strip-value {
  font-family: var(--mono);
  font-size: 1.35rem;
  margin: 0.4rem 0 0.2rem;
  font-weight: 500;
}

.strip-value.good { color: var(--good); }
.strip-value.watch { color: var(--watch); }
.strip-value.risk { color: var(--risk); }

.strip-sub {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.panel {
  margin-top: 1.25rem;
  padding: 1.15rem 1.2rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-elev);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.row {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr 0.7fr 0.7fr 1.6fr;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
  align-items: start;
}

.row.head {
  border-top: 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 0.35rem;
}

.row .amt {
  font-family: var(--mono);
  font-size: 0.92rem;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.badge.expected { background: rgba(61, 220, 151, 0.12); color: var(--good); }
.badge.unexpected { background: rgba(255, 107, 107, 0.12); color: var(--risk); }
.badge.mixed { background: rgba(230, 184, 77, 0.14); color: var(--watch); }
.badge.unknown { background: rgba(139, 147, 167, 0.14); color: var(--muted); }

.desc {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.events {
  display: grid;
  gap: 0.65rem;
}

.event {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}

.event:first-child { border-top: 0; }

.event .name { font-weight: 600; }
.event .when {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.82rem;
  margin-top: 0.2rem;
}
.event .amt {
  font-family: var(--mono);
  white-space: nowrap;
}

@media (max-width: 960px) {
  .strip { grid-template-columns: 1fr 1fr; }
  .strip-more-grid { grid-template-columns: 1fr 1fr; }
  .row {
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem 0.75rem;
  }
  .row.head { display: none; }
  .row .desc { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .top { flex-direction: column; align-items: flex-start; }
  .strip { grid-template-columns: 1fr; }
  .strip-more-grid { grid-template-columns: 1fr; }
}

.change-note {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.92rem;
}