:root {
  --bg: #0a0c12;
  --bg2: #0e1119;
  --panel: #131722;
  --panel2: #181d2a;
  --hover: #1e2433;
  --line: #232a3b;
  --line2: #2d3550;
  --text: #e8ebf4;
  --muted: #8a92a8;
  --dim: #5d6680;
  --accent: #7c5cff;
  --accent2: #00c6ff;
  --grad: linear-gradient(135deg, #7c5cff 0%, #3d8bff 55%, #00c6ff 100%);
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #fb6b85;
  --info: #60a5fa;
  --radius: 16px;
  --shadow: 0 20px 60px rgba(0, 0, 0, .45);
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
  --acc-rgb: 124, 92, 255;
  --acc2-rgb: 0, 198, 255;
  --accent-soft: #b4a3ff;
  --bg-rgb: 10, 12, 18;
  --card-bg: linear-gradient(180deg, rgba(24, 29, 42, .85), rgba(19, 23, 34, .85));
  --input: #0f131c;
  --well: rgba(14, 18, 27, .6);
  --sidebar: linear-gradient(180deg, rgba(19, 23, 34, .92), rgba(12, 14, 21, .96));
  --topbar: rgba(10, 12, 18, .72);
  --modal: linear-gradient(180deg, #171c29, #121622);
  --panel-rgb: 19, 23, 34;
  --art-a: .62;
  --art-b: .78;
  --art-c: .94;
}
:root[data-theme="blue"] { --accent: #3d8bff; --accent2: #22d3ee; --acc-rgb: 61, 139, 255; --acc2-rgb: 34, 211, 238; --accent-soft: #93c5fd; --grad: linear-gradient(135deg, #2563eb 0%, #3d8bff 55%, #22d3ee 100%); }
:root[data-theme="green"] { --accent: #10b981; --accent2: #a3e635; --acc-rgb: 16, 185, 129; --acc2-rgb: 163, 230, 53; --accent-soft: #6ee7b7; --grad: linear-gradient(135deg, #059669 0%, #10b981 55%, #a3e635 100%); }
:root[data-theme="orange"] { --accent: #ff6a1a; --accent2: #ffb020; --acc-rgb: 255, 106, 26; --acc2-rgb: 255, 176, 32; --accent-soft: #fdba74; --grad: linear-gradient(135deg, #ea580c 0%, #ff6a1a 55%, #ffb020 100%); }
:root[data-theme="red"] { --accent: #ef4444; --accent2: #fb923c; --acc-rgb: 239, 68, 68; --acc2-rgb: 251, 146, 60; --accent-soft: #fca5a5; --grad: linear-gradient(135deg, #b91c1c 0%, #ef4444 55%, #fb923c 100%); }
:root[data-theme="pink"] { --accent: #ec4899; --accent2: #a855f7; --acc-rgb: 236, 72, 153; --acc2-rgb: 168, 85, 247; --accent-soft: #f9a8d4; --grad: linear-gradient(135deg, #db2777 0%, #ec4899 50%, #a855f7 100%); }
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f7; --bg2: #e6eaf2; --panel: #ffffff; --panel2: #f1f4f9; --hover: #e8ecf4; --line: #dde2ec; --line2: #c9d0de;
  --text: #171c2b; --muted: #5b6478; --dim: #8a92a8; --bg-rgb: 238, 241, 247; --panel-rgb: 255, 255, 255;
  --card-bg: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(250, 251, 254, .92));
  --input: #ffffff; --well: #f4f6fa; --sidebar: linear-gradient(180deg, #ffffff, #f6f8fc); --topbar: rgba(255, 255, 255, .8);
  --modal: linear-gradient(180deg, #ffffff, #f8f9fc); --shadow: 0 20px 60px rgba(30, 40, 70, .18); --accent-soft: #7c5cff;
  --art-a: .7; --art-b: .86; --art-c: .96;
}
:root[data-theme="light"] .pill { background: rgba(91, 100, 120, .1); }
:root[data-theme="light"] .btn.primary, :root[data-theme="light"] .ws-ribbon.blue { color: #fff; }
:root[data-theme="light"] .topbar h1, :root[data-theme="light"] .card h2 { color: var(--text); }
:root[data-theme="light"] .btn.danger { color: #d1335a; background: rgba(209, 51, 90, .08); }
:root[data-theme="light"] .btn.ok { color: #047857; background: rgba(16, 185, 129, .1); }
:root[data-theme="light"] .pill.ok { color: #047857; }
:root[data-theme="light"] .pill.warn { color: #b45309; }
:root[data-theme="light"] .pill.bad { color: #be123c; }
:root[data-theme="light"] .status-ok { color: #047857; }
:root[data-theme="light"] .meter > span { text-shadow: none; color: var(--text); }
:root[data-theme="light"] .modal-back { background: rgba(30, 40, 70, .35); }
:root[data-theme="light"] .brand img, :root[data-theme="light"] .login-card { position: relative; }
.lang-toggle { position: absolute; top: 18px; right: 18px; display: inline-flex; align-items: center; gap: 6px; background: var(--panel2); border: 1px solid var(--line2); color: var(--muted); border-radius: 99px; padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer; }
.lang-toggle:hover { color: var(--text); border-color: var(--accent); }
.lang-toggle svg { width: 14px; height: 14px; }
.login-card .logo { box-shadow: 0 6px 20px rgba(30, 40, 70, .2); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 700px at 10% -10%, rgba(var(--acc-rgb), .14), transparent 60%),
              radial-gradient(1000px 600px at 110% 10%, rgba(var(--acc2-rgb), .08), transparent 60%), var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(var(--acc-rgb), .45); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #262d40; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid var(--line); backdrop-filter: blur(12px); z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px; }
.brand img { width: 42px; height: 42px; border-radius: 12px; box-shadow: 0 0 24px rgba(var(--acc2-rgb), .25); }
.brand b { display: block; font-size: 16px; letter-spacing: .2px; }
.brand span { font-size: 12px; color: var(--muted); }
.nav { flex: 1; overflow-y: auto; padding: 6px 12px; }
.nav-section { display: flex; align-items: center; width: 100%; background: none; border: none; cursor: pointer; font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--dim); padding: 16px 12px 6px; border-radius: 8px; }
.nav-section:hover { color: var(--muted); }
.nav-section span { flex: 1; text-align: left; }
.nav-section svg { width: 14px; height: 14px; transition: transform .2s; }
.nav-section.closed svg { transform: rotate(-90deg); }
.nav-group { overflow: hidden; }
.nav-group.closed { display: none; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 2px 0; border-radius: 12px;
  color: var(--muted); font-weight: 500; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--hover); color: var(--text); }
.nav a.active { background: linear-gradient(90deg, rgba(var(--acc-rgb), .22), rgba(var(--acc2-rgb), .06)); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav .badge { margin-left: auto; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); }
.side-user .who { flex: 1; min-width: 0; }
.side-user .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who span { font-size: 12px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 16px 28px;
  background: var(--topbar); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.2px; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.content { padding: 26px 28px 60px; max-width: 1500px; width: 100%; }

.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  background: var(--card-bg);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset;
}
.card h2 { margin: 0 0 4px; font-size: 16px; font-weight: 650; }
.card h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card .hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head .grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.mono { font-family: var(--mono); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.sep { height: 1px; background: var(--line); margin: 16px 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.stat { position: relative; overflow: hidden; }
.stat .label { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.stat .value { font-size: 30px; font-weight: 750; letter-spacing: -.8px; margin: 6px 0 2px; }
.stat .value small { font-size: 14px; color: var(--muted); font-weight: 500; letter-spacing: 0; margin-left: 4px; }
.stat canvas { width: 100%; height: 60px; display: block; margin-top: 10px; }
.stat .label svg { width: 15px; height: 15px; flex: none; }
.stat svg.icon-bg { position: absolute; right: -10px; top: -10px; opacity: .06; width: 110px; height: 110px; }
.stat .icon-bg { position: absolute; right: -10px; top: -10px; opacity: .06; width: 110px; height: 110px; }
.bar { height: 8px; background: var(--well); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--grad); border-radius: 99px; transition: width .4s; }
.bar.warn > i { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.bar.bad > i { background: linear-gradient(90deg, #ef4444, #fb6b85); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 11px;
  border: 1px solid var(--line2); background: var(--panel2); color: var(--text); font-weight: 600; cursor: pointer;
  transition: transform .08s, background .15s, border-color .15s, opacity .15s; white-space: nowrap;
}
.btn:hover { background: var(--hover); border-color: var(--dim); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 24px rgba(var(--acc-rgb), .35); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { background: rgba(251, 107, 133, .12); border-color: rgba(251, 107, 133, .35); color: #ff9db0; }
.btn.danger:hover { background: rgba(251, 107, 133, .2); }
.btn.ok { background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .35); color: #7ff0c4; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 32px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: rgba(138, 146, 168, .14); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: rgba(52, 211, 153, .13); color: var(--ok); }
.pill.warn { background: rgba(251, 191, 36, .13); color: var(--warn); }
.pill.bad { background: rgba(251, 107, 133, .14); color: var(--bad); }
.pill.info { background: rgba(96, 165, 250, .14); color: var(--info); }
.pill.plain::before { display: none; }
.pill.live::before { animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .3px; }
.field .help { font-size: 12px; color: var(--dim); }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line2); background: var(--input); color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--acc-rgb), .22); }
.input.code { font-family: var(--mono); font-size: 13px; }
.checkbox { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 8px 10px; border-radius: 10px; }
.checkbox:hover { background: var(--hover); }
.checkbox input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }
.checkbox b { display: block; font-weight: 600; }
.checkbox span { font-size: 12px; color: var(--muted); }
.checkbox.danger b::after { content: "Känslig"; margin-left: 8px; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: rgba(251, 107, 133, .15); color: var(--bad); vertical-align: middle; }
.switch { position: relative; width: 44px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line2); cursor: pointer; transition: background .2s; }
.switch i::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + i { background: var(--grad); }
.switch input:checked + i::after { transform: translateX(20px); }

.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--dim); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--hover); }
.table-wrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }

.avatar { width: 36px; height: 36px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; flex: none; position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-pick { position: relative; cursor: pointer; flex: none; border-radius: 16px; }
.avatar-pick .avatar { border-radius: 16px; font-size: 24px; }
.avatar-edit { position: absolute; inset: 0; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.55); color: #fff; opacity: 0; transition: opacity .15s; }
.avatar-edit svg { width: 20px; height: 20px; }
.avatar-pick:hover .avatar-edit { opacity: 1; }
.avatar-remove { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--danger, #e5484d); color: #fff; display: none; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.avatar-remove svg { width: 12px; height: 12px; }
.avatar-pick:hover .avatar-remove { display: flex; }
.app-card { display: flex; flex-direction: column; gap: 14px; transition: transform .15s, border-color .15s; cursor: pointer; }
.app-card:hover { transform: translateY(-2px); border-color: var(--line2); }
.app-icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--grad); color: #fff; font-weight: 800; font-size: 20px; flex: none; box-shadow: 0 8px 26px rgba(var(--acc-rgb), .3); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: none; padding: 10px 14px; color: var(--muted); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

.log {
  background: #07090e; border: 1px solid var(--line); border-radius: 12px; padding: 14px; font: 12.5px/1.55 var(--mono); color: #c9d1e3;
  white-space: pre-wrap; word-break: break-word; max-height: 560px; overflow: auto;
}
.term-wrap { background: #07090e; border: 1px solid var(--line); border-radius: 14px; padding: 10px; height: calc(100vh - 210px); min-height: 360px; }
.term-wrap .xterm { height: 100%; }

.files-path { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-family: var(--mono); font-size: 13px; }
.files-path button { background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.files-path button:hover { background: var(--hover); color: var(--text); }
.file-icon { width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--panel2); color: var(--muted); flex: none; }
.file-icon.dir { background: rgba(var(--acc-rgb), .15); color: var(--accent-soft); }
.file-icon svg { width: 16px; height: 16px; }
.dropzone { border: 2px dashed var(--line2); border-radius: 14px; padding: 18px; text-align: center; color: var(--muted); transition: border-color .15s, background .15s; }
.dropzone.over { border-color: var(--accent); background: rgba(var(--acc-rgb), .08); color: var(--text); }
.editor { width: 100%; min-height: 60vh; font: 13px/1.6 var(--mono); background: #07090e; color: #dbe2f3; border: 1px solid var(--line); border-radius: 12px; padding: 14px; resize: vertical; outline: none; tab-size: 4; }

.modal-back { position: fixed; inset: 0; background: rgba(4, 6, 10, .72); backdrop-filter: blur(6px); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 100; overflow-y: auto; animation: fade .15s; }
.modal { width: 100%; max-width: 620px; background: var(--modal); border: 1px solid var(--line2); border-radius: 20px; box-shadow: var(--shadow); animation: pop .18s; }
.modal.wide { max-width: 940px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 6px; }
.modal-head h2 { margin: 0; font-size: 18px; flex: 1; }
.modal-body { padding: 12px 22px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }

#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { min-width: 260px; max-width: 420px; background: var(--panel); border: 1px solid var(--line2); border-left: 3px solid var(--ok); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); animation: pop .2s; }
.toast.bad { border-left-color: var(--bad); }
.toast b { display: block; }
.toast span { color: var(--muted); font-size: 13px; }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 420px; padding: 34px; border-radius: 24px; background: var(--modal); border: 1px solid var(--line2); box-shadow: var(--shadow), 0 0 80px rgba(var(--acc-rgb), .12); }
.login-card .logo { width: 84px; height: 84px; border-radius: 22px; display: block; margin-bottom: 18px; box-shadow: 0 0 40px rgba(var(--acc2-rgb), .25); }
.login-card h1 { margin: 0 0 4px; font-size: 24px; }
.login-card p { margin: 0 0 22px; color: var(--muted); }
.code-input { text-align: center; font: 600 26px var(--mono); letter-spacing: 10px; height: 56px; }
.qr { background: #fff; padding: 12px; border-radius: 16px; width: 220px; height: 220px; display: block; margin: 0 auto; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { width: 42px; height: 42px; color: var(--dim); margin-bottom: 10px; }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; background: rgba(96, 165, 250, .08); border: 1px solid rgba(96, 165, 250, .25); }
.notice.warn { background: rgba(251, 191, 36, .07); border-color: rgba(251, 191, 36, .3); }
.notice.ok { background: rgba(52, 211, 153, .07); border-color: rgba(52, 211, 153, .3); }
.notice.bad { background: rgba(251, 107, 133, .08); border-color: rgba(251, 107, 133, .3); }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.perm-group { border: 1px solid var(--line); border-radius: 14px; padding: 6px; }
.perm-group h4 { margin: 8px 10px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); display: flex; align-items: center; gap: 8px; }
.role-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.role-pick button { text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; }
.role-pick button b { display: block; font-size: 13px; }
.role-pick button span { font-size: 11px; color: var(--muted); line-height: 1.35; display: block; margin-top: 2px; }
.role-pick button.active { border-color: var(--accent); background: rgba(var(--acc-rgb), .12); }
.spin { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .25); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 30px 0; }
.loading .spin { border-top-color: var(--accent); border-color: rgba(var(--acc-rgb), .2); border-top-color: var(--accent); }
.cores { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 6px; }
.cores div { height: 34px; border-radius: 8px; background: var(--well); position: relative; overflow: hidden; }
.cores div i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--grad); opacity: .85; }

.game-badge { border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; letter-spacing: .5px; flex: none; box-shadow: 0 8px 24px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .08); }
.game-pick { min-height: 210px; }
.game-pick h2 { margin: 6px 0 4px; }
.steps { display: flex; gap: 8px; flex-wrap: wrap; }
.steps span { padding: 6px 14px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); color: var(--dim); font-size: 13px; font-weight: 600; }
.steps span.active { color: var(--text); border-color: var(--accent); background: rgba(var(--acc-rgb), .14); }
.steps span.done { color: var(--ok); cursor: pointer; }
.drawer { background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.drawer > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 16px 20px; cursor: pointer; user-select: none; }
.drawer > summary::-webkit-details-marker { display: none; }
.drawer > summary > div { flex: 1; }
.drawer > summary b { display: block; font-size: 15px; }
.drawer > summary span { font-size: 12px; color: var(--muted); }
.drawer > summary svg { width: 18px; height: 18px; color: var(--muted); transform: rotate(-90deg); transition: transform .2s; }
.drawer[open] > summary svg { transform: none; }
.drawer > summary:hover { background: var(--hover); }
.drawer-body { padding: 4px 20px 20px; }
.summary { border-color: rgba(var(--acc-rgb), .4); box-shadow: 0 0 40px rgba(var(--acc-rgb), .12); }
.connect { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--well); border: 1px solid var(--line2); font-size: 18px; font-weight: 600; }
.connect .mono { flex: 1; }
.chip { background: var(--panel2); border: 1px solid var(--line2); border-radius: 99px; padding: 4px 12px; font: 12px var(--mono); color: var(--muted); cursor: pointer; }
.chip:hover { color: var(--text); border-color: var(--accent); }
.thread { display: flex; flex-direction: column; gap: 12px; max-height: 58vh; overflow-y: auto; padding: 4px; }
.msg { max-width: 78%; align-self: flex-start; background: var(--panel2); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 10px 14px; }
.msg.mine { align-self: flex-end; border-radius: 16px 16px 4px 16px; background: linear-gradient(135deg, rgba(var(--acc-rgb), .22), rgba(61, 139, 255, .14)); border-color: rgba(var(--acc-rgb), .35); }
.msg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.msg-head .avatar { border-radius: 8px; font-size: 12px; }
.msg-text { white-space: pre-wrap; word-break: break-word; }
@media (max-width: 900px) { .msg { max-width: 92%; } }

.game-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
.game-menu { position: sticky; top: 86px; background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.game-menu-title { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--dim); padding: 8px 10px 4px; }
.game-menu-addr { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.game-menu-addr .game-badge { border-radius: 8px; font-size: 10px !important; }
.game-menu a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--muted); font-weight: 500; }
.game-menu a:hover { background: var(--hover); color: var(--text); }
.game-menu a.active { background: linear-gradient(90deg, rgba(var(--acc-rgb), .22), rgba(var(--acc2-rgb), .06)); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.game-menu a svg { width: 17px; height: 17px; flex: none; }
.ov-title { display: inline-block; font-size: 22px !important; font-weight: 750 !important; padding-bottom: 8px; margin-bottom: 18px !important; border-bottom: 2px solid transparent; border-image: var(--grad) 1; }
.ov-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 34px; }
.ov-info, .ov-bars { display: flex; flex-direction: column; gap: 16px; }
.ov-item label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.ov-item > div { display: flex; align-items: center; gap: 8px; font-size: 15px; min-height: 26px; }
.ov-item .btn.icon { height: 26px; width: 26px; }
.ov-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.status-ok { color: var(--ok); } .status-bad { color: var(--bad); } .status-info { color: var(--info); } .status-dim { color: var(--muted); }
.meter { position: relative; width: 100%; height: 24px; background: var(--well); border: 1px solid var(--line2); border-radius: 99px; overflow: hidden; }
.meter > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--grad); border-radius: 99px; transition: width .5s; }
.meter.warn > i { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.meter.bad > i { background: linear-gradient(90deg, #ef4444, #fb6b85); }
.meter > span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 700; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.more-item { display: flex; align-items: center; gap: 14px; text-align: left; width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; }
.more-item:hover { border-color: var(--accent); }
.more-item svg { width: 20px; height: 20px; color: var(--accent2); flex: none; }
.more-item b { display: block; }
.more-item span { font-size: 12px; color: var(--muted); }
@media (max-width: 1100px) {
  .game-layout { grid-template-columns: 1fr; }
  .game-menu { position: static; display: flex; gap: 4px; overflow-x: auto; padding: 6px; }
  .game-menu-title, .game-menu-addr { display: none; }
  .game-menu a { white-space: nowrap; }
  .ov-grid { grid-template-columns: 1fr; gap: 22px; }
}

.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; border: 1px solid var(--line); border-radius: 14px; padding: 6px; }
.sub-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--well); }
@media (max-width: 700px) { .perm-grid { grid-template-columns: 1fr; } }
.ws-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 18px; }
.ws-bar select.input { height: 36px; width: auto; min-width: 150px; }
.ws-bar .checkbox, .ws-bar input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.ws-card { display: flex; flex-direction: column; background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color .15s, transform .15s; }
.ws-card:hover { border-color: var(--line2); transform: translateY(-2px); }
.ws-title { font-size: 16px; font-weight: 650; padding: 14px 14px 2px; }
.ws-meta { display: flex; justify-content: space-between; gap: 8px; padding: 0 14px 10px; font-size: 12px; }
.stars { color: #ff8a3d; letter-spacing: 1px; }
.ws-img { aspect-ratio: 16 / 9; background: var(--well) center / cover no-repeat; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ws-desc { padding: 12px 14px; font-size: 13px; color: var(--muted); line-height: 1.5; height: 112px; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent); mask-image: linear-gradient(180deg, #000 70%, transparent); }
.ws-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 14px 14px; margin-top: auto; }
.ws-actions .btn { width: 100%; }
.ws-card { position: relative; }
.ws-card.has-update { border-color: rgba(52, 211, 153, .55); box-shadow: 0 0 0 1px rgba(52, 211, 153, .25), 0 10px 30px rgba(52, 211, 153, .08); }
.ws-ribbon { padding: 6px 14px; font-size: 12px; font-weight: 800; letter-spacing: 2px; text-align: center; }
.ws-ribbon.green { background: linear-gradient(90deg, #10b981, #34d399); color: #052e1f; }
.ws-ribbon.orange { background: linear-gradient(90deg, #f59e0b, #fbbf24); color: #3b2402; }
.ws-ribbon.blue { background: var(--grad); color: #fff; }

.ws-server { padding: 0 14px; color: var(--muted); flex-wrap: nowrap; }
.ws-meta.col { flex-direction: column; gap: 2px; }
.ws-meta .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--well); }
.task-row.off { opacity: .55; }
.task-icon { width: 38px; height: 38px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; background: rgba(var(--acc-rgb), .15); color: var(--accent-soft); flex: none; }
.task-icon svg { width: 18px; height: 18px; }
.chip.on { background: rgba(var(--acc-rgb), .2); border-color: var(--accent); color: var(--text); }
.main { position: relative; }
.game-bg { position: fixed; inset: 0 0 0 264px; z-index: -1; background: center / cover no-repeat; opacity: 0; transition: opacity .8s; pointer-events: none; }
.game-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(var(--bg-rgb), var(--art-a)) 0%, rgba(var(--bg-rgb), var(--art-b)) 45%, rgba(var(--bg-rgb), var(--art-c)) 100%); }
.game-bg.on { opacity: 1; }
.shell { position: relative; z-index: 0; }
.game-card { position: relative; overflow: hidden; }
.game-card::before { content: ""; position: absolute; inset: 0; background: var(--art, none) center / cover no-repeat; opacity: .22; transition: opacity .3s; z-index: 0; -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%); mask-image: linear-gradient(180deg, #000 0%, transparent 85%); }
.game-card:hover::before { opacity: .32; }
.game-card > * { position: relative; z-index: 1; }
@media (max-width: 900px) { .game-bg { inset: 0; } }
.ws-order { display: flex; align-items: center; gap: 6px; padding: 12px 10px 2px 14px; }
.ws-order .ws-title { padding: 0; flex: 1; min-width: 0; }
.ws-num { font: 700 12px var(--mono); color: var(--accent2); background: rgba(var(--acc2-rgb), .1); border-radius: 7px; padding: 2px 7px; flex: none; }
.btn.hidden { visibility: hidden; }
.mod-line { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--well); }
.kv-form { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; align-items: center; }
.kv-form label { font-size: 13px; color: var(--muted); text-align: right; white-space: nowrap; }
.msg-edit { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--well); }
.det-box { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: var(--well); }
.det-box h3 { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; color: var(--accent2); }
.det-box h3 svg { width: 16px; height: 16px; }
.det-box ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.det-box li { line-height: 1.7; }
.det-box li .btn.icon { height: 24px; width: 24px; margin-left: 4px; vertical-align: middle; }
.cfg-table td:first-child { white-space: nowrap; }
.cfg-table td:last-child { width: 1%; }
@media (max-width: 700px) { .kv-form { grid-template-columns: 1fr; } .kv-form label { text-align: left; } .cfg-table td:last-child .row { flex-wrap: wrap !important; } }
body.has-art .card, body.has-art .game-menu, body.has-art .drawer, body.has-art .ws-card, body.has-art .ws-bar {
  background: rgba(var(--panel-rgb), .58); backdrop-filter: blur(16px) saturate(1.25); -webkit-backdrop-filter: blur(16px) saturate(1.25);
  border-color: rgba(255, 255, 255, .08);
}
body.has-art .topbar { background: rgba(var(--bg-rgb), .45); }
:root[data-theme="light"] body.has-art .card, :root[data-theme="light"] body.has-art .game-menu, :root[data-theme="light"] body.has-art .ws-card { border-color: rgba(30, 40, 70, .1); }
.meter > i { box-shadow: 0 0 14px -2px currentColor; }
.meter.players > i { background: linear-gradient(90deg, #10b981, #34d399); color: #34d399; }
.meter.cpu > i { background: linear-gradient(90deg, #f97316, #fbbf24); color: #fb923c; }
.meter.mem > i { background: linear-gradient(90deg, #3b82f6, #22d3ee); color: #38bdf8; }
.meter.disk > i { background: linear-gradient(90deg, #a855f7, #ec4899); color: #d946ef; }
.meter.warn > i { background: linear-gradient(90deg, #f59e0b, #fbbf24); color: #fbbf24; }
.meter.bad > i { background: linear-gradient(90deg, #ef4444, #fb6b85); color: #fb6b85; }
.theme-pick { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-pick button { width: 92px; padding: 8px; border-radius: 14px; border: 2px solid var(--line); background: var(--panel2); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.theme-pick button i { width: 100%; height: 34px; border-radius: 9px; display: block; }
.theme-pick button.active { border-color: var(--accent); color: var(--text); }
.bill-banners { display: flex; flex-direction: column; gap: 10px; padding: 0 28px; }
.bill-banners:not(:empty) { padding-top: 18px; }
.bill-banner { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 14px; border: 1px solid; }
.bill-banner > svg { width: 26px; height: 26px; flex: none; }
.bill-banner b { display: block; font-size: 15px; }
.bill-banner div > div { font-size: 13px; opacity: .9; }
.bill-banner.warn { background: rgba(251, 191, 36, .12); border-color: rgba(251, 191, 36, .45); color: #fde68a; }
.bill-banner.bad { background: rgba(239, 68, 68, .14); border-color: rgba(239, 68, 68, .55); color: #fecaca; animation: billpulse 1.6s ease-in-out infinite; }
.bill-banner.over { background: linear-gradient(90deg, #b91c1c, #ef4444); border-color: #fca5a5; color: #fff; padding: 20px 22px; box-shadow: 0 10px 40px rgba(239, 68, 68, .45); animation: billpulse 1.2s ease-in-out infinite; }
.bill-banner.over b { font-size: 18px; }
.bill-days { font-weight: 800; font-size: 13px; padding: 6px 12px; border-radius: 99px; background: rgba(0, 0, 0, .25); white-space: nowrap; }
@keyframes billpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .5); } 50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); } }
:root[data-theme="light"] .bill-banner.warn { color: #92400e; }
:root[data-theme="light"] .bill-banner.bad { color: #991b1b; }
.stat-bad { border-color: rgba(239, 68, 68, .5); }
.stat-bad .value { color: var(--bad); }
.stat-warn .value { color: var(--warn); }
.table tr.row-over td { background: rgba(239, 68, 68, .08); }
@media (max-width: 900px) { .bill-banners { padding: 0 16px; } .bill-banner { flex-wrap: wrap; } }
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .content { padding: 18px 16px 50px; }
  .topbar { padding: 12px 16px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .hide-sm { display: none !important; }
}

.plugin-img { background-size: contain !important; background-repeat: no-repeat; background-position: center; display: flex; align-items: center; justify-content: center; color: var(--dim, #66708a); }
.plugin-img svg { width: 42px; height: 42px; opacity: .5; }

.console-log { height: 440px; max-height: none; }
.console-out { height: 260px; max-height: none; margin-top: 4px; }
.console-line { margin-bottom: 10px; }
.console-cmd { color: var(--acc, #7c5cff); font-weight: 600; }
.console-res { white-space: pre-wrap; }
.console-res .spin { width: 12px; height: 12px; vertical-align: -2px; }
.console-err { color: var(--bad, #ff5d6c); }
.console-prompt { display: flex; align-items: center; gap: 10px; margin-top: 10px; background: var(--well, #0e121b); border: 1px solid var(--line, #262d40); border-radius: 11px; padding: 6px 6px 6px 14px; }
.console-prompt .mono { color: var(--acc, #7c5cff); font-weight: 700; }
.console-input { flex: 1; background: transparent; border: 0; outline: 0; color: inherit; font-family: var(--mono); font-size: 13px; min-width: 0; }
.upg-price { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line, #262d40); padding-top: 12px; font-size: 18px; }
.upg-price b { font-size: 24px; }
.ws-card.is-off { opacity: .7; }
.side-discord { display: flex; align-items: center; gap: 10px; margin: 4px 12px; padding: 7px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 13px; text-decoration: none; flex: 0 0 auto; }
.side-discord:hover { background: rgba(88, 101, 242, .14); color: var(--text); }
.side-discord svg { width: 16px !important; height: 16px !important; flex: 0 0 16px; color: #8b95ff; }
.side-discord small { display: none; }
