@import url('/assets/brand.css');

:root {
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 72px;
  --fs-xs: 0.8125rem; --fs-sm: 0.875rem; --fs-base: 1rem; --fs-md: 1.125rem; --fs-lg: 1.375rem; --fs-xl: 1.75rem; --fs-2xl: 2.25rem; --fs-hero: clamp(2.5rem, 6vw, 4rem);
  --radius: 14px; --radius-sm: 10px; --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(16, 20, 28, .06), 0 6px 20px rgba(16, 20, 28, .06);
  --bg: var(--brand-background); --surface: #ffffff; --surface-2: #eef0f4; --border: #d9dde4;
  --text: var(--brand-text); --muted: #545b66; --heading: var(--brand-heading);
  --primary: var(--brand-primary); --primary-strong: var(--brand-primary-strong); --primary-soft: var(--brand-primary-soft);
  --link: var(--brand-link); --btn-bg: var(--brand-button-background); --btn-text: var(--brand-button-text);
  --ok-bg: #e5f4ea; --ok-text: #1b6536; --warn-bg: #fff3dc; --warn-text: #7f4d00; --bad-bg: #fdeae7; --bad-text: #9c2717; --info-bg: #e8eefc; --info-text: #23439a;
  --focus: #1f5fd1;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #121418; --surface: #1c1f25; --surface-2: #262a32; --border: #353b45;
  --text: #eef0f3; --muted: #aab1bc; --heading: var(--brand-primary-light); --link: var(--brand-primary-light);
  --primary-soft: #3a211c;
  --ok-bg: #16301f; --ok-text: #8ddba6; --warn-bg: #33270f; --warn-text: #f3c56b; --bad-bg: #3a1b17; --bad-text: #ffaa9c; --info-bg: #1b2540; --info-text: #a9c1ff;
  --focus: #8ab4ff;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--brand-font-body); font-size: var(--fs-base); line-height: 1.55; color: var(--text); background: var(--bg); overflow-x: hidden; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--brand-font-heading); color: var(--heading); line-height: 1.15; margin: 0 0 var(--space-3); letter-spacing: -0.01em; }
h1 { font-size: var(--fs-2xl); } h2 { font-size: var(--fs-xl); } h3 { font-size: var(--fs-lg); } h4 { font-size: var(--fs-md); }
p { margin: 0 0 var(--space-3); }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.money, .price { white-space: nowrap; font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 18px; height: 18px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 44px; padding: 10px 18px; border-radius: var(--radius-pill); border: 1.5px solid transparent; font: inherit; font-weight: 700; font-size: var(--fs-sm); cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--btn-bg); color: var(--btn-text); }
.btn-primary:hover { filter: brightness(.88); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); }
.btn-light { background: #ffffff; color: #1d2129; }
.btn-light:hover { background: #f1f1f1; }
.btn-danger { background: transparent; color: var(--bad-text); border-color: currentColor; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; cursor: not-allowed; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--link); font: inherit; font-weight: 600; cursor: pointer; padding: 10px 4px; min-height: 44px; text-decoration: underline; }

/* Layout */
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 var(--space-4); }
.section { padding: var(--space-8) 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-5); }
.section-head p { max-width: 60ch; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: var(--fs-xs); font-weight: 800; color: var(--primary-strong); margin-bottom: var(--space-2); }
[data-theme="dark"] .eyebrow { color: var(--brand-primary-light); }
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.stack > * + * { margin-top: var(--space-4); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.spread { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.page { padding: var(--space-6) 0 var(--space-8); min-height: 60vh; }
.page-title { margin-bottom: var(--space-2); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-5); box-shadow: var(--shadow); }
.card h3 { margin-bottom: var(--space-2); }
.card-media { margin: calc(var(--space-5) * -1) calc(var(--space-5) * -1) var(--space-4); border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; aspect-ratio: 16 / 9; background: var(--surface-2); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 40; background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .bar { display: flex; align-items: center; gap: var(--space-3); min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); text-decoration: none; color: var(--text); font-weight: 800; font-size: var(--fs-md); }
.brand img { height: 36px; width: auto; }
.nav { display: flex; gap: 2px; margin-left: var(--space-4); }
.nav a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 12px; border-radius: var(--radius-pill); text-decoration: none; color: var(--text); font-weight: 600; font-size: var(--fs-sm); }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary-strong); }
[data-theme="dark"] .nav a[aria-current="page"] { color: var(--brand-primary-light); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.icon-btn:hover { border-color: var(--primary); }
.tabbar { display: none; }
@media (max-width: 900px) {
  .nav { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 45; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; font-size: 0.6875rem; font-weight: 700; color: var(--muted); text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--primary-strong); }
  [data-theme="dark"] .tabbar a[aria-current="page"] { color: var(--brand-primary-light); }
  body.has-tabbar { padding-bottom: 72px; }
  .hide-sm { display: none !important; }
}

