/* ===== Ungunii token-uud ===== */
:root {
  color-scheme: light;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bg: #f3f5fb;
  --surface: #ffffff;
  --surface-2: #f6f7fb;
  --surface-glass: rgba(255, 255, 255, 0.72);
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --text: #0f172a;
  --text-2: #475569;
  --muted: #8a94a6;
  --accent: #6d5dfc;
  --accent-soft: rgba(109, 93, 252, 0.1);
  --grad: linear-gradient(135deg, #6d5dfc 0%, #a855f7 100%);
  --ok: #0ca30c;
  --ok-soft: rgba(12, 163, 12, 0.1);
  --ok-text: #067306;
  --warn: #eda100;
  --warn-soft: rgba(237, 161, 0, 0.14);
  --warn-text: #865a00;
  --bad: #d03b3b;
  --bad-soft: rgba(208, 59, 59, 0.1);
  --bad-text: #b02424;
  --info: #2a78d6;
  --info-soft: rgba(42, 120, 214, 0.1);
  --info-text: #1d5fae;
  --grid: #e9ecf3;
  --axis: #c9cfdb;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 30px -12px rgba(15, 23, 42, 0.14);
  --shadow-lg: 0 30px 80px -20px rgba(15, 23, 42, 0.35);
  --radius: 20px;
  /* Graphikiin series (dataviz validator-oor shalgasan, surface #ffffff) */
  --s-success: #0ca30c;
  --s-declined: #2a78d6;
  --s-rejected: #eda100;
  --s-failed: #d03b3b;
  --s-pending: #b8bdc8;
  --aurora: 0.3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0d16;
    --surface: #151a26;
    --surface-2: #1b2131;
    --surface-glass: rgba(18, 22, 34, 0.72);
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.13);
    --text: #eef1f8;
    --text-2: #b4bccc;
    --muted: #7d879a;
    --accent: #8b7dff;
    --accent-soft: rgba(139, 125, 255, 0.15);
    --ok-soft: rgba(12, 163, 12, 0.16);
    --ok-text: #4fd14f;
    --warn-soft: rgba(237, 161, 0, 0.16);
    --warn-text: #f2bb45;
    --bad-soft: rgba(208, 59, 59, 0.18);
    --bad-text: #f28585;
    --info-soft: rgba(57, 135, 229, 0.18);
    --info-text: #79b2f2;
    --grid: #232a3b;
    --axis: #344057;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
    /* surface #151a26 deer shalgasan */
    --s-declined: #3987e5;
    --s-rejected: #c98500;
    --s-pending: #4b5468;
    --aurora: 0.22;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0d16;
  --surface: #151a26;
  --surface-2: #1b2131;
  --surface-glass: rgba(18, 22, 34, 0.72);
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --text: #eef1f8;
  --text-2: #b4bccc;
  --muted: #7d879a;
  --accent: #8b7dff;
  --accent-soft: rgba(139, 125, 255, 0.15);
  --ok-soft: rgba(12, 163, 12, 0.16);
  --ok-text: #4fd14f;
  --warn-soft: rgba(237, 161, 0, 0.16);
  --warn-text: #f2bb45;
  --bad-soft: rgba(208, 59, 59, 0.18);
  --bad-text: #f28585;
  --info-soft: rgba(57, 135, 229, 0.18);
  --info-text: #79b2f2;
  --grid: #232a3b;
  --axis: #344057;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
  --s-declined: #3987e5;
  --s-rejected: #c98500;
  --s-pending: #4b5468;
  --aurora: 0.22;
}

