/* Portal stylesheet: a card dashboard on the Linear app frame (fixed sidebar, quiet chrome,
   Inter), Mild colours. --brand and --brand-bg come from Settings → Brand, so the same layout
   carries any logo and colour pair. Every field and button is 36px tall, so rows never jump. */
:root {
  --brand: #FFF066; --brand-ink: #000; --brand-bg: #F4F5F0;
  --sidebar: #FAFAF7; --card: #FFFFFF; --soft: #F6F6F1; --hover: rgba(0, 0, 0, .04); --selected: rgba(0, 0, 0, .06);
  --line: #E6E7E0; --line-strong: #D6D7CF;
  --text: #161615; --text-2: #6C6C66; --text-3: #A1A19A; --danger: #C2410C; --ok: #15803D;
  --shadow-card: 0 1px 2px rgba(16, 16, 15, .04), 0 0 0 1px rgba(16, 16, 15, .02);
  --shadow-pop: 0 8px 24px rgba(16, 16, 15, .12);
  --control-h: 36px; --radius: 8px; --radius-card: 14px; --gap: 16px; --page-x: 40px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.booting main, .booting .site-header { visibility: hidden; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--brand-bg); color: var(--text);
  font: 400 14px/1.45 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
p { margin: 0; }
strong { font-weight: 600; }

/* ── Text roles ── */
.lead { margin: 8px 0 24px; color: var(--text-2); font-size: 14px; }
.muted, .note, .chart-total, .creator-account { color: var(--text-2); font-size: 13px; }
.note { margin-top: 14px; }
.status-line { margin: 0 0 14px; font-size: 14px; font-weight: 500; }
.verdict { margin: 0 0 14px; font-size: 15px; font-weight: 600; }

/* ── Controls: one height everywhere ── */
label { display: block; margin: 14px 0 6px; color: var(--text-2); font-size: 13px; font-weight: 500; }
input, select, textarea { width: 100%; height: var(--control-h); padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--card); color: var(--text); font: inherit; font-size: 14px; }
textarea { height: auto; min-height: 110px; padding: 10px 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; resize: vertical; }
input[type='checkbox'] { width: 16px; height: 16px; padding: 0; accent-color: var(--text); flex-shrink: 0; }
input[type='file'] { height: auto; padding: 7px 10px; font-size: 13px; }
input[type='color'] { width: 64px; padding: 3px; cursor: pointer; }
input::placeholder { color: var(--text-3); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px var(--selected); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

button, .button-secondary, .qr a { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--control-h); padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 500; line-height: 1; white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease; }
button:hover:not(:disabled), .qr a:hover { background: var(--soft); }
button:disabled { opacity: .45; cursor: default; }
.button-primary, button[type='submit']:not(.text-link), .provider.apple-signin { background: var(--text); border-color: var(--text); color: #fff; }
.button-primary:hover:not(:disabled), button[type='submit']:not(.text-link):hover:not(:disabled) { background: #2D2D2B; }
#users-export, #purchases-export, .payout-setup button { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
#users-export:hover, #purchases-export:hover { background: var(--brand); filter: brightness(.96); }
.button-small { height: 30px; padding: 0 10px; font-size: 13px; }
.button-block { width: 100%; height: 40px; }
.text-link { height: auto; padding: 0; border: 0; background: none; color: var(--text); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.text-link:hover:not(:disabled) { background: none; }
form > button, .button-block { margin-top: 18px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .span-all { grid-column: 1 / -1; }
.form-grid button { margin-top: 18px; }
.inline-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.inline-form .grow { flex: 1 1 260px; min-width: 0; }
.inline-form label { margin-top: 0; }
.narrow-form { max-width: 440px; }
.confirmation { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; color: var(--text); font-size: 14px; font-weight: 400; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 12px; background: var(--soft);
  color: var(--text-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge-yellow { background: var(--brand); color: var(--brand-ink); }
.badge-dark { background: var(--text); color: #fff; }
.badge-outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.table-code, .created-code, #creator-code { font-weight: 700; font-variant-numeric: tabular-nums; }
td .code-chip { gap: 6px; height: 28px; padding: 0 10px; border-radius: 6px; background: var(--soft); border-color: transparent;
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
td .code-chip svg { width: 13px; height: 13px; color: var(--text-3); }

/* ── Callouts, toast ── */
.callout { margin: 14px 0 0; padding: 14px 16px; border-radius: var(--radius-card); background: var(--brand); color: var(--brand-ink); font-size: 14px; font-weight: 500; }
.callout p { margin: 0 0 6px; overflow-wrap: anywhere; }
.callout.payout-setup { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 var(--gap); }
.callout.payout-setup button { background: var(--text); border-color: var(--text); color: #fff; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translateX(-50%); width: max-content; max-width: min(560px, calc(100% - 32px));
  margin: 0; padding: 12px 16px; border-radius: 10px; background: var(--text); color: #fff; font-size: 14px; box-shadow: var(--shadow-pop); }
.toast:empty { display: none; }

/* ── Signed out ── */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--sidebar); border-bottom: 1px solid var(--line); }
.signed-out .site-header { display: none; }
.brand { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 8px; border-radius: var(--radius); color: var(--text); text-decoration: none; }
.brand:hover { background: var(--hover); }
.brand img { display: block; width: 28px; height: 28px; padding: 4px; border-radius: 7px; background: var(--brand); object-fit: contain; }
.brand-label { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signed-out main { padding: 10vh 16px 64px; }
.panel.narrow { max-width: 420px; margin: 0 auto; }
.auth-card { padding: 32px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow-card), 0 12px 40px rgba(16, 16, 15, .06); }
.auth-card h1 { font-size: 20px; font-weight: 700; text-align: center; }
.auth-card > .lead { text-align: center; }
.auth-logo { display: block; width: 52px; height: 52px; padding: 7px; margin: 0 auto 18px; border-radius: 13px; background: var(--brand); object-fit: contain; }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin: 16px 0 0; }
.auth-switch { margin: 18px 0 0; color: var(--text-2); font-size: 13px; text-align: center; }
.providers { display: grid; gap: 10px; margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.provider { width: 100%; height: 40px; }
.provider img { flex-shrink: 0; }
.join-steps, .stripe-steps { display: grid; gap: 10px; margin: 0 0 18px; padding-left: 20px; font-size: 14px; text-align: left; }
.join-steps li::marker, .stripe-steps li::marker { color: var(--text-3); font-weight: 700; }
#invite-login { margin-top: 12px; }

/* ── Signed in: sidebar + page ── */
.sidenav { display: flex; flex-direction: column; gap: 2px; }
.sidenav:empty, .signed-out .sidenav { display: none; }
.sidenav button { justify-content: flex-start; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: 0; background: transparent; color: var(--text-2); font-weight: 500; }
.sidenav button:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.sidenav button[aria-current='page'] { background: var(--card); color: var(--text); box-shadow: var(--shadow-card), inset 0 0 0 1px var(--line); }
.sidenav svg { width: 18px; height: 18px; flex-shrink: 0; }
.header-account { display: flex; align-items: center; gap: 8px; min-width: 0; }
.header-email { color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell, .shell-content { min-width: 0; }
.shell-content { max-width: 1320px; padding: 32px var(--page-x) 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 24px; }
.page-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.page-subtitle { margin: 6px 0 0; color: var(--text-2); font-size: 14px; }
.page-actions { display: flex; gap: 8px; }

/* A section: a 17px title, then its card. */
.section-heading { margin: 36px 0 12px; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.shell-content .panel, .shell-content section.panel { margin: 0 0 var(--gap); padding: 24px; border-radius: var(--radius-card); background: var(--card); box-shadow: var(--shadow-card); }
.panel h2:not(:first-child), #finance-admin > h2 { margin-top: 24px; }
.panel > :last-child { margin-bottom: 0; }

/* ── Stat cards ── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); margin: 0 0 var(--gap); }
.kpi { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 20px 22px; border-radius: var(--radius-card); background: var(--card); box-shadow: var(--shadow-card); }
.kpi span { color: var(--text-2); font-size: 13px; font-weight: 500; }
.kpi strong { font-size: 30px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi strong .kpi-line { display: block; overflow: hidden; text-overflow: ellipsis; }
.kpi strong .kpi-line + .kpi-line { margin-top: 4px; font-size: 15px; letter-spacing: 0; }
.kpi small { color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi:first-child { background: var(--text); color: #fff; }
.kpi:first-child span, .kpi:first-child small { color: rgba(255, 255, 255, .6); }
.panel .kpis .kpi { background: var(--soft); box-shadow: none; }
.panel .kpis .kpi:first-child { background: var(--soft); color: var(--text); }
.panel .kpis .kpi:first-child span { color: var(--text-2); }

/* ── Plain tables (setup screens) ── */
.table-scroll { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { height: 44px; padding: 0 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 14px; overflow-wrap: anywhere; }
th { height: 36px; color: var(--text-2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 0; }
tbody tr:last-child td { border-bottom: 0; }
td.nowrap { white-space: nowrap; overflow-wrap: normal; }
td .cell-sub { display: block; color: var(--text-2); font-size: 13px; }
td .cell-actions { display: flex; flex-wrap: wrap; gap: 8px; }
td .cell-actions button { height: 32px; font-size: 13px; }
td .cell-actions button.action-primary { background: var(--text); border-color: var(--text); color: #fff; }
.empty, td.empty { padding: 28px 0; color: var(--text-2); text-align: center; }

/* ── Toolbars ── */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.toolbar input, .toolbar select, .toolbar button { height: 32px; font-size: 13px; }
.toolbar input[type='search'] { flex: 0 1 300px; }
.toolbar select { width: auto; padding-right: 28px; }
.toolbar-end { margin-left: auto; }
.invite-inline { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; margin: 0 0 14px; padding: 14px; border-radius: 10px; background: var(--soft); }
.invite-inline input, .invite-inline button { height: 32px; font-size: 13px; }
.invite-inline button { margin: 0; }
.invite-inline .invite-hint, .invite-inline .note { grid-column: 1 / -1; margin: 0; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { height: 32px; border-radius: 16px; font-size: 13px; }
.chips button[aria-pressed='true'] { background: var(--text); border-color: var(--text); color: #fff; }
#users-count { margin: 0 0 12px; color: var(--text-2); font-size: 13px; }
.panel-actions { display: flex; justify-content: flex-end; margin-bottom: 14px; }

/* ── Segmented controls ── */
.segmented, .metric-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--soft); }
.segmented button, .metric-tabs button { height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-size: 13px; }
.segmented button:hover:not(:disabled), .metric-tabs button:hover:not(:disabled) { background: transparent; color: var(--text); }
.segmented button[aria-pressed='true'], .metric-tabs button[aria-pressed='true'] { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }

/* ── Chart: fixed height, so the page never jumps while data loads ── */
.chart-card { position: relative; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.chart-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-2); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-visits { background: var(--text-3); }
.dot-registrations { background: var(--text); }
.dot-purchases { background: var(--brand); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .3); }
.chart { position: relative; width: 100%; min-height: 200px; }
.chart svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-dasharray: 3 5; }
.chart .grid line.baseline { stroke: var(--line-strong); stroke-dasharray: none; }
.chart .axis text { fill: var(--text-3); font-size: 11px; font-family: 'Inter', sans-serif; }
.chart .bar { fill: var(--text); transition: opacity .12s ease; }
.chart .bar-zero { fill: var(--line-strong); }
.chart.is-hovering .bar:not(.is-active) { opacity: .25; }
.chart .hit { fill: transparent; cursor: crosshair; touch-action: pan-y; }
.chart-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-2); font-size: 14px; pointer-events: none; }
.chart-tooltip { position: absolute; z-index: 5; min-width: 160px; padding: 10px 12px; border-radius: 10px; background: var(--text); color: #fff;
  font-size: 13px; line-height: 1.5; pointer-events: none; box-shadow: var(--shadow-pop); }
.chart-tooltip strong { display: block; margin-bottom: 2px; }
.chart-tooltip span { display: block; color: rgba(255, 255, 255, .6); }
.chart-tooltip span.is-active { color: #fff; font-weight: 600; }

/* ── Bloggers invite, discount, payouts ── */
.invite-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 24px; align-items: end; }
.invite-card h2 { margin-bottom: 6px; }
.invite-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.invite-fields label { margin-top: 0; }
.invite-card #issuance-note { grid-column: 1 / -1; }
#created-credentials { margin: 0 0 16px; }
.blockers { display: grid; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.blockers li { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--soft); font-size: 14px; }
.blockers li::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex-shrink: 0; }
.switches { display: grid; gap: 8px; margin-bottom: 10px; }
.switch { display: flex; align-items: center; gap: 12px; margin: 0; padding: 14px 16px; border-radius: 10px; background: var(--soft); color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer; }
.disclosure { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.disclosure summary { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; list-style: none; cursor: pointer; }
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::before { content: '›'; display: inline-flex; justify-content: center; width: 16px; color: var(--text-2); transition: transform .12s ease; }
.disclosure[open] summary::before { transform: rotate(90deg); }

/* ── Blogger earnings page ── */
#creator-panel { padding: 0 !important; background: transparent !important; box-shadow: none !important; }
#creator-panel > .creator-account { margin: 0 0 14px; }
#creator-code-pending { margin: 0 0 var(--gap); }
.share-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: center; }
.share-grid { display: grid; gap: 2px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { min-width: 0; }
#creator-code { text-align: center; letter-spacing: .1em; font-size: 16px; }
.qr { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qr img { width: 140px; height: 140px; padding: 6px; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
#stripe-continue, #stripe-dashboard { margin-top: 10px; }
#stripe-key-remove { margin-top: 12px; }
.brand-preview { display: flex; align-items: center; gap: 12px; }
.brand-preview img { width: 44px; height: 44px; padding: 6px; border-radius: 10px; background: var(--brand); object-fit: contain; }

/* Top bar: logo and name, the two tabs, the account; the page sits under it. */
body:not(.signed-out) .site-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; height: 56px; padding: 0 var(--page-x);
  background: rgba(250, 250, 247, .92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
body:not(.signed-out) .sidenav { flex-direction: row; gap: 4px; }
body:not(.signed-out) .sidenav button { width: auto; height: 32px; padding: 0 12px; font-size: 13px; }
body:not(.signed-out) .sidenav svg { width: 16px; height: 16px; }
body:not(.signed-out) .header-account { margin-left: auto; }
body:not(.signed-out) #logout { height: 32px; font-size: 13px; }
.shell-content { margin: 0 auto; }

/* Tablet and phone */
@media (max-width: 899px) {
  :root { --page-x: 16px; --gap: 12px; }
  body:not(.signed-out) .site-header { gap: 12px; }
  .brand-label { display: none; }
  .invite-inline { grid-template-columns: minmax(0, 1fr); }
  .shell-content { padding-top: 20px; }
  .page-head h1 { font-size: 22px; }
  .invite-card { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}
@media (max-width: 760px) {
  .header-email { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi strong { font-size: 24px; }
  .shell-content .panel { padding: 18px; }
  .form-grid, .invite-fields, .share-card { grid-template-columns: minmax(0, 1fr); }
  .copy-row { flex-wrap: wrap; }
  .segmented, .metric-tabs, .chart-controls { width: 100%; }
  .segmented button, .metric-tabs button { flex: 1 1 0; padding: 0 6px; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .data-table td { display: flex; justify-content: space-between; gap: 12px; height: auto; padding: 4px 0; border: 0; text-align: right; }
  .data-table td::before { content: attr(data-label); flex-shrink: 0; color: var(--text-2); font-size: 12px; text-align: left; }
}

/* Drag to reorder: each main-page block has a handle beside its title. */
.dnd-block { position: relative; }
.dnd-block.is-dragging { opacity: .4; }
.dnd-block.is-target { box-shadow: 0 -3px 0 var(--text); border-radius: 2px; }
.dnd-handle { position: absolute; top: 2px; left: -30px; width: 22px; height: 26px; padding: 0; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-3); font-size: 16px; letter-spacing: -2px; cursor: grab; opacity: 0; transition: opacity .12s ease; }
.dnd-block:hover > .dnd-handle, .dnd-handle:focus-visible { opacity: 1; }
.dnd-handle:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.dnd-block > .section-heading { margin-top: 32px; }
.dnd-block:first-child > .section-heading { margin-top: 0; }
@media (max-width: 899px) { .dnd-handle { position: static; opacity: 1; float: right; } }

/* ── Polish pass: one grid, quieter controls ── */
/* Header content sits on the same 1320px grid as the page, not on the window edges. */
body:not(.signed-out) .site-header { padding-inline: max(var(--page-x), calc((100% - 1320px) / 2 + var(--page-x))); }
body:not(.signed-out) .sidenav { margin-left: auto; }
body:not(.signed-out) .header-account { margin-left: 8px; padding-left: 16px; }
body:not(.signed-out) .header-email { font-size: 13px; }
/* Tables: wider gutters, small caps header two points down, 13px cells. */
th, td { padding: 0 16px; font-size: 13px; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
th { height: 32px; font-size: 10px; letter-spacing: .07em; color: var(--text-3); }
td { height: 48px; font-variant-numeric: tabular-nums; }
td .cell-sub { font-size: 12px; }
/* Row actions read as links, not buttons. */
td .cell-actions { gap: 16px; flex-wrap: nowrap; }
td .cell-actions button { height: auto; padding: 0; border: 0; background: none; color: var(--text-2); font-size: 13px; font-weight: 500;
  text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; transition: color .12s ease, text-decoration-color .12s ease; }
td .cell-actions button:hover:not(:disabled) { background: none; color: var(--text); text-decoration-color: currentColor; }
td .cell-actions button.action-primary { background: none; color: var(--text); font-weight: 600; text-decoration-color: currentColor; }
/* Invite: a short inline form, not full-width fields. */
.invite-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; }
.invite-inline input { width: 200px; flex: 0 0 200px; }
.invite-inline .invite-hint, .invite-inline .note { flex: 1 0 100%; }
/* Browser surfaces in the palette. */
::selection { background: var(--brand); color: var(--brand-ink); }
html { scrollbar-color: var(--line-strong) transparent; }
@media (max-width: 760px) {
  body:not(.signed-out) .site-header { height: auto; flex-wrap: wrap; row-gap: 8px; padding-block: 10px; }
  body:not(.signed-out) .sidenav { order: 3; flex: 1 0 100%; margin-left: 0; }
  body:not(.signed-out) .header-account { margin-left: auto; padding-left: 0; border-left: 0; }
  .dnd-handle { display: none; }
}
/* Dark buttons stay dark on hover. */
.provider.apple-signin:hover:not(:disabled), .callout.payout-setup button:hover:not(:disabled), #invite-toggle:hover:not(:disabled) { background: #2D2D2B; border-color: #2D2D2B; color: #fff; }

/* Centred text tabs: brand left, tabs in the middle, account right. */
@media (min-width: 761px) {
  body:not(.signed-out) .site-header { display: grid; grid-template-columns: 1fr auto 1fr; }
  body:not(.signed-out) .sidenav { margin: 0; height: 100%; gap: 28px; }
  body:not(.signed-out) .header-account { justify-self: end; }
}
body:not(.signed-out) .sidenav button { position: relative; height: 100%; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none;
  color: var(--text-2); font-size: 14px; font-weight: 500; }
body:not(.signed-out) .sidenav button:hover:not(:disabled) { background: none; color: var(--text); }
body:not(.signed-out) .sidenav button[aria-current='page'] { background: none; box-shadow: none; color: var(--text); }
body:not(.signed-out) .sidenav button[aria-current='page']::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--text); }
@media (max-width: 760px) { body:not(.signed-out) .sidenav { gap: 20px; height: 36px; } }
.integration-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.integration-form { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.integration-form label { margin-top: 0; }
.integration-form button { margin: 0; }
.integration-actions { display: flex; align-items: center; gap: 16px; margin-top: 14px; }
@media (max-width: 760px) { .integration-form { grid-template-columns: minmax(0, 1fr); } }

/* Tabs differ in height; a reserved scrollbar gutter keeps the header and grid still when switching. */
html { scrollbar-gutter: stable; }

/* Status badges: green for done (accepted, connected), as in most dashboards. */
:root { --ok-soft: #DCFCE7; }
.badge-green { background: var(--ok-soft); color: var(--ok); }

/* Settings: every block opens with one plain sentence on what it does. */
.settings-lead { max-width: 68ch; margin: -4px 0 16px; font-size: 13px; line-height: 1.5; }
.switch > span { display: grid; gap: 2px; }
.switch strong { font-weight: 600; }
.switch small { color: var(--text-2); font-size: 13px; font-weight: 400; }
.nowrap-table th, .nowrap-table td { white-space: nowrap; }

/* Settings rows in the Linear manner: what it is on the left, the control on the right. */
.settings-rows { display: grid; margin: 0 0 8px; border-top: 1px solid var(--line); }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 64px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.settings-row-text { display: grid; gap: 2px; min-width: 0; }
.settings-row-text strong { font-size: 14px; font-weight: 600; }
.settings-row-text small { color: var(--text-2); font-size: 13px; }
.settings-row-control { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.brand-tile { width: 40px; height: 40px; padding: 6px; border-radius: 10px; background: var(--brand); object-fit: contain; }
.upload-link { margin: 0; cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.upload-link:focus-within { outline: 2px solid var(--text); outline-offset: 2px; }
.inline-text { width: 220px; height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; font: inherit; font-size: 14px; font-weight: 500; text-align: right; color: var(--text); }
.inline-text:hover { background: var(--soft); }
.inline-text:focus { text-align: left; background: var(--card); border-color: var(--line-strong); }
.swatches { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.swatch { position: relative; width: 22px; height: 22px; min-width: 0; padding: 0; border: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); cursor: pointer; transition: transform .12s ease; }
.swatch:hover:not(:disabled) { transform: scale(1.12); }
.swatch[aria-checked='true'] { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12), 0 0 0 2px var(--card), 0 0 0 4px var(--text); }
.swatch-custom { display: inline-block; margin: 0; background: conic-gradient(#ff5f5f, #ffd05f, #5fff8a, #5fd0ff, #8a5fff, #ff5fd0, #ff5f5f); }
.swatch-custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.stock { gap: 12px; }
.stock strong { min-width: 64px; text-align: right; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stock-empty { color: var(--danger); }
.stock-meter { width: 120px; height: 6px; border-radius: 3px; background: var(--soft); overflow: hidden; }
.stock-meter span { display: block; height: 100%; border-radius: 3px; background: var(--text); }
@media (max-width: 760px) {
  .settings-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .swatches { justify-content: flex-start; }
  .inline-text { width: 100%; text-align: left; }
}

/* Selects draw their own chevron, set in from the edge. */
select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%236C6C66' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px; }
.toolbar select { padding-right: 34px; }

/* Bloggers: row actions sit on the right edge, so a longer label never shifts the others. */
#admin-panel th:last-child { text-align: right; }
#admin-panel td:last-child .cell-actions { justify-content: flex-end; }

/* Email code: large, spaced digits. */
.code-input { height: 52px; font-size: 24px; font-weight: 600; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
#code-form .callout { margin: 0 0 14px; }

/* Partner share card: the code reads as the hero, copy actions as links. */
#creator-account { display: none; }
.share-row { align-items: center; gap: 16px; }
.share-row input { height: auto; padding: 0; border: 0; background: none; box-shadow: none; }
.share-row input:focus-visible { box-shadow: none; }
.share-code { width: auto; max-width: 8ch; font-size: 34px; font-weight: 700; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.share-link { flex: 1 1 auto; min-width: 0; font-size: 14px; color: var(--text-2); text-overflow: ellipsis; }
.share-grid > div { display: grid; gap: 6px; }
.share-grid small { font-size: 12px; }
.share-row input.share-code, .share-row input.share-link { flex: 0 1 auto; field-sizing: content; text-align: left; }
.share-row input.share-code { min-width: 4ch; font-size: 34px; font-weight: 700; letter-spacing: .12em; line-height: 1.1; color: var(--text); }
.copy-row.share-row { display: flex; justify-content: flex-start; }
#creator-code.share-code { width: 4.6ch; flex: 0 0 auto; font-size: 34px; letter-spacing: .1em; text-align: left; }
#creator-link.share-link { width: min(100%, 42ch); flex: 0 1 auto; }

/* Partner purchases: each filter sits directly above the column it filters. */
.purchases-table th, .purchases-table td { width: 25%; }
.purchases-table .filter-row td { height: auto; padding-top: 4px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.purchases-table .filter-row select { width: auto; max-width: 100%; height: 32px; font-size: 13px; }
.purchases-table .filter-row .segmented button { height: 26px; }
#purchases-count { margin: 0; }

/* Dismissible notice: text left, close × right. */
.callout.dismissible { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.callout.dismissible[hidden] { display: none; }
.callout.dismissible p { margin: 0; }
.callout-close { flex: 0 0 auto; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: inherit; font-size: 18px; line-height: 1; }
.callout-close:hover:not(:disabled) { background: rgba(0, 0, 0, .06); }

/* Password fields: eye toggle inside the input, mismatch note beside the label. */
.password-field { position: relative; }
.password-field input { padding-right: 44px; }
.password-field .eye { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text-3); }
.password-field .eye:hover:not(:disabled), .password-field .eye.on { color: var(--text); background: transparent; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.field-error { color: var(--danger); font-weight: 500; }
.field-error[hidden] { display: none; }
input.invalid { border-color: var(--danger); }

/* A repeated confirmation blinks once, so a second press is visibly answered. */
@keyframes callout-flash { from { opacity: .35; } to { opacity: 1; } }
.callout.flash { animation: callout-flash .35s ease-out; }
@media (prefers-reduced-motion: reduce) { .callout.flash { animation: none; } }
