:root {
  color-scheme: dark;
  --bg: #0b0e12;
  --surface: #131820;
  --surface-2: #1a212b;
  --line: #2a3441;
  --text: #edf2f7;
  --muted: #8f9baa;
  --accent: #70d6a1;
  --danger: #ff6b6b;
  --shadow: 0 18px 55px rgba(0,0,0,.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; max-width: 100%; overflow-x: hidden; background: var(--bg); color: var(--text); }
body { font-size: 14px; }
button, input, textarea { font: inherit; }
button { min-height: 38px; padding: 8px 13px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; transition: border-color .15s ease, transform .15s ease, background .15s ease; }
button:hover { border-color: #526071; }
button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(112,214,161,.36); outline-offset: 2px; }
button.primary { background: var(--accent); color: #07120c; border-color: var(--accent); font-weight: 750; }
button.danger { color: #ffdede; border-color: rgba(255,107,107,.45); background: rgba(255,107,107,.11); }
.toolbar { position: fixed; z-index: 20; inset: 0 0 auto; min-height: 72px; padding: 12px 18px; display: grid; grid-template-columns: minmax(190px, .7fr) minmax(180px, 1fr) auto; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); background: rgba(11,14,18,.96); box-shadow: 0 10px 30px rgba(0,0,0,.22); }
.brand { display: flex; gap: 10px; align-items: center; min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; background: var(--accent); color: #07120c; font-weight: 900; }
.brand b, .brand small { display: block; }
.brand small { margin-top: 2px; color: var(--muted); }
.search input { width: 100%; min-height: 42px; padding: 8px 12px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.bulk-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.panel-main { padding: 94px 18px 30px; }
.moderator-settings { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(300px, 1.2fr); gap: 18px; align-items: center; max-width: 1900px; margin: 0 auto 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.moderator-settings h1 { margin: 0 0 5px; font-size: 16px; }
.moderator-settings p { margin: 0; color: var(--muted); line-height: 1.4; }
.moderator-settings code { color: var(--accent); }
.moderator-settings form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }
.moderator-settings label { min-width: 0; }
.moderator-settings textarea { display: block; width: 100%; min-height: 62px; resize: vertical; padding: 9px 11px; color: var(--text); background: #0e1217; border: 1px solid var(--line); border-radius: 8px; }
.client-grid { --columns: 1; --card-basis: 100%; display: flex; flex-wrap: wrap; align-items: stretch; gap: 14px; max-width: 1900px; margin: 0 auto; }
.client-card { position: relative; min-width: 280px; max-width: 100%; flex: 1 1 var(--card-basis); display: flex; flex-direction: column; padding: 15px 15px 52px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.client-card.manual-size { flex: 0 0 min(var(--client-card-width), 100%); width: min(var(--client-card-width), 100%); }
.card-head { display: grid; grid-template-columns: auto auto minmax(0,1fr) auto; gap: 10px; align-items: start; }
.move-grip { width: 28px; min-height: 28px; padding: 0; touch-action: none; cursor: grab; color: var(--muted); background: transparent; border-color: transparent; font-size: 18px; line-height: 1; }
.move-grip:hover, .move-grip:focus-visible { color: var(--text); border-color: var(--line); background: var(--surface-2); }
.client-card.dragging { opacity: .58; pointer-events: none; outline: 2px dashed var(--accent); outline-offset: 2px; }
.client-card.dragging .move-grip { cursor: grabbing; }
.client-select { padding-top: 4px; }
.identity { min-width: 0; }
.identity h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.identity p { margin: 4px 0 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-badge { padding: 4px 8px; border-radius: 999px; color: var(--muted); background: #222a34; white-space: nowrap; font-size: 12px; }
.status-badge.online { color: var(--accent); background: rgba(112,214,161,.1); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 14px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.stats div { padding: 8px 10px; background: var(--surface-2); min-width: 0; }
.stats dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.stats dd { margin: 4px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.tool { display: flex; align-items: center; gap: 12px; }
.tool-item { display: inline-flex; align-items: center; gap: 6px; }
.tool-item img { width: 24px; height: 24px; flex: 0 0 24px; object-fit: contain; image-rendering: pixelated; }
.inventory-grid { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 3px; width: 100%; }
.inventory-slot { position: relative; aspect-ratio: 1; min-width: 0; contain: layout paint; border: 1px solid #35404d; border-radius: 4px; background: #0e1217; image-rendering: pixelated; }
.inventory-slot img { display: block; width: 100%; height: 100%; padding: 8%; object-fit: contain; }
.inventory-slot span { position: absolute; right: 2px; bottom: 0; color: #fff; font-weight: 800; font-size: clamp(8px, 1.1vw, 12px); text-shadow: 1px 1px #000, -1px -1px #000; }
.command-composer { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; margin-top: 12px; }
.command-composer label { min-width: 0; }
.command-input { width: 100%; min-height: 38px; padding: 7px 10px; color: var(--text); background: #0e1217; border: 1px solid var(--line); border-radius: 8px; }
.command-composer button { min-height: 38px; padding-inline: 10px; }
.command-send { color: #dce8ff; border-color: rgba(120,164,255,.45); background: rgba(74,118,210,.13); }
.chat-send { color: #d9ffe9; border-color: rgba(112,214,161,.45); background: rgba(112,214,161,.1); }
.card-footer { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 14px; }
.last-update { color: var(--muted); font-size: 12px; }
.card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.card-actions button { min-height: 34px; padding: 6px 9px; }
.resize-grip { position: absolute; right: 7px; bottom: 7px; width: 30px; min-height: 30px; padding: 0; overflow: hidden; touch-action: none; cursor: nwse-resize; background: transparent; border-color: transparent; }
.resize-grip::after { content: ""; position: absolute; right: 4px; bottom: 4px; width: 15px; height: 15px; opacity: .62; background: repeating-linear-gradient(135deg, transparent 0 3px, var(--muted) 3px 5px); clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.resize-grip:hover, .resize-grip:focus-visible { border-color: var(--line); background: var(--surface-2); }
.resize-grip:hover::after, .resize-grip:focus-visible::after, .client-card.resizing .resize-grip::after { opacity: 1; background: repeating-linear-gradient(135deg, transparent 0 3px, var(--text) 3px 5px); }
.empty-state { max-width: 560px; margin: 20vh auto; text-align: center; color: var(--muted); }
.empty-state h1 { color: var(--text); }
.notice { position: fixed; z-index: 30; right: 18px; top: 84px; max-width: min(420px, calc(100vw - 36px)); padding: 12px 14px; border: 1px solid rgba(112,214,161,.5); border-radius: 9px; background: #15251d; box-shadow: var(--shadow); }
.notice.failure { border-color: rgba(255,107,107,.5); background: #2b1719; }
dialog { width: min(500px, calc(100vw - 28px)); padding: 0; color: var(--text); border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0,0,0,.72); }
.dialog-card { padding: 22px; }
.dialog-card h2 { margin: 4px 0 10px; }
.dialog-card .muted { line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.muted { color: var(--muted); }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 50% 20%, #18241f, var(--bg) 48%); }
.login-shell { width: min(420px, 100%); }
.login-card { padding: 28px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.login-card h1 { margin: 5px 0; }
.login-card label { display: block; margin: 22px 0 7px; color: var(--muted); }
.login-card input { width: 100%; min-height: 44px; padding: 9px 11px; color: var(--text); border: 1px solid var(--line); border-radius: 8px; background: #0e1217; }
.login-card button { width: 100%; margin-top: 12px; background: var(--accent); border-color: var(--accent); color: #07120c; font-weight: 800; }
.form-error { color: #ffb2b2; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
@media (max-width: 900px) {
  .toolbar { grid-template-columns: 1fr 1fr; }
  .bulk-actions { grid-column: 1 / -1; justify-content: stretch; }
  .bulk-actions button { flex: 1 1 130px; }
  .panel-main { padding-top: 140px; }
  .moderator-settings { grid-template-columns: 1fr; }

}
@media (max-width: 620px) {
  .toolbar { padding: 10px; grid-template-columns: 1fr; gap: 8px; }
  .brand { justify-content: space-between; }
  .search { grid-row: 2; }
  .bulk-actions { grid-row: 3; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); }
  .bulk-actions button { padding-inline: 4px; font-size: 12px; }
  .panel-main { padding: 190px 8px 20px; }
  .moderator-settings form { grid-template-columns: 1fr; }
  .client-grid { gap: 8px; }
  .client-card { padding: 11px 11px 48px; border-radius: 9px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .command-composer { grid-template-columns: 1fr 1fr; }
  .command-composer label { grid-column: 1 / -1; }
  .card-footer { align-items: stretch; flex-direction: column; }
  .card-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .card-actions button { padding-inline: 3px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