/* ===== Undsen ===== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font: 14px/1.5 var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s;
}
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.015em; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent); }
code, pre { font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace; font-size: 12px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.sm { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
::selection { background: var(--accent-soft); }

/* Aurora ar tal */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora span {
  position: absolute; width: 52vmax; height: 52vmax; border-radius: 50%;
  filter: blur(90px); opacity: var(--aurora);
  animation: drift 26s ease-in-out infinite alternate;
}
.aurora span:nth-child(1) { background: #8b7dff; top: -24vmax; left: -14vmax; }
.aurora span:nth-child(2) { background: #38bdf8; top: -26vmax; right: -22vmax; animation-delay: -9s; opacity: calc(var(--aurora) * 0.7); }
.aurora span:nth-child(3) { background: #f472b6; bottom: -34vmax; left: 28vw; animation-delay: -17s; opacity: calc(var(--aurora) * 0.5); }
body.in-app .aurora span { opacity: calc(var(--aurora) * 0.45); }
@keyframes drift { to { transform: translate3d(7vmax, 5vmax, 0) scale(1.12); } }

/* ===== Tovch, oroltuud ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent;
  font: 600 14px/1 var(--font); color: var(--text); background: var(--surface);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn svg.i { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn.primary { color: #fff; background: var(--grad); box-shadow: 0 8px 20px -8px rgba(109, 93, 252, 0.7); }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 12px 26px -10px rgba(109, 93, 252, 0.85); }
.btn.ghost { border-color: var(--border-strong); background: var(--surface); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.danger { color: #fff; background: var(--bad); box-shadow: 0 8px 20px -8px rgba(208, 59, 59, 0.7); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.sm svg.i { width: 16px; height: 16px; }
.btn.lg { height: 48px; font-size: 15px; border-radius: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.btn.loading svg.i { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; flex: none;
  border: 0; border-radius: 11px; background: transparent; color: var(--text-2); cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }
.icon-btn.sm svg.i { width: 17px; height: 17px; }
.icon-btn.danger:hover { color: var(--bad-text); background: var(--bad-soft); }

input, select {
  width: 100%; height: 42px; padding: 0 12px;
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: var(--muted); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, select:focus-visible { outline: none; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
.field small { color: var(--muted); font-size: 12px; }
.form-err { color: var(--bad-text); min-height: 1.2em; margin-top: 10px; font-size: 13px; font-weight: 500; }
.form-err.ok { color: var(--ok-text); }

.search { position: relative; display: block; flex: 1 1 220px; max-width: 340px; }
.search svg.i { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 38px; }

/* Segmented */
.seg {
  display: inline-flex; gap: 3px; padding: 4px; max-width: 100%; overflow-x: auto;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  border: 0; background: transparent; padding: 7px 12px; border-radius: 9px;
  font: 600 13px/1.2 var(--font); color: var(--text-2); cursor: pointer; white-space: nowrap;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.seg button small { margin-left: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }

/* ===== Nevtreh ===== */
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: 100%; max-width: 400px; padding: 36px 32px 28px;
  background: var(--surface-glass); backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid var(--border); border-radius: 28px; box-shadow: var(--shadow-lg);
  animation: pop 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}
.login-card .brand { margin-bottom: 28px; }
.login-card h1 { font-size: 28px; margin-bottom: 6px; }
.login-card > .muted { margin-bottom: 24px; }
.login-card .btn { margin-top: 8px; }

/* ===== Layout ===== */
.shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; z-index: 20; height: 100vh;
  display: flex; flex-direction: column; gap: 28px; padding: 22px 16px 18px;
  background: var(--surface-glass); backdrop-filter: blur(20px) saturate(1.4);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.brand strong { display: block; font-size: 16px; letter-spacing: -0.01em; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.brand-mark {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center;
  border-radius: 13px; color: #fff; background: var(--grad);
  box-shadow: 0 10px 22px -10px rgba(109, 93, 252, 0.9);
}
.brand-mark.sm { width: 34px; height: 34px; border-radius: 11px; }
.brand-mark svg.i { width: 22px; height: 22px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px; text-decoration: none;
  color: var(--text-2); font-weight: 600; font-size: 14px;
  transition: background 0.2s, color 0.2s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { color: var(--accent); background: var(--accent-soft); }
.nav a.active::before {
  content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--grad);
}
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  color: #3d2900; background: var(--warn); animation: pulse-badge 2s ease-in-out infinite;
}
@keyframes pulse-badge { 50% { box-shadow: 0 0 0 5px rgba(237, 161, 0, 0.18); } }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 6px; padding-top: 16px; border-top: 1px solid var(--border); }
.avatar {
  width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center;
  color: #fff; background: var(--grad); font-weight: 700; font-size: 14px;
}
.me { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
main { width: 100%; max-width: 1340px; padding: 34px clamp(16px, 3vw, 44px) 72px; }
.topbar { display: none; }

.env-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; padding: 10px 16px;
  border-radius: 14px; font-size: 13px; color: #3d2900;
  background: repeating-linear-gradient(135deg, #f7c548 0 14px, #f3b72a 14px 28px);
  box-shadow: 0 8px 20px -10px rgba(237, 161, 0, 0.8);
}
.env-banner svg.i { width: 18px; height: 18px; }
.env-banner b { letter-spacing: 0.04em; }
.env-banner .muted { color: rgba(61, 41, 0, 0.75); margin-left: auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: clamp(24px, 3vw, 32px); font-weight: 800; letter-spacing: -0.025em; }
.page-head .muted { margin-top: 4px; }
.eyebrow { color: var(--muted); font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.live-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--ok-text); background: var(--ok-soft);
}
.live-pill i { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.live-pill i::after, .status.on i::after, .dot.on::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: currentColor;
  animation: ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.live-pill i::after { background: var(--ok); }
@keyframes ping { 0% { transform: scale(1); opacity: 0.7; } 80%, 100% { transform: scale(2.8); opacity: 0; } }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.toolbar select { width: auto; min-width: 170px; }

/* ===== Kart ===== */
.card {
  position: relative; padding: 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head .muted { font-size: 13px; margin-top: 2px; }
.hero-ic {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px;
  color: var(--accent); background: var(--accent-soft);
}
.link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 13px; text-decoration: none; white-space: nowrap; }
.link svg.i { width: 16px; height: 16px; transition: transform 0.2s; }
.link:hover svg.i { transform: translateX(3px); }

/* Systemiin baidal */
.health {
  display: flex; align-items: center; gap: 16px; padding: 18px 20px; margin-bottom: 22px;
  border-radius: var(--radius); border: 1px solid; transition: background 0.4s, border-color 0.4s;
}
.h-icon {
  width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 15px;
  color: #fff; animation: glow 2.6s ease-in-out infinite;
}
.h-icon svg.i { width: 24px; height: 24px; }
.h-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.h-text b { font-size: 16px; }
.h-text span { color: var(--text-2); }
.health.ok { background: linear-gradient(120deg, var(--ok-soft), transparent 70%); border-color: rgba(12, 163, 12, 0.25); }
.health.ok .h-icon { background: var(--ok); --glow: rgba(12, 163, 12, 0.45); }
.health.warn { background: linear-gradient(120deg, var(--warn-soft), transparent 70%); border-color: rgba(237, 161, 0, 0.35); }
.health.warn .h-icon { background: var(--warn); --glow: rgba(237, 161, 0, 0.45); }
.health.bad { background: linear-gradient(120deg, var(--bad-soft), transparent 70%); border-color: rgba(208, 59, 59, 0.35); }
.health.bad .h-icon { background: var(--bad); --glow: rgba(208, 59, 59, 0.45); }
.health.info { background: linear-gradient(120deg, var(--info-soft), transparent 70%); border-color: rgba(42, 120, 214, 0.3); }
.health.info .h-icon { background: var(--info); --glow: rgba(42, 120, 214, 0.45); }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 var(--glow); } 50% { box-shadow: 0 0 0 9px transparent; } }

/* Nuur */
.dash-top { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.dash-bottom { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; }
.hero-card { overflow: hidden; display: flex; flex-direction: column; }
.hero-foot { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: auto; padding-top: 20px; }
.hero-foot div { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); min-width: 0; }
.hero-foot span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-foot b { display: block; font-size: 17px; font-weight: 700; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-card::after {
  content: ""; position: absolute; right: -80px; top: -80px; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%); pointer-events: none;
}
.hero-num { font-size: clamp(52px, 7vw, 76px); font-weight: 800; line-height: 1; letter-spacing: -0.04em; margin: 4px 0 22px; }
.hero-num.bump { animation: bump 0.6s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes bump { 40% { transform: scale(1.06); color: var(--ok-text); } }
.split { display: flex; gap: 2px; height: 14px; margin-bottom: 14px; }
.split span { min-width: 6px; height: 100%; border-radius: 4px; transform-origin: left; animation: grow-x 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.split span.none { flex: 1; background: var(--surface-2); animation: none; }
@keyframes grow-x { from { transform: scaleX(0); } }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-2); }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.legend b { color: var(--text); font-weight: 700; }
.sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.bg-success { background: var(--s-success); } .bg-declined { background: var(--s-declined); }
.bg-rejected { background: var(--s-rejected); } .bg-failed { background: var(--s-failed); }
.bg-pending { background: var(--s-pending); }

.minis { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.mini { display: flex; flex-direction: column; gap: 4px; padding: 18px; transition: transform 0.25s, box-shadow 0.25s; }
.mini:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.mini-ic { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; margin-bottom: 8px; }
.mini-ic svg.i { width: 19px; height: 19px; }
.c-ok { color: var(--ok-text); background: var(--ok-soft); }
.c-accent { color: var(--accent); background: var(--accent-soft); }
.c-info { color: var(--info-text); background: var(--info-soft); }
.c-warn { color: var(--warn-text); background: var(--warn-soft); }
.mini-k { font-size: 13px; color: var(--text-2); font-weight: 500; }
.mini-v { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.mini-v small { font-size: 16px; color: var(--muted); font-weight: 600; }
.mini > small { font-size: 12px; color: var(--muted); }

/* Graphik */
.chart { position: relative; margin: 0 -4px 12px; }
.chart svg { display: block; width: 100%; height: 240px; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .base { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .col { transition: opacity 0.15s; }
.chart.animate .col { transform-box: fill-box; transform-origin: bottom; animation: grow-y 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(var(--i) * 9ms); }
.chart svg.hovering .col:not(.on) { opacity: 0.35; }
.chart .hit { fill: transparent; cursor: crosshair; }
.f-success { fill: var(--s-success); } .f-declined { fill: var(--s-declined); }
.f-rejected { fill: var(--s-rejected); } .f-failed { fill: var(--s-failed); }
.f-pending { fill: var(--s-pending); }
@keyframes grow-y { from { transform: scaleY(0); } }
.chart-empty {
  position: absolute; inset: 0 0 24px 34px; display: grid; place-items: center;
  color: var(--muted); font-size: 13px; pointer-events: none;
}
.chart-table { margin-top: 14px; max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 12px; }
.chart-table table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-table th, .chart-table td { padding: 7px 10px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.chart-table th:first-child, .chart-table td:first-child { text-align: left; }
.chart-table th { position: sticky; top: 0; background: var(--surface); color: var(--muted); font-weight: 600; }

/* Shuud urgal */
.feed { list-style: none; margin: 0 -10px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.feed-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; }
.feed-item.new { animation: slide-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both, flash 2.6s ease-out; }
@keyframes slide-in { from { opacity: 0; transform: translateY(-14px) scale(0.98); } }
@keyframes flash { 0%, 30% { background: var(--accent-soft); } 100% { background: transparent; } }
.feed-ic { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 11px; }
.feed-ic svg.i { width: 18px; height: 18px; }
.feed-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.feed-main b { font-size: 14px; font-weight: 600; }
.feed-main span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-item time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.s-success .feed-ic { color: var(--ok-text); background: var(--ok-soft); }
.s-declined .feed-ic { color: var(--info-text); background: var(--info-soft); }
.s-failed .feed-ic { color: var(--bad-text); background: var(--bad-soft); }
.s-rejected .feed-ic { color: var(--warn-text); background: var(--warn-soft); }
.s-queued .feed-ic, .s-retrying .feed-ic { color: var(--text-2); background: var(--surface-2); }

/* Hooson tuluv, skeleton */
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 16px; text-align: center; color: var(--muted); grid-column: 1 / -1; }
.empty .e-ic { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 18px; background: var(--surface-2); color: var(--muted); animation: float 3.5s ease-in-out infinite; }
.empty .e-ic svg.i { width: 26px; height: 26px; }
.empty b { color: var(--text); font-size: 15px; }
@keyframes float { 50% { transform: translateY(-6px); } }
.skeleton {
  border-radius: 16px; min-height: 120px;
  background: linear-gradient(100deg, var(--surface) 20%, var(--surface-2) 40%, var(--surface) 60%) 0 0 / 220% 100%;
  border: 1px solid var(--border); animation: shimmer 1.3s linear infinite;
}
.skeleton.line { min-height: 52px; border-radius: 14px; }
@keyframes shimmer { to { background-position: -220% 0; } }

/* Tuluv, pill */
.status { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status i { position: relative; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.on { color: var(--ok-text); background: var(--ok-soft); }
.status.off { color: var(--muted); background: var(--surface-2); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill svg.i { width: 14px; height: 14px; }
.pill.success { color: var(--ok-text); background: var(--ok-soft); }
.pill.declined { color: var(--info-text); background: var(--info-soft); }
.pill.failed { color: var(--bad-text); background: var(--bad-soft); }
.pill.rejected { color: var(--warn-text); background: var(--warn-soft); }
.pill.queued, .pill.retrying { color: var(--text-2); background: var(--surface-2); }
.pill.retrying svg.i { animation: spin 1.4s linear infinite; }
.dot { position: relative; display: inline-block; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--ok); color: var(--ok); }

.banner {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 20px;
  border-radius: 16px; border: 1px solid rgba(237, 161, 0, 0.35);
  background: linear-gradient(120deg, var(--warn-soft), transparent 75%);
  animation: rise 0.5s both;
}
.banner > svg.i { width: 22px; height: 22px; color: var(--warn-text); animation: twinkle 2.4s ease-in-out infinite; }
.banner div { display: flex; flex-direction: column; }
.banner span { color: var(--text-2); font-size: 13px; }
@keyframes twinkle { 50% { transform: scale(1.18) rotate(12deg); } }

/* Unshigchid */
.dev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.dev-card {
  display: flex; flex-direction: column; gap: 14px; padding: 18px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
.dev-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.dev-card.setup { border-color: rgba(237, 161, 0, 0.45); background: linear-gradient(170deg, var(--warn-soft), var(--surface) 45%); }
.dev-top { display: flex; align-items: center; justify-content: space-between; }
.dev-actions { display: flex; gap: 2px; opacity: 0.6; transition: opacity 0.2s; }
.dev-card:hover .dev-actions { opacity: 1; }
.dev-room { display: flex; align-items: center; gap: 12px; }
.dev-room > svg.i { width: 40px; height: 40px; padding: 10px; border-radius: 12px; color: var(--accent); background: var(--accent-soft); }
.dev-room.none > svg.i { color: var(--muted); background: var(--surface-2); }
.dev-room strong { display: block; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.dev-room.none strong { font-size: 15px; color: var(--muted); font-weight: 600; }
.dev-room small { display: block; color: var(--muted); font-size: 12px; }
.dev-name { font-size: 14px; font-weight: 600; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dev-stats div { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.dev-stats b { display: block; font-size: 15px; font-weight: 700; }
.dev-stats span { font-size: 11px; color: var(--muted); }
.dev-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.dev-foot code { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Angiud */
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.stat-chip { display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.stat-chip > svg.i { width: 32px; height: 32px; padding: 7px; border-radius: 10px; }
.stat-chip b { font-size: 18px; font-weight: 800; }
.stat-chip span { font-size: 13px; color: var(--text-2); }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; }
.room-card {
  display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
.room-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.room-card.has { border-color: transparent; background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad) border-box; border: 1.5px solid transparent; }
.room-card.removed { opacity: 0.7; }
.room-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.bld { min-width: 30px; height: 26px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 8px; font-size: 12px; font-weight: 800; color: var(--accent); background: var(--accent-soft); }
.room-card h3 { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; overflow-wrap: anywhere; }
.room-card p { font-size: 12px; color: var(--muted); }
.room-devs { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.room-devs:empty { display: none; }
.room-card .btn { margin-top: auto; align-self: flex-start; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 3px 3px 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border);
}
.chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.chip button:hover { color: var(--bad-text); background: var(--bad-soft); }
.chip button svg.i { width: 13px; height: 13px; }

/* Husnegt */
.scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { padding: 13px 18px; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.tbl td { padding: 13px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr { transition: background 0.15s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr.enter { animation: rise 0.4s both; animation-delay: calc(var(--i) * 18ms); }
.tbl td b { display: block; font-weight: 700; white-space: nowrap; }
.tbl td small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; }
.tbl td code { font-size: 12px; padding: 3px 7px; border-radius: 6px; background: var(--surface-2); white-space: nowrap; }
.tbl td.why { color: var(--text-2); font-size: 13px; min-width: 200px; max-width: 360px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px 10px 18px; }

/* Tohirgoo */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 20px; align-items: start; }
.settings-grid form .btn { margin-top: 4px; }
.kv { list-style: none; margin: 0 0 16px; padding: 0; }
.kv li { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.kv li span { color: var(--text-2); }
.kv li code, .kv li b { text-align: right; overflow-wrap: anywhere; }
.dev-box summary, .adv summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  font-weight: 600; font-size: 13px; color: var(--text-2); padding: 6px 0;
}
.dev-box summary::-webkit-details-marker, .adv summary::-webkit-details-marker { display: none; }
.dev-box summary svg.i { width: 18px; height: 18px; }
.dev-box summary::after, .adv summary::after { content: "›"; margin-left: auto; font-size: 18px; transition: transform 0.2s; }
.dev-box[open] summary::after, .adv[open] summary::after { transform: rotate(90deg); }
.dev-box p { margin: 10px 0; font-size: 13px; color: var(--text-2); }
.code-wrap { position: relative; }
.code-wrap .icon-btn { position: absolute; top: 6px; right: 6px; background: var(--surface); }
pre { margin: 0; padding: 14px 16px; overflow-x: auto; line-height: 1.7; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }

/* ===== Modal ===== */
dialog.modal {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0;
  border: 1px solid var(--border); border-radius: 24px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.modal.sm { width: min(400px, calc(100vw - 24px)); }
dialog.modal[open] { animation: pop 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
dialog.modal::backdrop { background: rgba(8, 10, 22, 0.5); backdrop-filter: blur(6px); }
dialog.modal[open]::backdrop { animation: fade 0.25s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(0.96); } }
@keyframes fade { from { opacity: 0; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 22px 10px; }
.modal-head h2 { font-size: 20px; font-weight: 800; }
.modal-head .muted { font-size: 13px; margin-top: 2px; }
.modal-body { padding: 10px 22px; max-height: calc(100vh - 220px); overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 22px; }
.confirm { text-align: center; padding-top: 28px; }
.confirm h2 { font-size: 18px; margin: 14px 0 6px; }
.confirm-ic { width: 56px; height: 56px; display: inline-grid; place-items: center; border-radius: 18px; color: var(--bad-text); background: var(--bad-soft); }
.confirm-ic svg.i { width: 26px; height: 26px; }
.adv { margin-bottom: 8px; padding: 4px 14px; border: 1px dashed var(--border-strong); border-radius: 14px; }
.adv[open] { padding-bottom: 2px; }
.adv .field:first-of-type { margin-top: 10px; }

.switch-row {
  position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 14px; margin-bottom: 14px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); cursor: pointer;
}
.switch-row input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch { position: relative; width: 46px; height: 27px; flex: none; border-radius: 999px; background: var(--border-strong); transition: background 0.25s; }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25); transition: transform 0.3s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.switch-row input:checked + .switch { background: var(--ok); }
.switch-row input:checked + .switch::after { transform: translateX(19px); }
.switch-row input:focus-visible + .switch { box-shadow: 0 0 0 4px var(--accent-soft); }
.switch-row b { display: block; font-size: 14px; }
.switch-row small { display: block; color: var(--muted); font-size: 12px; }

.modal .search { max-width: none; }
.pick-list { list-style: none; margin: 14px 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pick-list button {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.pick-list button:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateX(3px); }
.pick-list button > span { flex: 1; min-width: 0; }
.pick-list b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-list small { color: var(--muted); font-size: 12px; }
.pick-list em { font-style: normal; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; color: var(--warn-text); background: var(--warn-soft); white-space: nowrap; }
.pick-list em.free { color: var(--ok-text); background: var(--ok-soft); }

/* Toast, tooltip */
.toasts { position: fixed; z-index: 100; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 380px; padding: 12px 16px;
  border-radius: 14px; background: #121624; color: #f1f3f9; box-shadow: var(--shadow-lg);
  font-weight: 500; animation: toast-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.toast svg.i { color: #4ade80; }
.toast.err svg.i { color: #ff8f8f; }
.toast.out { animation: toast-out 0.3s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }
.tip {
  position: fixed; left: 0; top: 0; z-index: 110; min-width: 150px; padding: 10px 12px;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow); font-size: 12px; pointer-events: none;
  opacity: 0; transition: opacity 0.12s;
}
.tip.show { opacity: 1; }
.tip .t-head { font-weight: 700; margin-bottom: 6px; color: var(--text); }
.tip .t-row { display: flex; align-items: center; gap: 8px; color: var(--text-2); line-height: 1.8; }
.tip .t-row b { margin-left: auto; padding-left: 12px; color: var(--text); font-variant-numeric: tabular-nums; }
.tip .t-key { width: 12px; height: 3px; border-radius: 2px; flex: none; }

/* Orj ireh animation (tab solihod) */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.tab.entering > * { animation: rise 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.tab.entering > *:nth-child(2) { animation-delay: 0.05s; }
.tab.entering > *:nth-child(3) { animation-delay: 0.1s; }
.tab.entering > *:nth-child(4) { animation-delay: 0.15s; }
.tab.entering > *:nth-child(5) { animation-delay: 0.2s; }
.tab.entering .dev-grid > *, .tab.entering .room-grid > *, .tab.entering .feed > *, .tab.entering .minis > * {
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(0.12s + var(--i, 0) * 30ms);
}

/* ===== Responsive ===== */
@media (max-width: 1180px) {
  .dash-top, .dash-bottom { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: auto 0 0 0; height: auto; flex-direction: row; gap: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--border);
  }
  .sidebar .brand, .side-foot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; gap: 2px; }
  .nav a { flex: 1; flex-direction: column; gap: 3px; padding: 8px 4px; font-size: 11px; text-align: center; }
  .nav a.active::before { display: none; }
  .nav-badge { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; min-width: 18px; height: 18px; font-size: 10px; }
  .topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
  .topbar .brand { padding: 0; }
  main { padding: 16px 16px 104px; }
  .page-head { margin-bottom: 18px; }
  .search { max-width: none; }
  .toasts { left: 16px; right: 16px; bottom: 92px; align-items: stretch; }
  .health { flex-wrap: wrap; }
}
@media (max-width: 520px) {
  .minis { gap: 12px; }
  .mini { padding: 14px; }
  .mini-v { font-size: 22px; }
  .card { padding: 18px; }
  .live-pill { display: none; }
  .tbl th, .tbl td { padding: 12px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
