:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --sunken: #eceef1;
  --line: #e3e5e9;
  --line-strong: #cfd3d9;
  --ink: #15171c;
  --ink-2: #474c56;
  --ink-3: #6b717c;
  --ink-4: #a5aab3;
  --primary: #15171c;
  --primary-ink: #ffffff;
  --primary-hover: #2b2e35;
  --signal: #16a34a;
  --signal-soft: rgba(22,163,74,.12);
  --warn: #b45309;
  --warn-soft: rgba(245,158,11,.16);
  --danger: #c62828;
  --danger-soft: rgba(220,38,38,.10);
  --info: #2f6fd0;
  --info-soft: rgba(47,111,208,.11);
  --neutral-soft: rgba(115,121,132,.12);
  --row-hover: #f6f7f9;
  --row-selected: #eef0f3;
  --skeleton: #eceef1;
  --skeleton-hi: #f8f9fb;
  --scrim: rgba(15,17,22,.32);
  --shadow-1: 0 1px 2px rgba(16,18,24,.05);
  --shadow-pop: 0 12px 32px -8px rgba(16,18,24,.18), 0 2px 6px rgba(16,18,24,.06);
  --shadow-modal: 0 24px 64px -16px rgba(16,18,24,.28), 0 2px 8px rgba(16,18,24,.06);
  --shadow-drawer: -16px 0 48px -12px rgba(16,18,24,.22);
  --focus: 0 0 0 2px var(--surface), 0 0 0 4px #5b6270;
  --sheen: linear-gradient(180deg, #2a2d34 0%, #15171c 100%);
  --sheen-ink: #f3f4f6;

  --chart-1: #5b6270;
  --chart-2: #2f6fd0;
  --chart-3: #16a34a;
  --chart-4: #c27c0e;
  --chart-5: #8a5cc2;
  --chart-6: #c2410c;
  --chart-7: #0e8a8a;
  --chart-8: #c62828;

  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Unbounded", "Inter", -apple-system, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-full: 999px;
  --dur-1: 120ms; --dur-2: 160ms; --dur-3: 200ms;
  --ease-out: cubic-bezier(.2,.8,.2,1);
  --ease-in: cubic-bezier(.4,0,1,1);

  --bg2: var(--surface);
  --bg3: var(--surface-2);
  --bg-3: var(--surface-2);
  --bg-4: var(--sunken);
  --bg-soft: var(--surface-2);
  --card: var(--surface);
  --text: var(--ink);
  --text2: var(--ink-3);
  --text-muted: var(--ink-3);
  --muted: var(--ink-3);
  --border: var(--line);
  --border-soft: var(--line);
  --accent: var(--ink);
  --accent2: var(--ink-2);
  --green: var(--signal);
  --red: var(--danger);
  --orange: var(--warn);
  --yellow: var(--warn);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101114; --surface: #16181c; --surface-2: #1c1e23; --sunken: #0d0e11;
    --line: #272a31; --line-strong: #363a44;
    --ink: #eceef2; --ink-2: #b6bbc5; --ink-3: #8f95a0; --ink-4: #5f6570;
    --primary: #e9ebef; --primary-ink: #121317; --primary-hover: #ffffff;
    --signal: #30d158; --signal-soft: rgba(48,209,88,.14);
    --warn: #ffb340; --warn-soft: rgba(255,179,64,.14);
    --danger: #ff6b6b; --danger-soft: rgba(255,107,107,.13);
    --info: #6ea8ff; --info-soft: rgba(110,168,255,.14);
    --neutral-soft: rgba(138,144,155,.16);
    --row-hover: #1c1e23; --row-selected: #22252b;
    --skeleton: #1f2227; --skeleton-hi: #2a2d33;
    --scrim: rgba(0,0,0,.58);
    --shadow-1: 0 1px 0 rgba(0,0,0,.3);
    --shadow-pop: 0 16px 40px -8px rgba(0,0,0,.6), 0 0 0 1px #2c3038;
    --shadow-modal: 0 24px 64px -12px rgba(0,0,0,.7), 0 0 0 1px #2c3038;
    --shadow-drawer: -20px 0 60px -10px rgba(0,0,0,.7);
    --focus: 0 0 0 2px var(--surface), 0 0 0 4px #9aa1ad;
    --sheen: linear-gradient(180deg, #f6f7f9 0%, #c9cdd4 100%);
    --sheen-ink: #15171c;
    --chart-1: #bfc4cc; --chart-2: #6ea8ff; --chart-3: #30d158; --chart-4: #ffb340;
    --chart-5: #b48cf2; --chart-6: #ff8a4c; --chart-7: #3cc7c7; --chart-8: #ff6b6b;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101114; --surface: #16181c; --surface-2: #1c1e23; --sunken: #0d0e11;
  --line: #272a31; --line-strong: #363a44;
  --ink: #eceef2; --ink-2: #b6bbc5; --ink-3: #8f95a0; --ink-4: #5f6570;
  --primary: #e9ebef; --primary-ink: #121317; --primary-hover: #ffffff;
  --signal: #30d158; --signal-soft: rgba(48,209,88,.14);
  --warn: #ffb340; --warn-soft: rgba(255,179,64,.14);
  --danger: #ff6b6b; --danger-soft: rgba(255,107,107,.13);
  --info: #6ea8ff; --info-soft: rgba(110,168,255,.14);
  --neutral-soft: rgba(138,144,155,.16);
  --row-hover: #1c1e23; --row-selected: #22252b;
  --skeleton: #1f2227; --skeleton-hi: #2a2d33;
  --scrim: rgba(0,0,0,.58);
  --shadow-1: 0 1px 0 rgba(0,0,0,.3);
  --shadow-pop: 0 16px 40px -8px rgba(0,0,0,.6), 0 0 0 1px #2c3038;
  --shadow-modal: 0 24px 64px -12px rgba(0,0,0,.7), 0 0 0 1px #2c3038;
  --shadow-drawer: -20px 0 60px -10px rgba(0,0,0,.7);
  --focus: 0 0 0 2px var(--surface), 0 0 0 4px #9aa1ad;
  --sheen: linear-gradient(180deg, #f6f7f9 0%, #c9cdd4 100%);
  --sheen-ink: #15171c;
  --chart-1: #bfc4cc; --chart-2: #6ea8ff; --chart-3: #30d158; --chart-4: #ffb340;
  --chart-5: #b48cf2; --chart-6: #ff8a4c; --chart-7: #3cc7c7; --chart-8: #ff6b6b;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
  overflow-x: hidden;
}
button, input, select, textarea { font-family: inherit; }
a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); border-radius: var(--r-sm); }
::selection { background: color-mix(in srgb, var(--ink) 18%, transparent); }
b, strong { font-weight: 600; }
h1, h2, h3, h4 { letter-spacing: -0.01em; }
hr { border: 0; border-top: 1px solid var(--line); }
code { font-family: var(--font-mono); font-size: .92em; }
.mono, .oc-mono, .oc-set-key, .ud-id { font-family: var(--font-mono); }
.text-muted { color: var(--ink-3); }
.text-sm { font-size: 12px; }
.num, td, .stat-card .value { font-variant-numeric: tabular-nums; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.ms-icon {
  font-variation-settings: "opsz" 20, "wght" 400, "FILL" 0, "GRAD" 0;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.login-wrap { background: var(--bg); padding: 16px; }
.login-box {
  width: min(380px, 100%);
  padding: 36px 32px 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-pop);
  animation: ui-rise var(--dur-3) var(--ease-out) both;
}
.login-box > div:first-child > div {
  background: var(--sheen) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), var(--shadow-1) !important;
  border-radius: 14px !important;
  width: 52px !important; height: 52px !important;
}
.login-box > div:first-child .ms-icon { color: var(--sheen-ink) !important; }
.login-box h1 { font-family: var(--font-display); font-weight: 600; font-size: 22px !important; letter-spacing: -0.035em; margin-bottom: 6px; }
.login-box p { font-size: 13px; color: var(--ink-3); margin-bottom: 22px; }
.login-box .btn {
  height: 40px; padding: 0 16px;
  background: var(--primary); color: var(--primary-ink);
  border-radius: var(--r-md); font-size: 14px; font-weight: 550;
}
.login-box .btn:hover { background: var(--primary-hover); opacity: 1; }
.login-box .btn .ms-icon { margin: 0; color: inherit; }
.login-box .error { color: var(--danger); }

