/* ==========================================================================
   SKO Healthcare — "Clarity" design system
   Tokens come from App\Support\Theme (Control Center → Settings → Look & feel);
   the values below are only fallbacks for pages rendered without them.
   ========================================================================== */

:root {
  --brand: #2454F0; --brand-600: #1F4AD3; --brand-700: #1B3EB1; --brand-ink: #1F4AD3; --brand-rgb: 36, 84, 240;
  --brand-25: #F8FAFF; --brand-50: #EEF2FE; --brand-100: #DEE6FD; --brand-200: #BCCBFA; --brand-300: #92AAF8; --on-brand: #fff;
  --accent: #0EB5C8; --accent-ink: #087A87; --accent-50: #E7F8FA; --accent-100: #CFF0F4;
  --ink: #0C1633; --ink-2: #3A4461; --muted: #6F7891; --faint: #9AA2B6; --line: #E0E5EE; --line-2: #EBEFF5;
  --canvas: #F2F5FA; --canvas-2: #EBEFF5; --surface: #fff; --surface-2: #F8FAFC; --field: #fff;
  --night: #0A1433; --night-2: #16203E; --night-3: #212A47; --night-line: #232C49; --night-text: #C0C5D1; --night-muted: #7D849A;
  --green: #12A150; --green-ink: #0B7A3B; --green-50: #E8F7EE;
  --amber: #E8920C; --amber-ink: #9A5B00; --amber-50: #FEF4E2;
  --red: #E5484D; --red-ink: #B42328; --red-50: #FDECEC;
  --violet: #7B61FF; --violet-ink: #5B3FE0; --violet-50: #F0EDFF;
  --gray: #8A94AD; --gray-ink: #556079; --gray-50: #EFF2F7;
  --shadow-xs: 0 1px 2px rgba(12,22,51,.06);
  --shadow-sm: 0 1px 2px rgba(12,22,51,.05), 0 4px 14px -8px rgba(12,22,51,.12);
  --shadow: 0 1px 2px rgba(12,22,51,.04), 0 14px 34px -18px rgba(12,22,51,.2);
  --shadow-lg: 0 30px 70px -28px rgba(12,22,51,.42);
  --ring: 0 0 0 4px rgba(36,84,240,.16);
  --font-ui: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Sora', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --r-sm: 8px; --r: 11px; --r-lg: 16px; --r-xl: 22px;
  --ease: cubic-bezier(.2,.8,.2,1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 500 14.5px/1.55 var(--font-ui); color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
table { border-collapse: collapse; }
hr { border: 0; border-top: 1px solid var(--line-2); margin: 20px 0; }
[hidden] { display: none !important; }
::selection { background: var(--brand-100); color: var(--ink); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

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

/* ---------- Typography ---------- */
.h1, h1 { font: 700 clamp(22px, 2.2vw, 27px)/1.18 var(--font-display); letter-spacing: -.025em; }
.h2, h2 { font: 700 20px/1.25 var(--font-display); letter-spacing: -.02em; }
.h3, h3 { font: 650 16px/1.3 var(--font-display); letter-spacing: -.012em; }
.h4, h4 { font: 650 14.5px/1.35 var(--font-display); letter-spacing: -.005em; }
.display { font-family: var(--font-display); letter-spacing: -.02em; }
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--brand-ink); }
.muted { color: var(--muted); } .faint { color: var(--faint); } .ink-2 { color: var(--ink-2); }
.small { font-size: 13px; } .tiny { font-size: 12px; } .big { font-size: 16px; }
.strong, b, strong { font-weight: 700; }
.mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link { color: var(--brand-ink); font-weight: 650; } .link:hover { text-decoration: underline; text-underline-offset: 3px; }
.prose { font-size: 15px; line-height: 1.7; color: var(--ink-2); }
.prose h2 { margin: 1.6em 0 .5em; color: var(--ink); } .prose h3 { margin: 1.4em 0 .4em; color: var(--ink); }
.prose p, .prose ul, .prose ol { margin: 0 0 1em; } .prose ul { list-style: disc; padding-left: 1.3em; } .prose ol { list-style: decimal; padding-left: 1.3em; }
.prose a { color: var(--brand-ink); text-decoration: underline; }

/* ---------- Layout utilities ---------- */
.flex { display: flex; } .inline-flex { display: inline-flex; } .grid { display: grid; }
.items-center { align-items: center; } .items-start { align-items: flex-start; } .items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; } .justify-end { justify-content: flex-end; } .justify-center { justify-content: center; }
.wrap { flex-wrap: wrap; } .col { flex-direction: column; } .grow { flex: 1 1 auto; min-width: 0; } .none { flex: none; }
.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-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-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; } .w-full { width: 100%; } .text-right { text-align: right; } .text-center { text-align: center; }
.stack > * + * { margin-top: 12px; } .stack-lg > * + * { margin-top: 20px; } .stack-sm > * + * { margin-top: 6px; }
.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; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn { --btn-h: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--btn-h); padding: 0 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 650; font-size: 14px; line-height: 1; white-space: nowrap; box-shadow: var(--shadow-xs); transition: background .15s, border-color .15s, box-shadow .15s, transform .12s, color .15s; user-select: none; }
.btn:hover { border-color: var(--brand-200); background: var(--brand-25); }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 17px; height: 17px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 8px 18px -10px rgba(var(--brand-rgb), .9); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-soft { background: var(--brand-50); border-color: transparent; color: var(--brand-ink); box-shadow: none; }
.btn-soft:hover { background: var(--brand-100); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--canvas-2); border-color: transparent; color: var(--ink); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #1b2748; border-color: #1b2748; }
.btn-danger { color: var(--red-ink); }
.btn-danger:hover { background: var(--red-50); border-color: #f6c3c5; }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 8px 18px -10px rgba(18,161,80,.8); }
.btn-success:hover { background: #0e8b44; border-color: #0e8b44; }
.btn-sm { --btn-h: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; gap: 6px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-xs { --btn-h: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn-xs .icon { width: 13px; height: 13px; }
.btn-lg { --btn-h: 48px; padding: 0 22px; font-size: 15px; border-radius: 13px; }
.btn-icon { width: var(--btn-h); padding: 0; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn-group { display: inline-flex; }
.btn-group > .btn + .btn { margin-left: -1px; }
.btn-group > .btn:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.btn-group > .btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 650; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.label .req { color: var(--red); }
.help { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.error { font-size: 12.5px; color: var(--red-ink); font-weight: 600; }
.input, .select, .textarea { width: 100%; min-height: 42px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--field); color: var(--ink); font-size: 14px; font-weight: 500; transition: border-color .15s, box-shadow .15s, background .15s; appearance: none; -webkit-appearance: none; }
.textarea { padding: 10px 12px; line-height: 1.5; resize: vertical; min-height: 88px; }
.select { padding-right: 36px; 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='%236F7891' 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 11px center; cursor: pointer; }
.input:hover, .select:hover, .textarea:hover { border-color: #cdd5e3; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--red); }
.input[readonly] { background: var(--surface-2); color: var(--ink-2); }
.input-sm { min-height: 34px; font-size: 13px; border-radius: 9px; }
.input-lg { min-height: 50px; font-size: 16px; border-radius: 13px; }
.affix { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--r); background: var(--field); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.affix:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.affix > span { display: flex; align-items: center; padding: 0 12px; background: var(--surface-2); color: var(--muted); font-weight: 650; font-size: 13px; white-space: nowrap; }
.affix > span:first-child { border-right: 1px solid var(--line); } .affix > span:last-child { border-left: 1px solid var(--line); }
.affix .input { border: 0; box-shadow: none !important; border-radius: 0; }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon > .input { padding-left: 38px; }
.check { width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid #c3cbd9; background: var(--field); appearance: none; -webkit-appearance: none; display: inline-grid; place-content: center; cursor: pointer; flex: none; transition: .15s; margin: 0; }
.check::after { content: ''; width: 10px; height: 6px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform .12s; }
.check:checked { background: var(--brand); border-color: var(--brand); }
.check:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.check[type="radio"] { border-radius: 50%; }
.check[type="radio"]::after { width: 8px; height: 8px; border: 0; border-radius: 50%; background: #fff; transform: scale(0); }
.check[type="radio"]:checked::after { transform: scale(1); }
.check-line { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 600; font-size: 14px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 650; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 40px; height: 23px; border-radius: 99px; background: #cfd6e3; position: relative; transition: background .18s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(12,22,51,.25); transition: transform .2s var(--ease); }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }
.switch input:disabled + .track { opacity: .5; }
.segmented { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--canvas-2); border: 1px solid var(--line-2); gap: 2px; }
.segmented a, .segmented button, .segmented label { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border-radius: 9px; font-size: 13px; font-weight: 650; color: var(--muted); cursor: pointer; white-space: nowrap; }
.segmented input { display: none; }
.segmented .is-active, .segmented input:checked + span, .segmented a:hover { color: var(--ink); }
.segmented .is-active, .segmented label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 18px; }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-6 { grid-column: span 6; } .span-4 { grid-column: span 4; } .span-3 { grid-column: span 3; }
.color-field { display: flex; gap: 8px; align-items: center; }
.color-field input[type="color"] { width: 42px; height: 42px; padding: 3px; border: 1px solid var(--line); border-radius: var(--r); background: var(--field); cursor: pointer; flex: none; }
.image-field { display: flex; align-items: center; gap: 14px; }
.image-preview { width: 76px; height: 76px; border-radius: 14px; border: 1px dashed #cbd3e1; background: var(--surface-2); display: grid; place-items: center; color: var(--faint); overflow: hidden; flex: none; }
.image-preview img { width: 100%; height: 100%; object-fit: contain; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.checklist label { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; font-weight: 600; font-size: 13.5px; cursor: pointer; background: var(--field); transition: .15s; }
.checklist label:hover { border-color: var(--brand-200); }
.checklist label:has(input:checked) { border-color: var(--brand-300); background: var(--brand-25); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); min-height: 60px; }
.card-head.no-line { border-bottom: 0; padding-bottom: 4px; }
.card-title { font: 650 15.5px/1.3 var(--font-display); letter-spacing: -.012em; display: flex; align-items: center; gap: 9px; }
.card-title .icon { color: var(--muted); }
.card-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; font-weight: 500; }
.card-body { padding: 18px 20px; }
.card-body.tight { padding: 8px 12px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; }
.card-link { font-size: 13px; font-weight: 650; color: var(--brand-ink); display: inline-flex; align-items: center; gap: 4px; margin-left: auto; white-space: nowrap; }
.card-link:hover { gap: 7px; }
.card.pad { padding: 20px; }
.card-flat { box-shadow: none; }
.card-soft { background: var(--surface-2); border-color: var(--line-2); box-shadow: none; }

/* ---------- Chips & badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px 0 8px; border-radius: 99px; font-size: 12px; font-weight: 650; white-space: nowrap; background: var(--gray-50); color: var(--gray-ink); line-height: 1; }
.chip > i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip-green { background: var(--green-50); color: var(--green-ink); }
.chip-blue { background: var(--brand-50); color: var(--brand-ink); }
.chip-amber { background: var(--amber-50); color: var(--amber-ink); }
.chip-red { background: var(--red-50); color: var(--red-ink); }
.chip-violet { background: var(--violet-50); color: var(--violet-ink); }
.chip-aqua { background: var(--accent-50); color: var(--accent-ink); }
.chip-gray { background: var(--gray-50); color: var(--gray-ink); }
.chip-solid { background: var(--brand); color: #fff; }
.chip-outline { background: transparent; border: 1px solid var(--line); color: var(--ink-2); }
.chip-lg { height: 28px; padding: 0 12px; font-size: 13px; }
.chip .icon { width: 13px; height: 13px; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 6px; font-size: 11.5px; font-weight: 700; background: var(--canvas-2); color: var(--ink-2); letter-spacing: .01em; white-space: nowrap; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; font-size: 11px; font-weight: 750; background: var(--canvas-2); color: var(--ink-2); line-height: 1; }
.count-red { background: var(--red); color: #fff; } .count-brand { background: var(--brand); color: #fff; } .count-amber { background: var(--amber); color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--gray); }
.dot-green { background: var(--green); } .dot-amber { background: var(--amber); } .dot-red { background: var(--red); } .dot-blue { background: var(--brand); }
.dot-live { position: relative; background: var(--green); }
.dot-live::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; background: var(--green); opacity: .35; animation: pulse-ring 1.8s var(--ease) infinite; }
@keyframes pulse-ring { 0% { transform: scale(.5); opacity: .5; } 100% { transform: scale(1.6); opacity: 0; } }
.type-chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px 0 6px; border-radius: 99px; background: var(--tc-50); color: var(--tc-ink); font-size: 12px; font-weight: 700; white-space: nowrap; }
.type-chip .icon { width: 14px; height: 14px; color: var(--tc); }
.type-tile { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--tc-50); color: var(--tc); flex: none; }
.type-tile .icon { width: 21px; height: 21px; stroke-width: 1.8; }
.type-tile.lg { width: 52px; height: 52px; border-radius: 15px; } .type-tile.lg .icon { width: 26px; height: 26px; }
.type-tile.sm { width: 30px; height: 30px; border-radius: 9px; } .type-tile.sm .icon { width: 16px; height: 16px; }

/* ---------- Avatars ---------- */
.avatar { --av: 36px; width: var(--av); height: var(--av); border-radius: 50%; display: grid; place-items: center; font: 700 calc(var(--av) * .36)/1 var(--font-display); letter-spacing: -.02em; background: var(--brand-50); color: var(--brand-ink); flex: none; overflow: hidden; text-transform: uppercase; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { --av: 24px; } .avatar-sm { --av: 30px; } .avatar-lg { --av: 48px; } .avatar-xl { --av: 72px; }
.avatar.h1 { background: #E6EDFF; color: #2447C9; } .avatar.h2 { background: #DDF6F3; color: #0B7F76; }
.avatar.h3 { background: #FFEBDD; color: #B4540E; } .avatar.h4 { background: #F1E8FF; color: #6D3FD6; }
.avatar.h5 { background: #FFE4EC; color: #C0265A; } .avatar.h6 { background: #E3F4FF; color: #0B6EB0; }
.avatar.h7 { background: #EAF6DF; color: #3F7D16; } .avatar.h8 { background: #FFF3CF; color: #946200; }
.avatar-stack { display: flex; } .avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; } .avatar-stack .avatar:first-child { margin-left: 0; }
.person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.person b { display: block; font-weight: 650; font-size: 14px; color: var(--ink); line-height: 1.3; }
.person small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.35; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th { position: sticky; top: 0; z-index: 1; text-align: left; font-size: 12px; font-weight: 650; color: var(--muted); background: var(--surface-2); padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th a { display: inline-flex; align-items: center; gap: 4px; }
.table th a:hover { color: var(--ink); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--brand-25); }
.table tr.is-link { cursor: pointer; }
.table .col-check { width: 44px; padding-right: 0; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.table-compact td { padding: 9px 14px; } .table-compact th { padding: 8px 14px; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 0; }
.row-actions { display: inline-flex; gap: 2px; opacity: .75; transition: opacity .15s; }
.table tr:hover .row-actions { opacity: 1; }
.cell-main b { font-weight: 650; display: block; line-height: 1.3; }
.cell-main small { color: var(--muted); font-size: 12.5px; display: block; }
.thumb { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; background: var(--canvas-2); flex: none; }

/* ---------- Lists ---------- */
.list > li, .list-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line-2); }
.list > li:last-child, .list-row:last-child { border-bottom: 0; }
a.list-row:hover, .list > li.is-link:hover { background: var(--brand-25); }
.kv { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 9px 14px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 550; }
.kv dd { font-weight: 600; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 12px 12px 13px; font-size: 14px; font-weight: 650; color: var(--muted); white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs .is-active { color: var(--ink); }
.tabs .is-active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2.5px; border-radius: 3px 3px 0 0; background: var(--brand); }
.tabs .count { font-size: 11px; }
.tabs .is-active .count { background: var(--brand-50); color: var(--brand-ink); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pills a, .pills button { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 650; color: var(--ink-2); white-space: nowrap; }
.pills a:hover, .pills button:hover { border-color: var(--brand-200); color: var(--ink); }
.pills .is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.pills .is-active .count { background: rgba(255,255,255,.18); color: #fff; }

/* ---------- Alerts, toasts, empty ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: var(--r-lg); font-size: 14px; border: 1px solid transparent; }
.alert > .icon { margin-top: 1px; }
.alert b { display: block; margin-bottom: 2px; }
.alert-info { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.alert-success { background: var(--green-50); color: var(--green-ink); border-color: #c8ecd6; }
.alert-warning { background: var(--amber-50); color: var(--amber-ink); border-color: #f7ddb0; }
.alert-danger { background: var(--red-50); color: var(--red-ink); border-color: #f6c9cb; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 11px; min-width: 280px; max-width: 420px; padding: 12px 14px 12px 12px; border-radius: 14px; background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); font-weight: 600; font-size: 14px; animation: toast-in .35s var(--ease); }
.toast .toast-icon { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,.12); flex: none; }
.toast-success .toast-icon { background: var(--green); } .toast-error .toast-icon { background: var(--red); }
.toast button { margin-left: auto; opacity: .6; } .toast button:hover { opacity: 1; }
.toast.is-leaving { animation: toast-out .25s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 44px 24px; color: var(--muted); }
.empty-art { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); margin-bottom: 8px; position: relative; }
.empty-art::after { content: ''; position: absolute; inset: -8px; border-radius: 26px; border: 1px dashed var(--brand-200); }
.empty-art .icon { width: 28px; height: 28px; }
.empty b { color: var(--ink); font: 650 16px var(--font-display); }
.empty p { max-width: 380px; font-size: 14px; }
.empty .btn { margin-top: 10px; }

/* ---------- Dropdowns & modals ---------- */
.dropdown { position: relative; }
.menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; min-width: 220px; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top right; pointer-events: none; transition: opacity .16s, transform .16s var(--ease); }
.menu.left { left: 0; right: auto; transform-origin: top left; }
.dropdown.is-open > .menu { opacity: 1; transform: none; pointer-events: auto; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink-2); text-align: left; }
.menu a:hover, .menu button:hover { background: var(--canvas); color: var(--ink); }
.menu .icon { color: var(--muted); }
.menu hr { margin: 6px 4px; }
.menu-label { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.menu .danger { color: var(--red-ink); } .menu .danger .icon { color: var(--red); }
.modal-backdrop { position: fixed; inset: 0; z-index: 150; background: rgba(8, 14, 34, .46); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.modal-backdrop.is-open { opacity: 1; pointer-events: auto; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); transform: translateY(10px) scale(.98); transition: transform .25s var(--ease); }
.modal-backdrop.is-open .modal { transform: none; }
.modal-lg { width: min(820px, 100%); } .modal-sm { width: min(420px, 100%); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 6px; }
.modal-head h3 { font-size: 18px; }
.modal-head p { color: var(--muted); font-size: 14px; margin-top: 3px; }
.modal-body { padding: 14px 22px 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; }
.modal-close { margin-left: auto; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.modal-close:hover { background: var(--canvas); color: var(--ink); }

/* ---------- Progress & meters ---------- */
.progress { height: 8px; border-radius: 99px; background: var(--canvas-2); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); transition: width .6s var(--ease); }
.progress.green > span { background: var(--green); } .progress.amber > span { background: var(--amber); } .progress.red > span { background: var(--red); } .progress.aqua > span { background: var(--accent); }
.progress.thin { height: 5px; }
.ring { --p: 0; --size: 64px; --thick: 7px; --color: var(--brand); width: var(--size); height: var(--size); border-radius: 50%; background: conic-gradient(var(--color) calc(var(--p) * 1%), var(--canvas-2) 0); display: grid; place-items: center; flex: none; }
.ring::before { content: ''; grid-area: 1 / 1; width: calc(var(--size) - var(--thick) * 2); height: calc(var(--size) - var(--thick) * 2); border-radius: 50%; background: var(--surface); }
.ring > * { grid-area: 1 / 1; position: relative; font: 700 14px var(--font-display); }

/* ---------- Charts (server-rendered SVG) ---------- */
.chart { width: 100%; height: auto; overflow: visible; }
.chart text { font: 600 10.5px var(--font-ui); fill: var(--faint); }
.chart .grid-line { stroke: var(--line-2); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart .area { fill: url(#brandFade); fill: rgba(var(--brand-rgb), .09); }
.chart .dot { fill: var(--surface); stroke: var(--brand); stroke-width: 2.5; }
.chart .bar { fill: var(--brand); } .chart .bar-2 { fill: var(--accent); } .chart .bar-3 { fill: var(--brand-200); } .chart .bar-4 { fill: var(--amber); } .chart .bar-5 { fill: var(--violet); }
.chart .bar:hover, .chart rect:hover { opacity: .85; }
.spark { width: 100%; height: 36px; color: var(--brand); }
.spark svg { width: 100%; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* ---------- Pagination ---------- */
.pager { display: flex; align-items: center; gap: 4px; }
.pager a, .pager span { min-width: 34px; height: 34px; padding: 0 8px; border-radius: 9px; display: inline-grid; place-items: center; font-size: 13px; font-weight: 650; color: var(--ink-2); }
.pager a:hover { background: var(--canvas-2); color: var(--ink); }
.pager .is-active { background: var(--ink); color: #fff; }
.pager .is-disabled { color: var(--faint); }

/* ---------- Misc ---------- */
.kbd, kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 6px; border: 1px solid var(--line); border-bottom-width: 2px; background: var(--surface); font: 650 11px var(--font-ui); color: var(--muted); }
.divider { height: 1px; background: var(--line-2); margin: 16px 0; }
.vr { width: 1px; align-self: stretch; background: var(--line-2); }
.skeleton { background: linear-gradient(90deg, var(--canvas-2), var(--canvas), var(--canvas-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 700; padding: 2px 6px 2px 4px; border-radius: 99px; }
.delta .icon { width: 13px; height: 13px; stroke-width: 2.4; }
.delta.up { color: var(--green-ink); background: var(--green-50); }
.delta.down { color: var(--red-ink); background: var(--red-50); }
.delta.flat { color: var(--gray-ink); background: var(--gray-50); }
.pulse-line { stroke-dasharray: 360; stroke-dashoffset: 360; animation: draw-pulse 2.4s var(--ease) forwards; }
@keyframes draw-pulse { to { stroke-dashoffset: 0; } }
.fade-up { animation: fade-up .5s var(--ease) both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 900px) {
  .cols-3, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-8, .span-6, .span-4, .span-3 { grid-column: span 12; }
}
@media (max-width: 600px) {
  .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
