/* ENDCORE – End design: void black, end purple, ender-pearl teal, endstone yellow. */
:root {
  --void: #06030c;
  --glass: rgba(18, 10, 32, 0.66);
  --glass-strong: rgba(14, 8, 26, 0.86);
  --glass-soft: rgba(30, 18, 52, 0.45);
  --line: rgba(176, 112, 255, 0.16);
  --line-strong: rgba(176, 112, 255, 0.38);
  --purple: #a45bff;
  --purple-2: #7a2cff;
  --purple-3: #d3a8ff;
  --glow: rgba(164, 91, 255, 0.45);
  --pearl: #2fe0c0;
  --endstone: #ece6a6;
  --text: #f1ecff;
  --muted: #aaa0c8;
  --dim: #6f6690;
  --ok: #3ce8a6;
  --warn: #ffc44d;
  --danger: #ff4f82;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--line);
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  --sans: "Segoe UI Variable", "Segoe UI", Inter, system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--void); color: var(--text); font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
::selection { background: rgba(164, 91, 255, 0.45); }
a { color: var(--purple-3); text-decoration: none; }
a:hover { color: #fff; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--pearl); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(164, 91, 255, 0.28); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(164, 91, 255, 0.5); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- background ---------- */
#bg { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -3; opacity: 0.62; filter: saturate(1.15) hue-rotate(-12deg); transition: opacity .6s; }
body.no-video #bg { display: none; }
.bg-tint {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(1200px 700px at 78% -10%, rgba(122, 44, 255, 0.35), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(47, 224, 192, 0.12), transparent 60%),
    linear-gradient(180deg, rgba(6, 3, 12, 0.35), rgba(6, 3, 12, 0.78));
}
body.no-video .bg-tint { background:
    radial-gradient(1200px 700px at 78% -10%, rgba(122, 44, 255, 0.4), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(47, 224, 192, 0.14), transparent 60%), var(--void); }
.bg-grain { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .07;
  background-image: radial-gradient(rgba(255,255,255,.7) 1px, transparent 1px); background-size: 3px 3px; mix-blend-mode: overlay; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 268px 1fr; height: 100vh; }
.sidebar {
  background: var(--glass-strong); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px; }
.brand-mark { width: 38px; height: 38px; flex: none; filter: drop-shadow(0 0 12px var(--glow)); }
.brand-name { font-weight: 800; letter-spacing: .22em; font-size: 15px; background: linear-gradient(90deg, #fff, var(--purple-3) 55%, var(--pearl)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { font-size: 10.5px; letter-spacing: .28em; color: var(--dim); text-transform: uppercase; }
.nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.nav-label { font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); padding: 16px 12px 6px; display: flex; align-items: center; justify-content: space-between; }
.nav-label button { background: none; border: 0; color: var(--dim); cursor: pointer; padding: 2px; border-radius: 6px; display: grid; }
.nav-label button:hover { color: var(--text); background: var(--glass-soft); }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--muted);
  font-weight: 500; position: relative; transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(164, 91, 255, 0.1); color: var(--text); }