.sidebar {
  width: 240px;
  padding: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  backdrop-filter: none;
}
.sidebar .logo {
  height: 60px; padding: 0 16px; margin: 0;
  border-bottom: 0;
  font-family: var(--font-display); font-weight: 650; font-size: 15px; letter-spacing: -0.04em;
  gap: 10px;
}
.sidebar .logo .ms-icon {
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--sheen); color: var(--sheen-ink) !important;
  font-size: 16px !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
  font-variation-settings: "opsz" 20, "FILL" 1;
}
.sidebar .logo span:not(.ms-icon) { color: var(--ink) !important; }
.sidebar nav { padding: 4px 8px 16px; }
.sidebar nav a {
  min-height: 32px; padding: 6px 10px; margin: 1px 0; gap: 10px; line-height: 1.35;
  border-radius: var(--r-sm); border-left: 0 !important;
  color: var(--ink-2); font-size: 13px; font-weight: 450;
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
  cursor: pointer; user-select: none;
}
.sidebar nav a .icon, .sidebar nav a .ms-icon { width: 20px; font-size: 18px; color: var(--ink-3); transition: color var(--dur-1); }
.sidebar nav a:hover { background: var(--sunken); color: var(--ink); text-decoration: none; }
.sidebar nav a:hover .ms-icon { color: var(--ink-2); }
.sidebar nav a.active { background: var(--sunken); color: var(--ink); font-weight: 550; }
.sidebar nav a.active .ms-icon { color: var(--ink); font-variation-settings: "opsz" 20, "FILL" 1; }
.sidebar .nav-section { text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--ink-3); padding: 12px 10px 4px; }
.sidebar .nav-group { border-top: 0; margin-top: 2px; }
.sidebar .nav-group:first-of-type { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.sidebar .nav-group-header {
  height: 32px; padding: 0 10px; gap: 10px; border-radius: var(--r-sm);
  text-transform: none; letter-spacing: 0;
  font-size: 13px; font-weight: 450; color: var(--ink-2);
  transition: background-color var(--dur-1), color var(--dur-1);
}
.sidebar .nav-group-header:hover { background: var(--sunken); color: var(--ink); }
.sidebar .nav-group-icon { width: 20px; font-size: 18px; color: var(--ink-3); }
.sidebar .nav-chevron { font-size: 18px; color: var(--ink-4); opacity: 1; transition: transform var(--dur-2) var(--ease-out); }
.sidebar .nav-group-body { position: relative; padding: 2px 0 6px 0; }
.sidebar .nav-group-body::before { content: ""; position: absolute; left: 19px; top: 2px; bottom: 8px; width: 1px; background: var(--line); }
.sidebar .nav-group-body a { padding-left: 32px; font-size: 13px; min-height: 30px; padding-top: 5px; padding-bottom: 5px; }
.sidebar .nav-group-body a .ms-icon { display: none; }
.sidebar .nav-group:not(.collapsed) .nav-group-body { animation: ui-fade-down var(--dur-2) var(--ease-out); }
.sidebar .logout {
  height: auto; margin: 0; padding: 10px 12px;
  border-top: 1px solid var(--line);
  color: var(--ink-3); font-size: 13px; gap: 8px;
}
.sidebar .logout:hover { color: var(--danger); text-decoration: none; }
.sidebar .logout .ms-icon { margin-right: 0 !important; }
.ui-side-foot { display: flex; align-items: center; gap: 6px; padding: 8px 8px 10px; border-top: 1px solid var(--line); flex-shrink: 0; }
.ui-side-foot .logout { border-top: 0; padding: 0 10px; height: 32px; border-radius: var(--r-sm); flex: 1; display: flex; align-items: center; }
.ui-side-foot .logout:hover { background: var(--danger-soft); }
.ui-theme-btn {
  width: 32px; height: 32px; border-radius: var(--r-sm); border: 0; background: transparent;
  color: var(--ink-3); display: inline-grid; place-items: center; cursor: pointer;
  transition: background-color var(--dur-1), color var(--dur-1);
}
.ui-theme-btn:hover { background: var(--sunken); color: var(--ink); }
.ui-theme-btn .ms-icon { font-size: 18px; }
.ns-navbadge { background: var(--danger); color: #fff; }

.main { padding: 28px 32px 56px; max-width: none; }

.main > [id^="page-"] { max-width: none; }

.ui-burger, .ui-scrim { display: none; }

.page-title {
  font-family: var(--font-display);
  font-weight: 600; font-size: 24px; letter-spacing: -0.035em; line-height: 1.15;
  color: var(--ink);
  margin-bottom: 20px;
}
[id^="page-"] > h2, [id^="page-"] > div:not(.panel):not([class*="card"]) > h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.panel h2, .modal h2 { font-family: var(--font-ui); font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.panel h3 { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.detail-header { gap: 12px; flex-wrap: wrap; }
.detail-header .page-title { margin-bottom: 0; }
.back-btn {
  display: inline-flex; align-items: center; height: 32px; padding: 0 10px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13px;
  transition: border-color var(--dur-1), background-color var(--dur-1);
}
.back-btn:hover { border-color: var(--line-strong); background: var(--surface-2); color: var(--ink); }
.ud-id { border-color: var(--line); color: var(--ink-3); border-radius: var(--r-sm); font-size: 12px; }
.ud-id:hover { border-color: var(--ink-3); color: var(--ink); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 20px;
}

.stats-grid {
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  margin-bottom: 20px;
}
.stat-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line);
  padding: 14px 16px 15px;
  transition: background-color var(--dur-1) var(--ease-out);
  min-width: 0;
}
:not(.stats-grid) > .stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
}
.stat-card[onclick]:hover, .stats-grid > a.stat-card:hover { background: var(--surface-2); cursor: pointer; }
.stat-card .label {
  font-size: 12px; font-weight: 450; color: var(--ink-3);
  text-transform: none; letter-spacing: 0;
}
.stat-card .value {
  font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2;
  margin-top: 6px; color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat-card .value.accent, .stat-card .value.orange { color: var(--ink); }
.stat-card .value.green { color: var(--signal); }
.stat-card .value.red { color: var(--danger); }
.stat-card .value .text-muted { font-weight: 450 !important; }

table { border-collapse: separate; border-spacing: 0; }
th {
  height: 36px; padding: 0 12px;
  font-size: 12px; font-weight: 500; color: var(--ink-3);
  text-transform: none; letter-spacing: 0;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
thead th:first-child { border-top-left-radius: var(--r-sm); }
thead th:last-child { border-top-right-radius: var(--r-sm); }
.panel > table:first-child thead th, .panel > .tbl-scroll:first-child thead th { background: var(--surface-2); }
td { padding: 11px 12px; font-size: 13px; color: var(--ink-2); border-bottom: 1px solid var(--line); vertical-align: middle; }
td b, td strong { color: var(--ink); }
tbody tr:last-child > td { border-bottom: 0; }
tr { transition: background-color var(--dur-1) var(--ease-out); }
tr:hover { background: var(--row-hover); }
thead tr:hover { background: transparent; }
.row-clickable:hover, .a-clickrow:hover { background: var(--row-hover); }
tr[onclick] { cursor: pointer; }
th.th-sort:hover { color: var(--ink); }
th.th-sort .th-sort-ic { opacity: 0; transition: opacity var(--dur-1), transform var(--dur-2) var(--ease-out); }
th.th-sort:hover .th-sort-ic { opacity: .5; }
th.th-sort.th-sort-active { color: var(--ink); }
th.th-sort.th-sort-active .th-sort-ic { opacity: 1; color: var(--ink); }
.tbl-dense th, .tbl-dense td { padding: 7px 9px; }
.tbl-dense th { height: 32px; padding-top: 0; padding-bottom: 0; }
.tbl-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); }

.panel:has(> table:first-child), .panel:has(> .tbl-scroll:first-child) { padding: 0; }
.panel > table:first-child thead th:first-child,
.panel > .tbl-scroll:first-child thead th:first-child { border-top-left-radius: calc(var(--r-lg) - 1px); }
.panel > table:first-child thead th:last-child,
.panel > .tbl-scroll:first-child thead th:last-child { border-top-right-radius: calc(var(--r-lg) - 1px); }
.panel > table:first-child th:first-child, .panel > table:first-child td:first-child,
.panel > .tbl-scroll:first-child th:first-child, .panel > .tbl-scroll:first-child td:first-child { padding-left: 16px; }
.panel > table:first-child th:last-child, .panel > table:first-child td:last-child,
.panel > .tbl-scroll:first-child th:last-child, .panel > .tbl-scroll:first-child td:last-child { padding-right: 16px; }
.panel:has(> table:first-child) > :not(table):not(style):not(script),
.panel:has(> .tbl-scroll:first-child) > :not(.tbl-scroll):not(style):not(script) { margin: 0; padding: 12px 16px; }
.panel:has(> table:first-child) > .pagination:empty,
.panel:has(> .tbl-scroll:first-child) > .pagination:empty { display: none; }
.panel:has(> table:first-child) > .pagination { border-top: 1px solid var(--line); justify-content: flex-end; }

tbody.ui-rows-in > tr { animation: ui-row-in var(--dur-3) var(--ease-out) both; }
tbody.ui-rows-in > tr:nth-child(2) { animation-delay: 12ms; }
tbody.ui-rows-in > tr:nth-child(3) { animation-delay: 24ms; }
tbody.ui-rows-in > tr:nth-child(4) { animation-delay: 36ms; }
tbody.ui-rows-in > tr:nth-child(5) { animation-delay: 48ms; }
tbody.ui-rows-in > tr:nth-child(6) { animation-delay: 60ms; }
tbody.ui-rows-in > tr:nth-child(7) { animation-delay: 72ms; }
tbody.ui-rows-in > tr:nth-child(8) { animation-delay: 84ms; }
tbody.ui-rows-in > tr:nth-child(9) { animation-delay: 96ms; }
tbody.ui-rows-in > tr:nth-child(10) { animation-delay: 108ms; }
tbody.ui-rows-in > tr:nth-child(11) { animation-delay: 120ms; }
tbody.ui-rows-in > tr:nth-child(12) { animation-delay: 132ms; }
tbody.ui-rows-in > tr:nth-child(13) { animation-delay: 144ms; }
tbody.ui-rows-in > tr:nth-child(n+14) { animation-delay: 156ms; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px 0 7px;
  border: 1px solid var(--line); border-radius: var(--r-full);
  font-size: 12px; font-weight: 500; line-height: 1;
  background: transparent; color: var(--ink-2);
  white-space: nowrap; vertical-align: middle;
}
.badge.active, .badge.trial, .badge.blocked, .badge.expired, .badge.free, .badge.premium,
.badge.paid, .badge.success, .badge.pending, .badge.failed, .badge.error, .badge.ok, .badge.warning, .badge.online, .badge.offline {
  padding-left: 7px;
}
.badge.active::before, .badge.trial::before, .badge.blocked::before, .badge.expired::before,
.badge.paid::before, .badge.success::before, .badge.pending::before, .badge.failed::before, .badge.error::before,
.badge.ok::before, .badge.warning::before, .badge.online::before, .badge.offline::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); flex-shrink: 0;
}

