/* SnapPage Pro — control panel design system (light + dark) */

:root {
  --brand: #7c5cfc;
  --brand-600: #6a48f0;
  --brand-50: #f3f0ff;
  --brand-ring: rgba(124, 92, 252, .35);

  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #f9f9fc;
  --surface-3: #f1f1f6;
  --border: #e6e6ee;
  --border-strong: #d6d6e2;
  --text: #15151f;
  --text-2: #4b4b5c;
  --muted: #7a7a8c;

  --success: #12a150;  --success-bg: #e7f7ee;
  --warning: #b7791f;  --warning-bg: #fdf4e3;
  --danger: #d92d48;   --danger-bg: #fdecef;
  --info: #0b7bd6;     --info-bg: #e6f2fc;
  --accent-bg: #f3f0ff;

  --chart-1: #7c5cfc; --chart-2: #22c3a6; --chart-3: #f59e0b; --chart-4: #ec4899; --chart-5: #0ea5e9;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 16, 40, .05);
  --shadow: 0 1px 3px rgba(16, 16, 40, .06), 0 8px 24px -12px rgba(16, 16, 40, .12);
  --shadow-lg: 0 24px 60px -20px rgba(16, 16, 40, .35);
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', 'Cascadia Code', Menlo, Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand-50: rgba(124, 92, 252, .14);
  --bg: #0b0b12;
  --surface: #13131c;
  --surface-2: #171722;
  --surface-3: #1e1e2b;
  --border: #262636;
  --border-strong: #33334a;
  --text: #ececf3;
  --text-2: #b4b4c6;
  --muted: #8686a0;
  --success: #34d17d; --success-bg: rgba(52, 209, 125, .12);
  --warning: #f5b544; --warning-bg: rgba(245, 181, 68, .12);
  --danger: #ff5a73;  --danger-bg: rgba(255, 90, 115, .12);
  --info: #4fb0ff;    --info-bg: rgba(79, 176, 255, .12);
  --accent-bg: rgba(124, 92, 252, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
::selection { background: var(--brand-ring); }
.icon { flex-shrink: 0; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; transition: transform .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 20px; font-weight: 700; font-size: 15px; color: var(--text); }
.sidebar-brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #8b5cf6, #ec4899); box-shadow: 0 6px 16px -6px rgba(139, 92, 246, .7); }
.brand-tag { font-size: 10px; font-weight: 600; color: var(--brand); background: var(--brand-50); padding: 2px 6px; border-radius: 6px; margin-left: auto; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 12px 16px; }
.nav-section { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 16px 10px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--text-2); font-weight: 500; margin: 1px 0; transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--brand-50); color: var(--brand); }
.nav-link .count { margin-left: auto; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.nav-link .count.alert { background: var(--danger-bg); color: var(--danger); }
.nav-link.active .count { background: var(--brand); color: #fff; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 12px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.sidebar-user .who { min-width: 0; flex: 1; }
.sidebar-user .who strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .who span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; min-width: 0; }
.crumbs a { color: var(--muted); }
.crumbs strong { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-search { margin-left: auto; position: relative; width: min(340px, 40vw); }
.topbar-search input { width: 100%; padding-left: 36px; height: 38px; background: var(--surface); }
.topbar-search .icon { position: absolute; left: 11px; top: 10px; color: var(--muted); }
.topbar-search kbd { position: absolute; right: 8px; top: 9px; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.content { padding: 28px; width: 100%; max-width: 1320px; margin: 0 auto; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.app-foot { padding: 20px 28px; color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--border); }
.scrim { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 600 13px/1 var(--font); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  box-shadow: var(--shadow-sm); text-decoration: none !important;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 16px -8px var(--brand); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.95); background: var(--danger); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.95); background: var(--success); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-soft-danger { color: var(--danger); }
.btn-soft-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-sm { height: 32px; padding: 0 10px; font-size: 12px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 600; }
.card-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card-body { padding: 20px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; justify-content: flex-end; gap: 8px; }
.card-flush .card-body { padding: 0; }
.card.highlight { border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); box-shadow: 0 0 0 4px var(--brand-50); }
.card.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }

/* ---------- Grid ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-side { grid-template-columns: minmax(0, 1fr) 340px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mb-2 { margin-bottom: 16px; }
.text-muted { color: var(--muted); } .text-2 { color: var(--text-2); } .text-sm { font-size: 13px; } .text-xs { font-size: 12px; }
.text-right { text-align: right; } .text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); }
.nowrap { white-space: nowrap; } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }

/* ---------- KPI tiles ---------- */
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.kpi-icon.green { background: var(--success-bg); color: var(--success); }
.kpi-icon.amber { background: var(--warning-bg); color: var(--warning); }
.kpi-icon.blue { background: var(--info-bg); color: var(--info); }
.kpi-icon.pink { background: rgba(236, 72, 153, .12); color: #ec4899; }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-sub { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; padding: 1px 6px; border-radius: 999px; font-size: 12px; }
.delta.up { color: var(--success); background: var(--success-bg); }
.delta.down { color: var(--danger); background: var(--danger-bg); }
.delta.flat { color: var(--muted); background: var(--surface-3); }
.spark { position: absolute; right: 16px; bottom: 16px; width: 96px; height: 28px; }
.spark polyline { fill: none; stroke: var(--brand); stroke-width: 2; opacity: .8; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { color: var(--success); background: var(--success-bg); }
.badge-warning { color: var(--warning); background: var(--warning-bg); }
.badge-danger { color: var(--danger); background: var(--danger-bg); }
.badge-info { color: var(--info); background: var(--info-bg); }
.badge-muted { color: var(--muted); background: var(--surface-3); }
.badge-accent { color: var(--brand); background: var(--accent-bg); }
.badge-plain .dot { display: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--surface-3); color: var(--text-2); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr[data-href] { cursor: pointer; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table input[type=checkbox] { width: 16px; height: 16px; }
.cell-user { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.cell-user .meta { min-width: 0; }
.cell-user strong { display: block; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.cell-user span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }

.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: 12px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #8b5cf6, #ec4899); }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.c1 { background: linear-gradient(135deg, #6366f1, #22d3ee); } .avatar.c2 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.avatar.c3 { background: linear-gradient(135deg, #10b981, #3b82f6); } .avatar.c4 { background: linear-gradient(135deg, #ec4899, #8b5cf6); }

/* ---------- List rows ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .sub { color: var(--muted); font-size: 12px; }

/* ---------- Description list ---------- */
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; margin: 0; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea, input:where(:not([type=checkbox], [type=radio], [type=file], [type=range], [type=hidden], [type=submit], [type=button], [type=color], [type=image], [type=reset])), select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: 400 14px var(--font); transition: border-color .15s, box-shadow .15s;
}
textarea, .textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a7a8c' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
input::placeholder, textarea::placeholder { color: var(--muted); }
input[type=file] { width: 100%; padding: 8px; border-radius: var(--radius-sm); border: 1px dashed var(--border-strong); background: var(--surface-2); color: var(--text-2); font: 400 13px var(--font); }
input[type=file]::file-selector-button { margin-right: 12px; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 600 12px var(--font); cursor: pointer; }
input[readonly] { background: var(--surface-2); color: var(--text-2); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); }
.input-group { display: flex; }
.input-group input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-left: -1px; height: 40px; box-shadow: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; }
.check input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--brand); }
.check small { display: block; color: var(--muted); font-size: 12px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .2s; flex-shrink: 0; }
.switch .track::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--brand-ring); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: 0; }
.setting-row strong { display: block; font-size: 14px; }
.setting-row span { color: var(--muted); font-size: 13px; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar .search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.toolbar .search input { padding-left: 34px; height: 36px; }
.toolbar .search .icon { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.toolbar select, .toolbar input[type=date] { height: 36px; width: auto; min-width: 130px; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-3); gap: 2px; flex-wrap: wrap; }
.seg a { padding: 6px 12px; border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.seg a:hover { color: var(--text); text-decoration: none; }
.seg a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg a .n { font-size: 11px; color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }

/* ---------- Pagination ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.pager .pages { display: flex; gap: 4px; }
.pager a, .pager span.cur { min-width: 32px; height: 32px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); color: var(--text-2); font-weight: 500; }
.pager a:hover { background: var(--surface-3); text-decoration: none; }
.pager span.cur { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Alerts & toasts ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid; font-size: 14px; }
.alert .icon { margin-top: 1px; }
.alert-success { color: var(--success); background: var(--success-bg); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert-error, .alert-danger { color: var(--danger); background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-warning { color: var(--warning); background: var(--warning-bg); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.alert-info { color: var(--info); background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.alert > div { color: var(--text); }
.alert strong { color: inherit; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: toast-in .25s ease; font-weight: 500; }
.toast .icon { margin-top: 1px; }
.toast.success .icon { color: var(--success); } .toast.error .icon { color: var(--danger); } .toast.info .icon { color: var(--info); } .toast.warning .icon { color: var(--warning); }
.toast .close { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; }
.toast.hide { animation: toast-out .2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- Dialog ---------- */
dialog.modal { border: 0; padding: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text); width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
dialog.modal.wide { width: min(760px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(10, 10, 20, .55); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: modal-in .2s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 22px; max-height: 70vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty .icon-wrap { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.empty h3 { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty p { max-width: 380px; margin: 0 auto 16px; }

/* ---------- Charts ---------- */
.chart { width: 100%; height: 240px; display: block; }
.chart-grid { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart-line { fill: none; stroke: var(--chart-1); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--surface); stroke: var(--chart-1); stroke-width: 2; opacity: 0; transition: opacity .1s; }
.chart-hit:hover .chart-dot { opacity: 1; }
.chart-empty { height: 200px; display: grid; place-items: center; color: var(--muted); }
.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.bar-head span { color: var(--text-2); }
.bar-track { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--chart-1); }
.bar-fill.c2 { background: var(--chart-2); } .bar-fill.c3 { background: var(--chart-3); } .bar-fill.c4 { background: var(--chart-4); } .bar-fill.c5 { background: var(--chart-5); }
.bar-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- Progress ---------- */
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #ec4899); border-radius: 999px; }
.progress.warn > span { background: var(--warning); } .progress.danger > span { background: var(--danger); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 18px 28px; }
.timeline li::before { content: ''; position: absolute; left: 7px; top: 18px; bottom: -2px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .tl-dot { position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand); }
.timeline .tl-dot.success { border-color: var(--success); } .timeline .tl-dot.danger { border-color: var(--danger); } .timeline .tl-dot.muted { border-color: var(--border-strong); } .timeline .tl-dot.warning { border-color: var(--warning); }
.timeline .tl-title { font-weight: 600; font-size: 13px; }
.timeline .tl-sub { color: var(--muted); font-size: 12px; }

/* ---------- License key ---------- */
.keybox { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 12px; border: 1px dashed color-mix(in srgb, var(--brand) 45%, var(--border)); background: var(--brand-50); }
.keybox code { flex: 1; font-size: 16px; font-weight: 600; letter-spacing: .06em; color: var(--text); overflow-wrap: anywhere; }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--muted); }
pre.code { margin: 0; padding: 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); font: 12px/1.6 var(--mono); overflow: auto; max-height: 520px; color: var(--text-2); }

/* ---------- Hero / plan cards (customer) ---------- */
.hero { padding: 24px; border-radius: var(--radius-lg); color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(1200px 400px at 100% 0%, rgba(236, 72, 153, .55), transparent 55%), linear-gradient(135deg, #6d4bf5, #8b5cf6 55%, #a855f7); }
.hero h2 { font-size: 22px; font-weight: 700; }
.hero p { opacity: .85; margin-top: 6px; max-width: 560px; }
.hero .btn { background: #fff; color: #4c2ed8; border-color: #fff; }
.hero .btn.btn-ghost { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .25); color: #fff; }
.plan { padding: 24px; display: flex; flex-direction: column; gap: 14px; position: relative; }
.plan.popular { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50), var(--shadow); }
.plan .ribbon { position: absolute; top: -11px; left: 24px; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--brand); color: #fff; }
.plan .price { font-size: 34px; font-weight: 800; letter-spacing: -.03em; }
.plan .price small { font-size: 14px; color: var(--muted); font-weight: 500; }
.plan ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); }
.plan li { display: flex; gap: 8px; align-items: flex-start; }
.plan li .icon { color: var(--success); margin-top: 2px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; }
.steps li::before { content: counter(s); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-weight: 700; font-size: 12px; background: var(--brand-50); color: var(--brand); }
.method { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border-strong); border-radius: 12px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.method:hover { border-color: var(--brand); }
.method.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.method .ico { font-size: 22px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-3); }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 48px; }
.auth-form { width: 100%; max-width: 400px; margin: 0 auto; }
.auth-form h1 { font-size: 26px; font-weight: 700; margin: 28px 0 6px; }
.auth-form > p { color: var(--muted); margin-bottom: 24px; }
.auth-art { position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: flex-end;
  background: radial-gradient(800px 500px at 80% 10%, rgba(236, 72, 153, .6), transparent 60%), radial-gradient(700px 500px at 0% 100%, rgba(34, 211, 238, .35), transparent 60%), linear-gradient(160deg, #2a1a6e, #4c2ed8 50%, #7c3aed); }
.auth-art blockquote { margin: 0; font-size: 22px; font-weight: 600; line-height: 1.4; max-width: 460px; }
.auth-art .feature { display: flex; gap: 10px; align-items: center; margin-top: 12px; opacity: .9; }
.auth-art .glass { position: absolute; inset: 48px 48px auto auto; width: 62%; aspect-ratio: 16/10; border-radius: 18px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .25); backdrop-filter: blur(8px); box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .5); }
.auth-art .glass::before { content: ''; position: absolute; inset: 14px 14px auto; height: 10px; border-radius: 6px; background: rgba(255, 255, 255, .25); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 20px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.pw-meter { height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.pw-meter span { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }

/* ---------- Receipt ---------- */
.receipt { max-width: 760px; margin: 40px auto; padding: 48px; background: #fff; color: #111; border-radius: 16px; box-shadow: var(--shadow); }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td, .receipt th { padding: 10px 0; border-bottom: 1px solid #eee; text-align: left; }
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .receipt { box-shadow: none; margin: 0; padding: 0; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .grid-main, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(10, 10, 20, .45); z-index: 35; }
  .main { margin-left: 0; }
  .topbar .menu-btn { display: inline-flex; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (max-width: 720px) {
  .content { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
  .topbar-search { display: none; }
  .grid-2, .grid-4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: 20px; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 10px; }
  .auth-panel { padding: 28px 18px; }
  .kpi-value { font-size: 24px; }
  .table .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner { padding: 10px 28px; background: var(--warning-bg); color: var(--warning); font-weight: 500; font-size: 13px; border-bottom: 1px solid var(--border); }