.nav a.active { background: linear-gradient(90deg, rgba(164, 91, 255, 0.28), rgba(164, 91, 255, 0.06)); color: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: linear-gradient(var(--purple), var(--pearl)); box-shadow: 0 0 12px var(--glow); }
.nav a .ico { width: 18px; height: 18px; flex: none; }
.nav a .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-empty { color: var(--dim); font-size: 12.5px; padding: 6px 12px; }
.side-foot { border-top: 1px solid var(--line); padding: 14px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; background: linear-gradient(135deg, var(--purple-2), var(--pearl)); color: #0b0614; flex: none; }
.side-foot .who { flex: 1; min-width: 0; }
.side-foot .who b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .12em; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 16px 28px; border-bottom: 1px solid var(--line); background: rgba(10, 6, 20, 0.35); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.topbar h1 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: .01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .crumb { color: var(--dim); font-weight: 500; }
.menu-btn { display: none; }
.content { flex: 1; overflow-y: auto; padding: 26px 28px 40px; }
.content-inner { max-width: 1480px; margin: 0 auto; }

/* ---------- primitives ---------- */
.card { background: var(--glass); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card.pad-0 { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; font-weight: 650; flex: 1; }
.card-head .sub { color: var(--dim); font-size: 12.5px; }
.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 18px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hide { display: none !important; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: rgba(164, 91, 255, 0.1); color: var(--text); cursor: pointer; font-weight: 600; font-size: 13px;
  transition: transform .08s, background .15s, border-color .15s, box-shadow .15s; white-space: nowrap; min-height: 36px;
}
.btn:hover { background: rgba(164, 91, 255, 0.2); border-color: var(--purple); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .ico { width: 16px; height: 16px; }
.btn.primary { background: linear-gradient(135deg, var(--purple-2), var(--purple)); border-color: transparent; color: #fff; box-shadow: 0 6px 22px rgba(122, 44, 255, 0.4); }
.btn.primary:hover { box-shadow: 0 8px 30px rgba(164, 91, 255, 0.6); filter: brightness(1.08); }
.btn.teal { background: rgba(47, 224, 192, 0.12); border-color: rgba(47, 224, 192, 0.45); color: #c9fff4; }
.btn.teal:hover { background: rgba(47, 224, 192, 0.22); border-color: var(--pearl); }
.btn.danger { background: rgba(255, 79, 130, 0.1); border-color: rgba(255, 79, 130, 0.45); color: #ffd3e0; }
.btn.danger:hover { background: rgba(255, 79, 130, 0.22); border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--glass-soft); color: var(--text); }
.btn.sm { padding: 5px 10px; min-height: 30px; font-size: 12.5px; }
.btn.icon { padding: 0; width: 36px; }
.btn.sm.icon { width: 30px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.field small { color: var(--dim); font-size: 11.5px; }
.input, select.input, textarea.input {
  width: 100%; background: rgba(8, 4, 16, 0.6); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 12px; min-height: 38px; transition: border-color .15s, box-shadow .15s; color: var(--text);
}
.input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(164, 91, 255, 0.2); }
textarea.input { resize: vertical; min-height: 90px; font-family: var(--mono); font-size: 12.5px; }
select.input option { background: #140a24; }
.input-icon { position: relative; }
.input-icon .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--dim); }
.input-icon .input { padding-left: 34px; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; color: var(--muted); font-size: 13px; }
.check input { accent-color: var(--purple); width: 16px; height: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; letter-spacing: .03em; border: 1px solid transparent; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.badge.plain::before { display: none; }
.b-ok { color: var(--ok); background: rgba(60, 232, 166, 0.1); border-color: rgba(60, 232, 166, 0.3); }
.b-warn { color: var(--warn); background: rgba(255, 196, 77, 0.1); border-color: rgba(255, 196, 77, 0.3); }
.b-bad { color: var(--danger); background: rgba(255, 79, 130, 0.1); border-color: rgba(255, 79, 130, 0.3); }
.b-off { color: var(--dim); background: rgba(111, 102, 144, 0.12); border-color: rgba(111, 102, 144, 0.3); }
.b-info { color: var(--purple-3); background: rgba(164, 91, 255, 0.12); border-color: rgba(164, 91, 255, 0.35); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--dim); }
.dot.ok { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot.warn { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.dot.bad { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
.dot.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* ---------- stats ---------- */
.kpi { display: flex; gap: 14px; align-items: center; }
.kpi-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: rgba(164, 91, 255, 0.14); color: var(--purple-3); box-shadow: inset 0 0 0 1px var(--line); flex: none; }
.kpi-ico.teal { background: rgba(47, 224, 192, 0.12); color: var(--pearl); }
.kpi-ico.yellow { background: rgba(236, 230, 166, 0.1); color: var(--endstone); }
.kpi-ico.red { background: rgba(255, 79, 130, 0.1); color: var(--danger); }
.kpi-ico .ico { width: 22px; height: 22px; }
.kpi-val { font-size: 26px; font-weight: 750; line-height: 1.1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.meter { height: 7px; border-radius: 7px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 7px; background: linear-gradient(90deg, var(--purple-2), var(--purple), var(--pearl)); box-shadow: 0 0 12px var(--glow); transition: width .6s ease; }
.meter.warn > i { background: linear-gradient(90deg, #ff9b3d, var(--warn)); }
.meter.bad > i { background: linear-gradient(90deg, #ff2d6a, var(--danger)); }
.metric { display: grid; grid-template-columns: 22px 1fr auto; gap: 4px 10px; align-items: center; }
.metric .ico { width: 16px; height: 16px; color: var(--dim); }
.metric .meter { grid-column: 2 / 4; }
.metric b { font-variant-numeric: tabular-nums; font-size: 13px; }
.spark { width: 100%; height: 56px; display: block; }
.node-card .head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.node-card .head .ico-wrap { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: rgba(164, 91, 255, 0.14); color: var(--purple-3); }
.node-card h3 { margin: 0; font-size: 15px; }
.node-card .facts { display: flex; gap: 14px; flex-wrap: wrap; color: var(--dim); font-size: 12px; margin-top: 12px; }

.svc-card { display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: transform .15s, box-shadow .15s; position: relative; overflow: hidden; }
.svc-card:hover { transform: translateY(-2px); box-shadow: 0 24px 60px rgba(0,0,0,.5), 0 0 0 1px var(--line-strong), 0 0 40px rgba(122,44,255,.18); }
.svc-card .top { display: flex; align-items: center; gap: 12px; }
.svc-card .type-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, rgba(122,44,255,.35), rgba(47,224,192,.15)); color: #fff; box-shadow: inset 0 0 0 1px var(--line-strong); flex: none; }
.svc-card .type-ico .ico { width: 22px; height: 22px; }
.svc-card h3 { margin: 0; font-size: 15px; }
.svc-card .parts { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 11.5px; padding: 3px 8px; border-radius: 7px; background: rgba(255,255,255,.05); border: 1px solid var(--line); color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.chip .dot { width: 6px; height: 6px; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; border-radius: var(--radius-sm); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); font-weight: 650; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: rgba(14, 8, 26, 0.95); z-index: 1; }
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--text); }
.tbl td { padding: 9px 12px; border-bottom: 1px solid rgba(176, 112, 255, 0.07); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tbody tr:hover td { background: rgba(164, 91, 255, 0.07); }
.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.cell { font-family: var(--mono); font-size: 12px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl td.cell.null { color: var(--dim); font-style: italic; }
.tbl td.cell.editable:hover { box-shadow: inset 0 0 0 1px var(--line-strong); cursor: text; }
.tbl td .cell-input { width: 100%; min-width: 120px; background: #0b0614; border: 1px solid var(--purple); border-radius: 6px; padding: 4px 6px; font-family: var(--mono); font-size: 12px; color: var(--text); }
.empty { text-align: center; color: var(--dim); padding: 40px 20px; }
.empty .ico { width: 34px; height: 34px; opacity: .6; margin-bottom: 8px; }
.pager { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--muted); font-weight: 600; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a .ico { width: 15px; height: 15px; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: #fff; border-bottom-color: var(--purple); text-shadow: 0 0 18px var(--glow); }

.svc-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.svc-header .type-ico { width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center; background: linear-gradient(135deg, rgba(122,44,255,.45), rgba(47,224,192,.2)); box-shadow: inset 0 0 0 1px var(--line-strong), 0 0 30px rgba(122,44,255,.3); flex: none; }
.svc-header .type-ico .ico { width: 28px; height: 28px; }
.svc-header h2 { margin: 0; font-size: 22px; }
.svc-header .meta { color: var(--dim); font-size: 12.5px; display: flex; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.svc-header .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

/* ---------- logs / code ---------- */
.log-layout { display: grid; grid-template-columns: 260px 1fr; gap: 18px; min-height: 560px; }
.log-list { max-height: 70vh; overflow-y: auto; }
.log-list .grp { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim); padding: 12px 10px 4px; }
.log-list a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--muted); font-size: 13px; }
.log-list a:hover { background: var(--glass-soft); color: var(--text); }
.log-list a.active { background: rgba(164, 91, 255, 0.2); color: #fff; }
pre.code { margin: 0; background: rgba(4, 2, 9, 0.75); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; font: 12.5px/1.55 var(--mono); color: #dcd5f0; overflow: auto; max-height: 68vh; white-space: pre-wrap; word-break: break-all; }
pre.code .l-err { color: #ff8fb0; }
pre.code .l-warn { color: var(--warn); }
pre.code .l-hit { background: rgba(47, 224, 192, 0.18); color: #fff; }
.output { max-height: 320px; }

/* ---------- files ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-family: var(--mono); font-size: 12.5px; }
.crumbs a { padding: 3px 6px; border-radius: 6px; color: var(--muted); }
.crumbs a:hover { background: var(--glass-soft); color: #fff; }
.crumbs .sl { color: var(--dim); }
.fname { display: flex; align-items: center; gap: 10px; }
.fname .ico { width: 17px; height: 17px; color: var(--dim); flex: none; }
.fname .ico.folder { color: var(--endstone); }
.drop-hint { border: 2px dashed var(--purple); border-radius: var(--radius); }

/* ---------- modal / drawer / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(4, 2, 8, 0.66); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 50; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal { width: min(640px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--glass-strong); border-radius: 18px; box-shadow: var(--shadow), 0 0 80px rgba(122, 44, 255, 0.25); padding: 24px; animation: rise .2s; }
.modal.wide { width: min(980px, 100%); }
.modal.xwide { width: min(1240px, 100%); }
.modal h2 { margin: 0 0 4px; font-size: 18px; }
.modal .lead { color: var(--muted); margin: 0 0 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.drawer-overlay { place-items: stretch end; padding: 0; }
.drawer { width: min(820px, 100vw); height: 100vh; overflow: auto; background: var(--glass-strong); border-left: 1px solid var(--line-strong); padding: 26px; animation: slide .2s; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 80; }
.toast { min-width: 260px; max-width: 420px; padding: 12px 16px; border-radius: 12px; background: var(--glass-strong); box-shadow: var(--shadow); border-left: 3px solid var(--purple); animation: rise .2s; font-size: 13px; }
.toast.ok { border-left-color: var(--ok); }
.toast.bad { border-left-color: var(--danger); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; overflow-y: auto; height: 100vh; }
.auth-card { width: min(420px, 100%); padding: 34px 32px; border-radius: 22px; background: var(--glass-strong); box-shadow: var(--shadow), 0 0 120px rgba(122, 44, 255, 0.35); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); animation: rise .35s; }
.auth-card .brand { padding: 0 0 20px; justify-content: center; flex-direction: column; text-align: center; gap: 10px; }
.auth-card .brand-mark { width: 64px; height: 64px; }
.auth-card .brand-name { font-size: 24px; }
.auth-card form > * + * { margin-top: 14px; }
.auth-card .btn.primary { width: 100%; min-height: 44px; font-size: 14px; }
.auth-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; color: var(--dim); font-size: 12px; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.lang-switch button { background: none; border: 0; padding: 5px 10px; cursor: pointer; color: var(--dim); font-weight: 700; font-size: 11.5px; letter-spacing: .08em; }
.lang-switch button.on { background: rgba(164, 91, 255, 0.25); color: #fff; }
.alert { padding: 10px 14px; border-radius: 10px; font-size: 13px; border: 1px solid; }
.alert.bad { background: rgba(255, 79, 130, 0.1); border-color: rgba(255, 79, 130, 0.35); color: #ffd3e0; }
.alert.info { background: rgba(164, 91, 255, 0.1); border-color: var(--line-strong); color: var(--purple-3); }
.alert.warn { background: rgba(255, 196, 77, 0.08); border-color: rgba(255, 196, 77, 0.35); color: #ffe7b0; }

/* ---------- misc ---------- */
.type-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.type-pick button { text-align: left; background: rgba(8, 4, 16, 0.5); border: 1px solid var(--line); border-radius: 14px; padding: 16px; cursor: pointer; color: var(--text); transition: border-color .15s, background .15s; }
.type-pick button:hover { border-color: var(--purple); }
.type-pick button.on { border-color: var(--purple); background: rgba(164, 91, 255, 0.15); box-shadow: 0 0 30px rgba(122, 44, 255, 0.25); }
.type-pick b { display: block; margin: 10px 0 4px; }
.type-pick span { color: var(--dim); font-size: 12px; }
.type-pick .ico { width: 26px; height: 26px; color: var(--purple-3); }
.inv { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.inv .it { background: rgba(8, 4, 16, 0.55); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; }
.inv .it b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv .it span { color: var(--dim); font-size: 11.5px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 13px; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.term-wrap { height: calc(100vh - 220px); min-height: 360px; padding: 12px; background: rgba(4, 2, 9, 0.88); }
.term-wrap .xterm { height: 100%; }
.ico { width: 18px; height: 18px; display: inline-block; vertical-align: middle; flex: none; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); padding: 40px; }
.qr-secret { font-family: var(--mono); font-size: 17px; letter-spacing: .14em; padding: 12px 14px; background: rgba(8, 4, 16, 0.6); border: 1px dashed var(--line-strong); border-radius: 10px; text-align: center; word-break: break-all; }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-strong); background: rgba(255,255,255,.04); }

@media (max-width: 1200px) { .items-layout { grid-template-columns: 1fr !important; } .items-layout > .card:first-child { position: static !important; } .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 80px rgba(0,0,0,.7); }
  .menu-btn { display: inline-flex; }
  .content { padding: 18px 16px 30px; }
  .topbar { padding: 12px 16px; }
  .g-2, .form-grid, .type-pick { grid-template-columns: 1fr; }
  .g-3, .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { gap: 10px; } .kpi-ico { width: 38px; height: 38px; } .kpi-val { font-size: 21px; }
  .log-layout { grid-template-columns: 1fr; }
  .svc-header .actions { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } #bg { display: none; } }