.badge.active::before, .badge.paid::before, .badge.success::before, .badge.ok::before, .badge.online::before { background: var(--signal); opacity: .85; }
.badge.trial::before, .badge.pending::before, .badge.warning::before { background: var(--warn); opacity: .85; }
.badge.blocked::before, .badge.failed::before, .badge.error::before { background: var(--danger); opacity: .85; }
.badge.expired, .badge.offline { color: var(--ink-3); }
.badge.expired::before, .badge.offline::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.badge.free, .badge.premium { color: var(--ink-2); }
.badge.oc-grey { color: var(--ink-3); }

.ui-chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 7px; max-width: 100%;
  border: 1px solid var(--line); border-radius: var(--r-full);
  background: transparent; color: var(--ink-2);
  font-size: 11.5px; font-weight: 500; line-height: 1; letter-spacing: 0;
  white-space: nowrap; vertical-align: middle; font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis;
}
.ui-chip + .ui-chip { margin-left: 4px; }
.ui-chip .ms-icon { font-size: 13px; color: var(--ink-3); }
.ui-chip.is-ok::before, .ui-chip.is-warn::before, .ui-chip.is-danger::before, .ui-chip.is-info::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; opacity: .85;
}
.ui-chip.is-ok::before { background: var(--signal); }
.ui-chip.is-warn::before { background: var(--warn); }
.ui-chip.is-danger::before { background: var(--danger); }
.ui-chip.is-info::before { background: var(--ink-3); }
.ui-chip.is-off { color: var(--ink-3); border-style: dashed; }
.ui-chip.is-strong { color: var(--ink); border-color: var(--line-strong); }
.ui-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; }
.ui-chips > .ui-chip + .ui-chip { margin-left: 0; }

