/* Admin and affiliate dashboards. Builds on styles.css tokens (paper canvas, ink type, one coral accent). */
body.dash { background: var(--bg); font-size: 15px; line-height: 1.5; }
.dash .wrap { width: min(1200px, 100% - 40px); margin: 0 auto; padding: 28px 0 80px; }
.dash header.dash-head { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; flex-wrap: wrap; }
.dash header.dash-head .brand { font-size: 17px; }
.dash header.dash-head .spacer { flex: 1; }
.dash h1 { font-size: 30px; letter-spacing: -0.035em; }
.dash h2 { font-size: 19px; letter-spacing: -0.02em; margin: 0 0 12px; }
.dash h3 { font-size: 15px; margin: 0 0 8px; }
.dash .muted { color: var(--text-2); }
.dash .small { font-size: 13px; }
.dash .mono { font-family: var(--mono); font-size: 13px; }
.dash [hidden] { display: none !important; }

/* ── app shell: sidebar + main ─────────────────────────────── */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--surface) 240px, transparent 240px); }
.sb { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; }
.sb .brand { font-size: 16px; padding: 4px 10px 14px; }
.sb .brand small { display: block; font: 500 12px 'Inter', sans-serif; color: var(--text-3); letter-spacing: 0; margin-top: 1px; }
.sb-group { font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); padding: 14px 10px 4px; }
.sb-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; text-align: left; font: 550 14px 'Inter', sans-serif; color: var(--text-2); padding: 8px 10px; border-radius: 9px; cursor: pointer; text-decoration: none; }
.sb-item svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sb-item:hover { background: var(--surface-2); color: var(--text); }
.sb-item[aria-current='page'] { background: var(--brand-soft); color: var(--brand-text); }
.sb-count { margin-left: auto; min-width: 20px; text-align: center; font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 99px; background: var(--brand); color: #fff; }
.sb-count:empty { display: none; }
.sb-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; }
.sb-user { font-size: 12.5px; color: var(--text-3); padding: 0 10px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { padding: 26px 32px 70px; min-width: 0; width: 100%; max-width: 1240px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; }
.page-head .sub { color: var(--text-2); font-size: 14px; margin-top: 2px; }
.page-head .spacer { flex: 1; }
.dash .page-head select, .dash .toolbar select { width: auto; }
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; }
.section-title h2 { margin: 0; }
.section-title .spacer { flex: 1; }
.section-title a, .linkish { font-size: 13.5px; font-weight: 600; color: var(--brand-text); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; }
.grid.main-side { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); margin-bottom: 16px; align-items: start; }
table.t td:first-child { white-space: nowrap; }
.statlist { display: grid; gap: 0; }
.statlist > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--surface-3); font-size: 14px; }
.statlist > div:last-child { border-bottom: 0; }
.statlist span { color: var(--text-2); }
.statlist b { font-variant-numeric: tabular-nums; text-align: right; }
.kpi.big .value { font-size: 30px; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-page .auth { margin: 0; width: min(400px, 100%); }
.auth-page .brand { justify-content: center; margin-bottom: 18px; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .sb nav { display: flex; gap: 2px; }
  .sb { position: sticky; z-index: 5; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; }
  .sb .brand { padding: 0 8px 0 2px; }
  .sb .brand span, .sb-group, .sb-user { display: none; }
  .sb-item { width: auto; white-space: nowrap; padding: 7px 10px; }
  .sb-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .main { padding: 20px 16px 60px; }
  .grid.main-side { grid-template-columns: 1fr; }
}

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px; box-shadow: var(--shadow-sm); min-width: 0; }
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(min(170px, 40%), 1fr)); margin-bottom: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); margin-bottom: 16px; }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); margin-bottom: 16px; }
.stack > * + * { margin-top: 16px; }

.kpi .label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.kpi .value { font: 650 26px var(--display); letter-spacing: -0.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

.tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); padding: 4px; border-radius: 12px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; font: 600 14px 'Inter', sans-serif; color: var(--text-2); padding: 7px 14px; border-radius: 9px; cursor: pointer; }
.tabs button[aria-selected='true'] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .spacer { flex: 1; }

