/* ==========================================================================
   kptVPN admin — design system v2 (emerald, dark first).
   Loaded after admin.css: tokens + shell + the shared component vocabulary
   (ops-*, ka-*, tf-*, au-*, ou-*) that every section is built from.
   ========================================================================== */

/* ---------- Tokens ---------- */
.am-shell, dialog#modal.am-modal {
  --ax-bg: #050c09;
  --ax-side: #07110d;
  --ax-surface: #0a1612;
  --ax-raised: #0e1c17;
  --ax-sunken: #061009;
  --ax-hover: rgba(110, 231, 183, .055);
  --ax-selected: rgba(16, 185, 129, .13);
  --ax-line: rgba(167, 243, 208, .085);
  --ax-line-2: rgba(167, 243, 208, .15);
  --ax-text: #e8f3ed;
  --ax-text-2: #b8ccc1;
  --ax-muted: #7f978b;
  --ax-accent: #34d399;
  --ax-accent-strong: #10b981;
  --ax-accent-hover: #34d399;
  --ax-accent-ink: #022519;
  --ax-accent-soft: rgba(16, 185, 129, .14);
  --ax-ring: 0 0 0 3px rgba(16, 185, 129, .28);
  --ax-ok: #4ade80; --ax-ok-bg: rgba(34, 197, 94, .12);
  --ax-warn: #fbbf24; --ax-warn-bg: rgba(251, 191, 36, .11);
  --ax-bad: #fb7185; --ax-bad-bg: rgba(244, 63, 94, .11);
  --ax-info: #7dd3fc; --ax-info-bg: rgba(56, 189, 248, .1);
  --ax-radius: 16px;
  --ax-radius-sm: 10px;
  --ax-shadow: inset 0 1px 0 rgba(255, 255, 255, .025), 0 10px 30px -18px rgba(0, 0, 0, .8);
  --ax-pop: 0 24px 60px -12px rgba(0, 0, 0, .75), 0 0 0 1px rgba(167, 243, 208, .06);
  --ax-top-h: 60px;
  --ax-side-w: 272px;
  --ax-font: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ax-display: Outfit, Manrope, system-ui, sans-serif;
  --ax-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  /* The admin keeps its own emerald even when the cabinet is rebranded. */
  --color-accent-300: 110, 231, 183;
  --color-accent-400: 52, 211, 153;
  --color-accent-500: 16, 185, 129;
  --color-accent-600: 5, 150, 105;
  --color-accent-700: 4, 120, 87;
  /* Legacy names read by section styles in admin.css */
  --am-bg: var(--ax-bg); --am-side: var(--ax-side); --am-surface: var(--ax-surface); --am-sunken: var(--ax-sunken);
  --am-hover: var(--ax-hover); --am-selected: var(--ax-selected); --am-line: var(--ax-line); --am-text: var(--ax-text);
  --am-text-2: var(--ax-text-2); --am-muted: var(--ax-muted); --am-accent: var(--ax-accent); --am-shadow: var(--ax-shadow);
  color-scheme: dark;
}
html.light .am-shell, html[data-theme="light"] .am-shell,
html.light dialog#modal.am-modal, html[data-theme="light"] dialog#modal.am-modal {
  --ax-bg: #f2f6f4;
  --ax-side: #fbfdfc;
  --ax-surface: #ffffff;
  --ax-raised: #ffffff;
  --ax-sunken: #f5f9f7;
  --ax-hover: rgba(4, 120, 87, .05);
  --ax-selected: rgba(16, 185, 129, .12);
  --ax-line: #e2ebe6;
  --ax-line-2: #cddcd3;
  --ax-text: #0f241a;
  --ax-text-2: #33503f;
  --ax-muted: #5c7466;
  --ax-accent: #047857;
  --ax-accent-strong: #059669;
  --ax-accent-hover: #047857;
  --ax-accent-ink: #ffffff;
  --ax-accent-soft: rgba(16, 185, 129, .1);
  --ax-ok: #15803d; --ax-ok-bg: rgba(34, 197, 94, .1);
  --ax-warn: #a16207; --ax-warn-bg: rgba(234, 179, 8, .12);
  --ax-bad: #be123c; --ax-bad-bg: rgba(244, 63, 94, .08);
  --ax-info: #0369a1; --ax-info-bg: rgba(14, 165, 233, .09);
  --ax-shadow: 0 1px 2px rgba(15, 50, 30, .04), 0 6px 20px -14px rgba(15, 50, 30, .25);
  --ax-pop: 0 24px 60px -16px rgba(15, 50, 30, .3), 0 0 0 1px rgba(15, 50, 30, .06);
  --am-bg: var(--ax-bg); --am-side: var(--ax-side); --am-surface: var(--ax-surface); --am-sunken: var(--ax-sunken);
  --am-hover: var(--ax-hover); --am-selected: var(--ax-selected); --am-line: var(--ax-line); --am-text: var(--ax-text);
  --am-text-2: var(--ax-text-2); --am-muted: var(--ax-muted); --am-accent: var(--ax-accent); --am-shadow: var(--ax-shadow);
  color-scheme: light;
}
.am-shell .ops-app, .am-dialog {
  --o-text: var(--ax-text); --o-text-2: var(--ax-text-2); --o-muted: var(--ax-muted);
  --o-line: var(--ax-line); --o-line-strong: var(--ax-line-2);
  --o-card: var(--ax-surface); --o-raised: var(--ax-raised); --o-sunken: var(--ax-sunken); --o-hover: var(--ax-hover);
  --o-accent: var(--ax-accent-strong); --o-accent-soft: var(--ax-accent-soft); --o-accent-text: var(--ax-accent);
  --o-ring: var(--ax-ring);
  --o-ok: var(--ax-ok); --o-ok-bg: var(--ax-ok-bg); --o-warn: var(--ax-warn); --o-warn-bg: var(--ax-warn-bg);
  --o-bad: var(--ax-bad); --o-bad-bg: var(--ax-bad-bg);
  --o-radius: var(--ax-radius); --o-radius-sm: var(--ax-radius-sm);
}