.ui-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
  text-transform: none; letter-spacing: 0;
}
.ui-status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-4);
}
.ui-status.is-ok::before { background: var(--signal); box-shadow: none; opacity: .85; }
.ui-status.is-warn::before { background: var(--warn); box-shadow: none; opacity: .85; }
.ui-status.is-danger::before { background: var(--danger); box-shadow: none; opacity: .85; }
.ui-status.is-danger { color: var(--ink); }

.ui-callout {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; margin: 0 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-2); color: var(--ink-2);
  font-size: 12.5px; line-height: 1.55;
}
.ui-callout > .ms-icon { font-size: 16px; line-height: 20px; color: var(--ink-3); flex-shrink: 0; }
.ui-callout.is-warn > .ms-icon { color: var(--warn); }
.ui-callout.is-danger > .ms-icon { color: var(--danger); }
.ui-callout.is-ok > .ms-icon { color: var(--signal); }
.ui-callout b, .ui-callout strong, .ui-callout-title { color: var(--ink); font-weight: 600; }
.ui-callout-title { display: block; margin-bottom: 2px; }
.ui-callout > div { min-width: 0; }

.ui-num { white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; }
.ui-sub { display: block; color: var(--ink-3); font-size: 11px; font-weight: 400; white-space: nowrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink);
  font-size: 13px; font-weight: 500; line-height: 1.2; white-space: nowrap;
  box-shadow: var(--shadow-1);
  cursor: pointer; text-decoration: none;
  transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out),
              color var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out), opacity var(--dur-1);
}
.btn:hover { opacity: 1; transform: none; border-color: var(--line-strong); background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn .ms-icon { font-size: 18px; margin-right: 0; color: inherit; opacity: .85; }
.btn-sm { min-height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn-sm .ms-icon { font-size: 16px; }
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.btn-primary:hover { background: var(--primary-hover); border-color: transparent; color: var(--primary-ink); }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-outline:hover { border-color: var(--line-strong); color: var(--ink); background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); border-color: transparent; color: #fff; }
.btn-success { background: var(--signal); color: #fff; border-color: transparent; }
.btn-success:hover { background: color-mix(in srgb, var(--signal) 88%, #000); border-color: transparent; color: #fff; }
.btn-warning { background: var(--warn-soft); color: var(--warn); border-color: transparent; box-shadow: none; }
.btn-warning:hover { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); border-color: transparent; }
:root[data-theme="dark"] .btn-danger, :root[data-theme="dark"] .btn-success { color: #121317; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-danger, :root:not([data-theme="light"]) .btn-success { color: #121317; }
}

td .btn-danger, td .btn-success, td .btn-warning {
  background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-1);
}
td .btn-danger { color: var(--danger); }
td .btn-success { color: var(--signal); }
td .btn-warning { color: var(--warn); }
td .btn-danger:hover { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
td .btn-success:hover { background: var(--signal-soft); border-color: transparent; color: var(--signal); }
td .btn-warning:hover { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
:root[data-theme="dark"] td .btn-danger, :root[data-theme="dark"] td .btn-success { color: inherit; }
:root[data-theme="dark"] td .btn-danger { color: var(--danger); }
:root[data-theme="dark"] td .btn-success { color: var(--signal); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) td .btn-danger { color: var(--danger); }
  :root:not([data-theme="light"]) td .btn-success { color: var(--signal); }
}
.btn-icon-only { min-width: 32px; padding: 0 7px; }
.btn-icon-only .ms-icon { margin: 0; }
.btn-icon-sm { border-radius: var(--r-sm); color: var(--ink-3); transition: background-color var(--dur-1), color var(--dur-1); }
.btn-icon-sm:hover { background: var(--sunken); color: var(--ink); }
button { -webkit-tap-highlight-color: transparent; }

.input, select.input, textarea.input {
  min-height: 32px; padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md);
  color: var(--ink); font-size: 13px; line-height: 1.3;
  box-shadow: var(--shadow-1);
  transition: border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out), background-color var(--dur-1);
}
textarea.input { line-height: 1.5; padding: 8px 10px; }
.input:hover { border-color: var(--line-strong); }
.input:focus, .input:focus-visible { border-color: var(--ink-3); box-shadow: 0 0 0 3px var(--neutral-soft); border-radius: var(--r-md); }
.input::placeholder, textarea::placeholder, input::placeholder { color: var(--ink-4); }
.input:disabled { opacity: .6; cursor: not-allowed; }
select.input {
  appearance: none; -webkit-appearance: none;
  padding-right: 28px;
  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='%23878d98' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 14px;
  cursor: pointer;
}
html select.tk-select, html select.tk-input {
  appearance: none; -webkit-appearance: none; padding-right: 28px;
  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='%23878d98' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 14px;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--ink); }
input[type="file"]::file-selector-button {
  height: 24px; margin-right: 10px; padding: 0 10px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  font: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
  transition: border-color var(--dur-1), background-color var(--dur-1);
}
input[type="file"]::file-selector-button:hover { border-color: var(--line-strong); background: var(--sunken); }
input[type="date"].input, input[type="datetime-local"].input { font-variant-numeric: tabular-nums; }
input[type="date"]::-webkit-calendar-picker-indicator { opacity: .5; cursor: pointer; }
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
:root[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(1); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) input[type="date"]::-webkit-calendar-picker-indicator,
  :root:not([data-theme="light"]) input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(1); }
}
.form-group label { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-bottom: 6px; }
.search-bar { gap: 8px; margin-bottom: 14px; }
.copyable { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); font-family: var(--font-mono); font-size: 12px; }
.copyable:hover { background: var(--sunken); }

.tabs { gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab {
  position: relative; padding: 9px 12px; margin-bottom: -1px;
  font-size: 13px; font-weight: 500; color: var(--ink-3);
  border-bottom: 2px solid transparent; border-radius: var(--r-sm) var(--r-sm) 0 0;
  transition: color var(--dur-1), border-color var(--dur-2) var(--ease-out), background-color var(--dur-1);
}
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }

html .a-seg { background: var(--sunken) !important; border-radius: var(--r-md) !important; padding: 2px !important; border: 0 !important; }
html .a-seg-btn { border-radius: var(--r-sm) !important; color: var(--ink-2) !important; font-weight: 500 !important; font-size: 12.5px; transition: background-color var(--dur-1), color var(--dur-1), box-shadow var(--dur-1) !important; }
html .a-seg-btn:hover:not(.active):not(:disabled) { color: var(--ink) !important; }
html .a-seg-btn.active { background: var(--surface) !important; color: var(--ink) !important; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--line) !important; }

