:root {
  --bg: #f4efe6;
  --bg-strong: #fffaf2;
  --surface: rgba(255, 250, 242, 0.82);
  --surface-strong: #fffdf7;
  --surface-soft: rgba(255, 255, 255, 0.56);
  --ink: #172121;
  --muted: #5d645f;
  --line: rgba(23, 33, 33, 0.12);
  --brand: #0f5a43;
  --brand-soft: #d9efe7;
  --accent: #c47b2a;
  --accent-soft: #f6e2c4;
  /* Darkened slightly from the original palette (#d08a18/#b64332/#1f7a57) so status text
     clears ~4.5:1 contrast against their tinted pill backgrounds (see .good/.caution/.risk),
     while keeping the same green/amber/red hues for good/caution/risk meaning. */
  --warn: #906011;
  --risk: #b24231;
  --good: #1e7654;
  --shadow: 0 18px 48px rgba(33, 35, 28, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-sans: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(196, 123, 42, 0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(15, 90, 67, 0.12), transparent 24%),
    linear-gradient(135deg, #efe8d9 0%, #f7f2e8 42%, #f0f5ef 100%);
  font-family: var(--font-sans);
}

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

button {
  cursor: pointer;
}

.page-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  padding: 36px 28px 32px;
  border-right: 1px solid var(--line);
  background: rgba(255, 247, 235, 0.68);
  backdrop-filter: blur(12px);
}

.brand-block h1 {
  margin: 8px 0 14px;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.eyebrow,
.section-label,
.stat-label,
.column-title,
.mini-stat-label,
.heatmap-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--muted);
}

.lede,
.hero-note,
.compact-list li,
.advice-list li,
.helper-copy,
.body-copy,
.report-card p,
.topbar-subtext,
.history-meta,
.report-text,
.field span,
.template-card p,
.objective-card p {
  color: var(--muted);
  line-height: 1.55;
}

.side-nav {
  display: grid;
  gap: 10px;
  margin: 34px 0;
}

.nav-link,
.secondary-button,
.primary-button,
.ghost-button {
  border-radius: var(--radius-sm);
  transition: 180ms ease;
}

.nav-link {
  padding: 14px 16px;
  text-align: left;
  border: 1px solid transparent;
  color: var(--ink);
  background: transparent;
}

.nav-link:hover,
.nav-link.active {
  border-color: rgba(15, 90, 67, 0.18);
  background: rgba(15, 90, 67, 0.09);
}

.principles-card,
.panel-card,
.hero-card,
.stat-card,
.permission-banner {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.principles-card {
  padding: 18px 18px 16px;
}

.principles-card-accent {
  background: linear-gradient(180deg, rgba(246, 226, 196, 0.62), rgba(255, 253, 247, 0.88));
  margin-top: 16px;
}

.principles-card ul,
.compact-list,
.advice-list {
  padding-left: 18px;
  margin: 14px 0 0;
}

.secondary-button,
.primary-button,
.ghost-button {
  border: 1px solid var(--line);
  padding: 12px 16px;
}

.primary-button {
  background: var(--brand);
  color: #fff8ef;
  border-color: transparent;
}

.primary-button:hover {
  background: #0a4836;
}

.secondary-button {
  background: var(--surface-strong);
  color: var(--ink);
}

.secondary-button:hover,
.ghost-button:hover {
  background: rgba(15, 90, 67, 0.09);
}

.secondary-button-full {
  width: 100%;
  margin-top: 14px;
}

.ghost-button {
  background: transparent;
  padding: 8px 12px;
}

.main-panel {
  padding: 28px;
}

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

.topbar h2,
.card-head h3,
.template-card h4,
.objective-card h4 {
  margin: 6px 0 0;
  font-size: 1.45rem;
}

.topbar-subtext {
  margin: 8px 0 0;
}

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

.topbar-actions-wide {
  align-items: center;
}

.topbar-chip,
.pill,
.control-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  font-size: 0.88rem;
}

.control-pill {
  gap: 10px;
}

.control-pill span {
  color: var(--muted);
  font-size: 0.8rem;
}

.control-pill select {
  border: 0;
  background: transparent;
  color: var(--ink);
}

.permission-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
  padding: 14px 18px;
}

.permission-banner-readonly {
  border-color: rgba(182, 67, 50, 0.2);
  background: linear-gradient(180deg, rgba(255, 243, 238, 0.85), rgba(255, 250, 242, 0.92));
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.hero-grid,
.stats-grid,
.content-grid,
.report-grid,
.form-grid,
.mini-stats-grid,
.trend-grid,
.template-grid {
  display: grid;
  gap: 18px;
}

.hero-grid {
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  margin-bottom: 18px;
}

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

.content-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  margin-bottom: 18px;
}

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

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

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

.form-grid-tight {
  grid-template-columns: repeat(2, minmax(0, 220px));
}