/* Hero */
.hero { position: relative; color: #ffffff; background-color: #15171c; background-image: linear-gradient(100deg, rgba(12, 14, 18, .86) 0%, rgba(12, 14, 18, .62) 55%, rgba(12, 14, 18, .35) 100%), url('/assets/stock-1.webp'); background-size: cover; background-position: center; }
.hero-inner { min-height: min(86vh, 720px); display: flex; flex-direction: column; justify-content: center; padding: var(--space-8) 0; max-width: 720px; }
.hero h1 { color: #ffffff; font-size: var(--fs-hero); line-height: 1.04; letter-spacing: -0.02em; margin-bottom: var(--space-4); }
.hero p.lead { font-size: var(--fs-md); color: #f1f2f4; max-width: 56ch; margin-bottom: var(--space-5); }
.hero .eyebrow { color: var(--brand-primary-light); }
.hero-badges { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-5); font-size: var(--fs-sm); color: #f1f2f4; }
.hero-badges span { display: inline-flex; align-items: center; gap: 6px; }

/* Steps */
.steps { counter-reset: step; }
.step { position: relative; padding-top: var(--space-6); }
.step::before { counter-increment: step; content: counter(step); position: absolute; top: 0; left: 0; width: 36px; height: 36px; border-radius: 50%; background: var(--btn-bg); color: var(--btn-text); display: grid; place-items: center; font-weight: 800; }

/* Pricing */
.price-card { display: grid; grid-template-rows: auto auto 1fr auto; gap: var(--space-2); height: 100%; }
.price-card .price { font-size: var(--fs-xl); font-weight: 800; color: var(--text); }
.price-card .per { font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--text); }
.badge-ok { background: var(--ok-bg); color: var(--ok-text); }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); }
.badge-bad { background: var(--bad-bg); color: var(--bad-text); }
.badge-info { background: var(--info-bg); color: var(--info-text); }

.notice { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4); border-radius: var(--radius-sm); background: var(--info-bg); color: var(--info-text); }
.notice-warn { background: var(--warn-bg); color: var(--warn-text); }
.notice-bad { background: var(--bad-bg); color: var(--bad-text); }
.notice-ok { background: var(--ok-bg); color: var(--ok-text); }
.notice a, .notice .link-btn { color: inherit; }

/* Chips and slots */
.chips { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: var(--space-2); scrollbar-width: thin; }
.chip { flex: none; min-height: 44px; min-width: 64px; padding: 6px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; font-size: var(--fs-sm); cursor: pointer; text-align: center; line-height: 1.2; }
.chip small { display: block; font-weight: 600; color: var(--muted); font-size: var(--fs-xs); }
.chip[aria-pressed="true"] { border-color: var(--primary-strong); background: var(--primary-soft); color: var(--primary-strong); }
[data-theme="dark"] .chip[aria-pressed="true"] { color: var(--brand-primary-light); border-color: var(--brand-primary-light); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--space-2); }
.slot { min-height: 52px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; font-variant-numeric: tabular-nums; }
.slot:hover:not([disabled]) { border-color: var(--primary-strong); }
.slot[disabled] { cursor: not-allowed; background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.slot small { display: block; font-size: var(--fs-xs); font-weight: 600; text-decoration: none; }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-4); font-size: var(--fs-sm); color: var(--muted); }