.uf-chip, .kb-linked-chip, .a-tl-prop {
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2);
  animation: ui-chip-in var(--dur-2) var(--ease-out);
}
.uf-chip b { color: var(--ink-3); font-weight: 500; }
.uf-chip button:hover { color: var(--ink); }
.uf-chip-clear { color: var(--ink-3); font-weight: 500; border-radius: var(--r-sm); }
.uf-chip-clear:hover { color: var(--ink); background: var(--sunken); }
.uf-badge { background: var(--primary); color: var(--primary-ink); font-weight: 600; animation: ui-pop var(--dur-2) var(--ease-out); }
.uf-combo.has-value .input { border-color: var(--ink-3); }
.uf-dd {
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
  box-shadow: var(--shadow-pop);
  animation: ui-pop-in var(--dur-2) var(--ease-out);
  transform-origin: top left;
}
.uf-dd-item { border-radius: var(--r-sm); color: var(--ink-2); }
.uf-dd-item.active, .uf-dd-item:hover { background: var(--sunken); color: var(--ink); }
.uf-dd-item.selected { color: var(--ink); font-weight: 600; }
.uf-dd-item .n { color: var(--ink-4); font-variant-numeric: tabular-nums; }
.uf-pill { background: var(--surface); border-color: var(--line); color: var(--ink-2); height: 28px; padding: 0 11px; display: inline-flex; align-items: center; transition: background-color var(--dur-1), border-color var(--dur-1), color var(--dur-1); }
.uf-pill:hover { border-color: var(--line-strong); color: var(--ink); }
.uf-pill.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 500; }
.uf-pill.on .n { color: inherit; opacity: .7; }
.uf-seg { border: 0; background: var(--sunken); padding: 2px; border-radius: var(--r-md); gap: 2px; }
.uf-seg button { background: transparent; border-radius: var(--r-sm); color: var(--ink-2); height: 26px; transition: background-color var(--dur-1), color var(--dur-1); }
.uf-seg button + button { border-left: 0; }
.uf-seg button.on { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--line); }
.uf-multi-list { border-color: var(--line); border-radius: var(--r-md); }
.uf-multi-list label:hover { background: var(--sunken); }
.uf-sec > h3 { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; color: var(--ink); }
.uf-field > label { font-weight: 500; color: var(--ink-2); }

.uf-backdrop { background: var(--scrim); z-index: 900; animation: ui-fade-in var(--dur-3) var(--ease-out); }
.uf-drawer {
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-drawer);
  transition: transform 160ms var(--ease-in), visibility 0s linear 160ms;
}
.uf-drawer.open { transition: transform var(--dur-3) var(--ease-out), visibility 0s; }
.uf-drawer-head { height: 56px; padding: 0 12px 0 20px; }
.uf-drawer-head h2 { font-size: 16px; font-weight: 600; }
.uf-drawer-foot { padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); }
.uf-drawer-foot .btn-primary { flex: 1; min-height: 36px; }
.uf-drawer-foot .btn { min-height: 36px; }
.uf-x { border-radius: var(--r-md); width: 32px; height: 32px; justify-content: center; align-items: center; }
.uf-x:hover { background: var(--sunken); }

.modal-overlay {
  background: var(--scrim);
  padding: 16px;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.modal-overlay.show { animation: ui-fade-in var(--dur-3) var(--ease-out); }
.modal-overlay.show > .modal { animation: ui-modal-in var(--dur-3) var(--ease-out); }
.modal-overlay.ui-leaving { display: flex; pointer-events: none; animation: ui-fade-out 150ms var(--ease-in) forwards; }
.modal-overlay.ui-leaving > .modal { animation: ui-modal-out 150ms var(--ease-in) forwards; }
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-modal);
  padding: 24px;
  max-width: 100%;
  max-height: min(88vh, 100%);
}
.modal h2 { font-size: 17px; margin-bottom: 14px; }
.modal .actions { gap: 8px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }

.ui-toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 2000;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  pointer-events: none; max-width: calc(100vw - 32px);
}
.toast {
  position: static;
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; max-width: 380px; padding: 9px 14px 9px 12px;
  background: var(--primary); color: var(--primary-ink);
  border: 0; border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  font-size: 13px; line-height: 1.4;
  pointer-events: auto;
  animation: ui-toast-in var(--dur-3) var(--ease-out);
}
body > .toast { position: fixed; top: auto; bottom: 20px; right: 20px; z-index: 2000; }
.toast::before {
  font-family: 'Material Symbols Outlined'; font-size: 18px; line-height: 1; flex-shrink: 0;
  font-variation-settings: "opsz" 20, "FILL" 1;
  content: "check_circle"; color: var(--signal);
}
.toast.error::before { content: "error"; color: var(--danger); }
.toast.warning::before { content: "warning"; color: var(--warn); }
.toast.info::before { content: "info"; color: var(--ink-4); }
:root .toast.success, :root .toast.error, :root .toast.warning { border: 0; }
.toast.ui-out { animation: ui-toast-out 140ms var(--ease-in) forwards; }

.skel, .skel-line, .skel-text {
  background: var(--skeleton) linear-gradient(90deg, transparent 0, var(--skeleton-hi) 50%, transparent 100%) no-repeat;
  background-size: 50% 100%;
  background-position: -150% 0;
  animation: ui-shimmer 1.3s linear infinite;
  border-radius: 5px;
}
.skel { height: 10px; }
.skel-line, .skel-text { height: 10px; }
.skel-badge { height: 20px; border-radius: 10px; }
.skel-avatar { width: 28px; height: 28px; border-radius: 50%; }
.empty { color: var(--ink-3); font-size: 13px; padding: 40px 24px; }

