/* TipCalculate — tipcalculateapp.com
   One stylesheet for the public site and the account portal.
   Sections: tokens · base · layout · components · site · marketing · prose · portal · utilities */

/* ---------- Tokens ---------- */

:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --surface-2: #f4f4f2;
  --surface-3: #ececea;
  --ink: #1c1f2e;
  --ink-2: #3b4054;
  --muted: #6b6b73;
  --faint: #9a9aa2;
  --line: #e6e6e3;
  --line-strong: #d6d6d2;

  /* The green of the app icon's percent badge, darkened enough for white text and links. */
  --accent: #0b8a5f;
  --accent-hover: #097652;
  --accent-ink: #ffffff;
  --accent-soft: #e5f6ee;
  --accent-text: #087a54;
  --brand-green: #12b886;

  --positive: #15803d;
  --positive-soft: #e8f5ec;
  --warning: #a16207;
  --warning-soft: #fdf5e1;
  --danger: #c62828;
  --danger-hover: #ab2020;
  --danger-soft: #fdecec;


  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r-xs: 6px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 24px;

  --shadow-sm: 0 1px 2px rgb(24 24 27 / 0.05);
  --shadow: 0 1px 2px rgb(24 24 27 / 0.04), 0 4px 16px -4px rgb(24 24 27 / 0.08);
  --shadow-lg: 0 2px 6px rgb(24 24 27 / 0.05), 0 24px 48px -16px rgb(24 24 27 / 0.18);

  --ring: 0 0 0 3px rgb(18 184 134 / 0.32);
  --header-h: 64px;
  --container: 1140px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f11;
    --surface: #17171a;
    --surface-2: #1d1d21;
    --surface-3: #26262b;
    --ink: #f2f2f3;
    --ink-2: #d0d0d5;
    --muted: #9b9ba4;
    --faint: #6e6e77;
    --line: #2a2a2f;
    --line-strong: #37373d;

    --accent: #35e0a1;
    --accent-hover: #5ae8b3;
    --accent-ink: #062b1d;
    --accent-soft: #11291f;
    --accent-text: #4fdcaa;

    --positive: #4ade80;
    --positive-soft: #13261a;
    --warning: #fbbf24;
    --warning-soft: #2a2210;
    --danger: #f87171;
    --danger-hover: #fb8f8f;
    --danger-soft: #2c1517;


    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 4px 16px -4px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 2px 6px rgb(0 0 0 / 0.4), 0 24px 48px -16px rgb(0 0 0 / 0.7);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; color: var(--ink); font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-xs); }
[hidden] { display: none !important; }

.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

.icon { width: 18px; height: 18px; flex: none; stroke-width: 1.75; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 22px; height: 22px; }
i.icon { display: inline-block; }

.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; background: var(--ink); color: var(--bg); border-radius: var(--r-sm); }
.skip-link:focus { top: 12px; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.container--narrow { max-width: 760px; }
@media (max-width: 640px) { .container { padding: 0 16px; } }

.section { padding: 112px 0; }
.section--tight { padding: 72px 0; }
.section + .section { border-top: 1px solid var(--line); }
@media (max-width: 760px) { .section { padding: 72px 0; } .section--tight { padding: 56px 0; } }

.section-head { max-width: 640px; margin-bottom: 48px; }
.section-head--center { margin-left: auto; margin-right: auto; text-align: center; }
.eyebrow { display: inline-block; margin-bottom: 14px; color: var(--muted); font: 500 13px/1 var(--mono); letter-spacing: 0.02em; text-transform: uppercase; }
.section-title { font-size: clamp(30px, 4vw, 44px); letter-spacing: -0.03em; }
.section-lede { margin-top: 16px; color: var(--muted); font-size: 18px; }

/* ---------- Components ---------- */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  font-weight: 500; font-size: 15px; line-height: 1; white-space: nowrap;
  cursor: pointer; text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn--sm { height: 34px; padding: 0 12px; font-size: 14px; }
.btn--lg { height: 48px; padding: 0 22px; font-size: 16px; border-radius: var(--r); }
.btn--block { width: 100%; }
.btn--icon { width: 36px; height: 36px; padding: 0; }

.btn--primary { background: var(--ink); color: var(--bg); }
.btn--primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--bg)); }
.btn--accent { background: var(--accent); color: var(--accent-ink); }
.btn--accent:hover { background: var(--accent-hover); }
.btn--secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); box-shadow: var(--shadow-sm); }
.btn--secondary:hover { background: var(--surface-2); }
.btn--ghost { background: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: var(--danger-hover); }
.btn--danger-outline { background: var(--surface); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); color: var(--danger); }
.btn--danger-outline:hover { background: var(--danger-soft); }

.btn .spinner { width: 16px; height: 16px; }

/* Spinner */
.spinner { width: 20px; height: 20px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; opacity: .7; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Forms */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 16px; }
.label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.label .optional { color: var(--faint); font-weight: 400; }
.hint { font-size: 13px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  font-size: 15px; transition: border-color .15s ease, box-shadow .15s ease;
}
.textarea { height: auto; min-height: 120px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b6b73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line-strong)); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-left: 36px; }
.input-group > .icon { position: absolute; left: 11px; color: var(--faint); pointer-events: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .field + .field { margin-top: 0; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; } }

.checkbox { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }

/* Switch */
.switch { position: relative; display: inline-block; width: 40px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 999px; transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: var(--ring); }

/* Alerts */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid; font-size: 14px; line-height: 1.5; }
.alert .icon { margin-top: 2px; }
.alert--info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--ink-2); }
.alert--info .icon { color: var(--accent-text); }
.alert--success { background: var(--positive-soft); border-color: color-mix(in srgb, var(--positive) 25%, transparent); color: var(--ink-2); }
.alert--success .icon { color: var(--positive); }
.alert--warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); color: var(--ink-2); }
.alert--warning .icon { color: var(--warning); }
.alert--danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 25%, transparent); color: var(--ink-2); }
.alert--danger .icon { color: var(--danger); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.badge--accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.badge--positive { background: var(--positive-soft); color: var(--positive); border-color: transparent; }
.badge--warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge--danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card--pad { padding: 24px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.card__title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.card__sub { margin-top: 2px; color: var(--muted); font-size: 13px; }
.card__body { padding: 20px; }
.card__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* Tables */
.table-wrap { position: relative; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { padding: 10px 16px; text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table th.num { font-family: var(--sans); }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }

/* Avatar */
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; overflow: hidden; background: var(--surface-3); color: var(--ink-2); font-size: 13px; font-weight: 600; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--lg { width: 64px; height: 64px; font-size: 22px; }

/* Kbd */
kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; font: 500 12px/1.5 var(--mono); color: var(--ink-2); background: var(--surface); }

/* Code */
code { padding: 2px 6px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); font: 0.88em var(--mono); }
pre { margin: 0; padding: 16px 18px; overflow-x: auto; border-radius: var(--r); background: #141417; color: #e7e7ea; font: 13.5px/1.65 var(--mono); }
pre code { padding: 0; background: none; border: 0; font: inherit; color: inherit; }
.code-block { position: relative; }
.code-block .copy-btn { position: absolute; top: 10px; right: 10px; }
.code-block .copy-btn.btn--ghost { color: #a1a1aa; }
.code-block .copy-btn.btn--ghost:hover { background: #26262b; color: #fff; }
.tok-c { color: #7c7c86; }
.tok-s { color: #a5d6a7; }
.tok-k { color: #93b4f8; }
.tok-n { color: #f0c27b; }

/* Dialog */
dialog.modal { width: min(480px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog.modal--wide { width: min(640px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgb(15 15 17 / 0.45); backdrop-filter: blur(2px); }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.modal__title { font-size: 18px; }
.modal__body { padding: 16px 22px 22px; }
.modal__body > p { color: var(--muted); font-size: 15px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
@media (prefers-reduced-motion: no-preference) {
  dialog.modal[open] { animation: modal-in .16s ease-out; }
  @keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(.985); } }
}

/* Toast */
.toast-region { position: fixed; z-index: 90; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r); background: var(--ink); color: var(--bg); font-size: 14px; box-shadow: var(--shadow-lg); pointer-events: auto; }
.toast .icon { width: 16px; height: 16px; }
.toast--error .icon { color: #fca5a5; }
.toast--success .icon { color: #86efac; }
@media (prefers-reduced-motion: no-preference) { .toast { animation: toast-in .2s ease-out; } @keyframes toast-in { from { opacity: 0; transform: translateY(8px); } } }

/* Empty state */
.empty { display: grid; justify-items: center; gap: 10px; padding: 56px 24px; text-align: center; }
.empty__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.empty h3 { font-size: 16px; }
.empty p { max-width: 380px; color: var(--muted); font-size: 14px; }

/* Skeleton */
.skeleton { display: block; border-radius: var(--r-xs); background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Tabs (segmented) */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.segmented button { height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; }
.segmented button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* Divider with label */
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--faint); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; font-size: 17px; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { flex: none; border-radius: 22.3%; box-shadow: 0 0 0 1px rgb(28 31 46 / 0.08); }

/* ---------- Site chrome ---------- */

.site-header { position: sticky; top: 0; z-index: 50; height: var(--header-h); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.site-header.is-scrolled { border-bottom-color: var(--line); }
.site-header__inner { display: flex; align-items: center; gap: 32px; height: 100%; }
.site-nav { display: flex; gap: 4px; margin-right: auto; }
.site-nav a { padding: 6px 10px; border-radius: var(--r-sm); color: var(--muted); font-size: 15px; font-weight: 500; }
.site-nav a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--ink); }
.site-header__actions { display: flex; align-items: center; gap: 8px; }
.menu-toggle { display: none; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; }
.mobile-nav { display: grid; padding: 8px 16px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.mobile-nav a { padding: 12px 4px; color: var(--ink); font-weight: 500; border-bottom: 1px solid var(--line); }
.mobile-nav a:last-child { border-bottom: 0; }
@media (max-width: 860px) {
  .site-nav { display: none; }
  .site-header__inner { justify-content: space-between; }
  .site-header__actions [data-account-link] { display: none; }
  .menu-toggle { display: grid; }
}
@media (min-width: 861px) { .mobile-nav { display: none !important; } }
@media (max-width: 400px) { .site-header__actions .btn--primary { display: none; } }

.site-footer { margin-top: 0; padding: 64px 0 32px; border-top: 1px solid var(--line); background: var(--surface); }
.site-footer__grid { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 32px; }
.site-footer__brand p { max-width: 280px; margin: 14px 0 18px; color: var(--muted); font-size: 14px; }
.site-footer h2 { margin-bottom: 14px; font-size: 13px; font-weight: 500; color: var(--ink); letter-spacing: 0; }
.site-footer ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.site-footer li a { color: var(--muted); font-size: 14px; }
.site-footer li a:hover { color: var(--ink); text-decoration: none; }
.store-links { display: flex; flex-wrap: wrap; gap: 8px; }
.store-links img { height: 40px; width: auto; }
.site-footer__bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.made-by { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.made-by:hover { color: var(--ink); text-decoration: none; }
@media (max-width: 860px) { .site-footer__grid { grid-template-columns: repeat(2, 1fr); } .site-footer__brand { grid-column: span 2; } }

/* Page header (inner pages) */
.page-hero { padding: 72px 0 48px; border-bottom: 1px solid var(--line); }
.page-hero h1 { font-size: clamp(34px, 5vw, 52px); letter-spacing: -0.035em; }
.page-hero p { max-width: 620px; margin-top: 16px; color: var(--muted); font-size: 18px; }
.page-hero .meta { margin-top: 20px; color: var(--muted); font-size: 14px; }
.breadcrumb { display: flex; gap: 8px; margin-bottom: 20px; color: var(--muted); font-size: 14px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--ink); }

/* ---------- Marketing ---------- */

.hero { padding: 88px 0 0; overflow: hidden; }
.hero__grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; }
.hero h1 { font-size: clamp(40px, 6vw, 68px); letter-spacing: -0.045em; line-height: 1.02; }
.hero h1 .soft { color: var(--faint); }
.hero__lede { max-width: 520px; margin-top: 22px; color: var(--muted); font-size: 19px; line-height: 1.55; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.hero__meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 28px; color: var(--muted); font-size: 14px; }
.hero__meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero__visual { position: relative; align-self: end; }
@media (max-width: 900px) { .hero__grid { grid-template-columns: 1fr; } .hero__visual { max-width: 420px; margin: 0 auto; } }

/* Interactive calculator on the home page */
.calc { position: relative; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); }
.calc__label { color: var(--muted); font: 500 12px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.calc__bill { display: flex; align-items: baseline; gap: 4px; margin-top: 10px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); }
.calc__bill span { color: var(--muted); font: 500 28px/1 var(--mono); }
.calc__bill input { width: 100%; border: 0; background: transparent; font: 500 34px/1.1 var(--mono); letter-spacing: -0.03em; }
.calc__bill input:focus { outline: none; }
.calc__bill:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.calc__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 32px; min-width: 52px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: 500 14px var(--mono); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.range { width: 100%; margin-top: 14px; accent-color: var(--ink); }
.stepper { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); }
.stepper button { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-sm); cursor: pointer; }
.stepper output { min-width: 26px; text-align: center; font: 500 15px var(--mono); }
.calc__totals { display: grid; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--line-strong); }
.calc__totals div { display: flex; justify-content: space-between; color: var(--muted); font-size: 15px; }
.calc__totals strong { color: var(--ink); font: 500 16px var(--mono); }
.calc__totals .grand { color: var(--ink); font-weight: 500; }
.calc__totals .grand strong { font-size: 24px; letter-spacing: -0.02em; }
.calc__note { margin-top: 14px; color: var(--faint); font-size: 12px; text-align: center; }

.device-shot { position: relative; margin: 0 auto; width: min(340px, 80%); }
.device-shot img { width: 100%; height: auto; filter: drop-shadow(0 30px 40px rgb(24 24 27 / .18)); }
.hero__stack { position: relative; display: grid; justify-items: end; padding-bottom: 0; }
.hero__stack .calc { position: absolute; left: 0; bottom: 64px; width: min(340px, 78%); z-index: 2; }
@media (max-width: 900px) { .hero__stack .calc { position: relative; left: auto; bottom: auto; width: 100%; margin-bottom: -40px; } .hero__stack { justify-items: center; } }

.logos { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 36px; padding: 40px 0; color: var(--muted); font-size: 14px; }
.logos span { display: inline-flex; align-items: center; gap: 8px; }

/* Feature grid */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--line); gap: 1px; }
.feature { padding: 28px; background: var(--surface); }
.feature__icon { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 18px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); }
.feature h3 { font-size: 17px; }
.feature p { margin-top: 8px; color: var(--muted); font-size: 15px; }
@media (max-width: 900px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .feature-grid { grid-template-columns: 1fr; } }

/* Split showcase */
.showcase { display: grid; grid-template-columns: 1fr 1.25fr; gap: 64px; align-items: center; }
.showcase + .showcase { margin-top: 112px; }
.showcase--flip { grid-template-columns: 1.25fr 1fr; }
.showcase--flip .showcase__media { order: -1; }
.showcase h3 { font-size: clamp(26px, 3vw, 34px); letter-spacing: -0.03em; }
.showcase p { margin-top: 14px; color: var(--muted); font-size: 17px; }
.checklist { display: grid; gap: 10px; margin: 24px 0 0; padding: 0; list-style: none; }
.checklist li { display: flex; gap: 10px; color: var(--ink-2); font-size: 15px; }
.checklist .icon { margin-top: 3px; color: var(--positive); width: 16px; height: 16px; }
.showcase__media { border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface-2); padding: 20px; overflow: hidden; }
.showcase__media img { width: 100%; height: auto; border-radius: 14px; box-shadow: var(--shadow); }
@media (max-width: 900px) { .showcase, .showcase--flip { grid-template-columns: 1fr; gap: 32px; } .showcase--flip .showcase__media { order: 0; } }

/* Platforms */
.platforms { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.platform { padding: 22px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.platform .icon { width: 22px; height: 22px; color: var(--ink); }
.platform h3 { margin-top: 16px; font-size: 16px; }
.platform p { margin-top: 6px; color: var(--muted); font-size: 14px; }
@media (max-width: 900px) { .platforms { grid-template-columns: repeat(2, 1fr); } }

/* Plans */
.plans { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; max-width: 860px; margin: 0 auto; }
.plan { display: flex; flex-direction: column; padding: 28px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.plan--featured { border-color: var(--ink); box-shadow: var(--shadow); }
.plan__name { display: flex; align-items: center; justify-content: space-between; font-size: 15px; font-weight: 600; }
.plan__price { margin-top: 16px; font: 500 36px/1 var(--mono); letter-spacing: -0.03em; }
.plan__price small { color: var(--muted); font: 400 14px var(--sans); letter-spacing: 0; }
.plan__desc { margin-top: 10px; color: var(--muted); font-size: 15px; }
.plan .checklist { margin-bottom: 24px; }
.plan .btn { margin-top: auto; }
@media (max-width: 760px) { .plans { grid-template-columns: 1fr; } }

/* FAQ / disclosure */
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 0; font-size: 17px; font-weight: 500; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .icon { color: var(--muted); transition: transform .2s; }
.faq details[open] summary .icon { transform: rotate(45deg); }
.faq .answer { padding: 0 40px 22px 0; color: var(--muted); font-size: 16px; }
.faq .answer p + p { margin-top: 10px; }

/* CTA band */
.cta { padding: 56px; border-radius: var(--r-xl); background: var(--ink); color: var(--bg); display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: center; }
.cta h2 { color: var(--bg); font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -0.03em; }
.cta p { margin-top: 10px; color: color-mix(in srgb, var(--bg) 70%, var(--ink)); font-size: 17px; }
.cta .store-links img { height: 44px; }
@media (max-width: 760px) { .cta { grid-template-columns: 1fr; padding: 32px; } }

/* Tipping guide */
.guide-layout { display: grid; grid-template-columns: 220px 1fr; gap: 48px; align-items: start; }
.guide-toc { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: 2px; }
.guide-toc a { padding: 6px 10px; border-radius: var(--r-sm); color: var(--muted); font-size: 14px; }
.guide-toc a:hover, .guide-toc a.is-active { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.guide-search { position: sticky; top: calc(var(--header-h) + 12px); z-index: 5; margin-bottom: 24px; }
.guide-section { scroll-margin-top: calc(var(--header-h) + 80px); }
.guide-section + .guide-section { margin-top: 40px; }
.guide-section h2 { margin-bottom: 12px; font-size: 20px; }
.guide-list { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.guide-item { display: flex; justify-content: space-between; gap: 24px; padding: 14px 18px; border-bottom: 1px solid var(--line); font-size: 15px; }
.guide-item:last-child { border-bottom: 0; }
.guide-item span:last-child { color: var(--muted); text-align: right; }
@media (max-width: 860px) { .guide-layout { grid-template-columns: 1fr; } .guide-toc { display: none; } }
@media (max-width: 560px) { .guide-item { flex-direction: column; gap: 2px; } .guide-item span:last-child { text-align: left; } }

/* Help center */
.help-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.help-card { display: block; padding: 22px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.help-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); text-decoration: none; }
.help-card .icon { color: var(--ink); }
.help-card h3 { margin-top: 14px; font-size: 16px; }
.help-card p { margin-top: 6px; color: var(--muted); font-size: 14px; }
@media (max-width: 860px) { .help-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .help-grid { grid-template-columns: 1fr; } }

/* Changelog */
.release { display: grid; grid-template-columns: 180px 1fr; gap: 32px; padding: 32px 0; border-bottom: 1px solid var(--line); }
.release:first-child { padding-top: 0; }
.release__meta { color: var(--muted); font-size: 14px; }
.release__version { color: var(--ink); font: 500 18px var(--mono); }
.release__body { color: var(--ink-2); }
.release__body ul { margin: 10px 0 0; padding-left: 18px; }
.release__body li + li { margin-top: 6px; }
@media (max-width: 700px) { .release { grid-template-columns: 1fr; gap: 10px; } }

/* ---------- Prose (legal, docs) ---------- */

.doc-layout { display: grid; grid-template-columns: 1fr 220px; gap: 64px; align-items: start; padding: 56px 0 96px; }
.doc-layout--left { grid-template-columns: 220px 1fr; }
.doc-toc { position: sticky; top: calc(var(--header-h) + 32px); font-size: 14px; }
.doc-toc h2 { margin-bottom: 12px; color: var(--muted); font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.doc-toc ol, .doc-toc ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; border-left: 1px solid var(--line); }
.doc-toc a { display: block; margin-left: -1px; padding: 5px 12px; border-left: 1px solid transparent; color: var(--muted); }
.doc-toc a:hover { color: var(--ink); text-decoration: none; }
.doc-toc a.is-active { color: var(--ink); border-left-color: var(--ink); }
@media (max-width: 960px) { .doc-layout, .doc-layout--left { grid-template-columns: 1fr; } .doc-toc { display: none; } }

.prose { max-width: 720px; color: var(--ink-2); font-size: 16.5px; line-height: 1.7; }
.prose > * + * { margin-top: 16px; }
.prose h2 { margin-top: 56px; padding-top: 8px; color: var(--ink); font-size: 24px; letter-spacing: -0.025em; scroll-margin-top: calc(var(--header-h) + 24px); }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 32px; color: var(--ink); font-size: 18px; letter-spacing: -0.015em; scroll-margin-top: calc(var(--header-h) + 24px); }
.prose h2 + p, .prose h3 + p { margin-top: 10px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li + li { margin-top: 8px; }
.prose li::marker { color: var(--faint); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent-text) 35%, transparent); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: currentColor; }
.prose hr { margin: 40px 0; border: 0; border-top: 1px solid var(--line); }
.prose .table-wrap { margin-top: 20px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.prose .table { font-size: 14.5px; line-height: 1.5; }
.prose .table td { vertical-align: top; }
.prose .callout { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.prose .callout strong:first-child { display: block; margin-bottom: 4px; }
.prose .summary-list { display: grid; gap: 12px; margin: 20px 0 0; padding: 0; list-style: none; }
.prose .summary-list li { display: flex; gap: 12px; margin: 0; }
.prose .summary-list .icon { margin-top: 4px; color: var(--ink); }

/* ---------- Auth (login) ---------- */

.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); }
.auth-main { display: flex; flex-direction: column; padding: 28px 32px; }
.auth-main .brand { align-self: flex-start; }
.auth-card { width: 100%; max-width: 380px; margin: auto; padding: 40px 0; }
.auth-card h1 { font-size: 28px; letter-spacing: -0.03em; }
.auth-card .sub { margin-top: 8px; color: var(--muted); font-size: 15px; }
.auth-card form { margin-top: 24px; }
.auth-card .btn--block + .btn--block { margin-top: 10px; }
.auth-oauth { display: grid; gap: 10px; margin-top: 28px; }
.auth-switch { margin-top: 24px; color: var(--muted); font-size: 14px; text-align: center; }
.auth-switch button, .link-button { padding: 0; border: 0; background: none; color: var(--accent-text); font-weight: 500; cursor: pointer; }
.auth-switch button:hover, .link-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.auth-legal { color: var(--faint); font-size: 12.5px; text-align: center; }
.auth-legal a { color: var(--muted); }
.auth-aside { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 48px; background: #141417; color: #e7e7ea; overflow: hidden; }
.auth-aside h2 { max-width: 420px; color: #fff; font-size: 30px; letter-spacing: -0.03em; }
.auth-aside p { max-width: 420px; margin-top: 12px; color: #a1a1aa; }
.auth-aside__stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; max-width: 460px; border: 1px solid #2a2a2f; border-radius: var(--r-lg); background: #2a2a2f; overflow: hidden; }
.auth-aside__stats div { padding: 18px 20px; background: #18181b; }
.auth-aside__stats span { display: block; color: #8b8b94; font-size: 13px; }
.auth-aside__stats strong { display: block; margin-top: 6px; color: #fff; font: 500 24px var(--mono); letter-spacing: -0.02em; }
.auth-aside__foot { color: #8b8b94; font-size: 13px; }
.btn--oauth { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn--oauth:hover { background: var(--surface-2); }
.btn--oauth svg { width: 18px; height: 18px; }
.password-field { position: relative; }
.password-field .input { padding-right: 44px; }
.password-field button { position: absolute; right: 4px; top: 4px; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.password-field button:hover { color: var(--ink); background: var(--surface-2); }
@media (max-width: 900px) { .auth-page { grid-template-columns: 1fr; } .auth-aside { display: none; } .auth-main { padding: 20px 16px; } }

/* ---------- Portal ---------- */

.portal { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; background: var(--bg); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 16px 12px; border-right: 1px solid var(--line); background: var(--surface); }
.sidebar .brand { padding: 6px 8px 18px; }
.sidebar__nav { display: grid; gap: 2px; }
.sidebar__label { margin: 20px 10px 6px; color: var(--faint); font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--r-sm); color: var(--ink-2); font-size: 14.5px; font-weight: 500; }
.nav-item .icon { color: var(--muted); }
.nav-item:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.nav-item[aria-current="page"] .icon { color: var(--ink); }
.nav-item .badge { margin-left: auto; }
.sidebar__foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.user-button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: var(--r-sm); background: transparent; text-align: left; cursor: pointer; }
.user-button:hover { background: var(--surface-2); }
.user-button__text { display: block; min-width: 0; flex: 1; }
.user-button__name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; }
.user-button__email { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12.5px; }
.menu { position: absolute; z-index: 60; min-width: 220px; padding: 6px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-lg); }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--ink-2); font-size: 14px; text-align: left; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.menu hr { margin: 6px 0; border: 0; border-top: 1px solid var(--line); }
.menu .danger { color: var(--danger); }
.menu__head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu__head strong { display: block; font-size: 14px; font-weight: 500; }
.menu__head span { display: block; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }

.portal-main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 32px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar__title { font-size: 15px; font-weight: 600; }
.topbar__crumb { color: var(--muted); font-size: 15px; }
.topbar__actions { display: flex; gap: 8px; margin-left: auto; }
.sidebar-toggle { display: none; }
.portal-content { width: 100%; max-width: 1560px; margin: 0 auto; padding: 28px 40px 48px; }
.portal-content--narrow { max-width: 880px; }
.page-title { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.page-title h1 { font-size: 26px; letter-spacing: -0.03em; }
.page-title p { margin-top: 6px; color: var(--muted); font-size: 15px; }
.page-title__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.portal-loading { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }

@media (max-width: 960px) {
  .portal { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 70; inset: 0 auto 0 0; width: 272px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .portal.nav-open .sidebar { transform: none; }
  .portal.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 65; background: rgb(15 15 17 / .4); }
  .sidebar-toggle { display: grid; }
  .topbar { padding: 0 16px; }
  .portal-content { padding: 24px 16px; }
}

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.stat__label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; }
.stat__label .icon { width: 15px; height: 15px; }
.stat__value { margin-top: 10px; font: 500 28px/1.1 var(--mono); letter-spacing: -0.03em; }
.stat__value small { color: var(--muted); font-size: 15px; }
.stat__foot { margin-top: 8px; color: var(--muted); font-size: 13px; }
.stat__foot .up { color: var(--positive); }
.stat__foot .down { color: var(--danger); }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .stats { grid-template-columns: 1fr; } }

.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; margin-top: 12px; }
.grid-2--even { grid-template-columns: 1fr 1fr; }
.grid-2 > *, .stats > *, .settings-stack > *, .doc-layout > *, .guide-layout > *, .card__head > * { min-width: 0; }
@media (max-width: 1100px) { .grid-2, .grid-2--even { grid-template-columns: 1fr; } }

/* Bar chart */
.chart { position: relative; height: 100%; min-height: 220px; display: flex; align-items: flex-end; gap: 10px; padding: 8px 4px 0; }
.chart__gridline { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.chart__gridline span { position: absolute; top: -9px; right: 0; padding-left: 6px; background: var(--surface); color: var(--faint); font: 11px var(--mono); }
.chart__col { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; height: 100%; }
.chart__bar { width: 100%; max-width: 38px; min-height: 2px; border-radius: 6px 6px 2px 2px; background: var(--surface-3); transition: background .15s; }
.chart__col.is-current .chart__bar { background: var(--ink); }
.chart__col:hover .chart__bar { background: var(--accent); }
.chart__x { color: var(--muted); font: 11.5px var(--mono); }
.chart__tip { position: absolute; z-index: 2; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); display: none; padding: 6px 8px; border-radius: 6px; background: var(--ink); color: var(--bg); font: 12px var(--mono); white-space: nowrap; pointer-events: none; }
.chart__col:hover .chart__tip { display: block; }
.chart__col:nth-child(-n+5 of .chart__col) .chart__tip { left: 0; transform: none; }
.chart__col:nth-last-child(-n+4) .chart__tip { left: auto; right: 0; transform: none; }
.chart__col { min-width: 0; }
@media (max-width: 640px) { .chart { gap: 4px; } .chart__col:nth-child(even of .chart__col) .chart__x { visibility: hidden; } }
.chart__bar-wrap { position: relative; width: 100%; display: flex; justify-content: center; }

/* Category bars */
.cat-list { display: grid; gap: 14px; }
.cat-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; font-size: 14px; }
.cat-row__name { display: flex; align-items: center; gap: 8px; }
.cat-row__val { font: 500 13.5px var(--mono); }
.cat-row__bar { grid-column: span 2; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.cat-row__bar span { display: block; height: 100%; border-radius: inherit; }
.cat-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.cat-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 9px; }
.cat-icon .icon { width: 16px; height: 16px; }

/* Tip list rows */
.tip-row { display: flex; align-items: center; gap: 12px; }
.tip-row__text { min-width: 0; }
.tip-row__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.tip-row__sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; }
.row-actions .btn { color: var(--muted); }
.row-actions .btn:hover { color: var(--ink); }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar .input-group { flex: 1; min-width: 200px; }
.toolbar .select { width: auto; min-width: 150px; }
.toolbar .input, .toolbar .select { height: 36px; font-size: 14px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }
.pagination div { display: flex; gap: 6px; }

/* Settings rows */
.setting { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting__text strong { display: block; font-size: 14.5px; font-weight: 500; }
.setting__text span { display: block; margin-top: 2px; color: var(--muted); font-size: 13.5px; }
.setting__text { flex: 1; min-width: 0; }
.setting__control { flex: none; }
.setting__control .select { min-width: 200px; max-width: 280px; }
.setting--stack { flex-direction: column; align-items: stretch; gap: 12px; }
@media (max-width: 640px) { .setting { flex-direction: column; align-items: stretch; gap: 12px; } .setting__control .select { width: 100%; } }

.settings-stack { display: grid; gap: 16px; align-content: start; }
.settings-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.settings-columns > * { min-width: 0; }
@media (max-width: 1180px) { .settings-columns { grid-template-columns: 1fr; } }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer; }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--ink); }

.provider-row { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.provider-row:last-child { border-bottom: 0; }
.provider-row svg { width: 20px; height: 20px; }
.provider-row .badge { margin-left: auto; }

/* Key list */
.key-row { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.key-row:last-child { border-bottom: 0; }
.key-row > div { min-width: 0; }
.key-row code { overflow-wrap: anywhere; }
@media (max-width: 640px) { .key-row { grid-template-columns: 1fr auto; } .key-row > div { grid-column: 1 / -1; } }
.key-row__name { font-weight: 500; font-size: 14.5px; }
.key-row__meta { margin-top: 2px; color: var(--muted); font-size: 13px; }
.key-row code { font-size: 12.5px; }
.secret-box { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface-2); font: 13.5px var(--mono); word-break: break-all; }
.secret-box span { flex: 1; }

/* Danger zone */
.card--danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.card--danger .card__head { border-bottom-color: color-mix(in srgb, var(--danger) 20%, var(--line)); }

/* Definition list */
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; font-size: 14.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

/* Drawer */
.drawer { position: fixed; z-index: 80; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .22s ease; }
.drawer.is-open { transform: none; }
.drawer__head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer__body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer__foot { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.drawer__foot .spacer { flex: 1; }
.scrim { position: fixed; inset: 0; z-index: 75; background: rgb(15 15 17 / .35); }

/* ---------- Utilities ---------- */
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.stack-8 > * + * { margin-top: 8px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row--between { justify-content: space-between; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.w-full { width: 100%; }

/* Cards whose body should fill the card's height (charts next to taller cards) */
.card--fill { display: flex; flex-direction: column; }
.card--fill > .card__body { flex: 1; display: flex; flex-direction: column; }
.card--fill > .card__body > .chart { flex: 1; }

/* ---------- API examples (includes/api-examples.php) and console ---------- */

.method { display: inline-block; min-width: 46px; padding: 2px 6px; border-radius: 5px; font: 600 12px var(--mono); text-align: center; }
.method--get { background: var(--accent-soft); color: var(--accent-text); }
.method--post { background: #e9effd; color: #2d5bd3; }
@media (prefers-color-scheme: dark) { .method--post { background: #17213a; color: #8fb0ff; } }

.recipes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.recipes__nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.recipe-tab { display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: none; color: var(--ink-2); text-align: left; cursor: pointer; transition: background .12s, border-color .12s; }
.recipe-tab { background: var(--surface); }
.recipe-tab:hover { border-color: var(--line-strong); }
.recipe-tab[aria-selected="true"] { border-color: var(--ink); box-shadow: var(--shadow-sm); }
.recipe-tab__icon { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.recipe-tab[aria-selected="true"] .recipe-tab__icon { border-color: transparent; background: var(--accent-soft); color: var(--accent-text); }
.recipe-tab__text { min-width: 0; }
.recipe-tab__text strong { display: block; color: var(--ink); font-size: 14.5px; font-weight: 600; }
.recipe-tab__text span { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.recipe { min-width: 0; }
.recipe__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.recipe__path { padding: 0; border: 0; background: none; color: var(--ink-2); font-size: 14px; }
.recipe__grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 12px; align-items: stretch; }
@media (max-width: 1240px) { .portal .recipe__grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 980px) { .recipe__grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1100px) {
  .recipes__nav { display: flex; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  .recipes__nav::-webkit-scrollbar { display: none; }
  .recipe-tab { width: auto; flex: none; align-items: center; padding: 6px 12px 6px 6px; border-color: var(--line); border-radius: 999px; background: var(--surface); }
  .recipe-tab__text span { display: none; }
  .recipe-tab__text strong { white-space: nowrap; font-size: 14px; }
  .recipe-tab__icon { width: 26px; height: 26px; border-radius: 50%; }
}

.code-panel { display: flex; flex-direction: column; min-width: 0; border-radius: var(--r-lg); background: #141417; border: 1px solid #26262b; overflow: hidden; }
.code-panel__tabs, .preview-panel__tabs { display: flex; align-items: center; gap: 2px; padding: 6px 8px 0; overflow-x: auto; scrollbar-width: none; }
.code-panel__tabs { border-bottom: 1px solid #26262b; }
.code-panel__tabs button[role=tab] { height: 34px; padding: 0 10px; border: 0; border-bottom: 2px solid transparent; background: none; color: #9b9ba4; font: 500 13px var(--sans); white-space: nowrap; cursor: pointer; }
.code-panel__tabs button[role=tab]:hover { color: #e7e7ea; }
.code-panel__tabs button[aria-selected="true"] { color: #fff; border-bottom-color: var(--brand-green, #12b886); }
.code-panel__copy { display: inline-flex; align-items: center; gap: 6px; height: 28px; margin: 0 0 6px auto; padding: 0 10px; border: 1px solid #2f2f35; border-radius: 7px; background: #1c1c20; color: #c9c9cf; font: 500 12.5px var(--sans); white-space: nowrap; cursor: pointer; }
.code-panel__copy:hover { background: #26262b; color: #fff; }
.code-panel pre { flex: 1; margin: 0; padding: 16px 18px; border-radius: 0; background: transparent; font-size: 13px; line-height: 1.65; max-height: 520px; overflow: auto; }

.preview-panel { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); overflow: hidden; }
.preview-panel__tabs { border-bottom: 1px solid var(--line); background: var(--surface); padding-bottom: 6px; }
.preview-panel__tabs button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 7px; background: none; color: var(--muted); font: 500 13px var(--sans); cursor: pointer; }
.preview-panel__tabs button:hover { color: var(--ink); background: var(--surface-2); }
.preview-panel__tabs button[aria-selected="true"] { color: var(--ink); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.preview-panel__body { flex: 1; padding: 18px; }
.preview-panel__body--code pre { margin-top: 8px; max-height: 420px; overflow: auto; font-size: 12.5px; }
.preview-panel__note { padding: 10px 18px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12.5px; }

.pv-label { margin-bottom: 12px; color: var(--muted); font: 500 11.5px var(--mono); text-transform: uppercase; letter-spacing: .05em; }
.pv-card { padding: 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-sm); }
.pv-card--flush { padding: 0; overflow: hidden; }
.pv-tip { display: flex; align-items: center; gap: 12px; }
.pv-tip__text { flex: 1; min-width: 0; }
.pv-tip__text strong, .pv-tip__nums strong { display: block; font-weight: 600; font-size: 15px; }
.pv-tip__text span, .pv-tip__nums span { display: block; color: var(--muted); font-size: 13px; }
.pv-tip__nums { text-align: right; font-family: var(--mono); }
.pv-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 14px 0 0; padding-top: 14px; border-top: 1px dashed var(--line-strong); font-size: 13.5px; }
.pv-dl dt { color: var(--muted); }
.pv-dl dd { margin: 0; text-align: right; font-family: var(--mono); }
.pv-cat-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 8px; }
.pv-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pv-table th { padding: 9px 14px; background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 500; text-align: left; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); }
.pv-table td { padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.pv-table tr:last-child td { border-bottom: 0; }
.pv-table .num { text-align: right; font-family: var(--mono); }
.pv-place { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.pv-place .pv-cat-icon { width: 26px; height: 26px; border-radius: 7px; }
.pv-bars { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding-top: 22px; }
.pv-bar { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; padding-bottom: 22px; }
.pv-bar__fill { width: 100%; max-width: 40px; border-radius: 6px 6px 2px 2px; background: var(--surface-3); }
.pv-bar:last-child .pv-bar__fill { background: var(--brand-green, #12b886); }
.pv-bar__label { position: absolute; bottom: 0; color: var(--muted); font: 11.5px var(--mono); }
.pv-bar__value { position: absolute; top: -20px; color: var(--ink-2); font: 11px var(--mono); }
.pv-cat { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; font-size: 14px; }
.pv-cat + .pv-cat { margin-top: 12px; }
.pv-cat__name { display: flex; align-items: center; gap: 8px; }
.pv-cat__name i { width: 8px; height: 8px; border-radius: 50%; }
.pv-cat__val { font: 500 13px var(--mono); }
.pv-cat__bar { grid-column: span 2; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.pv-cat__bar span { display: block; height: 100%; border-radius: inherit; }
.pv-sheet { border: 1px solid var(--line); border-radius: var(--r); background: #fff; color: #202124; overflow: hidden; font: 12.5px Arial, Helvetica, sans-serif; box-shadow: var(--shadow-sm); }
.pv-sheet__bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #e0e0e0; background: #f8f9fa; font-weight: 600; }
.pv-sheet__dot { width: 12px; height: 12px; border-radius: 3px; background: #0f9d58; }
.pv-sheet table { width: 100%; border-collapse: collapse; }
.pv-sheet th, .pv-sheet td { padding: 5px 8px; border: 1px solid #e0e0e0; white-space: nowrap; }
.pv-sheet thead th { background: #f8f9fa; color: #5f6368; font-weight: 400; text-align: center; }
.pv-sheet tbody th, .pv-sheet thead tr:first-child th:first-child { width: 28px; background: #f8f9fa; color: #5f6368; font-weight: 400; text-align: center; }
.pv-sheet__head td { font-weight: 700; background: #fff; }
.pv-sheet .num { text-align: right; }

/* API console (dashboard) */
.console { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.console__request { padding: 20px; border-right: 1px solid var(--line); }
.console__response { display: flex; flex-direction: column; min-width: 0; background: var(--surface-2); border-radius: 0 0 var(--r-lg) 0; }
.console__endpoint { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); font: 13px var(--mono); overflow-x: auto; white-space: nowrap; }
.console textarea.textarea { min-height: 220px; font: 12.5px/1.6 var(--mono); }
.console__status { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--surface); font: 13px var(--mono); }
.console__status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.console__status.is-ok .dot { background: var(--positive); }
.console__status.is-error .dot { background: var(--danger); }
.console__body { flex: 1; padding: 18px; overflow: auto; max-height: 520px; }
.console__body pre { font-size: 12.5px; }
@media (max-width: 1100px) { .console { grid-template-columns: minmax(0, 1fr); } .console__request { border-right: 0; border-bottom: 1px solid var(--line); } .console__response { border-radius: 0 0 var(--r-lg) var(--r-lg); } }

/* Key rows with reveal/copy */
.key-row { grid-template-columns: minmax(0, 1fr) auto auto; }
.key-value { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; margin-top: 6px; padding: 3px 4px 3px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); }
.key-value code { padding: 0; border: 0; background: none; font-size: 12.5px; overflow-wrap: anywhere; }
.key-value .btn { height: 26px; width: 26px; color: var(--muted); }
.key-value .btn:hover { color: var(--ink); }
.key-row__actions { display: flex; gap: 6px; align-items: center; }