/* Forms */
.field { display: grid; gap: 6px; }
.field label { font-weight: 700; font-size: var(--fs-sm); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(31, 95, 209, .25); }
.field-error { color: var(--bad-text); font-size: var(--fs-sm); font-weight: 600; min-height: 0; }
.input[aria-invalid="true"] { border-color: var(--bad-text); }
.form-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.error-summary { padding: var(--space-4); border-radius: var(--radius-sm); background: var(--bad-bg); color: var(--bad-text); }
.error-summary ul { margin: var(--space-2) 0 0; padding-left: var(--space-5); }
.error-summary a { color: inherit; }
.segmented { display: inline-flex; border: 1.5px solid var(--border); border-radius: var(--radius-pill); padding: 3px; gap: 3px; background: var(--surface); }
.segmented button { min-height: 40px; padding: 6px 16px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-text); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.data th, table.data td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data th { position: sticky; top: 0; background: var(--surface-2); font-weight: 700; white-space: nowrap; z-index: 1; }
table.data th button { background: none; border: 0; font: inherit; font-weight: 700; color: var(--text); cursor: pointer; padding: 0; min-height: 32px; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; }
.table-tools { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.pager { display: flex; gap: var(--space-2); align-items: center; justify-content: flex-end; padding: var(--space-3); font-size: var(--fs-sm); }

/* States */
.skeleton { height: 18px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; margin: 10px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } * { scroll-behavior: auto !important; } }
.empty { text-align: center; padding: var(--space-6) var(--space-4); color: var(--muted); }
.empty p { margin-bottom: var(--space-4); }

/* Progress */
.meter { height: 8px; border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--primary); }

/* Dialog */
dialog.modal { border: 0; border-radius: var(--radius); padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
dialog.modal::backdrop { background: rgba(10, 12, 16, .55); }
.modal-body { padding: var(--space-5); }
.modal-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: flex-end; padding: 0 var(--space-5) var(--space-5); }

/* Toast */
.toast-host { position: fixed; z-index: 100; right: var(--space-4); bottom: calc(var(--space-4) + 72px); display: grid; gap: var(--space-2); max-width: min(420px, calc(100vw - 32px)); }
.toast { padding: 12px 16px; border-radius: var(--radius-sm); background: #1d2129; color: #ffffff; box-shadow: var(--shadow); font-weight: 600; font-size: var(--fs-sm); }
.toast-error { background: #8f2516; }
.toast-ok { background: #1b6536; }

/* Footer */
.site-footer { background: #15171c; color: #d5d8de; padding: var(--space-7) 0 var(--space-6); font-size: var(--fs-sm); }
.site-footer h4 { color: #ffffff; }
.site-footer a { color: var(--brand-primary-light); }
.site-footer .trust { display: flex; flex-wrap: wrap; gap: var(--space-4); margin: var(--space-4) 0; }
.site-footer .trust span { display: inline-flex; align-items: center; gap: 6px; color: #e9ebee; }

/* Admin shell */
.admin-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: #15171c; color: #e3e6ea; padding: var(--space-4); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { color: #ffffff; margin-bottom: var(--space-5); }
.sidebar nav a { display: flex; align-items: center; gap: var(--space-3); min-height: 44px; padding: 8px 12px; border-radius: var(--radius-sm); color: #e3e6ea; text-decoration: none; font-weight: 600; font-size: var(--fs-sm); }
.sidebar nav a:hover { background: #262a32; }
.sidebar nav a[aria-current="page"] { background: var(--brand-primary-strong); color: #ffffff; }
.sidebar .side-foot { margin-top: var(--space-6); font-size: var(--fs-xs); color: #b9bec7; }
.admin-main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: var(--space-3); min-height: 64px; padding: 0 var(--space-5); background: var(--surface); border-bottom: 1px solid var(--border); }
.admin-content { padding: var(--space-5); }
.topbar .badge { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
.topbar .header-actions { flex: none; }
.kpis { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); }
.kpi .label { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi .value { font-size: var(--fs-xl); font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--primary); }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--brand-font-body); }
@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: var(--space-3); }
  .sidebar nav { display: flex; overflow-x: auto; gap: 4px; }
  .sidebar nav a { flex: none; }
  .sidebar .side-foot { display: none; }
  .sidebar .brand { margin-bottom: var(--space-2); }
  .admin-content { padding: var(--space-4) var(--space-3); }
  .topbar { padding: 0 var(--space-3); }
}