/* ---------- Shell ---------- */
body.ax-body { background: var(--ax-bg, #050c09); }
html.light body.ax-body, html[data-theme="light"] body.ax-body { background: #f2f6f4; }
.ax {
  min-height: 100dvh;
  color: var(--ax-text);
  font-family: var(--ax-font);
  background:
    radial-gradient(900px 340px at 78% -160px, rgba(16, 185, 129, .085), transparent 70%),
    var(--ax-bg);
  -webkit-font-smoothing: antialiased;
}
html.light .ax, html[data-theme="light"] .ax { background: radial-gradient(900px 340px at 78% -160px, rgba(16, 185, 129, .07), transparent 70%), var(--ax-bg); }
.ax a { color: inherit; text-decoration: none; }
:where(.ax) button { font: inherit; color: inherit; }
.ax :focus-visible { outline: 2px solid var(--ax-accent); outline-offset: 2px; }
.ax-icon { width: 20px; height: 20px; flex-shrink: 0; }
/* `hidden` always wins: section styles often set display on the same element (the chart tooltip
   stayed on screen after hideTip() because of display:grid). */
.ax [hidden], .am-dialog [hidden], .ac-tip[hidden] { display: none !important; }
.ax kbd {
  display: inline-flex; align-items: center; gap: 2px; padding: 1px 6px; border: 1px solid var(--ax-line-2); border-bottom-width: 2px;
  border-radius: 6px; color: var(--ax-muted); font: 500 10.5px/1.5 var(--ax-mono); white-space: nowrap;
}

/* Sidebar */
.ax-side {
  position: fixed; inset: 0 auto 0 0; z-index: 50; display: flex; flex-direction: column;
  width: var(--ax-side-w); padding: calc(16px + var(--safe-top, 0px)) 12px calc(12px + var(--safe-bottom, 0px));
  border-right: 1px solid var(--ax-line); background: var(--ax-side);
}
.ax-side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 4px 16px; }
.ax-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.ax-brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0; border-radius: 11px;
  background: linear-gradient(150deg, rgba(52, 211, 153, .28), rgba(4, 120, 87, .12) 60%, rgba(2, 44, 34, .3));
  border: 1px solid rgba(110, 231, 183, .22); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 6px 18px -8px rgba(16, 185, 129, .6);
}
.ax-brand-text { min-width: 0; }
.ax-brand-text strong { display: block; font: 700 17px/1.1 var(--ax-display); letter-spacing: -.01em; }
.ax-brand-text small { display: block; margin-top: 3px; color: var(--ax-muted); font-size: 11.5px; font-weight: 600; }
.ax-side .ax-side-close { display: none; }
.ax-cmd {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 40px; margin: 0 0 10px; padding: 0 8px 0 11px;
  border: 1px solid var(--ax-line-2); border-radius: var(--ax-radius-sm); background: var(--ax-sunken); color: var(--ax-muted);
  font-size: 13px; text-align: left; cursor: pointer; transition: border-color .15s, color .15s, background-color .15s;
}
.ax-cmd span { flex: 1; }
.ax-cmd .ax-icon { width: 17px; height: 17px; }
.ax-cmd:hover { border-color: rgba(52, 211, 153, .35); color: var(--ax-text-2); }
.ax-nav { flex: 1; min-height: 0; margin: 0 -6px; padding: 4px 6px 8px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--ax-line-2) transparent; }
.ax-group { margin-top: 10px; }
.ax-group-head {
  display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 6px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ax-muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
}
.ax-group-head:hover { color: var(--ax-text-2); }
.ax-group-chevron { width: 14px; height: 14px; transition: transform .18s; transform: rotate(-90deg); opacity: .7; }
.ax-group.is-open .ax-group-chevron { transform: none; }
.ax-group-items { display: none; padding-top: 2px; }
.ax-group.is-open .ax-group-items { display: block; }
.ax-link {
  position: relative; display: flex; align-items: center; gap: 11px; min-height: 38px; margin: 1px 0; padding: 0 10px;
  border-radius: 9px; color: var(--ax-text-2); font-size: 13.5px; font-weight: 550; line-height: 1.25;
  transition: background-color .14s, color .14s;
}
.ax-link > span:not(.ax-badge) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ax-link .ax-icon { width: 18px; height: 18px; color: var(--ax-muted); transition: color .14s; }
.ax-link:hover { background: var(--ax-hover); color: var(--ax-text); }
.ax-link:hover .ax-icon { color: var(--ax-text-2); }
.ax-link.is-active { background: var(--ax-selected); color: var(--ax-text); font-weight: 700; }
.ax-link.is-active .ax-icon { color: var(--ax-accent); }
.ax-link.is-active::before { content: ""; position: absolute; left: -6px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--ax-accent); box-shadow: 0 0 12px rgba(52, 211, 153, .7); }
.ax-link--quiet { color: var(--ax-muted); }
.ax-link-go { width: 15px !important; height: 15px !important; opacity: .6; }
.ax-badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--ax-accent-strong); color: var(--ax-accent-ink); font: 700 11px/1 var(--ax-font); font-variant-numeric: tabular-nums;
}
.ax-nav-empty { padding: 12px 10px; color: var(--ax-muted); font-size: 12.5px; }
.ax-side-foot { display: grid; gap: 4px; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--ax-line); }
.ax-prefs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 4px; }
.ax-pref {
  display: flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 8px; border: 1px solid var(--ax-line);
  border-radius: 9px; background: transparent; color: var(--ax-muted); font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.ax-pref .ax-icon { width: 15px; height: 15px; }
.ax-pref:hover { color: var(--ax-text); border-color: var(--ax-line-2); background: var(--ax-hover); }
.ax-account { display: flex; align-items: center; gap: 10px; margin-top: 4px; padding: 8px; border: 1px solid var(--ax-line); border-radius: 12px; background: var(--ax-surface); }
.ax-avatar {
  display: grid; place-items: center; width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px;
  background: linear-gradient(150deg, #10b981, #047857); color: #ecfdf5; font: 700 14px/1 var(--ax-display);
}
.ax-account-text { flex: 1; min-width: 0; }
.ax-account-text strong, .ax-account-text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ax-account-text strong { font-size: 13px; }
.ax-account-text small { margin-top: 2px; color: var(--ax-muted); font-size: 11.5px; }
.ax-icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; padding: 0; border: 1px solid var(--ax-line);
  border-radius: 10px; background: transparent; color: var(--ax-muted); cursor: pointer; transition: color .14s, background-color .14s, border-color .14s;
}
.ax-icon-btn .ax-icon { width: 18px; height: 18px; }
.ax-icon-btn:hover { color: var(--ax-text); background: var(--ax-hover); border-color: var(--ax-line-2); }

/* Workspace + top bar */
.ax-workspace { min-width: 0; margin-left: var(--ax-side-w); }
.ax-top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  min-height: calc(var(--ax-top-h) + var(--safe-top, 0px)); padding: var(--safe-top, 0px) 32px 0;
  border-bottom: 1px solid var(--ax-line); background: color-mix(in srgb, var(--ax-bg) 94%, transparent);
}
.ax-menu-btn, .ax-top-brand { display: none; }
.ax-crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--ax-muted); }
.ax-crumbs a { color: var(--ax-muted); transition: color .14s; }
.ax-crumbs a:hover { color: var(--ax-text); }
.ax-crumbs span { white-space: nowrap; }
.ax-crumbs strong { display: inline-flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; color: var(--ax-text); font-weight: 650; white-space: nowrap; text-overflow: ellipsis; }
.ax-crumbs strong .ax-icon { width: 16px; height: 16px; color: var(--ax-accent); }
.ax-crumb-sep { width: 14px !important; height: 14px !important; opacity: .5; }
.ax-top-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.ax-find {
  display: flex; align-items: center; gap: 9px; width: 260px; height: 36px; padding: 0 7px 0 11px; border: 1px solid var(--ax-line-2);
  border-radius: 10px; background: var(--ax-surface); color: var(--ax-muted); font-size: 13px; cursor: pointer; transition: border-color .15s, color .15s;
}
.ax-find span { flex: 1; text-align: left; }
.ax-find .ax-icon { width: 16px; height: 16px; }
.ax-find:hover { border-color: rgba(52, 211, 153, .35); color: var(--ax-text-2); }
.ax-mode { padding: 4px 9px; border: 1px solid rgba(251, 191, 36, .3); border-radius: 999px; background: var(--ax-warn-bg); color: var(--ax-warn); font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.ax-main { width: 100%; max-width: 1440px; margin: 0 auto; padding: 28px 32px calc(48px + var(--safe-bottom, 0px)); box-sizing: border-box; }
/* The cabinet's page-enter animation keeps a transform on #page-content (fill-mode both), which
   turns it into the containing block of position:fixed children — record drawers then open inside
   the content column. In the admin the page only fades in. */
.ax #page-content { animation: ax-page-in .2s ease-out; }
@keyframes ax-page-in { from { opacity: .4; } }
.ax-page-loading { display: flex; justify-content: center; gap: 7px; padding: 120px 0; }
.ax-page-loading span { width: 8px; height: 8px; border-radius: 50%; background: var(--ax-accent); animation: ax-dot 1s infinite ease-in-out; }
.ax-page-loading span:nth-child(2) { animation-delay: .15s; }
.ax-page-loading span:nth-child(3) { animation-delay: .3s; }
@keyframes ax-dot { 0%, 80%, 100% { transform: scale(.5); opacity: .35; } 40% { transform: scale(1); opacity: 1; } }
.ax-scrim { display: none; }
.ax-tabbar { display: none; }

/* Command palette */
.ax-palette { position: fixed; inset: 0; z-index: 95; }
.ax-palette[hidden] { display: none; }
.ax-palette-backdrop { position: absolute; inset: 0; background: rgba(1, 6, 4, .72); animation: ax-fade .15s ease-out; }
html.light .ax-palette-backdrop, html[data-theme="light"] .ax-palette-backdrop { background: rgba(15, 36, 26, .35); }
.ax-palette-panel {
  position: absolute; left: 50%; top: max(10vh, calc(16px + var(--safe-top, 0px))); display: flex; flex-direction: column;
  width: min(640px, calc(100% - 24px)); max-height: min(560px, calc(100dvh - 20vh)); transform: translateX(-50%);
  border: 1px solid var(--ax-line-2); border-radius: 18px; background: var(--ax-raised); box-shadow: var(--ax-pop); overflow: hidden;
  animation: ax-pop .18s cubic-bezier(.2, .8, .2, 1);
}
@keyframes ax-fade { from { opacity: 0; } }
@keyframes ax-pop { from { opacity: 0; transform: translateX(-50%) translateY(-6px) scale(.985); } }
.ax-palette-input { display: flex; align-items: center; gap: 12px; padding: 0 14px 0 18px; border-bottom: 1px solid var(--ax-line); color: var(--ax-muted); }
.ax-palette-input input { flex: 1; min-width: 0; height: 58px; border: 0; outline: 0; background: transparent; color: var(--ax-text); font: 500 16px/1 var(--ax-font); }
.ax-palette-input input::-webkit-search-cancel-button { display: none; }
.ax .ax-palette-input input:focus-visible { outline: none; }
.ax-palette-input kbd { cursor: pointer; }
.ax-palette-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 6px 8px 10px; scrollbar-width: thin; }
.ax-palette-kind { margin: 12px 10px 4px; color: var(--ax-muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.ax-palette-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--ax-text-2); font-size: 14px; font-weight: 550; }
.ax-palette-item .ax-icon { width: 18px; height: 18px; color: var(--ax-muted); }
.ax-palette-item > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ax-palette-item.is-active { background: var(--ax-selected); color: var(--ax-text); }
.ax-palette-item.is-active .ax-icon { color: var(--ax-accent); }
.ax-palette-enter { opacity: 0; width: 16px !important; height: 16px !important; }
.ax-palette-item.is-active .ax-palette-enter { opacity: .8; }
.ax-palette-empty { margin: 0; padding: 36px 16px; color: var(--ax-muted); font-size: 14px; text-align: center; }
.ax-palette-foot { display: flex; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--ax-line); color: var(--ax-muted); font-size: 12px; }
.ax-palette-foot span { display: inline-flex; align-items: center; gap: 6px; }
body.ax-palette-open { overflow: hidden; }