.hero-card,
.panel-card {
  padding: 22px;
}

.hero-card-primary {
  background:
    linear-gradient(135deg, rgba(15, 90, 67, 0.95), rgba(23, 33, 33, 0.95)),
    var(--surface);
  color: #f8f5ee;
}

.hero-card-primary .section-label,
.hero-card-primary .hero-note,
.hero-card-primary .metric-caption {
  color: rgba(248, 245, 238, 0.78);
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
}

.metric-value {
  margin: 6px 0 4px;
  font-size: clamp(2.7rem, 6vw, 4.5rem);
  line-height: 0.94;
  font-weight: 700;
}

.metric-caption {
  margin: 0;
}

.signal-stack {
  display: grid;
  gap: 8px;
}

.signal,
.pill.good,
.pill.caution,
.pill.risk {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
}

.signal {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.86rem;
}

.good {
  background: rgba(31, 122, 87, 0.14);
  color: var(--good);
}

.caution {
  background: rgba(208, 138, 24, 0.14);
  color: var(--warn);
}

.risk {
  background: rgba(182, 67, 50, 0.14);
  color: var(--risk);
}

.stat-card {
  padding: 18px;
}

.stat-value {
  margin: 14px 0 6px;
  font-size: 1.9rem;
  font-weight: 700;
}

.stat-foot {
  margin: 0;
}

.good-text {
  color: var(--good);
}

.caution-text {
  color: var(--warn);
}

.risk-text {
  color: var(--risk);
}

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

.priority-list,
.initiative-board,
.history-list,
.objective-ladder {
  display: grid;
  gap: 12px;
}

.initiative-card,
.history-item,
.mini-stat,
.report-output,
.report-card,
.trend-card,
.objective-card,
.template-card {
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.initiative-card-head,
.initiative-meta,
.initiative-actions,
.form-actions,
.history-title,
.trend-card-head,
.objective-card-head {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.initiative-card-head,
.initiative-meta,
.history-title,
.trend-card-head,
.objective-card-head {
  justify-content: space-between;
  align-items: center;
}

.initiative-card h4,
.report-card h4,
.template-card h4,
.objective-card h4 {
  margin: 0 0 4px;
}

.initiative-card p,
.report-card p,
.mini-stat,
.history-item p,
.template-card p,
.objective-card p {
  margin: 0;
}

.progress-bar {
  height: 10px;
  overflow: hidden;
  margin: 12px 0;
  border-radius: 999px;
  background: rgba(23, 33, 33, 0.08);
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c47b2a, #0f5a43);
}

.initiative-stats,
.objective-tags,
.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.stack-form {
  display: grid;
  gap: 18px;
}

.inline-form {
  margin-top: 20px;
}

.field {
  display: grid;
  gap: 8px;
}

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

.field-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: end;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 247, 0.96);
  padding: 12px 14px;
  color: var(--ink);
}

.field textarea {
  resize: vertical;
}

.helper-copy {
  margin: 0;
}

.mini-stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.mini-stat-value {
  display: block;
  margin-top: 8px;
  font-size: 1.35rem;
}

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

.column-title {
  margin: 0 0 10px;
}

.report-output {
  min-height: 460px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 251, 242, 0.94));
}

.report-text {
  margin: 0;
  white-space: pre-wrap;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.95rem;
}

.trend-card {
  color: var(--ink);
}

.sparkline-wrap {
  margin: 14px 0 8px;
  color: var(--brand);
}

.sparkline {
  display: block;
  width: 100%;
  height: 42px;
}

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

.heatmap-cell {
  display: grid;
  gap: 8px;
  min-height: 96px;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.heatmap-cell strong {
  font-size: 1.6rem;
}

.template-card {
  display: grid;
  gap: 12px;
}

.import-status {
  min-height: 24px;
  color: var(--brand);
}

.list-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.list-controls input[type="search"],
.list-controls select {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 247, 0.96);
  padding: 10px 14px;
  color: var(--ink);
}

.list-controls input[type="search"] {
  flex: 1 1 200px;
}

.empty-state {
  color: var(--muted);
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 253, 247, 0.55);
}

input:disabled,
select:disabled,
textarea:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 1180px) {
  .page-shell,
  .hero-grid,
  .stats-grid,
  .content-grid,
  .content-grid-wide,
  .report-grid,
  .review-columns,
  .mini-stats-grid,
  .form-grid,
  .form-grid-tight,
  .trend-grid,
  .template-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .sidebar,
  .main-panel {
    padding: 22px 18px;
  }

  .brand-block h1 {
    font-size: 2.25rem;
  }

  .metric-row,
  .initiative-card-head,
  .initiative-meta,
  .history-title,
  .trend-card-head,
  .objective-card-head,
  .topbar {
    flex-direction: column;
    align-items: start;
  }

  .topbar-actions {
    justify-content: start;
  }
}
