:root {
  --bg: #f5f0e8;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --ink: #172033;
  --muted: #637089;
  --line: rgba(21, 33, 51, 0.12);
  --navy: #1e3a5f;
  --teal: #0f7f7a;
  --green: #1f8b4c;
  --red: #d8453f;
  --gold: #c88a2b;
  --cream: #fff4de;
  --shadow: 0 24px 60px rgba(23, 32, 51, 0.08);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Instrument Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 127, 122, 0.14), transparent 30%),
    radial-gradient(circle at top right, rgba(200, 138, 43, 0.14), transparent 26%),
    var(--bg);
}

.page-shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 36px 28px 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.7fr);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 28px;
}

.hero-copy,
.hero-side,
.panel {
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 32px 34px;
}

.hero h1,
.panel h2,
.panel h3 {
  margin: 0;
}

.hero h1 {
  font-family: "Newsreader", serif;
  font-size: clamp(2.3rem, 4vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  max-width: 16ch;
  margin-bottom: 18px;
}

.hero-text,
.panel-subtext,
.chart-copy p,
.summary-card span,
.rule-box p,
.table-note {
  color: var(--muted);
  line-height: 1.5;
}

.hero-side {
  padding: 22px;
  display: flex;
  align-items: stretch;
}

.summary-card {
  width: 100%;
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  background: linear-gradient(145deg, rgba(30, 58, 95, 0.96), rgba(15, 127, 122, 0.9));
  color: #fff;
}

.summary-card span {
  color: rgba(255, 255, 255, 0.76);
}

.summary-card strong {
  font-size: 2rem;
  line-height: 1;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.dashboard {
  display: grid;
  gap: 24px;
}

.panel {
  padding: 26px;
}

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

.panel-header.nested {
  margin-top: 10px;
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--navy);
  border-radius: 999px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

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

.kpi {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.kpi-label {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.kpi-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.kpi-note {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.chart-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 251, 255, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 18px;
}

.chart-copy {
  margin-bottom: 12px;
}

.age-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 16px;
  align-items: end;
  min-height: 280px;
}

.cohort {
  display: grid;
  gap: 10px;
}

.cohort-bars {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 8px;
  min-height: 210px;
  position: relative;
}

.cohort-bar {
  width: 24px;
  border-radius: 10px 10px 4px 4px;
  min-height: 4px;
}

.cohort-bar.gross {
  background: #3261d2;
}

.cohort-bar.cost {
  background: var(--red);
}

.cohort-bar.net {
  background: var(--green);
}

.cohort-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cohort-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 2px dashed;
  opacity: 0.65;
}

.cohort-line.gross {
  border-color: #5f8cff;
}

.cohort-line.net {
  border-color: #44c76a;
}

.cohort-meta {
  text-align: center;
}

.cohort-meta strong {
  display: block;
  margin-bottom: 4px;
}

.cohort-meta span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

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

.rule-box {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.rule-box.warm {
  background: linear-gradient(180deg, #fff8ef, #fff3de);
}

.rule-list,
.stacked-stats {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.rule-list li,
.stacked-stats li {
  color: var(--muted);
  line-height: 1.4;
}

.grade-summary {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

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

.grade-bar {
  height: 16px;
  background: #d9e5f1;
  border-radius: 999px;
  overflow: hidden;
}

.grade-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), var(--green));
}

.current-book-wrap.hidden {
  display: none;
}

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

.queue-card {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.queue-card strong {
  display: block;
  font-size: 1.6rem;
  margin-top: 8px;
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1120px;
  background: rgba(255, 255, 255, 0.86);
}

thead th {
  position: sticky;
  top: 0;
  background: #f8fbff;
  color: var(--navy);
  text-align: left;
  font-size: 0.88rem;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
}

tbody td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.94rem;
}

tbody tr:hover {
  background: rgba(50, 97, 210, 0.04);
}

.rec-badge,
.status-badge,
.approval-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.rec-badge.send,
.approval-badge.approved {
  background: rgba(31, 139, 76, 0.14);
  color: var(--green);
}

.rec-badge.review {
  background: rgba(200, 138, 43, 0.16);
  color: #99600b;
}

.rec-badge.no {
  background: rgba(216, 69, 63, 0.12);
  color: var(--red);
}

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

.small {
  font-size: 0.85rem;
}

.rule-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rule-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}

.rule-pill.pass {
  background: rgba(31, 139, 76, 0.12);
  color: var(--green);
}

.rule-pill.warn {
  background: rgba(200, 138, 43, 0.15);
  color: #99600b;
}

.rule-pill.fail {
  background: rgba(216, 69, 63, 0.12);
  color: var(--red);
}

.editable-cell {
  min-width: 118px;
}

select,
button.approve-button {
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 10px;
}

button.approve-button {
  cursor: pointer;
  color: var(--navy);
  font-weight: 700;
}

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

@media (max-width: 1100px) {
  .hero,
  .rule-grid,
  .kpi-grid,
  .queue-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 20px 14px 32px;
  }

  .hero-copy,
  .hero-side,
  .panel {
    padding: 20px;
  }

  .hero h1 {
    font-size: 2.5rem;
  }
}
