/* Slotwise — design tokens, reset and shared components.
   Hand-written, no build step. Brand colours and fonts come from Site settings (injected in partials/head). */

/* ============================================================ tokens */
:root {
  --brand: #6D5EF6;
  --brand-2: #A77BFA;
  --ink: #12122B;

  --bg: #F6F7FB;
  --surface: #FFFFFF;
  --surface-2: #F9FAFD;
  --surface-3: #F0F1F8;
  --border: #E7E8F1;
  --border-strong: #D7D9E6;
  --text: #121330;
  --text-2: #43465F;
  --muted: #6E7191;
  --muted-2: #A0A3BC;

  --green: #0F9F6E;  --green-bg: #E6F7F0;  --green-line: #BDEBD8;
  --red: #E5484D;    --red-bg: #FDEEEE;    --red-line: #F7C9CB;
  --amber: #C47A06;  --amber-bg: #FFF5E0;  --amber-line: #F6DBA4;
  --orange: #E8590C; --orange-bg: #FFF0E6; --orange-line: #F9CFB2;
  --blue: #2F6FEB;   --blue-bg: #EAF1FE;   --blue-line: #C7D8FB;
  --violet: #7C4DEB; --violet-bg: #F1EBFE; --violet-line: #DACDFB;
  --pink: #D6336C;   --pink-bg: #FDEDF3;   --pink-line: #F7C6D8;
  --teal: #0C8599;   --teal-bg: #E3F6F9;   --teal-line: #AFE2EA;
  --gray: #5E6280;   --gray-bg: #F0F1F6;   --gray-line: #DFE1EA;

  --brand-soft: color-mix(in srgb, var(--brand) 8%, #fff);
  --brand-soft-2: color-mix(in srgb, var(--brand) 15%, #fff);
  --brand-line: color-mix(in srgb, var(--brand) 26%, #fff);
  --brand-strong: color-mix(in srgb, var(--brand) 84%, #000);
  --brand-ink: color-mix(in srgb, var(--brand) 55%, #0b0b25);
  --accent-soft: color-mix(in srgb, var(--brand-2) 12%, #fff);
  --grad: linear-gradient(135deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 55%, var(--brand-2)) 60%, var(--brand-2) 120%);
  --grad-soft: linear-gradient(135deg, color-mix(in srgb, var(--brand) 9%, #fff), color-mix(in srgb, var(--brand-2) 9%, #fff));

  --r-xs: 6px;
  --r-sm: 8px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-2xl: 28px;
  --sh-1: 0 1px 2px rgba(18, 19, 48, .05);
  --sh-2: 0 1px 2px rgba(18, 19, 48, .04), 0 10px 28px -12px rgba(18, 19, 48, .14);
  --sh-3: 0 28px 64px -20px rgba(18, 19, 48, .30);
  --sh-brand: 0 12px 28px -12px color-mix(in srgb, var(--brand) 60%, transparent);
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);

  --font: "Inter", "Hind Siliguri", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", "Hind Siliguri", system-ui, sans-serif;
  --font-bn: "Hind Siliguri", "Noto Sans Bengali", "Inter", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0B0C18;
  --surface: #13142A;
  --surface-2: #101124;
  --surface-3: #1B1D38;
  --border: #25284A;
  --border-strong: #33365E;
  --text: #ECECF8;
  --text-2: #BFC1DA;
  --muted: #8B8EAE;
  --muted-2: #5E6185;

  --green: #34D399;  --green-bg: rgba(52, 211, 153, .12);  --green-line: rgba(52, 211, 153, .28);
  --red: #F87171;    --red-bg: rgba(248, 113, 113, .12);   --red-line: rgba(248, 113, 113, .3);
  --amber: #FBBF24;  --amber-bg: rgba(251, 191, 36, .12);  --amber-line: rgba(251, 191, 36, .28);
  --orange: #FB923C; --orange-bg: rgba(251, 146, 60, .12); --orange-line: rgba(251, 146, 60, .3);
  --blue: #60A5FA;   --blue-bg: rgba(96, 165, 250, .12);   --blue-line: rgba(96, 165, 250, .3);
  --violet: #A78BFA; --violet-bg: rgba(167, 139, 250, .13); --violet-line: rgba(167, 139, 250, .3);
  --pink: #F472B6;   --pink-bg: rgba(244, 114, 182, .12);  --pink-line: rgba(244, 114, 182, .3);
  --teal: #22D3EE;   --teal-bg: rgba(34, 211, 238, .12);   --teal-line: rgba(34, 211, 238, .28);
  --gray: #A5A8C6;   --gray-bg: rgba(165, 168, 198, .1);   --gray-line: rgba(165, 168, 198, .22);

  --brand-soft: color-mix(in srgb, var(--brand) 16%, #13142A);
  --brand-soft-2: color-mix(in srgb, var(--brand) 26%, #13142A);
  --brand-line: color-mix(in srgb, var(--brand) 42%, #13142A);
  --brand-strong: color-mix(in srgb, var(--brand) 72%, #fff);
  --accent-soft: color-mix(in srgb, var(--brand-2) 16%, #13142A);
  --grad-soft: linear-gradient(135deg, color-mix(in srgb, var(--brand) 18%, #13142A), color-mix(in srgb, var(--brand-2) 12%, #13142A));

  --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
  --sh-2: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 36px -18px rgba(0, 0, 0, .8);
  --sh-3: 0 30px 70px -20px rgba(0, 0, 0, .8);
  color-scheme: dark;
}
[data-theme="dark"] body { background-image: radial-gradient(1000px 520px at 80% -12%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 62%); background-attachment: fixed; }

/* ============================================================ reset & type */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-feature-settings: "cv11", "ss01"; }
:lang(bn) body, [lang="bn"] { font-family: var(--font-bn); }
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); }
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.22; letter-spacing: -.018em; font-weight: 700; color: var(--text); font-family: var(--font-display); }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
code, kbd, pre { font-family: var(--mono); font-size: .9em; }
code { background: var(--surface-3); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; color: var(--text-2); word-break: break-word; }
kbd { background: var(--surface); border: 1px solid var(--border-strong); border-bottom-width: 2px; padding: 0 6px; border-radius: 6px; font-size: 11px; color: var(--muted); font-family: var(--font); }
::selection { background: color-mix(in srgb, var(--brand) 22%, transparent); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* ============================================================ icons */
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.icon-xs { width: 13px; height: 13px; }
.icon-lg { width: 22px; height: 22px; }
.icon-xl { width: 28px; height: 28px; }
.icon-fill { fill: currentColor; stroke: none; }

/* ============================================================ utilities */
.flex { display: flex; } .inline-flex { display: inline-flex; } .grid { display: grid; } .block { display: block; }
.items-center { align-items: center; } .items-start { align-items: flex-start; } .items-end { align-items: flex-end; } .items-baseline { align-items: baseline; }
.justify-between { justify-content: space-between; } .justify-center { justify-content: center; } .justify-end { justify-content: flex-end; }
.wrap { flex-wrap: wrap; } .flex-1, .grow { flex: 1 1 auto; min-width: 0; } .shrink-0 { flex-shrink: 0; } .flex-col { flex-direction: column; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; } .mb-6 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; } .mx-auto { margin-left: auto; margin-right: auto; }
.p-0 { padding: 0 !important; }
.text-xs { font-size: 12px; } .text-sm { font-size: 13px; } .text-md { font-size: 15px; } .text-lg { font-size: 17px; } .text-xl { font-size: 20px; } .text-2xl { font-size: 26px; }
.text-center { text-align: center; } .text-right { text-align: right; } .text-left { text-align: left; }
.strong { font-weight: 650; color: var(--text); } .semibold { font-weight: 600; } .bold { font-weight: 700; }
.muted { color: var(--muted); } .muted-2 { color: var(--muted-2); } .text-2 { color: var(--text-2); } .text-base { color: var(--text); }
.text-brand { color: var(--brand); } .text-green { color: var(--green); } .text-red { color: var(--red); } .text-amber { color: var(--amber); } .text-blue { color: var(--blue); } .text-violet { color: var(--violet); } .text-orange { color: var(--orange); } .text-teal { color: var(--teal); } .text-pink { color: var(--pink); }
.display { font-family: var(--font-display); }
.mono { font-family: var(--mono); font-size: .92em; }
.tabular { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.w-full { width: 100%; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-xs { display: flex; flex-direction: column; gap: 6px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cols-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); } .hide-sm { display: none !important; } }
@media (min-width: 721px) { .show-sm { display: none !important; } }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.sep-dot::before { content: "·"; margin: 0 6px; color: var(--muted-2); }

/* ============================================================ buttons */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px;
  border-radius: var(--r); border: 1px solid var(--btn-bd); background: var(--btn-bg); color: var(--btn-fg);
  font-size: 13.5px; font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer; user-select: none; text-decoration: none;
  box-shadow: var(--sh-1); transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .12s;
}
.btn:hover { color: var(--btn-fg); border-color: color-mix(in srgb, var(--btn-bd) 70%, var(--text) 30%); background: color-mix(in srgb, var(--btn-bg) 95%, var(--text) 5%); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { --btn-bg: var(--brand); --btn-fg: #fff; --btn-bd: var(--brand); box-shadow: 0 1px 2px rgba(18, 19, 48, .12), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn-primary:hover { --btn-bd: var(--brand-strong); color: #fff; background: var(--brand-strong); box-shadow: var(--sh-brand); }
.btn-grad { --btn-fg: #fff; background: var(--grad); border: 0; color: #fff; box-shadow: var(--sh-brand); }
.btn-grad:hover { color: #fff; filter: brightness(1.06) saturate(1.05); background: var(--grad); }
.btn-soft { --btn-bg: var(--brand-soft); --btn-fg: var(--brand); --btn-bd: transparent; box-shadow: none; }
.btn-soft:hover { color: var(--brand); background: var(--brand-soft-2); border-color: transparent; }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--text-2); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--text); }
.btn-danger { --btn-bg: var(--red); --btn-fg: #fff; --btn-bd: var(--red); }
.btn-danger:hover { color: #fff; background: color-mix(in srgb, var(--red) 88%, #000); }
.btn-danger-ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--red); box-shadow: none; }
.btn-danger-ghost:hover { background: var(--red-bg); border-color: transparent; color: var(--red); }
.btn-success { --btn-bg: var(--green); --btn-fg: #fff; --btn-bd: var(--green); }
.btn-success:hover { color: #fff; background: color-mix(in srgb, var(--green) 88%, #000); }
.btn-dark { --btn-bg: var(--ink); --btn-fg: #fff; --btn-bd: var(--ink); }
.btn-dark:hover { color: #fff; background: color-mix(in srgb, var(--ink) 85%, #fff); }
.btn-white { --btn-bg: #fff; --btn-fg: #121330; --btn-bd: #fff; }
.btn-white:hover { color: #121330; background: #F2F2FA; }
.btn-glass { --btn-bg: rgba(255, 255, 255, .1); --btn-fg: #fff; --btn-bd: rgba(255, 255, 255, .2); box-shadow: none; backdrop-filter: blur(8px); }
.btn-glass:hover { background: rgba(255, 255, 255, .18); color: #fff; border-color: rgba(255, 255, 255, .32); }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn-xs .icon { width: 13px; height: 13px; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; gap: 6px; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14.5px; border-radius: 11px; }
.btn-xl { height: 52px; padding: 0 26px; font-size: 15.5px; border-radius: 13px; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-icon.btn-xs { width: 26px; }
.btn-block { width: 100%; }
.btn-pill { border-radius: 999px; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--btn-fg); border-right-color: transparent; animation: spin .7s linear infinite; }
.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================ forms */
.label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.req { color: var(--red); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 14px; transition: border-color .15s, box-shadow .15s; box-shadow: var(--sh-1);
}
.textarea { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; min-height: 44px; }
.textarea.mono { font-family: var(--mono); font-size: 12.5px; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A0A3BC' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--muted) 40%); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input[readonly], .textarea[readonly] { background: var(--surface-2); color: var(--text-2); }
.input[type="date"], .input[type="time"], .input[type="datetime-local"] { padding-right: 8px; }
.input-sm, .select-sm { height: 34px; font-size: 13px; }
.input-lg { height: 48px; font-size: 15px; border-radius: 12px; }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.input-icon > .input { padding-left: 36px; }
.input-group { display: flex; align-items: stretch; }
.input-group .addon { display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--r) 0 0 var(--r); background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.input-group .input, .input-group .select { border-radius: 0 var(--r) var(--r) 0; }
.input-group .addon-end { border-right: 1px solid var(--border-strong); border-left: 0; border-radius: 0 var(--r) var(--r) 0; }
.input-group .input:has(+ .addon-end) { border-radius: var(--r) 0 0 var(--r); }
.field { min-width: 0; }
.field.is-invalid .input, .field.is-invalid .select, .field.is-invalid .textarea { border-color: var(--red); }
.error-text { margin-top: 6px; font-size: 12.5px; color: var(--red); font-weight: 500; }
.hint { margin-top: 6px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px 16px; }
.form-grid > * { grid-column: span 12; }
.form-grid > .span-2 { grid-column: span 2; } .form-grid > .span-3 { grid-column: span 3; } .form-grid > .span-4 { grid-column: span 4; }
.form-grid > .span-5 { grid-column: span 5; } .form-grid > .span-6 { grid-column: span 6; } .form-grid > .span-7 { grid-column: span 7; }
.form-grid > .span-8 { grid-column: span 8; } .form-grid > .span-9 { grid-column: span 9; }
@media (max-width: 720px) { .form-grid > [class*="span-"] { grid-column: span 12; } }
.form-section { padding-top: 14px; margin-top: 6px; border-top: 1px solid var(--border); }
.form-grid > .form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.form-section h3 { font-size: 15px; font-weight: 700; }
.form-section p { margin-top: 3px; font-size: 13px; color: var(--muted); max-width: 720px; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-radius: 0 0 var(--r-lg) var(--r-lg); position: sticky; bottom: 0; z-index: 2; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.check input, input.check { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; flex: none; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text-2); user-select: none; position: relative; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s var(--ease); }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }
.switch-sm .track { width: 32px; height: 18px; }
.switch-sm .track::after { width: 12px; height: 12px; }
.switch-sm input:checked + .track::after { transform: translateX(14px); }

.pill-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-picker label { position: relative; cursor: pointer; }
.pill-picker input { position: absolute; opacity: 0; }
.pill-picker span { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text-2); transition: all .15s; }
.pill-picker input:checked + span { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.pill-picker input:checked + span::before { content: "✓"; font-size: 12px; }
.pill-picker input:focus-visible + span { box-shadow: var(--ring); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.perm-grid label { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); cursor: pointer; font-size: 12.5px; color: var(--muted); line-height: 1.4; transition: border-color .15s, background .15s; }
.perm-grid label:hover { border-color: var(--border-strong); }
.perm-grid label:has(input:checked) { border-color: var(--brand-line); background: var(--brand-soft); }
.perm-grid input { margin-top: 2px; accent-color: var(--brand); }
.choice-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.choice-card { position: relative; display: flex; gap: 12px; padding: 14px; border: 1.5px solid var(--border); border-radius: var(--r-lg); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.choice-card:hover { border-color: var(--border-strong); }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent); }
.choice-card-title { font-weight: 650; color: var(--text); font-size: 13.5px; }
.choice-card-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.color-field { display: flex; gap: 8px; }
.color-field input[type="color"] { width: 44px; height: 40px; padding: 3px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface); cursor: pointer; flex: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; }
.swatch.is-active, .swatch:has(input:checked) { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.upload { display: flex; align-items: center; gap: 14px; }
.upload-preview { width: 64px; height: 64px; border-radius: 12px; border: 1px dashed var(--border-strong); background: var(--surface-2); display: grid; place-items: center; overflow: hidden; color: var(--muted-2); flex: none; }
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-meta { display: flex; flex-direction: column; gap: 6px; font-size: 13px; min-width: 0; }
input[type=file] { max-width: 100%; font-size: 12.5px; color: var(--muted); }
input[type=file]::file-selector-button { height: 32px; margin-right: 10px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; box-shadow: var(--sh-1); transition: background .15s; }
input[type=file]::file-selector-button:hover { background: var(--surface-3); }
.repeater { display: flex; flex-direction: column; gap: 8px; }
.repeater-row { display: flex; gap: 8px; align-items: center; }
.repeater-add { align-self: flex-start; }
.reveal-wrap { position: relative; }
.reveal-wrap .input { padding-right: 44px; }
.reveal-wrap .btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-family: var(--mono); font-size: 12.5px; }

/* segmented control */
.segmented { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--border); gap: 2px; }
.segmented button, .segmented a, .segmented label { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; cursor: pointer; }
.segmented button:hover, .segmented a:hover, .segmented label:hover { color: var(--text); }
.segmented .is-active, .segmented label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }

/* ============================================================ cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1); min-width: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); min-height: 56px; }
.card-header.plain { border-bottom: 0; padding-bottom: 2px; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 700; color: var(--text); font-family: var(--font-display); }
.card-title .icon { color: var(--muted); }
.card-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 20px; }
.card-body.tight { padding: 14px 16px; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card-footer.justify-end { justify-content: flex-end; }
.card-link { transition: border-color .15s, box-shadow .15s, transform .15s; color: inherit; }
.card-link:hover { border-color: var(--brand-line); box-shadow: var(--sh-2); color: inherit; }
.card-flush > .table-wrap .table th:first-child, .card-flush > .table-wrap .table td:first-child { padding-left: 20px; }

/* ============================================================ badges & chips */
.badge {
  --b-fg: var(--gray); --b-bg: var(--gray-bg); --b-line: var(--gray-line);
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; line-height: 1; color: var(--b-fg); background: var(--b-bg); border: 1px solid var(--b-line); white-space: nowrap; vertical-align: middle;
}
.badge .icon { width: 12px; height: 12px; }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-lg { height: 26px; padding: 0 11px; font-size: 12.5px; }
.badge-green { --b-fg: var(--green); --b-bg: var(--green-bg); --b-line: var(--green-line); }
.badge-red { --b-fg: var(--red); --b-bg: var(--red-bg); --b-line: var(--red-line); }
.badge-amber { --b-fg: var(--amber); --b-bg: var(--amber-bg); --b-line: var(--amber-line); }
.badge-orange { --b-fg: var(--orange); --b-bg: var(--orange-bg); --b-line: var(--orange-line); }
.badge-blue { --b-fg: var(--blue); --b-bg: var(--blue-bg); --b-line: var(--blue-line); }
.badge-violet { --b-fg: var(--violet); --b-bg: var(--violet-bg); --b-line: var(--violet-line); }
.badge-pink { --b-fg: var(--pink); --b-bg: var(--pink-bg); --b-line: var(--pink-line); }
.badge-brand { --b-fg: var(--brand); --b-bg: var(--brand-soft); --b-line: var(--brand-line); }
.badge-teal { --b-fg: var(--teal); --b-bg: var(--teal-bg); --b-line: var(--teal-line); }
.badge-gray { --b-fg: var(--gray); --b-bg: var(--gray-bg); --b-line: var(--gray-line); }
.badge-solid { color: #fff; background: var(--brand); border-color: var(--brand); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.chip .icon { width: 13px; height: 13px; }
.chip-soft { background: var(--surface-2); height: 22px; font-size: 11.5px; padding: 0 7px; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 11px; font-weight: 650; background: var(--brand-soft); color: var(--brand); }

.dot-live { position: relative; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; }
.dot-live::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--green); opacity: 0; animation: pulse-ring 1.8s var(--ease) infinite; }
@keyframes pulse-ring { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(1.6); opacity: 0; } }

.stars { display: inline-flex; align-items: center; gap: 1px; color: #F5A524; }
.stars .icon { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.stars .off { color: var(--border-strong); }
.stars-lg .icon { width: 18px; height: 18px; }

/* ============================================================ avatars */
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft-2); color: var(--brand-strong); font-size: 12.5px; font-weight: 700; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { width: 22px; height: 22px; font-size: 9.5px; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 44px; height: 44px; font-size: 15px; }
.avatar-xl { width: 64px; height: 64px; font-size: 20px; }
.avatar-2xl { width: 88px; height: 88px; font-size: 26px; }
.avatar-square { border-radius: 10px; }
.avatar-ring { box-shadow: 0 0 0 2px var(--surface); }
.avatar.tone-green { background: var(--green-bg); color: var(--green); }
.avatar.tone-amber { background: var(--amber-bg); color: var(--amber); }
.avatar.tone-blue { background: var(--blue-bg); color: var(--blue); }
.avatar.tone-pink { background: var(--pink-bg); color: var(--pink); }
.avatar.tone-teal { background: var(--teal-bg); color: var(--teal); }
.avatar.tone-orange { background: var(--orange-bg); color: var(--orange); }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar + .avatar { margin-left: -8px; }
.avatar-stack .avatar-sm + .avatar-sm { margin-left: -4px; }

/* ============================================================ tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { position: sticky; top: 0; z-index: 1; text-align: left; font-size: 11.5px; font-weight: 650; letter-spacing: .02em; color: var(--muted); background: var(--surface-2); padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th a { display: inline-flex; align-items: center; gap: 4px; color: inherit; }
.table th a:hover { color: var(--text); }
.table th.is-sorted { color: var(--text); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-2); }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, var(--brand-soft) 40%); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num, .table th.num { text-align: right; }
.table .center, .table th.center { text-align: center; }
.table-compact td { padding: 9px 16px; font-size: 13px; }
.table-compact th { padding: 8px 16px; }
.col-check { width: 44px; }
.col-actions { width: 1%; white-space: nowrap; text-align: right; }
.row-actions { display: flex; justify-content: flex-end; align-items: center; gap: 2px; }
.inline-form { display: inline; }
.cell-title { display: block; font-weight: 600; color: var(--text); }
a.cell-title:hover { color: var(--brand); }
.cell-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.cell-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.table-thumb { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; border: 1px solid var(--border); background: var(--surface-2); }
tr[data-href] { cursor: pointer; }

/* ============================================================ alerts */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r); border: 1px solid var(--gray-line); background: var(--gray-bg); color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.alert > .icon { margin-top: 1px; color: var(--muted); }
.alert-title { font-weight: 700; color: var(--text); margin-bottom: 1px; }
.alert-brand { background: var(--brand-soft); border-color: var(--brand-line); } .alert-brand > .icon { color: var(--brand); }
.alert-success { background: var(--green-bg); border-color: var(--green-line); } .alert-success > .icon { color: var(--green); }
.alert-warning { background: var(--amber-bg); border-color: var(--amber-line); } .alert-warning > .icon { color: var(--amber); }
.alert-danger { background: var(--red-bg); border-color: var(--red-line); } .alert-danger > .icon { color: var(--red); }
.alert-info { background: var(--blue-bg); border-color: var(--blue-line); } .alert-info > .icon { color: var(--blue); }

/* ============================================================ meters */
.meter { position: relative; height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--grad); transition: width .6s var(--ease); }
.meter.warn > span { background: var(--amber); }
.meter.full > span { background: var(--red); }
.meter.green > span { background: var(--green); }

/* ============================================================ empty state */
.empty { text-align: center; padding: 52px 24px; }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: var(--grad-soft); color: var(--brand); border: 1px solid var(--brand-line); }
.empty-icon .icon { width: 24px; height: 24px; }
.empty h3 { font-size: 16px; }
.empty p { margin: 6px auto 0; max-width: 440px; color: var(--muted); font-size: 13.5px; }
.empty-sm { padding: 28px 16px; }

/* ============================================================ pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.pagination-links { display: flex; gap: 4px; }
.pagination-links a, .pagination-links span { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; font-weight: 600; color: var(--text-2); border: 1px solid transparent; }
.pagination-links a:hover { background: var(--surface-3); color: var(--text); }
.pagination-links .is-active { background: var(--brand); color: #fff; }
.pagination-links .is-disabled { color: var(--muted-2); }

/* ============================================================ dropdowns */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; min-width: 230px; padding: 6px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--sh-3); opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top right; pointer-events: none; transition: opacity .15s, transform .15s var(--ease); }
.dropdown-menu.left { left: 0; right: auto; transform-origin: top left; }
.dropdown-menu.up { top: auto; bottom: calc(100% + 8px); transform-origin: bottom right; }
.dropdown.is-open > .dropdown-menu { opacity: 1; transform: none; pointer-events: auto; }
.dropdown-label { padding: 8px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-2); }
.dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--text-2); text-align: left; }
.dropdown-item:hover { background: var(--surface-3); color: var(--text); }
.dropdown-item .icon { color: var(--muted); }
.dropdown-item.danger { color: var(--red); } .dropdown-item.danger .icon { color: var(--red); }
.dropdown-sep { height: 1px; margin: 6px 4px; background: var(--border); }

/* ============================================================ modals & drawers */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 7vh 16px 16px; background: rgba(10, 10, 30, .45); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .18s; overflow-y: auto; }
.modal.is-open { opacity: 1; pointer-events: auto; }
.modal-dialog { width: 100%; max-width: 480px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--sh-3); transform: translateY(8px) scale(.98); transition: transform .2s var(--ease); }
.modal.is-open .modal-dialog { transform: none; }
.modal-lg .modal-dialog { max-width: 720px; }
.modal-md .modal-dialog { max-width: 580px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 6px; }
.modal-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--red-bg); color: var(--red); margin-bottom: 12px; }
.modal-title { font-size: 16.5px; font-weight: 700; color: var(--text); font-family: var(--font-display); }
.modal-body { padding: 10px 20px 18px; color: var(--text-2); font-size: 13.5px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 18px 18px; }