.ui-loading {
  position: relative;
  color: transparent !important;
  user-select: none;
  min-height: 92px;
  padding: 18px 16px !important;
  text-align: left !important;
}
.ui-loading::before {
  content: "";
  position: absolute; left: 16px; right: 16px; top: 18px; height: 58px;
  max-width: 560px;
  background:
    linear-gradient(var(--skeleton) 0 0) 0 0 / 62% 10px no-repeat,
    linear-gradient(var(--skeleton) 0 0) 0 24px / 88% 10px no-repeat,
    linear-gradient(var(--skeleton) 0 0) 0 48px / 44% 10px no-repeat;
  border-radius: 5px;
}
.ui-loading::after {
  content: "";
  position: absolute; left: 16px; right: 16px; top: 18px; height: 58px; max-width: 560px;
  background: linear-gradient(90deg, transparent, var(--skeleton-hi), transparent) no-repeat;
  background-size: 40% 100%;
  animation: ui-shimmer-x 1.3s linear infinite;
  mix-blend-mode: normal;
  -webkit-mask:
    linear-gradient(#000 0 0) 0 0 / 62% 10px no-repeat,
    linear-gradient(#000 0 0) 0 24px / 88% 10px no-repeat,
    linear-gradient(#000 0 0) 0 48px / 44% 10px no-repeat;
          mask:
    linear-gradient(#000 0 0) 0 0 / 62% 10px no-repeat,
    linear-gradient(#000 0 0) 0 24px / 88% 10px no-repeat,
    linear-gradient(#000 0 0) 0 48px / 44% 10px no-repeat;
}

td.ui-loading { height: 220px; padding: 0 !important; }
td.ui-loading::before, td.ui-loading::after {
  left: 16px; right: 16px; top: 0; height: 220px; max-width: none;
  -webkit-mask: none; mask: none;
}
td.ui-loading::before {
  background: repeating-linear-gradient(to bottom, transparent 0 17px, var(--skeleton) 17px 27px, transparent 27px 44px);
  -webkit-mask: repeating-linear-gradient(to right, #000 0 16%, transparent 16% 22%);
          mask: repeating-linear-gradient(to right, #000 0 16%, transparent 16% 22%);
}
td.ui-loading::after {
  -webkit-mask:
    repeating-linear-gradient(to bottom, transparent 0 17px, #000 17px 27px, transparent 27px 44px),
    repeating-linear-gradient(to right, #000 0 16%, transparent 16% 22%);
  -webkit-mask-composite: source-in;
  mask:
    repeating-linear-gradient(to bottom, transparent 0 17px, #000 17px 27px, transparent 27px 44px),
    repeating-linear-gradient(to right, #000 0 16%, transparent 16% 22%);
  mask-composite: intersect;
}
span.ui-loading, .text-muted.ui-loading:not(td):not(div) { display: inline-block; min-width: 180px; min-height: 14px; padding: 0 !important; }
span.ui-loading::before, span.ui-loading::after { top: 2px; left: 0; right: 0; height: 10px; background-size: 100% 10px; -webkit-mask-size: 100% 10px; mask-size: 100% 10px; }

tr.ui-sk-row:hover { background: transparent; }
tr.ui-sk-row td { height: 44px; padding-top: 0; padding-bottom: 0; }
.ui-sk {
  display: block; height: 10px; border-radius: 5px;
  background: var(--skeleton) linear-gradient(90deg, transparent 0, var(--skeleton-hi) 50%, transparent 100%) no-repeat;
  background-size: 50% 100%; background-position: -150% 0;
  animation: ui-shimmer 1.3s linear infinite;
}
.ui-sk.c { width: 28px; height: 28px; border-radius: 50%; }
.ui-sk.p { height: 20px; border-radius: 10px; width: 72px; }
.ui-sk-block { padding: 6px 0; }
.ui-sk-block .ui-sk + .ui-sk { margin-top: 14px; }
.ui-sk-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.ui-sk-kpi { padding: 16px; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.ui-sk-kpi .ui-sk:first-child { width: 60%; }
.ui-sk-kpi .ui-sk + .ui-sk { width: 40%; height: 18px; margin-top: 10px; }

.ui-page-in { animation: ui-page-in var(--dur-3) var(--ease-out); }
.ui-content-in { animation: ui-fade-in var(--dur-3) var(--ease-out); }

.pagination { gap: 4px; margin-top: 14px; }
.pagination button { min-height: 30px; min-width: 32px; padding: 0 10px; }
.pagination .btn-primary { pointer-events: none; }
.user-avatar { background: var(--sunken); box-shadow: 0 0 0 1px var(--line); }
.user-cell { gap: 10px; }
.user-cell, .user-cell * { color: var(--ink); }
.user-cell .text-muted, .user-cell .text-sm { color: var(--ink-3); }
details > summary { cursor: pointer; }
details > summary .ms-icon { transition: transform var(--dur-2) var(--ease-out); }

.ui-pulse { position: relative; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); flex-shrink: 0; vertical-align: middle; }
.ui-pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--signal); animation: ui-heartbeat 2.4s var(--ease-out) infinite; }

html .a-stage-badge { background: var(--neutral-soft); color: var(--ink-2); font-weight: 500; border-radius: var(--r-full); }
html .stage-paid, html .stage-retained { background: var(--signal-soft); color: var(--signal); }
html .stage-checkout { background: var(--warn-soft); color: var(--warn); }
html .stage-signup, html .stage-engaged { background: var(--info-soft); color: var(--info); }
html .a-visitor-card { background: var(--surface-2); border: 1px solid var(--line); }
html .a-id-chip { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
html .a-id-chip.probable { border-style: dashed; }
html .a-tl-item { border-bottom-color: var(--line); }
html .a-session-block { border-color: var(--line); }
html .a-session-head { background: var(--surface-2); }
html .a-grp-head td { background: var(--surface-2); border-top: 1px solid var(--line); }
html .a-grp-head:hover td { background: var(--row-hover); }
html .a-bar-track { background: var(--sunken); border: 0; height: 8px; border-radius: 4px; }
html .a-bar-fill { background: var(--chart-1); border-radius: 4px; transition: width var(--dur-3) var(--ease-out); }
html .a-chart-bar.v { background: var(--chart-1); }
html .a-chart-bar.s { background: var(--chart-4); opacity: 1; }
html .a-conv-item .v { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
html .a-tl-dot { border-color: var(--ink-3); }
html .a-tl-dot .ms-icon { color: var(--ink-3); }
html .a-tl-item.hit .a-tl-dot { border-color: var(--signal); background: var(--signal); }
html .a-sec h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
html .a-note { border-color: var(--line); background: var(--surface-2); border-radius: var(--r-md); }
html .viz-tip { border-color: var(--line); border-radius: var(--r-md); background: var(--surface); }
html .viz-funnel-track { background: var(--sunken); border-radius: var(--r-sm); height: 14px !important; }
html .viz-funnel-fill { border-radius: var(--r-sm); }
html .a-grid { gap: 16px; }
html .a-panel-col h2 { font-weight: 600; }

html .a-panel-col td:not(:first-child), html .a-panel-col th:not(:first-child) { white-space: nowrap; }

.ui-insights { padding: 0; overflow: hidden; }
.ui-insights-head { padding: 16px 20px 10px; }
.ui-insights-head h2 { margin: 0 0 2px; }
.ui-insights-head p { margin: 0; }
.ui-insight {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 16px 12px 20px; border: 0; border-top: 1px solid var(--line);
  background: transparent; color: var(--ink); text-align: left; font: inherit; cursor: pointer;
  transition: background-color var(--dur-1) var(--ease-out);
}
.ui-insight:hover { background: var(--row-hover); }
.ui-insight:hover .ms-icon { transform: translateX(2px); color: var(--ink); }
.ui-insight.is-static { cursor: default; align-items: flex-start; }
.ui-insight.is-static:hover { background: transparent; }
.ui-insight.is-static:hover .ms-icon { transform: none; }
.ui-insight .ms-icon { color: var(--ink-4); transition: transform var(--dur-1) var(--ease-out), color var(--dur-1); }
.ui-insight-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ui-insight-dot.danger { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.ui-insight-dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.ui-insight-dot.info { background: var(--info); box-shadow: 0 0 0 4px var(--info-soft); }
.ui-insight-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.ui-insight-text b { font-weight: 550; }
.ui-insight-lvl { font-size: 12px; white-space: nowrap; }
.ui-insight-lvl.danger { color: var(--danger); }
.ui-insight-lvl.warn { color: var(--warn); }
.ui-insight-lvl.info { color: var(--ink-3); }
@media (max-width: 600px) { .ui-insight-lvl { display: none; } }

html .tk-tabs { background: var(--sunken); border: 0; padding: 3px; border-radius: var(--r-md); }
html .tk-tab { border: 0; border-radius: var(--r-sm); color: var(--ink-2); }
html .tk-tab.active { background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--line); color: var(--ink); }
html .tk-search, html .tk-select, html .tk-chip, html .tk-viewtoggle, html .tk-bell, html .tk-x-btn {
  background: var(--surface); border-color: var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-1);
  transition: border-color var(--dur-1), background-color var(--dur-1), color var(--dur-1), width var(--dur-2) var(--ease-out);
}
html .tk-search:focus { border-color: var(--ink-3); box-shadow: 0 0 0 3px var(--neutral-soft); }
html .tk-chip:hover, html .tk-viewtoggle:hover, html .tk-bell:hover, html .tk-x-btn:hover { border-color: var(--line-strong); color: var(--ink); }
html .tk-chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
html .tk-col { background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r-lg); }
html .tk-col.drag-over { border-color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--ink-3); }
html .tk-col-head { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; color: var(--ink); }
html .tk-col-count { background: var(--surface); color: var(--ink-3); font-weight: 500; font-variant-numeric: tabular-nums; }
html .tk-card {
  background: var(--surface); border-color: var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-1);
  transition: transform var(--dur-1) var(--ease-out), border-color var(--dur-1), box-shadow var(--dur-2);
}
html .tk-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-pop); transform: translateY(-1px); }
html .tk-add-card { border-color: var(--line-strong); border-radius: var(--r-md); }
html .tk-add-card:hover { border-color: var(--ink-3); background: var(--surface); }
html .tk-due { border-radius: var(--r-full); }
html .tk-due.overdue { background: var(--danger-soft); color: var(--danger); }
html .tk-list th, html .tk-sec, html .tk-prop label, html .tk-field label { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 500; }
html .tk-sec { font-size: 13px; font-weight: 600; color: var(--ink); }
html .tk-lab-pill { text-transform: none; letter-spacing: 0; }
html .tk-input, html .tk-textarea, html .tk-ms-box, html .tk-desc-edit { background: var(--surface); border-color: var(--line); border-radius: var(--r-md); }
html .tk-input:focus, html .tk-textarea:focus, html .tk-desc-edit:focus, html .tk-ms-box:focus-within { border-color: var(--ink-3); box-shadow: 0 0 0 3px var(--neutral-soft); }
html .tk-ms-drop { border-color: var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); animation: ui-pop-in var(--dur-2) var(--ease-out); }
html .tk-comment { background: var(--surface-2); border-color: var(--line); }
html .tk-notif.unread { background: var(--row-selected); }
html .kb-node-root > .kb-node-row { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; }

html .kb-wrap { border-color: var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); }
html .kb-sidebar { background: var(--surface-2); border-right-color: var(--line); }
html .kb-search-input { background: var(--surface); border-color: var(--line); border-radius: var(--r-md); }
html .kb-search-input:focus { border-color: var(--ink-3); box-shadow: 0 0 0 3px var(--neutral-soft); }
html .kb-node-row { border-radius: var(--r-sm); transition: background-color var(--dur-1); }
html .kb-node-row:hover { background: var(--sunken); }
html .kb-node-row.active { background: var(--sunken); font-weight: 550; }
html .kb-title-input2 { font-weight: 650; letter-spacing: -0.025em; }
html .kb-editor .cdx-quote { border-left-color: var(--line-strong); }

html .bc-chip { border-color: var(--line); background: var(--surface); transition: background-color var(--dur-1), border-color var(--dur-1), color var(--dur-1); }
html .bc-chip:hover { border-color: var(--line-strong); }
html .bc-chip:has(input:checked) { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
html .lc-campaign-card { border-color: var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); transition: border-color var(--dur-1); }
html .lc-campaign-card:hover { border-color: var(--line-strong); }
html .lc-campaign-card h3 { font-weight: 600; }
html .lc-campaign-stats b { font-weight: 600; font-variant-numeric: tabular-nums; }
html .lc-step-row { border-color: var(--line); border-radius: var(--r-lg); }
html .lc-hint { background: var(--surface-2); border: 1px solid var(--line); }
html .lc-service-note { color: var(--warn); background: var(--warn-soft); }
html .ns-master { background: var(--surface); border-color: var(--line); transition: border-color var(--dur-1), background-color var(--dur-1); }
html .ns-master.on { border-color: var(--ink-3); background: var(--surface-2); }
html .ns-master.on .ms-icon { color: var(--ink); }
html .ns-actions { background: linear-gradient(to top, var(--bg) 65%, transparent); }
html .ar-progress { background: var(--sunken); border: 0; height: 6px; }
html .ar-progress > div { background: var(--ink); }

html .oc-cov { border-radius: var(--r-lg); }
html .oc-cov.ok { border-color: color-mix(in srgb, var(--signal) 40%, transparent); background: var(--signal-soft); }
html .oc-cov.shortfall { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: var(--danger-soft); }
html .oc-cov.unknown { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: var(--warn-soft); }
html .oc-cov.low { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: var(--warn-soft); }
html .oc-cov-head { font-weight: 600; }
html .oc-cov-grid b { font-weight: 600; font-variant-numeric: tabular-nums; }
html .oc-warn { border-color: var(--line); background: var(--surface-2); color: var(--ink-2); border-radius: var(--r-md); }
html .oc-warn b { color: var(--ink); }
html .oc-warn.is-danger { border-color: color-mix(in srgb, var(--danger) 28%, var(--line)); }

html .pp-wrap { border-color: var(--line); border-radius: var(--r-md); }
html .pp-table thead th { background: var(--surface-2); color: var(--ink-3); font-weight: 500; }
html .pp-table td { border-bottom-color: var(--line); }
html .pp-badge.auto, html .pp-badge.manual, html .pp-badge.anchor { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
html .pp-badge.manual { border-style: dashed; }
html .pp-badge.anchor { color: var(--ink); border-color: var(--line-strong); }
html .pp-anchor td { background: color-mix(in srgb, var(--info) 5%, transparent); }

html .blog-tabs button { border-color: var(--line); color: var(--ink-2); border-radius: var(--r-md); }
html .blog-tabs button.active { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
html .blog-tab-dot.on { background: var(--signal); }
html .blog-field label { text-transform: none; letter-spacing: 0; font-weight: 500; }
html .blog-field input, html .blog-field textarea { border-color: var(--line); background: var(--surface); }
html .lang-badge { text-transform: none; }
html .blog-comment { border-color: var(--line); }
html .blog-cover-thumb { border-color: var(--line-strong); background-color: var(--surface-2); }

#page-users > div:first-child { margin-bottom: 16px; }
#page-users > div:first-child .page-title { margin: 0; }
#usersFoundCount { font-size: 13px !important; color: var(--ink-3) !important; font-variant-numeric: tabular-nums; }
#page-users .panel { overflow-x: auto; }
#page-users td { white-space: nowrap; padding-left: 10px; padding-right: 10px; }
#page-users th { padding-left: 10px; padding-right: 10px; }
#page-users .ui-traffic .text-muted:last-child { display: none; }
#page-users td:first-child { color: var(--ink-4); font-variant-numeric: tabular-nums; }
#page-users .user-cell a { color: var(--ink); font-weight: 500; }
.ui-traffic { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.ui-traffic .v { color: var(--ink); min-width: 56px; }
.ui-meter { width: 48px; height: 4px; border-radius: 2px; background: var(--sunken); overflow: hidden; flex-shrink: 0; }
.ui-meter i { display: block; height: 100%; border-radius: 2px; background: var(--ink-3); transform-origin: left; animation: ui-grow var(--dur-3) var(--ease-out) both; }
.ui-meter i.hi { background: var(--warn); }
.ui-online-now { display: inline-flex; align-items: center; gap: 8px; color: var(--signal); font-weight: 500; }
@keyframes ui-grow { from { transform: scaleX(0); } }

html .nu-bar { background: var(--sunken); }
html .a-dup-chip { border-color: var(--line); border-radius: var(--r-md); transition: border-color var(--dur-1), background-color var(--dur-1); }
html .a-dup-chip:hover { border-color: var(--line-strong); background: var(--surface-2); }
html .carrier-logo-card { border-color: var(--line); background: var(--surface); }
html .carrier-logo-pic { background: var(--surface-2); }
html .carrier-logo-actions button { color: var(--ink-2); }
html .carrier-logo-actions button.danger { color: var(--danger); }
html .lookup-suspect > td { background: var(--danger-soft); }

@keyframes ui-shimmer { from { background-position: -150% 0; } to { background-position: 250% 0; } }
@keyframes ui-shimmer-x { from { background-position: -60% 0; } to { background-position: 160% 0; } }
@keyframes ui-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ui-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes ui-fade-down { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
@keyframes ui-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes ui-page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes ui-row-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@keyframes ui-modal-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes ui-modal-out { to { opacity: 0; transform: translateY(4px) scale(.985); } }
@keyframes ui-toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes ui-toast-out { to { opacity: 0; transform: translateY(4px); } }
@keyframes ui-chip-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes ui-pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes ui-pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes ui-heartbeat { 0% { transform: scale(1); opacity: .55; } 70%, 100% { transform: scale(2.6); opacity: 0; } }

@media (max-width: 900px) {
  .sidebar {
    width: 272px; z-index: 1100;
    transform: translateX(-100%);
    transition: transform var(--dur-3) var(--ease-out), box-shadow var(--dur-3);
    height: 100%; height: 100dvh;
  }
  body.ui-nav-open .sidebar { transform: none; box-shadow: 16px 0 48px -12px rgba(0,0,0,.35); }
  .ui-scrim {
    display: block; position: fixed; inset: 0; z-index: 1090; background: var(--scrim);
    opacity: 0; pointer-events: none; transition: opacity var(--dur-3) var(--ease-out);
  }
  body.ui-nav-open .ui-scrim { opacity: 1; pointer-events: auto; }
  .ui-burger {
    display: inline-flex; align-items: center; justify-content: center;
    position: fixed; left: 12px; top: 12px; z-index: 1080;
    width: 40px; height: 40px; border-radius: var(--r-md);
    border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    color: var(--ink); box-shadow: var(--shadow-pop); cursor: pointer;
  }
  .ui-burger .ms-icon { font-size: 22px; }
  .main { margin-left: 0; padding: 66px 16px 40px; }
  .page-title { font-size: 21px; margin-bottom: 16px; }
  .panel { padding: 16px; border-radius: var(--r-lg); }

  .panel { overflow-x: auto; max-width: 100%; }
  .panel > table { min-width: 560px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .stat-card .value { font-size: 19px; }
  .modal { padding: 20px 16px; width: 100% !important; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-overlay .modal { border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92vh; }
  .ui-toasts { left: 16px; right: 16px; bottom: 16px; align-items: stretch; }
  .toast { max-width: none; }
  .form-row { flex-wrap: wrap; }
  .form-row > * { min-width: min(100%, 200px); }
  .search-bar { flex-wrap: wrap; }
  .uf-bar .input, .uf-bar .uf-combo { width: calc(50% - 4px) !important; flex: 1 1 calc(50% - 4px); }
  .uf-bar .uf-search { flex-basis: 100%; width: 100% !important; }
  .uf-open-btn { flex: 1 1 100%; }

  [id^="page-"] > .flex, [id^="page-"] > div > .flex, .detail-header .flex, #userDetailActions,
  [id^="page-"] > div[style*="justify-content:space-between"] { flex-wrap: wrap; }
  [id^="page-"] { min-width: 0; max-width: 100%; }
  .main { overflow-x: clip; }
  .tbl-scroll, .a-scroll { max-width: 100%; }
  .blog-cover-row { flex-wrap: wrap; }
}
@media (max-width: 420px) {
  .stat-card { padding: 12px; }
  .stat-card .value { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
  }
  .ui-pulse::after, .ui-loading::after { display: none; }
  .skel, .skel-line, .skel-text, .ui-sk { background-image: none; }
}

.mon-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.mon-head .page-title { margin: 0; }
.mon-head-sub { color: var(--ink-3); font-size: 12.5px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.mon-head-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.mon-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 16px; overflow-x: auto; scrollbar-width: none; }
.mon-tabs::-webkit-scrollbar { display: none; }
.mon-tabs a { position: relative; padding: 9px 12px 10px; font: 500 13px var(--font-ui); color: var(--ink-3); text-decoration: none;
  white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; border-radius: var(--r-sm) var(--r-sm) 0 0; }
.mon-tabs a:hover { color: var(--ink); background: var(--row-hover); text-decoration: none; }
.mon-tabs a.is-on { color: var(--ink); }
.mon-tabs a.is-on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--ink); border-radius: 2px; }
.mon-tabs a:focus-visible { outline: none; box-shadow: var(--focus); }
.mon-tabs .mon-tab-n { font-size: 11px; color: var(--ink-3); background: var(--neutral-soft); border-radius: var(--r-full); padding: 0 6px; line-height: 17px; }
.mon-tabs .mon-tab-n.is-danger { color: var(--danger); background: var(--danger-soft); }