/* Phones and tablets: drawer menu + bottom tab bar */
@media (max-width: 999px) {
  .ax { --ax-top-h: 56px; }
  .ax-side {
    width: min(320px, 88vw); transform: translateX(-102%); transition: transform .22s cubic-bezier(.2, .8, .2, 1);
    box-shadow: 24px 0 60px -20px rgba(0, 0, 0, .7); z-index: 70;
  }
  .am-menu-open .ax-side { transform: none; }
  .ax-side .ax-side-close { display: inline-grid; }
  .ax-scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 65; border: 0; background: rgba(1, 6, 4, .66); animation: ax-fade .15s ease-out; }
  .ax-workspace { margin-left: 0; }
  .ax-top { padding: var(--safe-top, 0px) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); gap: 10px; }
  .ax-top-brand { display: flex; align-items: center; gap: 9px; font: 700 16px/1 var(--ax-display); }
  .ax-crumbs { display: none; }
  .ax-find { width: auto; height: 38px; padding: 0 12px; }
  .ax-find kbd, .ax-cmd kbd { display: none; }
  .ax-main { padding: 18px max(14px, env(safe-area-inset-right)) calc(96px + var(--safe-bottom, 0px)) max(14px, env(safe-area-inset-left)); }
  .ax-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 6px max(6px, env(safe-area-inset-right)) max(8px, var(--safe-bottom, 0px)) max(6px, env(safe-area-inset-left));
    border-top: 1px solid var(--ax-line); background: color-mix(in srgb, var(--ax-side) 96%, transparent);
  }
  .ax-tab {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; min-height: 52px;
    padding: 4px 2px; border: 0; border-radius: 12px; background: transparent; color: var(--ax-muted); font-size: 10.5px; font-weight: 650; cursor: pointer;
  }
  .ax-tab > span:not(.ax-badge) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ax-tab .ax-icon { width: 22px; height: 22px; }
  .ax-tab.is-active, .ax-tab[aria-expanded="true"] { color: var(--ax-accent); }
  .ax-tab.is-active::before { content: ""; position: absolute; top: -7px; left: 30%; right: 30%; height: 2px; border-radius: 0 0 3px 3px; background: var(--ax-accent); box-shadow: 0 0 10px rgba(52, 211, 153, .7); }
  .ax-tab .ax-badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; font-size: 10px; }
  .ax-palette-panel { top: calc(8px + var(--safe-top, 0px)); width: calc(100% - 16px); max-height: calc(100dvh - 24px - var(--safe-top, 0px)); border-radius: 16px; }
  .ax-palette-foot { display: none; }
  #toast-host { bottom: calc(90px + var(--safe-bottom, 0px)); }
}
@media (max-width: 420px) {
  .ax-find span { display: none; }
  .ax-find { width: 40px; padding: 0; justify-content: center; }
}