.dash input, .dash select, .dash textarea { font: 15px 'Inter', sans-serif; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; padding: 9px 12px; width: 100%; }
.dash textarea { min-height: 80px; resize: vertical; }
.dash input:focus, .dash select:focus, .dash textarea:focus { outline: 3px solid rgb(255 90 54 / 0.25); border-color: var(--brand); }
.dash label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 12px; }
.dash label > input, .dash label > select, .dash label > textarea { margin-top: 5px; font-weight: 400; }
.dash label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.dash label.check input { width: auto; margin-top: 3px; }
.dash .hint { font-size: 12.5px; color: var(--text-3); font-weight: 400; margin-top: 4px; }
.dash .row { display: flex; gap: 12px; flex-wrap: wrap; }
.dash .row > * { flex: 1 1 200px; }

.btn-s { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 600 13.5px 'Inter', sans-serif; padding: 7px 12px; border-radius: 9px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-s:hover { background: var(--surface-2); }
.btn-s.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-s.primary:hover { filter: brightness(1.2); }
.btn-s.danger { color: #b42318; }
.btn-s:disabled { opacity: 0.5; cursor: default; }

.err { color: #b42318; font-size: 14px; margin-top: 8px; min-height: 1em; }
.ok { color: var(--green); font-size: 14px; }

table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
table.t th { text-align: left; font-weight: 600; color: var(--text-2); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--surface-3); vertical-align: top; }
table.t td.n, table.t th.n { text-align: right; }
table.t tr:last-child td { border-bottom: 0; }
.scroll { overflow-x: auto; }
.empty { color: var(--text-3); font-size: 14px; padding: 12px 0; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.active, .pill.paid { color: #13723a; background: #eaf6ee; border-color: #cfe9d8; }
.pill.available { color: #1c5cab; background: #eaf2fc; border-color: #cfe0f6; }
.pill.pending { color: #8a5a00; background: #fdf4e3; border-color: #f2e0bb; }
.pill.rejected, .pill.suspended, .pill.reversal { color: #b42318; background: #fdeeec; border-color: #f6d3cf; }

/* bars: one series per chart, value on hover */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .col { fill: var(--brand-text); }
.chart .hit:hover + .col, .chart .col.on { fill: #a92e12; }
.chart .grid-line { stroke: var(--surface-3); stroke-width: 1; }
.chart .axis-row { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); margin-top: 6px; }
.chart .tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 12.5px; padding: 6px 9px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: var(--shadow-md); }
.chart .tip b { font-weight: 650; }

.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; font-size: 13.5px; }
.hbar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; position: relative; padding: 4px 8px; z-index: 0; }
.hbar .name i { position: absolute; inset: 0 auto 0 0; background: var(--brand-soft); border-radius: 6px; z-index: -1; }
.hbar .v { padding: 4px 0; font-variant-numeric: tabular-nums; color: var(--text-2); text-align: right; }

.banner { background: #fdf4e3; border: 1px solid #f2e0bb; color: #6b4600; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; }
.banner.red { background: #fdeeec; border-color: #f6d3cf; color: #8a1c12; }
.banner.green { background: #eaf6ee; border-color: #cfe9d8; color: #13542c; }

.linkbox { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.linkbox code { flex: 1; font-family: var(--mono); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

dialog.modal { border: 1px solid var(--border); border-radius: 16px; padding: 22px; max-width: 680px; width: calc(100% - 32px); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgb(20 16 12 / 0.35); }
dialog.modal dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; margin: 0 0 14px; }
dialog.modal dt { color: var(--text-2); }
dialog.modal dd { margin: 0; overflow-wrap: anywhere; }

.auth { max-width: 420px; margin: 40px auto; }
/* ── affiliate landing (logged out) ───────────────────────── */
.aff-top { position: sticky; top: 0; z-index: 10; background: rgb(245 241 234 / 0.85); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border); }
.aff-top-in { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.aff-top .brand { font-size: 17px; }
.aff-top .spacer { flex: 1; }
.aff-tag { font: 600 12px 'Inter', sans-serif; color: var(--brand-text); background: var(--brand-soft); padding: 4px 10px; border-radius: 99px; }
#public .wrap { padding-top: 0; padding-bottom: 0; }
.dash .aff-top .wrap { padding: 12px 0; }
.dash .aff-foot .wrap { padding: 0; }
.aff-hero { display: grid; grid-template-columns: 1.15fr 1fr; gap: 48px; align-items: center; padding: 64px 0 48px; }
.aff-hero h1 { font-size: clamp(38px, 5.2vw, 62px); line-height: 1.02; letter-spacing: -0.045em; margin: 14px 0 0; }
.aff-hl { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.aff-hero .lead { font-size: 18.5px; color: var(--text-2); margin: 18px 0 26px; max-width: 34em; }
.aff-ctas { display: flex; gap: 12px; flex-wrap: wrap; }
.aff-trust { margin-top: 16px; font-size: 13.5px; color: var(--text-3); }
.aff-calc { padding: 26px; border-radius: 24px; position: relative; }
.aff-calc::before { content: ''; position: absolute; inset: -1px; border-radius: 25px; padding: 1px; background: linear-gradient(140deg, rgb(255 90 54 / 0.55), transparent 45%); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.aff-calc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.dash label.aff-calc-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 14.5px; font-weight: 550; color: var(--text-2); margin-bottom: 10px; }
.aff-calc-label output { font: 650 22px var(--display); color: var(--text); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dash input[type='range'] { width: 100%; padding: 0; border: 0; background: transparent; accent-color: var(--brand); height: 28px; }
.dash input[type='range']:focus { outline: none; }
.aff-calc-out { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 14px; }
.aff-calc-out > div { background: var(--surface-2); border-radius: 16px; padding: 14px 16px; }
.aff-calc-out span { display: block; }
.aff-calc-out b { display: block; font: 700 34px var(--display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.aff-calc-out > div:first-child b { color: var(--brand-text); }
.aff-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.aff-fact { padding: 22px; border-radius: 20px; }
.aff-fact b { display: block; font-size: 17px; margin: 14px 0 4px; }
.aff-fact p, .aff-steps p { color: var(--text-2); font-size: 14.5px; margin: 0; }
.aff-ico { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-text); }
.aff-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.aff-section { padding: 72px 0 0; scroll-margin-top: 70px; }
.aff-section > h2 { font-size: clamp(28px, 3.4vw, 38px); letter-spacing: -0.035em; margin: 8px 0 24px; }
.aff-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.aff-steps li { padding: 24px; border-radius: 20px; }
.aff-steps b { display: block; font-size: 17px; margin: 14px 0 6px; }
.aff-num { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 700; font-size: 15px; }
.aff-join { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.aff-form, .aff-login, .aff-rules { padding: 28px; border-radius: 24px; }
.aff-form h2, .aff-login h2 { font-size: 26px; margin: 6px 0 18px; }
.aff-login h2 { font-size: 21px; margin: 0 0 4px; }
.aff-form .btn, .aff-login .btn { margin-top: 4px; }
.aff-side { display: grid; gap: 20px; }
.aff-rules h3 { font-size: 16px; margin-bottom: 10px; }
.aff-rules ul { padding-left: 18px; margin: 0; color: var(--text-2); font-size: 14px; }
.aff-rules li + li { margin-top: 6px; }
.aff-faq .faq { max-width: 820px; }
.aff-foot { margin-top: 80px; padding: 26px 0 40px; border-top: 1px solid var(--border); font-size: 14px; color: var(--text-3); }
.aff-foot a { color: var(--text-2); text-decoration: none; }
@media (max-width: 900px) {
  .aff-hero, .aff-join { grid-template-columns: 1fr; gap: 28px; }
  .aff-hero { padding-top: 36px; }
  .aff-facts, .aff-steps { grid-template-columns: 1fr; }
  .aff-tag, .aff-top .btn-ghost { display: none; }
  .aff-section { padding-top: 52px; }
}

/* row buttons (trial approvals): wrap instead of running off a narrow screen */
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
@media (max-width: 600px) { .row-actions { justify-content: flex-start; } table.t td:last-child { min-width: 96px; } }