.drawer { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(10, 10, 30, .38); opacity: 0; transition: opacity .2s; }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--sh-3); transform: translateX(100%); transition: transform .26s var(--ease); display: flex; flex-direction: column; }
.drawer.is-open { pointer-events: auto; }
.drawer.is-open .drawer-backdrop { opacity: 1; }
.drawer.is-open .drawer-panel { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px; }
.drawer-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); display: flex; gap: 8px; flex-wrap: wrap; }

/* command palette */
.cmdk .modal-dialog { max-width: 560px; overflow: hidden; }
.cmdk-input { width: 100%; height: 54px; padding: 0 20px; border: 0; border-bottom: 1px solid var(--border); background: transparent; font-size: 15px; outline: none; }
.cmdk-list { max-height: 56vh; overflow-y: auto; padding: 6px; }
.cmdk-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 9px; color: var(--text-2); font-weight: 500; }
.cmdk-item small { font-size: 11.5px; color: var(--muted-2); }
.cmdk-item.is-active, .cmdk-item:hover { background: var(--brand-soft); color: var(--brand); }
.cmdk-group { padding: 8px 14px 4px; font-size: 11px; font-weight: 700; color: var(--muted-2); text-transform: uppercase; letter-spacing: .05em; }

/* ============================================================ toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; 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(--ink); border: 1px solid rgba(255, 255, 255, .08); box-shadow: var(--sh-3); font-size: 13.5px; color: #F2F2FA; animation: toast-in .25s var(--ease); }
[data-theme="dark"] .toast { background: var(--surface-3); border-color: var(--border-strong); }
.toast > div { flex: 1; line-height: 1.45; }
.toast > .icon { margin-top: 1px; }
.toast-success > .icon { color: #34D399; } .toast-error > .icon { color: #F87171; } .toast-info > .icon { color: #93C5FD; }
.toast button { color: rgba(255, 255, 255, .5); padding: 2px; border-radius: 6px; }
.toast button:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: all .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============================================================ code */
.code-block { border-radius: var(--r-lg); background: #0F1027; border: 1px solid #23254A; overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 8px 14px; border-bottom: 1px solid #23254A; color: #9C9FC4; font-size: 12px; font-weight: 600; }
.code-block pre, pre.code { margin: 0; padding: 14px 16px; overflow-x: auto; color: #DADCF5; font-size: 12.5px; line-height: 1.7; background: #0F1027; }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 6px; color: #B9BCE0; font-size: 12px; font-weight: 600; }
.copy-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }

/* key-value list */
.kv { display: grid; grid-template-columns: minmax(110px, auto) minmax(0, 1fr); gap: 10px 16px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); font-weight: 550; min-width: 0; overflow-wrap: anywhere; }

/* prose (markdown pages & help) */
.prose { color: var(--text-2); font-size: 15px; line-height: 1.75; }
.prose > * + * { margin-top: 1em; }
.prose h2 { font-size: 22px; margin-top: 1.8em; color: var(--text); }
.prose h3 { font-size: 17px; margin-top: 1.5em; color: var(--text); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .35em; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose blockquote { margin: 0; padding: 12px 16px; border-left: 3px solid var(--brand); background: var(--brand-soft); border-radius: 0 10px 10px 0; color: var(--text-2); }
.prose pre { position: relative; padding: 16px; border-radius: 12px; background: #0F1027; color: #DADCF5; overflow-x: auto; font-size: 13px; line-height: 1.65; }
.prose pre code { background: none; border: 0; padding: 0; color: inherit; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 9px 12px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); color: var(--text); font-weight: 650; }
.prose hr { margin: 2em 0; }
.prose img { border-radius: 12px; border: 1px solid var(--border); }

@media print {
  .no-print, .site-header, .site-footer, .sidebar, .topbar, .toasts { display: none !important; }
  body { background: #fff; }
  .shell { display: block; }
}