/* ---------- Typography & page header ---------- */
.am-main .ops-app { font-family: var(--ax-font); color: var(--ax-text); }
.am-main .ops-app h2 { font: 650 26px/1.2 var(--ax-display); letter-spacing: -.02em; }
.am-main .ops-app h3 { font: 650 16px/1.3 var(--ax-display); letter-spacing: -.005em; }
.am-main .ops-head { gap: 14px; margin-bottom: 24px; }
.am-main .ops-head p { margin-top: 4px; color: var(--ax-muted); font-size: 13.5px; }
.am-main .ops-head-icon {
  width: 46px; height: 46px; border-radius: 13px; color: var(--ax-accent);
  background: linear-gradient(150deg, rgba(52, 211, 153, .2), rgba(16, 185, 129, .05));
  border: 1px solid rgba(52, 211, 153, .22); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.am-main .ops-head-icon .icon, .am-main .ops-head-icon .ax-icon { width: 22px; height: 22px; }
.am-main .ops-back { width: 38px; height: 38px; border-radius: 11px; border-color: var(--ax-line-2); background: var(--ax-surface); color: var(--ax-text-2); }
.am-main .ops-back:hover { color: var(--ax-text); border-color: rgba(52, 211, 153, .35); }
.am-main .ops-muted { color: var(--ax-muted); font-size: 13px; line-height: 1.5; }
.am-main .ops-form-section, .am-main .ops-actions-title, .am-main .ops-menu-title { color: var(--ax-muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; }

/* ---------- Surfaces ---------- */
.am-main .ops-card { border: 1px solid var(--ax-line); border-radius: var(--ax-radius); background: var(--ax-surface); box-shadow: var(--ax-shadow); padding: 20px; }
.am-main .ops-stat { border-radius: 12px; background: var(--ax-sunken); border-color: var(--ax-line); }
.am-main .ops-stat strong { font-family: var(--ax-display); font-weight: 650; }

/* KPI tiles: columns follow the number of tiles so a row never ends with a lonely card */
.am-main .ka-kpis { gap: 14px; margin-bottom: 22px; }
.am-main :is(.ka-kpis, .au-kpis):has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.am-main :is(.ka-kpis, .au-kpis):has(> :nth-child(3):last-child), .am-main :is(.ka-kpis, .au-kpis):has(> :nth-child(6):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.am-main :is(.ka-kpis, .au-kpis):has(> :nth-child(4):last-child), .am-main :is(.ka-kpis, .au-kpis):has(> :nth-child(8):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.am-main :is(.ka-kpis, .au-kpis):has(> :nth-child(5):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1279px) {
  .am-main :is(.ka-kpis, .au-kpis):has(> :nth-child(4):last-child), .am-main :is(.ka-kpis, .au-kpis):has(> :nth-child(8):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .am-main :is(.ka-kpis, .au-kpis):has(> :nth-child(5):last-child) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .am-main :is(.ka-kpis, .au-kpis):has(> :nth-child(5):last-child) > * { grid-column: span 2; }
  .am-main :is(.ka-kpis, .au-kpis):has(> :nth-child(5):last-child) > :nth-child(n+4) { grid-column: span 3; }
}
@media (max-width: 639px) {
  .am-main :is(.ka-kpis, .au-kpis):has(> :nth-child(3):last-child), .am-main :is(.ka-kpis, .au-kpis):has(> :nth-child(6):last-child), .am-main :is(.ka-kpis, .au-kpis):has(> :nth-child(5):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .am-main :is(.ka-kpis, .au-kpis):has(> :nth-child(5):last-child) > *, .am-main :is(.ka-kpis, .au-kpis):has(> :nth-child(5):last-child) > :nth-child(n+4) { grid-column: auto; }
  .am-main :is(.ka-kpis, .au-kpis) > .ka-kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
.am-main .ka-kpi {
  min-height: 0; padding: 18px; border: 1px solid var(--ax-line); border-radius: var(--ax-radius); background: var(--ax-surface);
  box-shadow: var(--ax-shadow); overflow: hidden; transition: border-color .16s, transform .16s;
}
.am-main .ka-kpi::after { content: ""; position: absolute; inset: 0 0 auto; height: 1px; background: linear-gradient(90deg, transparent, rgba(110, 231, 183, .18), transparent); pointer-events: none; }
.am-main .ka-kpi[href]:hover, .am-main a.ka-kpi:hover { border-color: rgba(52, 211, 153, .32); transform: translateY(-1px); }
.am-main .ka-kpi-top { justify-content: space-between; gap: 10px; }
.am-main .ka-kpi-label { color: var(--ax-muted); font-size: 12.5px; font-weight: 600; }
.am-main .ka-kpi-icon { order: 2; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: var(--ax-accent); background: var(--ax-accent-soft); }
.am-main .ka-kpi-icon .icon { width: 17px; height: 17px; }
.am-main .ka-kpi strong { margin-top: 14px; font: 650 28px/1.05 var(--ax-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.am-main .ka-kpi small { margin-top: 8px; color: var(--ax-muted); font-size: 12px; line-height: 1.45; }
.am-main .au-kpis { gap: 12px; }
.am-main .au-kpis .ka-kpi { min-height: 0; padding: 16px; }
.am-main .au-kpis .ka-kpi strong { font-size: 25px; }

/* ---------- Buttons ---------- */
.am-main .ops-button, .am-dialog .ops-button {
  min-height: 38px; padding: 0 14px; gap: 8px; border: 1px solid var(--ax-line-2); border-radius: var(--ax-radius-sm);
  background: rgba(255, 255, 255, .015); color: var(--ax-text); font-size: 13px; font-weight: 650; letter-spacing: .005em;
  transition: border-color .14s, background-color .14s, color .14s, box-shadow .14s;
}
html.light .am-main .ops-button, html[data-theme="light"] .am-main .ops-button, html.light .am-dialog .ops-button, html[data-theme="light"] .am-dialog .ops-button { background: #fff; }
.am-main .ops-button:hover, .am-dialog .ops-button:hover { border-color: rgba(52, 211, 153, .35); background: var(--ax-hover); }
.am-main .ops-button .icon { width: 16px; height: 16px; }
.am-main .ops-button.ops-primary, .am-dialog .ops-button.ops-primary, .am-main .ops-primary {
  border-color: transparent; background: var(--ax-accent-strong); color: var(--ax-accent-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 8px 22px -10px rgba(16, 185, 129, .75);
}
.am-main .ops-button.ops-primary:hover, .am-dialog .ops-button.ops-primary:hover, .am-main .ops-primary:hover { border-color: transparent; background: var(--ax-accent-hover); color: var(--ax-accent-ink); }
html.light .am-main .ops-primary:hover, html[data-theme="light"] .am-main .ops-primary:hover, html.light .am-dialog .ops-primary:hover, html[data-theme="light"] .am-dialog .ops-primary:hover { background: #047857; color: #fff; }
.am-main .ops-button.ops-danger, .am-dialog .ops-button.ops-danger, .am-main .ops-danger { border-color: transparent; background: #e11d48; color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16); }
.am-main .ops-button.ops-danger:hover, .am-dialog .ops-button.ops-danger:hover, .am-main .ops-danger:hover { background: #f43f5e; color: #fff; }
.am-main .ops-button:disabled, .am-dialog .ops-button:disabled { opacity: .5; box-shadow: none; }
.am-main .au-icon-btn { width: 38px; padding: 0; }
.am-main .ops-toolbar .ops-primary, .am-main .ops-toolbar .ops-danger { min-height: 42px; padding: 0 20px; }
.am-main .ops-open { width: 32px; height: 32px; border-radius: 9px; border-color: var(--ax-line-2); }
.am-main .ops-link, .am-main .ou-link-btn, .am-main .ou-link { color: var(--ax-accent); }

/* ---------- Forms ---------- */
.am-main .ops-field, .am-dialog .ops-field { gap: 7px; color: var(--ax-text-2); font-size: 12.5px; font-weight: 650; }
.am-main .ops-field small, .am-dialog .ops-field small { color: var(--ax-muted); }
.am-main .ops-field input, .am-main .ops-field textarea, .am-main .ops-field select, .am-main .ops-search, .am-main .ops-select,
.am-dialog .ops-field input, .am-dialog .ops-field textarea, .am-dialog .ops-field select {
  min-height: 42px; border: 1px solid var(--ax-line-2); border-radius: var(--ax-radius-sm); background: var(--ax-sunken); color: var(--ax-text);
  font-family: var(--ax-font); font-size: 14px; font-weight: 500;
}
.am-main .ops-field input[type=checkbox], .am-dialog .ops-field input[type=checkbox], .am-main .ops-field input[type=radio], .am-dialog .ops-field input[type=radio] { min-height: 0; }
.am-main .ops-field textarea, .am-dialog .ops-field textarea { font-family: var(--ax-mono); font-size: 13px; }
.am-main .ops-field textarea.ops-prose, .am-dialog .ops-field textarea.ops-prose { font-family: var(--ax-font); font-size: 14px; }
.am-main .ops-field input::placeholder, .am-main .ops-field textarea::placeholder, .am-main .ops-search::placeholder, .am-dialog .ops-field input::placeholder { color: color-mix(in srgb, var(--ax-muted) 80%, transparent); }
.am-main .ops-field input:hover, .am-main .ops-field textarea:hover, .am-main .ops-field select:hover, .am-main .ops-search:hover,
.am-dialog .ops-field input:hover, .am-dialog .ops-field textarea:hover, .am-dialog .ops-field select:hover { border-color: color-mix(in srgb, var(--ax-accent) 30%, var(--ax-line-2)); }
.am-main .ops-field input:focus, .am-main .ops-field textarea:focus, .am-main .ops-field select:focus, .am-main .ops-search:focus,
.am-dialog .ops-field input:focus, .am-dialog .ops-field textarea:focus, .am-dialog .ops-field select:focus { border-color: var(--ax-accent-strong); box-shadow: var(--ax-ring); }
.am-main .ops-searchbox, .am-main .ka-search { min-height: 40px; height: auto; border: 1px solid var(--ax-line-2); border-radius: var(--ax-radius-sm); background: var(--ax-sunken); }
.am-main .ops-searchbox:focus-within, .am-main .ka-search:focus-within { border-color: var(--ax-accent-strong); box-shadow: var(--ax-ring); }
.am-main .ops-switch-track, .am-dialog .ops-switch-track { flex-basis: 38px; height: 22px; border-color: var(--ax-line-2); background: var(--ax-sunken); }
.am-main .ops-switch-track::after, .am-dialog .ops-switch-track::after { top: 2px; left: 2px; width: 16px; height: 16px; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
.am-main .ops-switch input:checked + .ops-switch-track, .am-dialog .ops-switch input:checked + .ops-switch-track { border-color: var(--ax-accent-strong); background: var(--ax-accent-strong); }
.am-main .ops-pick, .am-dialog .ops-pick { border-color: var(--ax-line-2); background: var(--ax-sunken); }
.am-main .ops-pick:has(input:checked), .am-dialog .ops-pick:has(input:checked) { border-color: rgba(52, 211, 153, .5); background: var(--ax-accent-soft); color: var(--ax-text); }
.am-main .ops-filters-box { border-color: var(--ax-line); border-radius: 12px; background: var(--ax-surface); }
.am-main .ops-object { border-color: var(--ax-line); border-radius: 12px; }

/* ---------- Segmented tabs ---------- */
.am-main .ops-views { gap: 3px; padding: 4px; border: 1px solid var(--ax-line); border-radius: 12px; background: var(--ax-sunken); }
.am-main .ops-tab { min-height: 34px; padding: 0 14px; border-radius: 9px; color: var(--ax-muted); font-size: 13px; font-weight: 650; }
.am-main .ops-tab:hover { color: var(--ax-text); background: var(--ax-hover); }
.am-main .ops-tab.active { color: var(--ax-text); background: var(--ax-raised); box-shadow: inset 0 0 0 1px var(--ax-line-2), 0 4px 12px -6px rgba(0, 0, 0, .6); }
html.light .am-main .ops-tab.active, html[data-theme="light"] .am-main .ops-tab.active { background: #fff; box-shadow: 0 1px 3px rgba(15, 50, 30, .12), inset 0 0 0 1px var(--ax-line); }
.am-main .ops-tab .ops-count, .am-main .ops-tab small { color: var(--ax-muted); }

/* ---------- Tables ---------- */
.am-main .ops-table-wrap { border-top: 1px solid var(--ax-line); scrollbar-width: thin; }
.am-main .ops-table { font-size: 13.5px; }
.am-main .ops-table th, .am-main .au-row--head {
  padding-top: 11px; padding-bottom: 11px; background: var(--ax-raised); color: var(--ax-muted);
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; border-bottom: 1px solid var(--ax-line);
}
html.light .am-main .ops-table th, html[data-theme="light"] .am-main .ops-table th { background: #f7faf8; }
.am-main .ops-table td { padding-top: 13px; padding-bottom: 13px; border-bottom: 1px solid var(--ax-line); font-size: 13.5px; }
.am-main .ops-table tbody tr:hover, .am-main .ops-table tbody tr:focus-within { background: var(--ax-hover); }
.am-main .ops-mono { font-family: var(--ax-mono); color: var(--ax-text-2); }
.am-main .ops-money { font-variant-numeric: tabular-nums; }
.am-main .ops-pager { color: var(--ax-muted); }

/* ---------- Status ---------- */
.am-main .ops-pill, .am-dialog .ops-pill {
  gap: 6px; padding: 3px 9px; border: 1px solid var(--ax-line); border-radius: 999px; background: var(--ax-hover);
  color: var(--ax-text-2); font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
}
.am-main .ops-pill::before, .am-dialog .ops-pill::before { width: 6px; height: 6px; }
.am-main .ops-pill--ok, .am-dialog .ops-pill--ok { border-color: rgba(74, 222, 128, .22); background: var(--ax-ok-bg); color: var(--ax-ok); }
.am-main .ops-pill--warn, .am-dialog .ops-pill--warn { border-color: rgba(251, 191, 36, .24); background: var(--ax-warn-bg); color: var(--ax-warn); }
.am-main .ops-pill--bad, .am-dialog .ops-pill--bad { border-color: rgba(251, 113, 133, .25); background: var(--ax-bad-bg); color: var(--ax-bad); }
.am-main .ops-pill--info, .am-dialog .ops-pill--info { border-color: rgba(52, 211, 153, .25); background: var(--ax-accent-soft); color: var(--ax-accent); }
.am-main .ops-alert, .am-dialog .ops-alert { border-radius: 12px; border-color: rgba(251, 113, 133, .28); background: var(--ax-bad-bg); color: var(--ax-bad); font-size: 13.5px; line-height: 1.5; }
.am-main .ops-alert--warn, .am-dialog .ops-alert--warn { border-color: rgba(251, 191, 36, .28); background: var(--ax-warn-bg); color: var(--ax-warn); }
.am-main .ops-success, .am-main .ops-alert--ok, .am-dialog .ops-success { border-color: rgba(74, 222, 128, .25); background: var(--ax-ok-bg); color: var(--ax-ok); }
.am-main .ops-info, .am-dialog .ops-info { border-color: var(--ax-line-2); background: var(--ax-sunken); color: var(--ax-text-2); }
.am-main .ops-empty, .am-main .ka-empty, .am-main .tf-empty, .am-main .pm-empty { color: var(--ax-muted); }

/* ---------- Menus, drawers, dialogs ---------- */
.am-main .ops-menu, .am-dialog .ops-menu { padding: 6px; border: 1px solid var(--ax-line-2); border-radius: 14px; background: var(--ax-raised); box-shadow: var(--ax-pop); }
.am-main .ops-menu-item, .am-dialog .ops-menu-item { min-height: 38px; padding: 8px 10px; border-radius: 9px; color: var(--ax-text); font-size: 13.5px; }
.am-main .ops-menu-item:hover, .am-dialog .ops-menu-item:hover { background: var(--ax-hover); }
.am-main .ops-menu-item .icon { width: 17px; height: 17px; color: var(--ax-muted); }
.am-main .ops-menu-item.is-danger, .am-main .ops-menu-item.is-danger .icon { color: var(--ax-bad); }
.am-main .ops-drawer-backdrop { background: rgba(1, 6, 4, .7); }
.am-main .ops-drawer-panel { border-left-color: var(--ax-line-2); background: var(--ax-side); box-shadow: -30px 0 80px -20px rgba(0, 0, 0, .8); }
html.light .am-main .ops-drawer-panel, html[data-theme="light"] .am-main .ops-drawer-panel { background: #fbfdfc; box-shadow: -30px 0 80px -30px rgba(15, 50, 30, .3); }
.am-main .ops-drawer-head { border-bottom-color: var(--ax-line); }
.am-main .ops-drawer-head h3 { font-family: var(--ax-display); font-weight: 650; }
.am-main .ops-drawer-bar, .am-main .ops-drawer .ops-form-actions { background: var(--ax-side); border-color: var(--ax-line); }
html.light .am-main .ops-drawer-bar, html[data-theme="light"] .am-main .ops-drawer-bar, html.light .am-main .ops-drawer .ops-form-actions, html[data-theme="light"] .am-main .ops-drawer .ops-form-actions { background: #fbfdfc; }
dialog#modal.am-modal { border: 1px solid var(--ax-line-2); border-radius: 20px; background: var(--ax-raised); color: var(--ax-text); box-shadow: var(--ax-pop); font-family: var(--ax-font); }
dialog#modal.am-modal::backdrop { background: rgba(1, 6, 4, .72); }
html.light dialog#modal.am-modal::backdrop, html[data-theme="light"] dialog#modal.am-modal::backdrop { background: rgba(15, 36, 26, .35); }
.am-dialog-form { gap: 16px; padding: 22px 24px 20px; }
.ops-app .am-dialog-head h2 { font: 650 19px/1.3 var(--ax-display); letter-spacing: -.01em; }
.am-dialog-close { border-radius: 10px; }
.am-dialog-foot { gap: 10px; padding-top: 6px; }
.am-dialog-foot .ops-button { min-height: 42px; padding: 0 20px; }
@media (max-width: 639px) {
  dialog#modal.am-modal { border-radius: 20px 20px 0 0; border-bottom: 0; }
  dialog#modal.am-modal::before { content: ""; display: block; width: 40px; height: 4px; margin: 8px auto 0; border-radius: 4px; background: var(--ax-line-2); }
}

/* Toasts while the admin is open */
.ax-body #toast-host .toast {
  border: 1px solid var(--ax-line-2, rgba(167, 243, 208, .15)); border-radius: 14px; background: #0e1c17; color: #e8f3ed;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .7); font-family: var(--ax-font, Manrope, sans-serif); font-weight: 600;
}
.ax-body #toast-host .toast.success { border-color: rgba(52, 211, 153, .35); }
.ax-body #toast-host .toast.error { border-color: rgba(251, 113, 133, .4); }

/* ---------- Section vocabulary shared by many screens ---------- */
.am-main .au-toolbar { padding: 12px; border: 1px solid var(--ax-line); border-radius: var(--ax-radius); background: var(--ax-surface); box-shadow: var(--ax-shadow); }
.am-main .au-avatar, .am-main .ou-avatar { border-radius: 11px; background: linear-gradient(150deg, rgba(52, 211, 153, .22), rgba(16, 185, 129, .06)); color: var(--ax-accent); border: 1px solid rgba(52, 211, 153, .18); font-family: var(--ax-display); }
.am-main .au-avatar.is-muted { background: var(--ax-sunken); color: var(--ax-muted); border-color: var(--ax-line); }
.am-main .ops-card.tf-card { border-radius: var(--ax-radius); transition: border-color .16s; }
.am-main .ops-card.tf-card:hover { border-color: var(--ax-line-2); }
.am-main .tf-savebar { border-color: var(--ax-line-2); background: var(--ax-raised); box-shadow: var(--ax-pop); }
.am-main .tf-nav a, .am-main .tf-nav button { border-radius: 9px; }

/* Users list: the subscription cell wraps its badges instead of running into «Активность». */
.am-main .au-sub-line { flex-wrap: wrap; row-gap: 5px; }
.am-main .au-sub-line .ops-pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.am-main .au-traffic { min-width: 0; }
@media (max-width: 1279px) { .am-main .au-bar { width: auto; flex: 1; min-width: 40px; } }

/* Support inbox list tools: the search keeps most of the row. */
.am-main .at-filter { flex: 1 1 auto; min-width: 120px; }
.am-main .at-priority { flex: 0 1 150px; min-width: 0; min-height: 40px; border-radius: var(--ax-radius-sm); border-color: var(--ax-line-2); font-size: 13px; }
.am-main .ou-head-select { border-color: var(--ax-line-2); border-radius: 9px; }

/* Sticky helpers sit under the new top bar */
.am-main .au-toolbar { top: auto; }
@media (max-width: 999px) {
  /* Save bars stick above the bottom tab bar instead of under it. */
  .am-main .tf-savebar { bottom: calc(74px + var(--safe-bottom, 0px)); }
  .am-main .st-savebar { bottom: calc(80px + var(--safe-bottom, 0px)); }
  .am-main .tf-nav { top: calc(var(--ax-top-h) + var(--safe-top, 0px)); background: var(--ax-bg); }
  .am-main .au-toolbar { top: calc(var(--ax-top-h) + var(--safe-top, 0px)); }
}
@media (max-width: 767px) {
  .am-main .au-toolbar { position: sticky; z-index: 20; margin: 0 0 12px; }
}

/* ---------- Phone density ---------- */
@media (max-width: 639px) {
  .am-main .ops-app h2 { font-size: 22px; }
  .am-main .ops-head { gap: 12px; margin-bottom: 18px; }
  .am-main .ops-head-icon { display: none; }
  .am-main .ops-head-text { flex: 1 1 180px; min-width: 0; }
  .am-main .ops-head-actions { width: auto; margin-left: auto; }
  .am-main .ops-head-actions > .au-icon-btn { flex: 0 0 auto; }
  .am-main .ops-card { padding: 16px; border-radius: 14px; }
  .am-main .ka-kpis { gap: 10px; margin-bottom: 16px; }
  .am-main .ka-kpi { padding: 14px; border-radius: 14px; }
  .am-main .ka-kpi strong { font-size: 22px; margin-top: 10px; }
  .am-main .ka-kpi small { font-size: 11px; }
  .am-main .ka-kpi-icon { width: 28px; height: 28px; border-radius: 9px; }
  .am-main .ops-button, .am-main .ops-tab, .am-dialog .ops-button { min-height: 44px; }
  .am-main .au-icon-btn { width: 44px; }
  .am-main .ops-back { width: 44px; height: 44px; }
  .am-main .ops-field input, .am-main .ops-field select, .am-main .ops-field textarea, .am-main .ops-search, .am-dialog .ops-field input, .am-dialog .ops-field select, .am-dialog .ops-field textarea { min-height: 46px; font-size: 16px; }
  .am-main .ops-views { margin-left: 0; margin-right: 0; }
  /* Action menus open as a sheet above the tab bar instead of running off the bottom edge. */
  .am-main .ops-menu-wrap > .ops-menu, .am-main .au-pop > .ops-menu {
    position: fixed; left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); top: auto;
    bottom: calc(78px + var(--safe-bottom, 0px)); z-index: 85; width: auto; max-height: min(64dvh, 520px); overflow-y: auto;
    overscroll-behavior: contain; border-radius: 18px; animation: ax-sheet .18s cubic-bezier(.2, .8, .2, 1);
  }
  .am-main .ops-drawer .ops-menu-wrap > .ops-menu { bottom: calc(12px + var(--safe-bottom, 0px)); }
  .am-main .ops-menu-item { min-height: 46px; }
}
@keyframes ax-sheet { from { opacity: 0; transform: translateY(12px); } }

@media (prefers-reduced-motion: reduce) {
  .ax *, .ax *::before, .ax *::after { animation: none !important; transition: none !important; }
}

/* ---------- Charts (admin-charts.js) ---------- */
.am-main .ac-bar { max-width: 26px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, #34d399, #059669); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25); }
html.light .am-main .ac-bar, html[data-theme="light"] .am-main .ac-bar { background: linear-gradient(180deg, #10b981, #047857); }
.am-main .ac-hit { border-radius: 8px; }
.am-main .ac-grid span { border-top-style: dashed; border-top-color: var(--ax-line); }
.am-main .ac-grid small, .am-main .ac-x { color: var(--ax-muted); font-size: 11px; }
.am-main .ac-track { height: 8px; border-radius: 99px; background: var(--ax-sunken); box-shadow: inset 0 0 0 1px var(--ax-line); }
.am-main .ac-track > span { border-radius: 99px; background: linear-gradient(90deg, #059669, #34d399); }
.am-main .ac-empty { border-color: var(--ax-line-2); border-radius: 12px; color: var(--ax-muted); }
.am-main .ac-table summary { color: var(--ax-accent); font-size: 12.5px; }
.ax-body .ac-tip { padding: 9px 12px; border: 1px solid rgba(167, 243, 208, .16); border-radius: 12px; background: #0e1c17; color: #e8f3ed; box-shadow: 0 16px 40px -10px rgba(0, 0, 0, .7); font-family: Manrope, sans-serif; }
.ax-body .ac-tip .ac-tip-line { color: #8fa89b; }
html.light .ax-body .ac-tip, html[data-theme="light"] .ax-body .ac-tip { border-color: #d5e2da; background: #fff; color: #0f241a; box-shadow: 0 16px 40px -12px rgba(15, 50, 30, .25); }
html.light .ax-body .ac-tip .ac-tip-line, html[data-theme="light"] .ax-body .ac-tip .ac-tip-line { color: #5c7466; }

/* ---------- Overview (/admin, admin-overview.js) ---------- */
.xo { display: grid; gap: 20px; }
.xo-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 18px; padding: 4px 0 2px; }
.xo-head-text { min-width: 0; }
.xo-date { margin: 0 0 6px; color: var(--ax-muted); font-size: 13px; font-weight: 650; }
.am-main .xo-head h2 { font-size: 30px; letter-spacing: -.025em; }
.xo-head-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.xo-online { display: inline-flex; align-items: center; gap: 7px; color: var(--ax-muted); font-size: 13px; }
.xo-online b { color: var(--ax-text); font-variant-numeric: tabular-nums; }
.xo-online i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: xo-pulse 2s infinite; }
@keyframes xo-pulse { 70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
.xo-head-actions { display: flex; align-items: center; gap: 10px; }
.xo-find label {
  display: flex; align-items: center; gap: 10px; width: min(380px, 70vw); height: 42px; padding: 0 14px;
  border: 1px solid var(--ax-line-2); border-radius: 12px; background: var(--ax-surface); color: var(--ax-muted); transition: border-color .15s, box-shadow .15s;
}
.xo-find label:focus-within { border-color: var(--ax-accent-strong); box-shadow: var(--ax-ring); }
.xo-find .ax-icon { width: 17px; height: 17px; }
.xo-find input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ax-text); font: 500 14px var(--ax-font); }
.ops-app .xo-find input:focus-visible { box-shadow: none; }
.am-main .xo-refresh { width: 42px; min-height: 42px; border-radius: 12px; }
.xo-refresh .ax-icon { width: 18px; height: 18px; }
.xo-refresh.is-spinning .ax-icon { animation: am-spin .8s linear infinite; }

.am-main .xo .xo-label { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--ax-warn); font: 700 12px/1.2 var(--ax-font); letter-spacing: .06em; text-transform: uppercase; }
.xo-label .ax-icon { width: 15px; height: 15px; }
.xo-tasks { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
@media (min-width: 761px) and (max-width: 1279px) { .xo-tasks:has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.xo-task {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid rgba(251, 191, 36, .26); border-radius: 14px;
  background: linear-gradient(135deg, rgba(251, 191, 36, .1), rgba(251, 191, 36, .02)); transition: border-color .15s, transform .15s;
}
.xo-task:hover { border-color: rgba(251, 191, 36, .5); transform: translateY(-1px); }
.xo-task-icon { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; background: rgba(251, 191, 36, .14); color: var(--ax-warn); }
.xo-task-text { flex: 1; min-width: 0; }
.xo-task-text strong { display: block; font: 650 22px/1.1 var(--ax-display); font-variant-numeric: tabular-nums; }
.xo-task-text span { display: block; margin-top: 3px; color: var(--ax-text-2); font-size: 12.5px; }
.xo-task-go { width: 16px !important; height: 16px !important; color: var(--ax-muted); }
.xo-calm { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border: 1px solid rgba(74, 222, 128, .2); border-radius: 14px; background: linear-gradient(135deg, rgba(34, 197, 94, .09), rgba(34, 197, 94, .015)); }
.xo-calm > .ax-icon { width: 22px; height: 22px; color: var(--ax-ok); }
.xo-calm strong { display: block; font-size: 14px; }
.xo-calm span { display: block; margin-top: 2px; color: var(--ax-muted); font-size: 12.5px; }

.xo-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.xo-quick-item {
  display: inline-flex; align-items: center; gap: 9px; height: 38px; padding: 0 14px 0 6px; border: 1px solid var(--ax-line-2); border-radius: 999px;
  background: var(--ax-surface); color: var(--ax-text-2); font-size: 13px; font-weight: 650; transition: border-color .15s, color .15s, background-color .15s;
}
.xo-quick-item > span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ax-accent-soft); color: var(--ax-accent); }
.xo-quick-item .ax-icon { width: 15px; height: 15px; }
.xo-quick-item:hover { border-color: rgba(52, 211, 153, .4); color: var(--ax-text); }

.am-main .xo-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.am-main .xo-kpi { min-height: 132px; }
.am-main .xo-kpi small b { color: var(--ax-text-2); font-weight: 700; }
.xo-kpi .ka-kpi-icon .ax-icon { width: 17px; height: 17px; }
.xo-spark { display: block; width: 100%; height: 30px; margin-top: auto; padding-top: 10px; color: var(--ax-accent); pointer-events: none; overflow: visible; }
.xo-bad { color: var(--ax-bad); font-weight: 700; }

.xo-hero { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.xo-hero--single { grid-template-columns: minmax(0, 1fr); }
.xo-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.xo-trio[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.xo-trio[data-count="1"] { grid-template-columns: minmax(0, 1fr); }
.xo-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding: 20px; border: 1px solid var(--ax-line); border-radius: var(--ax-radius); background: var(--ax-surface); box-shadow: var(--ax-shadow); }
.xo-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.am-main .xo-panel-head h3 { margin: 0; font-size: 16px; }
.xo-panel-head p { margin: 4px 0 0; color: var(--ax-muted); font-size: 12.5px; }
.am-main .xo-seg { margin: -4px 0 0; flex-shrink: 0; }
.am-main .xo-seg .ops-tab { min-height: 30px; padding: 0 11px; font-size: 12.5px; }
.xo-total { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; }
.xo-total strong { font: 650 32px/1.05 var(--ax-display); letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.xo-total-note { color: var(--ax-muted); font-size: 12.5px; }
.xo-delta { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.xo-delta--up { background: var(--ax-ok-bg); color: var(--ax-ok); }
.xo-delta--down { background: var(--ax-bad-bg); color: var(--ax-bad); }
.xo-delta--flat { background: var(--ax-hover); color: var(--ax-muted); }
.xo-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; padding-top: 14px; border-top: 1px solid var(--ax-line); }
.xo-facts--tight { padding-top: 0; border-top: 0; }
.xo-facts dt { color: var(--ax-muted); font-size: 12px; }
.xo-facts dd { margin: 4px 0 0; font: 650 16px/1.2 var(--ax-display); font-variant-numeric: tabular-nums; }
.xo-more { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; flex-shrink: 0; color: var(--ax-accent); font-size: 13px; font-weight: 650; white-space: nowrap; }
.xo-more .ax-icon { width: 14px; height: 14px; transition: transform .15s; }
.xo-more:hover .ax-icon { transform: translateX(2px); }
.xo-split { display: flex; gap: 3px; height: 10px; overflow: hidden; border-radius: 99px; }
.xo-split span { min-width: 6px; }
.xo-split-paid { background: linear-gradient(90deg, #059669, #34d399); }
.xo-split-trial { background: #7dd3fc; opacity: .75; }
.xo-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: -4px 0 0; padding: 0; list-style: none; }
.xo-legend li { display: inline-flex; align-items: center; gap: 7px; color: var(--ax-muted); font-size: 12.5px; }
.xo-legend i { width: 8px; height: 8px; border-radius: 50%; }
.xo-legend b { margin-left: 2px; color: var(--ax-text); font-variant-numeric: tabular-nums; }
.am-main .xo-sub { margin: 4px 0 -4px; color: var(--ax-muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.xo-lines { display: grid; margin: 0; }
.xo-lines div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--ax-line); font-size: 13px; }
.xo-lines dt { color: var(--ax-muted); }
.xo-lines dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.xo-node-list, .xo-pay-list { display: grid; margin: 0; padding: 0; list-style: none; }
.xo-node { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--ax-line); }
.xo-node:last-child { border-bottom: 0; }
.xo-node-flag { width: 24px; font-size: 18px; line-height: 1; text-align: center; font-family: "Twemoji Country Flags", "Apple Color Emoji", "Segoe UI Emoji", sans-serif; }
.xo-node-main { display: grid; gap: 6px; flex: 1; min-width: 0; }
.xo-node-main strong { overflow: hidden; font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }
.xo-node-main small { color: var(--ax-muted); font-size: 12px; }
.xo-node.is-down .xo-node-main small { color: var(--ax-bad); }
.xo-node-bar { display: block; height: 5px; overflow: hidden; border-radius: 99px; background: var(--ax-sunken); }
.xo-node-bar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #059669, #34d399); }
.xo-node-users { min-width: 34px; color: var(--ax-text-2); font: 600 13px var(--ax-mono); text-align: right; }
.xo-node.is-off { opacity: .6; }
.xo-pay-row { display: flex; align-items: center; gap: 12px; margin: 0 -8px; padding: 9px 8px; border-radius: 11px; transition: background-color .14s; }
a.xo-pay-row:hover { background: var(--ax-hover); }
.xo-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; background: var(--ax-accent-soft); color: var(--ax-accent); font: 700 13px var(--ax-display); }
.xo-pay-text { flex: 1; min-width: 0; }
.xo-pay-text strong, .xo-pay-text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xo-pay-text strong { font-size: 13.5px; }
.xo-pay-text small { margin-top: 2px; color: var(--ax-muted); font-size: 12px; }
.xo-pay-sum { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.xo-note { margin: -4px 0 0; color: var(--ax-muted); font-size: 12.5px; }
.xo-service { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 28px; padding: 14px 20px; border: 1px solid var(--ax-line); border-radius: 14px; background: var(--ax-surface); }
.xo-service-title { display: inline-flex; align-items: center; gap: 9px; color: var(--ax-text-2); font-size: 13px; }
.xo-service-title .ax-icon { width: 18px; height: 18px; color: var(--ax-accent); }
.xo-service dl { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 0; }
.xo-service dt { color: var(--ax-muted); font-size: 11.5px; }
.xo-service dd { margin: 2px 0 0; font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.xo-service .xo-more { margin-left: auto; align-self: center; }
.xo-lead { margin: 0; }
@media (max-width: 1279px) {
  .am-main .xo-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .xo-hero { grid-template-columns: minmax(0, 1fr); }
  .xo-trio, .xo-trio[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .xo-trio[data-count="3"] > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .xo { gap: 16px; }
  .xo-head { align-items: stretch; }
  .am-main .xo-head h2 { font-size: 24px; }
  .xo-head-actions { width: 100%; }
  .xo-find { flex: 1; min-width: 0; }
  .xo-find label { width: 100%; height: 46px; box-sizing: border-box; }
  .xo-find input { font-size: 16px; }
  .am-main .xo-refresh { width: 46px; min-height: 46px; }
  .xo-tasks { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .xo-quick { flex-wrap: nowrap; margin: 0 -14px; padding: 0 14px 2px; overflow-x: auto; scrollbar-width: none; }
  .xo-quick::-webkit-scrollbar { display: none; }
  .xo-quick-item { flex-shrink: 0; }
  .am-main .xo-kpi { min-height: 118px; }
  .xo-spark { height: 26px; }
  .xo-trio, .xo-trio[data-count="2"] { grid-template-columns: minmax(0, 1fr); }
  .xo-trio[data-count="3"] > :last-child { grid-column: auto; }
  .xo-panel { padding: 16px; border-radius: 14px; }
  .xo-panel-head { flex-wrap: wrap; }
  .xo-total strong { font-size: 26px; }
  .xo-facts dd { font-size: 14px; }
  .xo-service { padding: 14px 16px; }
  .xo-service .xo-more { margin-left: 0; }
}

/* ---------- Phone tables ----------
   The card layout in admin.css is tailored to the payments table (Дата / Пользователь / Способ /
   Сумма / Статус). Other sections reuse .pm-table with their own columns, so on phones they get a
   plain "label — value" card instead of cells stacked on top of each other. */
@media (max-width: 700px) {
  .am-main .pm-table:not(:has(td[data-label="Дата"])) tr { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .am-main .pm-table:not(:has(td[data-label="Дата"])) td,
  .am-main .pm-table:not(:has(td[data-label="Дата"])) td.pm-amount,
  .am-main .pm-table:not(:has(td[data-label="Дата"])) td.pm-actions {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: 4px 10px; grid-column: 1 / -1; grid-row: auto;
    font-size: 13.5px; text-align: right;
  }
  .am-main .pm-table:not(:has(td[data-label="Дата"])) td[data-label]:not(:first-child)::before {
    content: attr(data-label); flex-shrink: 0; margin-right: auto; color: var(--ax-muted); font-size: 12.5px; font-weight: 500; text-align: left;
  }
  .am-main .pm-table:not(:has(td[data-label="Дата"])) td:first-child { display: block; margin-bottom: 2px; font-size: 14px; text-align: left; }
  .am-main .pm-table:not(:has(td[data-label="Дата"])) td:first-child small { margin-top: 2px; }
  .am-main .pm-table:not(:has(td[data-label="Дата"])) td.pm-actions { justify-content: flex-start; margin-top: 4px; }
  .am-main .pm-table:not(:has(td[data-label="Дата"])) td:empty { display: none; }
}
