/* ==========================================================================
   Snaplink design system — dashboard, public site and redirect pages.
   Colours are tokens; dark mode swaps them. --brand is set from admin settings.
   ========================================================================== */

:root {
  --brand: #5b5bd6;
  --brand-contrast: #fff;
  --brand-soft: color-mix(in srgb, var(--brand) 12%, transparent);
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-3: #ececef;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --text-2: #52525b;
  --text-3: #8b8b94;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #b45309;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #2563eb;
  --info-soft: #dbeafe;
  --shadow-sm: 0 1px 2px rgba(16, 16, 24, .05);
  --shadow: 0 1px 3px rgba(16, 16, 24, .06), 0 8px 24px -12px rgba(16, 16, 24, .12);
  --shadow-lg: 0 24px 60px -20px rgba(16, 16, 24, .35);
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 16px;
  --sidebar: 248px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c0f; --surface: #151519; --surface-2: #1c1c21; --surface-3: #26262c; --border: #2a2a31; --border-strong: #3a3a42;
    --text: #f4f4f5; --text-2: #b4b4bc; --text-3: #7c7c86; --success-soft: #0f2e1b; --warning-soft: #33250b; --danger-soft: #3a1414; --info-soft: #10213f;
    --success: #4ade80; --warning: #fbbf24; --danger: #f87171; --info: #60a5fa;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0c0f; --surface: #151519; --surface-2: #1c1c21; --surface-3: #26262c; --border: #2a2a31; --border-strong: #3a3a42;
  --text: #f4f4f5; --text-2: #b4b4bc; --text-3: #7c7c86; --success-soft: #0f2e1b; --warning-soft: #33250b; --danger-soft: #3a1414; --info-soft: #10213f;
  --success: #4ade80; --warning: #fbbf24; --danger: #f87171; --info: #60a5fa;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6); 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.55; 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, h5 { margin: 0 0 .5em; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 24px; } h2 { font-size: 19px; } h3 { font-size: 16px; } h4 { font-size: 14px; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
code, pre, kbd { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; }
pre { background: var(--surface-2); padding: 14px 16px; border-radius: var(--radius-sm); overflow: auto; border: 1px solid var(--border); }
kbd { border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: 11px; color: var(--text-2); background: var(--surface); }
::selection { background: var(--brand-soft); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Layout: dashboard ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border); padding: 16px 12px 24px; display: flex; flex-direction: column; gap: 2px; z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); padding: 4px 8px 16px; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand img { max-height: 30px; width: auto; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: var(--brand-contrast); display: grid; place-items: center; font-size: 15px; flex: none; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light.has-dark { display: none; } :root[data-theme="dark"] .logo-dark { display: inline; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-light.has-dark { display: none; } :root:not([data-theme="light"]) .logo-dark { display: inline; } }
.nav-section { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 16px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; }
.nav-link i { width: 18px; text-align: center; font-size: 14px; color: var(--text-3); }
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--brand-soft); color: var(--brand); }
.nav-link.active i { color: var(--brand); }
.nav-link .dot { width: 9px; height: 9px; border-radius: 50%; margin: 0 4px; }
.nav-link .count { margin-left: auto; font-size: 11px; color: var(--text-3); }
.sidebar-footer { margin-top: auto; padding-top: 16px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 10px 28px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar .search { display: flex; align-items: center; gap: 8px; color: var(--text-3); border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); padding: 6px 10px; min-width: 240px; cursor: pointer; }
.topbar .spacer { flex: 1; }
.content { padding: 28px; max-width: 1280px; width: 100%; }
.content.narrow { max-width: 880px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-header h1 { margin: 0; }
.page-header .subtitle { color: var(--text-3); margin-top: 2px; }
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.menu-toggle { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 640px) {
  .hide-sm { display: none !important; }
  .repeater-row { grid-template-columns: 1fr !important; padding-bottom: 10px; border-bottom: 1px dashed var(--border); }
  .repeater-row .btn-icon { justify-self: end; }
  .topbar { gap: 6px; }
  .topbar .btn-sm { padding: 0 8px; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 35; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .topbar .search { min-width: 0; }
  .topbar .search span { display: none; }
  .content { padding: 20px 16px; }
}

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, color .15s; text-decoration: none !important; box-shadow: var(--shadow-sm); }
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:disabled, .btn.disabled { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-contrast); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); border-color: color-mix(in srgb, var(--brand) 88%, #000); }
.btn-dark { background: var(--text); border-color: var(--text); color: var(--surface); }
.btn-dark:hover { background: color-mix(in srgb, var(--text) 85%, var(--brand)); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }
.btn-soft { background: var(--brand-soft); border-color: transparent; color: var(--brand); box-shadow: none; }
.btn-ai { background: linear-gradient(120deg, #8b5cf6, #ec4899); border: 0; color: #fff; }
.btn-ai:hover { filter: brightness(1.08); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: var(--radius); }
.btn-icon { width: 34px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 550; margin-bottom: 6px; color: var(--text); }
.form-label .opt { color: var(--text-3); font-weight: 400; }
.form-help { color: var(--text-3); font-size: 12.5px; margin-top: 5px; }
.form-control { display: block; width: 100%; height: 38px; padding: 0 11px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s; }
textarea.form-control { height: auto; min-height: 90px; padding: 9px 11px; resize: vertical; }
select.form-control { padding-right: 30px; 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='%238b8b94' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
select[multiple].form-control { height: auto; min-height: 90px; padding: 6px; background-image: none; }
.form-control:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.form-control::placeholder { color: var(--text-3); }
.form-control-lg { height: 48px; font-size: 15px; padding: 0 14px; border-radius: var(--radius); }
input[type="color"].form-control { padding: 3px; width: 54px; cursor: pointer; }
input[type="file"].form-control { padding: 6px; height: auto; }
.input-group { display: flex; align-items: stretch; }
.input-group > .form-control { border-radius: 0; flex: 1; min-width: 0; }
.input-group > :first-child { border-top-left-radius: var(--radius-sm); border-bottom-left-radius: var(--radius-sm); }
.input-group > :last-child { border-top-right-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
.input-group > * + * { margin-left: -1px; }
.input-group .addon { display: flex; align-items: center; padding: 0 11px; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-2); white-space: nowrap; }
.input-group .btn { border-radius: 0; height: auto; }
.input-group > select.form-control { flex: 0 1 auto; width: auto; max-width: 45%; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; margin-bottom: 8px; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }
.switch { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch .label strong { display: block; font-weight: 550; }
.switch .label span { color: var(--text-3); font-size: 12.5px; }
.toggle { position: relative; width: 38px; height: 22px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle .track { position: absolute; inset: 0; border-radius: 22px; background: var(--border-strong); transition: background .2s; }
.toggle .track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.toggle input:checked + .track { background: var(--brand); }
.toggle input:checked + .track::after { transform: translateX(16px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; }
.repeater-row { display: grid; gap: 8px; align-items: center; margin-bottom: 8px; }
.repeater-row .btn-icon { height: 38px; }
fieldset { border: 0; padding: 0; margin: 0; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card + .card { margin-top: 18px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-header h3, .card-title { margin: 0; font-size: 14px; font-weight: 600; }
.card-header .eyebrow, .eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }
.card-body { padding: 18px; }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.card-flush .card-body { padding: 0; }
.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.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-sidebar { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-sidebar { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- Stat tiles ---------- */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat .label { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }
.stat .value { font-size: 28px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .meta { color: var(--text-3); font-size: 12.5px; }

/* ---------- Tables / lists ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: 0; }
.item .check { margin: 0; }
.item .favicon { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; flex: none; overflow: hidden; color: var(--text-3); }
.item .favicon img { width: 18px; height: 18px; }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 600; color: var(--text); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .short { font-weight: 550; }
.item .sub { color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.item .side { display: flex; align-items: center; gap: 6px; flex: none; }
.item .clicks { text-align: right; min-width: 64px; font-variant-numeric: tabular-nums; }
.item .clicks strong { display: block; font-size: 15px; }
.item .clicks span { font-size: 11.5px; color: var(--text-3); }
@media (max-width: 640px) { .item { flex-wrap: wrap; } .item .side { width: 100%; justify-content: flex-end; } }

.bar-list { display: flex; flex-direction: column; gap: 4px; }
.bar-item { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 7px; overflow: hidden; z-index: 0; }
.bar-item .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--brand-soft); z-index: -1; border-radius: 7px; }
.bar-item .name { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-item .val { font-variant-numeric: tabular-nums; color: var(--text-2); font-weight: 550; }
.bar-item .pct { color: var(--text-3); font-size: 12px; margin-left: 6px; font-weight: 400; }

/* ---------- Badges, alerts ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 550; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; line-height: 1.7; }
.badge-brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.badge-success { background: var(--success-soft); color: var(--success); 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-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert a { color: inherit; text-decoration: underline; }
.alert .close { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; opacity: .6; font-size: 16px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tab { padding: 9px 14px; border: 0; background: none; font: inherit; font-weight: 550; color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.pill-tabs { display: inline-flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; flex-wrap: wrap; }
.pill-tabs .tab { border: 0; border-radius: 7px; padding: 6px 12px; margin: 0; }
.pill-tabs .tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
[data-pane]:not(.active) { display: none !important; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; background: rgba(9, 9, 11, .45); backdrop-filter: blur(2px); overflow-y: auto; }
.modal.open { display: flex; animation: fade .15s ease; }
.modal-dialog { width: 100%; max-width: 520px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: rise .18s ease; }
.modal-dialog.lg { max-width: 760px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
@keyframes fade { from { opacity: 0; } } @keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; display: none; }
.dropdown.open > .dropdown-menu { display: block; animation: rise .12s ease; }
.dropdown-menu.left { right: auto; left: 0; }
.dropdown-menu.up { top: auto; bottom: calc(100% + 6px); }
.dropdown-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; text-align: left; cursor: pointer; white-space: nowrap; }
.dropdown-item i { width: 16px; text-align: center; color: var(--text-3); }
.dropdown-item:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-item.danger, .dropdown-item.danger i { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 6px 0; }
.dropdown-header { padding: 6px 10px 4px; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }

/* ---------- Pagination, empty, toast ---------- */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 34px; height: 34px; display: inline-grid; place-items: center; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 550; }
.pagination a:hover { background: var(--surface-2); text-decoration: none; }
.pagination .current { background: var(--brand); border-color: var(--brand); color: #fff; }
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .icon { width: 56px; height: 56px; border-radius: 16px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 22px; margin: 0 auto 14px; }
.empty h3 { color: var(--text); }
.toast-wrap { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 550; animation: rise .2s ease; pointer-events: auto; }
.toast.error { background: var(--danger); color: #fff; }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 200px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Utilities ---------- */
.flex { display: flex; } .inline-flex { display: inline-flex; } .flex-col { flex-direction: column; } .flex-wrap { flex-wrap: wrap; } .flex-1 { flex: 1; min-width: 0; }
.items-center { align-items: center; } .items-start { align-items: flex-start; } .justify-between { justify-content: space-between; } .justify-center { justify-content: center; } .justify-end { justify-content: flex-end; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.p-0 { padding: 0 !important; } .w-100 { width: 100%; } .text-center { text-align: center; } .text-right { text-align: right; }
.text-muted { color: var(--text-3) !important; } .text-2 { color: var(--text-2); } .text-sm { font-size: 12.5px; } .text-xs { font-size: 11.5px; } .text-lg { font-size: 16px; }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); } .text-brand { color: var(--brand); }
.fw-600 { font-weight: 600; } .mono { font-family: var(--mono); } .nowrap { white-space: nowrap; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hidden, [hidden] { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--surface-3); flex: none; display: inline-grid; place-items: center; font-weight: 600; color: var(--text-2); font-size: 13px; }
.avatar-lg { width: 72px; height: 72px; font-size: 26px; }
.color-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.copy { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sticky { position: sticky; top: 76px; }
.thumb { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; background: var(--surface-2); flex: none; border: 1px solid var(--border); }
.code-box { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.code-box .btn { flex: none; }
details.advanced > summary { cursor: pointer; font-weight: 600; padding: 12px 0; list-style: none; display: flex; align-items: center; gap: 8px; }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::before { content: "\f054"; font: var(--fa-font-solid); font-size: 11px; transition: transform .15s; color: var(--text-3); }
details.advanced[open] > summary::before { transform: rotate(90deg); }
.section-title { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 4px 0 12px; }
.section-title i { color: var(--brand); }
.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.option { position: relative; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; cursor: pointer; background: var(--surface); display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, box-shadow .15s; }
.option:hover { border-color: var(--border-strong); }
.option input { position: absolute; opacity: 0; }
.option:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.option i { font-size: 18px; color: var(--brand); }
.option strong { font-size: 13px; }
.option span { font-size: 12px; color: var(--text-3); }

/* ---------- Public site ---------- */
.site-header { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; gap: 22px; height: 64px; }
.site-nav { display: flex; gap: 4px; flex: 1; }
.site-nav a { color: var(--text-2); font-weight: 550; padding: 6px 12px; border-radius: 8px; }
.site-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.wrap-sm { max-width: 760px; margin: 0 auto; padding: 0 20px; }
@media (max-width: 760px) { .site-nav { display: none; } .site-nav.open { display: flex; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; background: var(--surface); padding: 12px 16px; border-bottom: 1px solid var(--border); } }
.hero { padding: 84px 0 64px; text-align: center; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: -40% -10% auto; height: 520px; background: radial-gradient(closest-side, var(--brand-soft), transparent); z-index: -1; }
.hero h1 { font-size: clamp(34px, 6vw, 58px); letter-spacing: -.035em; line-height: 1.05; font-weight: 750; max-width: 820px; margin: 0 auto 16px; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero .lead { font-size: 18px; color: var(--text-2); max-width: 620px; margin: 0 auto 32px; }
.shorten-box { max-width: 720px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 8px; box-shadow: var(--shadow); display: flex; gap: 8px; }
.shorten-box input { border: 0; flex: 1; height: 50px; padding: 0 14px; font: inherit; font-size: 16px; background: transparent; color: var(--text); min-width: 0; }
.shorten-box input:focus { outline: none; }
@media (max-width: 560px) { .shorten-box { flex-direction: column; } .shorten-box .btn { width: 100%; } }
.shorten-result { max-width: 720px; margin: 16px auto 0; text-align: left; }
.section { padding: 72px 0; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 40px; }
.section-head h2 { font-size: clamp(26px, 4vw, 36px); letter-spacing: -.025em; }
.section-head p { color: var(--text-2); font-size: 16px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.feature .icon { width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 18px; margin-bottom: 14px; }
.feature h3 { font-size: 16px; }
.feature p { color: var(--text-2); margin: 0; }
.counter-row { display: flex; justify-content: center; gap: 56px; flex-wrap: wrap; margin-top: 48px; }
.counter strong { display: block; font-size: 30px; font-weight: 750; letter-spacing: -.03em; }
.counter span { color: var(--text-3); }
.cta-band { background: var(--text); color: var(--surface); border-radius: 24px; padding: 48px; text-align: center; }
.cta-band h2 { font-size: 30px; color: var(--surface); }
.cta-band p { color: color-mix(in srgb, var(--surface) 75%, transparent); }
.site-footer { border-top: 1px solid var(--border); padding: 40px 0; color: var(--text-3); margin-top: 40px; }
.site-footer .cols { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.site-footer a { color: var(--text-2); }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.site-footer h4 { color: var(--text); font-size: 13px; }
.social-row { display: flex; gap: 10px; }
.social-row a { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.auth-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 32px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 22px; text-align: center; }
.auth-card .sub { text-align: center; color: var(--text-3); margin-bottom: 24px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.prose { font-size: 16px; line-height: 1.75; color: var(--text); }
.prose h1, .prose h2, .prose h3 { margin-top: 1.6em; }
.prose img { border-radius: var(--radius); }
.prose blockquote { border-left: 3px solid var(--brand); margin: 1em 0; padding: 4px 16px; color: var(--text-2); }
.prose ul, .prose ol { padding-left: 1.4em; }
.post-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; color: var(--text); transition: box-shadow .15s, transform .15s; }
.post-card:hover { text-decoration: none; box-shadow: var(--shadow); transform: translateY(-2px); }
.post-card img, .post-card .ph { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--brand-soft); display: block; }
.post-card .body { padding: 18px; }
.post-card p { color: var(--text-2); }
.cookie-bar { position: fixed; left: 16px; bottom: 16px; max-width: 380px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: 14px; padding: 16px; z-index: 90; font-size: 13px; }

/* ---------- Redirect pages ---------- */
.blank-center { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.blank-card { width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 32px; text-align: center; box-shadow: var(--shadow); }
.blank-card .icon { width: 56px; height: 56px; border-radius: 16px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 22px; margin: 0 auto 16px; }
.frame-page { margin: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.frame-bar { display: flex; align-items: center; gap: 14px; padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--border); min-height: 56px; flex-wrap: wrap; }
.frame-bar .title { flex: 1; min-width: 0; }
.frame-bar .ad-slot { max-height: 90px; overflow: hidden; }
.frame-page iframe { flex: 1; border: 0; width: 100%; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--surface-3); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.ad-slot { text-align: center; margin: 16px auto; }
.powered { color: var(--text-3); font-size: 12px; margin-top: 18px; }
.powered a { color: var(--text-2); }
