:root {
  --bg: #080a10;
  --bg-elevated: #0b0e15;
  --panel: #0f131c;
  --panel-hover: #121722;
  --panel-strong: #141a26;
  --line: #202735;
  --line-strong: #2b3546;
  --text: #f1f4fa;
  --text-soft: #c9d0dc;
  --muted: #8993a5;
  --muted-2: #667184;
  --accent: #8aa7ff;
  --accent-soft: #17213a;
  --green: #79d4aa;
  --yellow: #dec26d;
  --red: #ed7d89;
  --sidebar-w: 278px;
  --topbar-h: 72px;
  --radius: 11px;
  --radius-sm: 8px;
  --ease: cubic-bezier(.2,.7,.2,1);
  --shadow: 0 18px 45px rgba(0,0,0,.24);
}

* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
::selection { background: rgba(138,167,255,.28); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #262e3c; border: 3px solid transparent; background-clip: padding-box; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #344054; border: 3px solid transparent; background-clip: padding-box; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.stack { display: flex; flex-direction: column; }
.gap-12 { gap: 12px; }
.full { width: 100%; }
.code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.wrap { white-space: normal !important; word-break: break-word; }

.ui-icon {
  width: 1em;
  height: 1em;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

/* shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) 1fr; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: #0a0d13;
  border-right: 1px solid #181e29;
  box-shadow: 10px 0 28px rgba(0,0,0,.12);
}
.server-select {
  min-height: 72px;
  margin: 14px 14px 8px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0f131c;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.server-select:hover { border-color: #303a4c; background: #111620; }
.server-icon {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: #e9edf5;
  color: #0c1018;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.03em;
}
.server-select-copy { min-width: 0; flex: 1; }
.server-select-copy strong { display: block; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-select-copy small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.chev { color: var(--muted-2); }

.searchbox {
  height: 41px;
  margin: 4px 14px 12px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0c1017;
  color: var(--muted);
  transition: border-color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
}
.searchbox:focus-within { border-color: #42506a; background: #10151f; box-shadow: 0 0 0 3px rgba(138,167,255,.06); }
.searchbox input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 12.5px; }
.searchbox input::placeholder { color: #606b7d; }
.search-icon { display: inline-grid; place-items: center; }

.sidebar-nav { padding: 2px 11px 82px; overflow: auto; }
.nav-item, .nav-group-title {
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  text-align: left;
}
.nav-item {
  min-height: 42px;
  padding: 0 11px;
  gap: 11px;
  border-radius: 8px;
  color: #9aa4b7;
  font-size: 12.5px;
  font-weight: 600;
  transition: background .16s var(--ease), color .16s var(--ease), transform .16s var(--ease);
}
.nav-item:hover { background: #111620; color: #dbe0ea; transform: translateX(1px); }
.nav-item.active { background: #171e2b; color: #f7f9fc; box-shadow: inset 2px 0 0 var(--accent); }
.nav-item.sub { min-height: 40px; padding-left: 22px; color: #8d98aa; font-weight: 520; }
.nav-item.sub.active { color: #f0f3f8; }
.nav-group { margin: 9px 0; }
.nav-group-title {
  min-height: 34px;
  padding: 0 10px;
  justify-content: space-between;
  color: #626d7f;
  font-size: 10px;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: .075em;
}
.nav-group-title > span:first-child { display: flex; align-items: center; gap: 10px; }
.nav-icon { width: 18px; height: 18px; display: inline-grid; place-items: center; color: #71809a; flex: 0 0 18px; }
.nav-item:hover .nav-icon { color: #9cabc4; }
.nav-item.active .nav-icon { color: #a9beff; }
.nav-icon .ui-icon { width: 17px; height: 17px; }

.sidebar-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64px;
  padding: 11px 14px;
  display: flex;
  gap: 8px;
  background: #0a0d13;
  border-top: 1px solid #181e29;
}

.main { grid-column: 2; min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 28px;
  border-bottom: 1px solid #181e29;
  background: rgba(8,10,16,.9);
  backdrop-filter: blur(12px);
}
.topbar-spacer { flex: 1; }
.icon-btn, .sidebar-footer button {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f131c;
  color: #9aa5b8;
  display: inline-grid;
  place-items: center;
  transition: background .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease), transform .16s var(--ease);
}
.icon-btn:hover, .sidebar-footer button:hover { background: #151b26; border-color: #303b4f; color: #f4f6fa; }
.icon-btn:active, .sidebar-footer button:active { transform: scale(.97); }
.icon-btn .ui-icon, .sidebar-footer .ui-icon { width: 18px; height: 18px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid #3a2b31;
  border-radius: 999px;
  background: #171014;
  color: #d88d96;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: #db6673; }
.status-pill.online { border-color: #254638; background: #0f1b16; color: #8fd7b6; }
.status-pill.online i { background: #72cea4; }
.license-pill { border-color: #2a3854; background: #0e1522; color: #9fb8e8; }
.license-pill.active { border-color: #294839; background: #0f1c17; color: #91d5b5; }
.license-pill.expired, .license-pill.suspended, .license-pill.revoked { border-color: #53303a; background: #211116; color: #e896a0; }
.user-chip { height: 42px; display: flex; align-items: center; gap: 9px; padding: 0 7px 0 5px; border-radius: 9px; }
.avatar { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: #e9edf5; color: #10141d; font-size: 12px; font-weight: 800; }
.user-chip strong { display: block; font-size: 12px; }
.user-chip small { display: block; margin-top: 1px; color: var(--muted); font-size: 10px; }

/* page */
.page { width: min(100%, 1760px); margin: 0 auto; padding: 32px 34px 52px; }
.page.page-enter { animation: page-in .2s var(--ease) both; }
.page.is-updating { opacity: .82; transition: opacity .12s linear; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin: 0 0 22px; }
.page-title { display: flex; align-items: flex-start; gap: 12px; }
.page-heading-icon {
  width: 40px;
  height: 40px;
  margin-top: 1px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #10151e;
  color: #a9bcf7;
  display: grid;
  place-items: center;
  flex: 0 0 40px;
}
.page-heading-icon .ui-icon { width: 19px; height: 19px; }
.page-title h1 { margin: 0; color: #f4f6fa; font-size: 28px; line-height: 1.12; letter-spacing: -.03em; font-weight: 740; }
.page-title p { margin: 7px 0 0; color: var(--muted); font-size: 12.5px; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.page-loading { display: grid; gap: 12px; animation: fade-in .14s ease both; }
.loading-head, .loading-card { border: 1px solid var(--line); border-radius: var(--radius); background: #0e121a; overflow: hidden; position: relative; }
.loading-head { width: 260px; height: 46px; border: 0; background: #10151d; }
.loading-card { height: 160px; }
.loading-card:after, .loading-head:after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.025), transparent); animation: shimmer 1.1s linear infinite; }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(255,255,255,.012);
  transition: border-color .18s var(--ease), background .18s var(--ease), transform .18s var(--ease);
}
.card:hover { border-color: #2a3445; }
.card-pad { padding: 18px; }
.card-head { min-height: 62px; padding: 14px 17px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #1d2430; }
.card-head h2 { margin: 0; font-size: 13.5px; line-height: 1.3; font-weight: 700; }
.card-head h2.with-icon, .section-title.with-icon { display: flex; align-items: center; gap: 8px; }
.card-head h2.with-icon .ui-icon, .section-title.with-icon .ui-icon { width: 16px; height: 16px; color: #8fa7db; }
.card-sub { margin-top: 4px; color: var(--muted); font-size: 10.5px; }
.grid { display: grid; gap: 13px; }
.grid-2 { grid-template-columns: repeat(2,minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4,minmax(0,1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

/* buttons */
.btn {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #2b3444;
  border-radius: 8px;
  background: #121721;
  color: #cbd2dd;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 650;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .15s var(--ease);
}
.btn:hover { background: #171e2a; border-color: #3a465c; color: #fff; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: #e9edf5; border-color: #e9edf5; color: #11151d; }
.btn.primary:hover { background: #fff; border-color: #fff; }
.btn.danger { background: #251317; border-color: #542e36; color: #ef939d; }
.btn.danger:hover { background: #30171d; border-color: #6b3944; color: #ffadb5; }
.btn.small { min-height: 31px; padding: 0 10px; font-size: 10.5px; }
.btn:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.btn .button-icon { display: inline-grid; place-items: center; }
.btn .button-icon .ui-icon { width: 14px; height: 14px; }

/* dashboard */
.server-card { min-height: 114px; margin-bottom: 13px; padding: 20px; display: grid; grid-template-columns: minmax(280px,1.8fr) repeat(4,minmax(120px,.65fr)); align-items: center; gap: 20px; }
.server-card > div:not(:first-child) { padding-left: 19px; border-left: 1px solid #1f2632; }
.server-name { font-size: 23px; font-weight: 760; letter-spacing: -.025em; }
.server-note { margin-top: 6px; color: var(--muted); font-size: 11.5px; }
.metric-label { display: block; color: #788397; font-size: 9.5px; font-weight: 720; text-transform: uppercase; letter-spacing: .08em; }
.metric-value { display: block; margin-top: 6px; color: #f0f3f8; font-size: 19px; font-weight: 730; }
.online-badge { display: inline-flex; align-items: center; height: 24px; margin-left: 9px; padding: 0 8px; border: 1px solid #2c533f; border-radius: 999px; background: #102018; color: #8bd9b2; font-size: 9px; font-weight: 700; vertical-align: 3px; }
.chart-card { min-height: 330px; position: relative; }
.chart-wrap { height: 274px; padding: 18px 16px 15px; }
.chart-wrap canvas { width: 100%; height: 100%; }
.chart-label { position: absolute; right: 18px; top: 15px; text-align: right; }
.chart-label strong { display: block; font-size: 22px; }
.chart-label small { display: block; margin-top: 1px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.mini-card { height: 162px; position: relative; overflow: hidden; }
.mini-card canvas { position: absolute; inset: 47px 0 0; width: 100%; height: 114px; }
.mini-number { position: absolute; right: 15px; top: 14px; font-size: 22px; font-weight: 800; }
.mini-number small { display: block; margin-top: 1px; text-align: right; color: var(--muted); font-size: 9px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; }
.quick-actions { display: grid; gap: 7px; padding: 13px; }
.quick-actions .btn { min-height: 32px; }
.stat-tile { padding: 17px; min-height: 110px; position: relative; }
.stat-tile .metric-value { font-size: 24px; }
.stat-tile .metric-label { font-size: 9px; }
.stat-tile-icon { position: absolute; top: 15px; right: 15px; color: #65738a; }
.stat-tile-icon .ui-icon { width: 17px; height: 17px; }

/* tables */
.table-card { overflow: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 780px; }
.table th, .table td { padding: 14px 15px; border-bottom: 1px solid #1d2430; text-align: left; white-space: nowrap; font-size: 11.5px; vertical-align: middle; }
.table th { position: sticky; top: 0; z-index: 2; background: #0d1119; color: #737e91; font-size: 9px; font-weight: 760; text-transform: uppercase; letter-spacing: .075em; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr td { transition: background .14s var(--ease); }
.table tbody tr:hover td { background: #121722; }
.row-actions { display: flex; gap: 6px; align-items: center; }
.tag { display: inline-flex; align-items: center; min-height: 25px; padding: 0 8px; border: 1px solid #303848; border-radius: 6px; background: #121720; color: #b2bac8; font-size: 9.5px; font-weight: 650; }
.tag.green { color: #8bd7b2; border-color: #2b523f; background: #102018; }
.tag.red { color: #ef929c; border-color: #57313a; background: #211217; }
.tag.yellow { color: #dbc77e; border-color: #554a2d; background: #201b10; }
.tag.blue { color: #9eb9ed; border-color: #314461; background: #101824; }
.empty { min-height: 126px; padding: 28px; display: grid; place-items: center; align-content: center; text-align: center; color: var(--muted); font-size: 11px; }
.empty strong { display: block; margin-bottom: 5px; color: #d7dce5; font-size: 12px; }

/* forms */
.input, .textarea, .select, .field-control input, .field-control textarea, .field-control select {
  width: 100%;
  border: 1px solid #2b3444;
  border-radius: 8px;
  background: #0b1017;
  color: #e5e9f0;
  outline: 0;
  padding: 0 11px;
  font-size: 11.5px;
  transition: border-color .16s var(--ease), background .16s var(--ease), box-shadow .16s var(--ease);
}
.input, .select, .field-control input, .field-control select { height: 40px; }
.textarea, .field-control textarea { min-height: 100px; padding-top: 10px; padding-bottom: 10px; resize: vertical; }
.input:focus, .textarea:focus, .select:focus, .field-control input:focus, .field-control textarea:focus, .field-control select:focus { border-color: #526585; background: #0e141e; box-shadow: 0 0 0 3px rgba(138,167,255,.07); }
input::placeholder, textarea::placeholder { color: #596476; }
.form-grid { display: grid; gap: 0; }
.field-row { min-height: 64px; padding: 10px 0; display: grid; grid-template-columns: minmax(220px,1fr) minmax(260px,1fr); align-items: center; gap: 22px; border-top: 1px solid #1b222d; }
.field-row:first-child { border-top: 0; }
.field-copy strong { display: block; font-size: 11.5px; font-weight: 650; }
.field-copy p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.field-control { display: flex; align-items: center; justify-content: flex-end; }
.field-control > input, .field-control > textarea, .field-control > select { max-width: 430px; }
.toggle { position: relative; width: 40px; height: 22px; flex: 0 0 auto; padding: 0; border: 1px solid #3a4353; border-radius: 999px; background: #232a36; transition: background .18s var(--ease), border-color .18s var(--ease); }
.toggle:before { content: ""; position: absolute; width: 14px; height: 14px; top: 3px; left: 4px; border-radius: 50%; background: #8a94a4; transition: transform .18s var(--ease), background .18s var(--ease); }
.toggle.on { border-color: #dfe5ef; background: #dfe5ef; }
.toggle.on:before { transform: translateX(17px); background: #0d121a; }
.section-card { margin-bottom: 13px; }
.section-body { padding: 20px; }
.section-title { margin: 0; font-size: 18px; font-weight: 730; }
.section-copy { margin: 5px 0 0; color: var(--muted); font-size: 10.5px; }
.webhook-row { display: grid; grid-template-columns: 120px 1fr 42px; gap: 11px; align-items: center; margin-bottom: 10px; }
.webhook-row label { font-size: 11px; font-weight: 600; }
.radio-tabs { display: flex; border: 1px solid #2a3443; border-radius: 8px; overflow: hidden; background: #0c1119; }
.radio-tabs button { height: 36px; padding: 0 12px; border: 0; border-right: 1px solid #2a3443; background: transparent; color: #8791a3; font-size: 10px; transition: background .14s var(--ease), color .14s var(--ease); }
.radio-tabs button:last-child { border-right: 0; }
.radio-tabs button.active { background: #1a2230; color: #fff; }

/* rules */
.rules-toolbar { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.rules-grid { display: grid; grid-template-columns: repeat(3,minmax(320px,1fr)); gap: 13px; }
.rule-card { min-height: 270px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #0e121a; transition: border-color .17s var(--ease), background .17s var(--ease), transform .17s var(--ease); }
.rule-card:hover { border-color: #2e394b; background: #10151e; transform: translateY(-1px); }
.rule-card h3 { margin: 0; display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 730; }
.rule-card > p { margin: 6px 0 13px; color: var(--muted); font-size: 10px; }
.rule-group-icon { width: 28px; height: 28px; border: 1px solid #263043; border-radius: 7px; background: #111722; color: #8da5d8; display: grid; place-items: center; }
.rule-group-icon .ui-icon { width: 14px; height: 14px; }
.rule-row { display: grid; grid-template-columns: minmax(0,1fr) auto 82px 42px; align-items: center; gap: 8px; min-height: 44px; border-top: 1px solid rgba(32,39,53,.72); }
.rule-row:first-of-type { border-top: 0; }
.rule-name { overflow: hidden; text-overflow: ellipsis; font-size: 10.5px; font-weight: 560; }
.rule-source { font-size: 8.5px; color: #7c879a; border: 1px solid #2a3342; border-radius: 5px; padding: 3px 5px; background: #10151d; }
.rule-row select { height: 31px; border: 1px solid #2c3545; border-radius: 7px; background: #111721; color: #dbe0e8; padding: 0 7px; font-size: 9.5px; outline: 0; }
.rule-row .toggle { justify-self: end; }
.rule-dot { display: none; }

/* console + map */
.console { height: 510px; padding: 15px; overflow: auto; border: 1px solid #1d2430; border-radius: 10px; background: #06080c; font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; line-height: 1.75; }
.console-line { display: flex; gap: 10px; }
.console-time { color: #5e6879; }
.console-level-info { color: #89a8df; }
.console-level-warn { color: #d8c172; }
.console-level-error { color: #e78690; }
.console-input { display: flex; gap: 9px; margin-top: 10px; }
.console-input input { flex: 1; }
.map-card { height: 680px; position: relative; overflow: hidden; background: #0a0d13; }
.map-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(110,124,154,.045) 1px,transparent 1px),linear-gradient(90deg,rgba(110,124,154,.045) 1px,transparent 1px); background-size: 44px 44px; }
.map-grid:before, .map-grid:after { content: ""; position: absolute; inset: 15% 8%; border: 1px solid rgba(130,146,188,.07); border-radius: 46% 54% 51% 49%; transform: rotate(-18deg); }
.map-grid:after { inset: 31% 23%; transform: rotate(22deg); }
.map-player { position: absolute; z-index: 3; display: flex; flex-direction: column; align-items: center; transform: translate(-50%,-50%); animation: marker-in .24s var(--ease) both; }
.map-player i { width: 10px; height: 10px; border: 2px solid #eef2f8; border-radius: 50%; background: #86a4ec; }
.map-player span { margin-top: 6px; padding: 3px 6px; border: 1px solid #30394a; border-radius: 5px; background: #0e131b; color: #dce2ed; font-size: 9px; white-space: nowrap; }
.map-legend { position: absolute; top: 14px; left: 14px; z-index: 4; padding: 8px 10px; border: 1px solid #2b3443; border-radius: 7px; background: rgba(10,14,21,.92); color: var(--muted); font-size: 9.5px; }

/* login */
.login-screen { height: 100vh; display: grid; place-items: center; background: #080a10; }
.login-card { width: min(430px,calc(100vw - 32px)); padding: 31px; border: 1px solid #27303e; border-radius: 13px; background: #0e1219; box-shadow: 0 28px 70px rgba(0,0,0,.35); animation: login-in .26s var(--ease) both; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-large { font-size: 20px; letter-spacing: -.02em; }
.brand span { color: #9eb3de; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; border: 1px solid #334058; border-radius: 9px; background: #131925; color: #dce5f6 !important; font-size: 13px; font-weight: 800; }
.login-card > p { margin: 8px 0 22px; }
.login-card label { display: grid; gap: 7px; color: #a5afbf; font-size: 11px; }
.login-card input { height: 42px; border: 1px solid #2b3444; border-radius: 8px; background: #0a0e15; padding: 0 11px; outline: 0; }
.login-card input:focus { border-color: #526585; box-shadow: 0 0 0 3px rgba(138,167,255,.07); }
.form-error { min-height: 16px; margin-top: 11px; color: #ed8893; font-size: 10px; }

/* overlays */
.toast-root { position: fixed; top: 17px; right: 17px; z-index: 1000; display: flex; flex-direction: column; gap: 9px; pointer-events: none; }
.toast { min-width: 300px; max-width: 430px; padding: 13px 14px; border: 1px solid #303a4c; border-radius: 9px; background: #111620; box-shadow: var(--shadow); font-size: 11px; animation: toast-in .2s var(--ease) both; pointer-events: auto; }
.toast.error { border-color: #58313a; background: #1d1115; }
.toast.exiting { animation: toast-out .16s ease both; }
.toast strong { display: block; margin-bottom: 3px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 20px; background: rgba(3,5,8,.74); backdrop-filter: blur(5px); animation: fade-in .16s ease both; }
.modal-backdrop.closing { animation: fade-out .14s ease both; }
.modal-backdrop.closing .modal { animation: modal-out .14s ease both; }
.modal { width: min(640px,100%); max-height: 90vh; overflow: auto; border: 1px solid #2d3747; border-radius: 12px; background: #0f141d; box-shadow: 0 30px 80px rgba(0,0,0,.44); animation: modal-in .2s var(--ease) both; }
.modal-head { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #1d2430; }
.modal-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.modal-body { padding: 18px; }
.modal-foot { padding: 13px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid #1d2430; }
.detail-list { display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 10px 13px; font-size: 11px; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; word-break: break-word; }
.divider { height: 1px; margin: 14px 0; background: #1d2430; }
.notice { margin-bottom: 13px; padding: 12px 13px; border: 1px solid #30405a; border-radius: 8px; background: #101722; color: #b5c4df; font-size: 10.5px; }
.warning { border-color: #51472c; background: #1f1a0f; color: #dccb8a; }
.license-key-box { padding: 13px; border: 1px dashed #40506a; border-radius: 9px; background: #0a1018; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.license-key-box code { font-size: 11px; word-break: break-all; }
.license-activation { padding: 10px 11px; border: 1px solid #1f2632; border-radius: 7px; background: #0b1017; }
.license-activation strong { display: block; font-size: 10px; }
.license-activation small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }

:focus-visible { outline: 2px solid rgba(138,167,255,.58); outline-offset: 2px; }

@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-5px); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes modal-out { to { opacity: 0; transform: translateY(4px) scale(.99); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes login-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes marker-in { from { opacity: 0; transform: translate(-50%,-45%) scale(.85); } to { opacity: 1; transform: translate(-50%,-50%) scale(1); } }
@keyframes shimmer { to { transform: translateX(100%); } }

@media (max-width: 1400px) {
  .rules-grid { grid-template-columns: repeat(2,minmax(300px,1fr)); }
  .grid-4 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .server-card { grid-template-columns: 1.6fr repeat(3,1fr); }
  .server-card > div:nth-child(n+5) { display: none; }
}
@media (max-width: 980px) {
  :root { --sidebar-w: 0px; }
  .app-shell { display: block; }
  .sidebar { left: -290px; width: 278px; transition: left .2s var(--ease); }
  .app-shell.sidebar-open .sidebar { left: 0; }
  .main { grid-column: auto; }
  .page { padding: 26px 20px 40px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
  .rules-grid { grid-template-columns: 1fr; }
  .server-card { grid-template-columns: 1fr 1fr; }
  .server-card > div:nth-child(n+3) { display: none; }
  .license-pill { display: none; }
}
@media (max-width: 680px) {
  .topbar { padding: 0 13px; }
  .page { padding: 20px 13px 34px; }
  .page-head { flex-direction: column; }
  .actions { justify-content: flex-start; }
  .page-title h1 { font-size: 25px; }
  .grid-4 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; gap: 8px; }
  .field-control { justify-content: flex-start; }
  .field-control > input, .field-control > textarea, .field-control > select { max-width: none; }
  .server-card { grid-template-columns: 1fr; }
  .server-card > div:nth-child(n+2) { display: none; }
  .status-pill { display: none; }
  .webhook-row { grid-template-columns: 1fr 42px; }
  .webhook-row label { grid-column: 1/-1; }
  .rule-row { grid-template-columns: minmax(0,1fr) 72px 42px; }
  .rule-source { display: none; }
  .detail-list { grid-template-columns: 1fr; }
  .table th, .table td { padding: 12px 13px; }
  .page-heading-icon { width: 37px; height: 37px; flex-basis: 37px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
