:root {
  --bg: #0e1116;
  --bg-2: #131820;
  --panel: #171d26;
  --panel-2: #1d2430;
  --line: #2a3342;
  --line-soft: #222a37;
  --fg: #e6e9ef;
  --muted: #8b95a7;
  --faint: #5d6778;
  --accent: #ff8a3d;
  --accent-ink: #1a0e04;
  --accent-soft: rgba(255, 138, 61, 0.14);
  --info: #5aa7ff;
  --ok: #4cc38a;
  --ok-soft: rgba(76, 195, 138, 0.14);
  --warn: #f0b429;
  --warn-soft: rgba(240, 180, 41, 0.14);
  --bad: #ef5b5b;
  --bad-soft: rgba(239, 91, 91, 0.14);
  --term: #080a0e;
  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
  --side: 212px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f4f7;
    --bg-2: #eaecf1;
    --panel: #ffffff;
    --panel-2: #f6f7fa;
    --line: #d5d9e2;
    --line-soft: #e4e7ee;
    --fg: #181c24;
    --muted: #596273;
    --faint: #8a93a3;
    --accent: #d9560b;
    --accent-ink: #ffffff;
    --accent-soft: rgba(217, 86, 11, 0.1);
    --info: #1f6fd1;
    --ok: #1c8a58;
    --ok-soft: rgba(28, 138, 88, 0.12);
    --warn: #a86b00;
    --warn-soft: rgba(168, 107, 0, 0.12);
    --bad: #c93232;
    --bad-soft: rgba(201, 50, 50, 0.1);
    --shadow: 0 10px 30px rgba(20, 30, 50, 0.18);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 650; text-wrap: balance; }
h1 { font-size: 1.7rem; }
h3 { font-size: 0.95rem; }
p { margin: 0; }
a { color: var(--info); }
code, pre, .mono { font-family: var(--mono); font-size: 0.86em; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
pre { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.grow { flex: 1 1 auto; }
.icon { flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; } }

#root { height: 100%; }

.screen { display: grid; place-items: center; min-height: 100%; padding: 24px 16px; background: radial-gradient(900px 500px at 15% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.screen-inner { width: min(520px, 100%); display: flex; flex-direction: column; gap: 16px; }
.screen-actions { display: flex; gap: 8px; }
.keep-row { display: flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; }
.lede { color: var(--muted); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); }
.brand-name { font-weight: 750; font-size: 1.15rem; letter-spacing: 0.02em; }
.server-list { display: flex; flex-direction: column; gap: 8px; }
.server-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; text-align: left; transition: border-color 0.15s, transform 0.15s; }
.server-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.server-name { font-weight: 650; flex: 1 1 auto; }
.server-meta { color: var(--muted); font-size: 0.86rem; }
.form-error { color: var(--bad); min-height: 1em; }
.form-error:empty { display: none; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.login-form { display: flex; gap: 8px; }
.login-form input { flex: 1; }
.dev-box { border-top: 1px dashed var(--line); padding-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.dev-row { display: flex; gap: 8px; flex-wrap: wrap; }
.dev-row input { flex: 1 1 200px; }

input[type="text"], input[type="search"], input[type="number"], input[type="password"], select, textarea {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 10px; min-width: 0; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }
textarea { resize: vertical; font-family: var(--mono); font-size: 0.9em; }
select { cursor: pointer; }
::placeholder { color: var(--faint); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel-2); color: var(--fg); cursor: pointer; white-space: nowrap; line-height: 1.2; transition: background 0.12s, border-color 0.12s; }
.btn:hover:not(:disabled) { border-color: var(--faint); background: var(--line-soft); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); border-color: var(--accent); }
.btn-danger { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); font-weight: 600; }
.btn-danger:hover:not(:disabled) { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-2); color: var(--fg); border-color: transparent; }
.btn-ghost.active { color: var(--accent); background: var(--accent-soft); }
.btn-sm { padding: 4px 8px; font-size: 0.86rem; }
.btn-icon { padding: 6px; }
.btn.busy { opacity: 0.6; pointer-events: none; }

.shell { display: grid; grid-template-columns: var(--side) 1fr; height: 100%; }
.sidebar { background: var(--bg-2); border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; padding: 14px 10px; gap: 14px; min-height: 0; overflow: auto; }
.sidebar .brand { padding: 2px 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer; text-align: left; }
.nav-item:hover { background: var(--panel); color: var(--fg); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-foot { border-top: 1px solid var(--line-soft); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.who { display: flex; align-items: center; gap: 8px; padding: 0 6px; min-width: 0; }
.who-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.who-text strong, .who-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-text span { color: var(--muted); font-size: 0.82rem; }
.conn-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.conn-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.conn-dot.down { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.side-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.latency { color: var(--muted); font-size: 0.8rem; font-family: var(--mono); margin-right: auto; padding-left: 6px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line-soft); min-height: 52px; flex: none; }
.topbar > .btn { display: none; }
.page-title { font-size: 1.1rem; }
.head-slot { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-host { flex: 1 1 auto; min-height: 0; position: relative; }
.page { position: absolute; inset: 0; overflow: auto; padding: 18px 20px 28px; }
.page.fill { overflow: hidden; display: flex; flex-direction: column; padding-bottom: 14px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; flex: none; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tab:hover:not(:disabled) { color: var(--fg); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab:disabled { opacity: 0.4; cursor: not-allowed; }

.card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); }
.card-head h3 { flex: 1 1 auto; }
.card-actions { display: flex; gap: 6px; align-items: center; }
.card-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 14px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.badge { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 99px; font-size: 0.75rem; font-weight: 600; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge-ok { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.badge-fail, .badge-bad { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }
.badge-warn { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.badge-info { color: var(--info); border-color: var(--info); }
.badge-accent { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.table-wrap { overflow: auto; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); max-width: 100%; }
table.grid { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
table.grid th { position: sticky; top: 0; background: var(--panel-2); text-align: left; font-size: 0.74rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); padding: 7px 10px; white-space: nowrap; }
table.grid td { padding: 6px 10px; border-top: 1px solid var(--line-soft); vertical-align: top; overflow-wrap: anywhere; }
table.grid tr.clickable { cursor: pointer; }
table.grid tr.clickable:hover td { background: var(--panel-2); }
.cell-json { font-size: 0.8em; }

.mono-block { background: var(--term); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 10px 12px; overflow: auto; max-height: 360px; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 0.84rem; }

.jsontree { font-family: var(--mono); font-size: 0.84rem; line-height: 1.55; }
.j-row, .j-node > summary { display: flex; gap: 8px; align-items: baseline; }
.j-node > summary { cursor: pointer; list-style: none; }
.j-node > summary::-webkit-details-marker { display: none; }
.j-node > summary::before { content: "+"; color: var(--faint); width: 10px; flex: none; }
.j-node[open] > summary::before { content: "-"; }
.j-body { margin-left: 14px; padding-left: 10px; border-left: 1px solid var(--line-soft); }
.j-key { color: var(--info); }
.j-sum { color: var(--faint); }
.j-str { color: var(--ok); overflow-wrap: anywhere; }
.j-num { color: var(--accent); }
.j-bool { color: var(--warn); }
.j-null { color: var(--faint); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; gap: 6px; padding: 2px 9px; background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 99px; font-size: 0.84rem; }
.chip b { color: var(--muted); font-weight: 500; }
.data-title { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 10px 0 6px; }
.data-view { display: flex; flex-direction: column; min-width: 0; }

.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 14px; }
.spin { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { color: var(--muted); padding: 22px 14px; text-align: center; }
.error-box { color: var(--bad); background: var(--bad-soft); border: 1px solid var(--bad); border-radius: var(--radius-sm); padding: 10px 12px; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { display: flex; gap: 6px; align-items: baseline; font-size: 0.82rem; color: var(--muted); }
.field-label em { color: var(--accent); font-style: normal; font-size: 0.72rem; }
.field-label small { margin-left: auto; color: var(--faint); font-size: 0.72rem; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--bad); }
.field-wide { grid-column: 1 / -1; }
.param-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.param-form.compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.command-card { display: flex; flex-direction: column; gap: 12px; }

.outcome { border: 1px solid var(--line-soft); border-left: 3px solid var(--ok); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--bg-2); min-width: 0; }
.outcome.fail { border-left-color: var(--bad); }
.outcome-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.outcome-error { color: var(--bad); overflow-wrap: anywhere; }
.output-lines { background: var(--term); border-radius: var(--radius-sm); padding: 8px 10px; max-height: 280px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.84rem; }
.card-results:empty { display: none; }

.il { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.il-scroll { overflow: auto; flex: 1 1 auto; min-height: 0; }
.il-foot { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; color: var(--muted); font-size: 0.82rem; }
.il-error { color: var(--bad); }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--info); border-radius: var(--radius-sm); padding: 10px 14px; box-shadow: var(--shadow); cursor: pointer; overflow-wrap: anywhere; animation: rise 0.2s ease-out; }
.toast.out { opacity: 0; transition: opacity 0.25s; }
.toast-success { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--bad); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

.modal-backdrop { position: fixed; inset: 0; background: rgba(5, 8, 12, 0.6); display: grid; place-items: center; z-index: 90; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal-wide { width: min(900px, 100%); }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { flex: 1; }
.modal-body { padding: 14px; overflow: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.confirm { display: flex; gap: 12px; flex-direction: column; }
.confirm-icon { color: var(--bad); }
.confirm-text { display: flex; flex-direction: column; gap: 10px; }
.palette { display: flex; flex-direction: column; gap: 10px; }
.palette-results { display: flex; flex-direction: column; max-height: 50vh; overflow: auto; }
.palette-row { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; border: 0; background: transparent; text-align: left; border-radius: var(--radius-sm); cursor: pointer; }
.palette-row span { color: var(--muted); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-row.active, .palette-row:hover { background: var(--accent-soft); }

@media (max-width: 860px) {
  .page.fill { overflow: auto; }
  .split-main, .split { overflow: visible; }
  .player-panel:has(.map-view) { overflow: visible; }
  .map-scroll { min-height: 320px; }
  .lv-term { min-height: 420px; }
  .term-box { min-height: 420px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(260px, 82vw); z-index: 60; transform: translateX(-102%); transition: transform 0.2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .topbar > .btn { display: inline-flex; }
  .topbar { padding: 8px 12px; }
  .page { padding: 14px 12px 24px; }
}

.check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.check input { accent-color: var(--accent); }
.tag { font-size: 0.7rem; padding: 0 6px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line-soft); color: var(--muted); white-space: nowrap; }
.dot-risk { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); flex: none; }
.note { background: var(--accent-soft); border-left: 3px solid var(--accent); padding: 8px 12px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.row.nowrap { flex-wrap: nowrap; }
.narrow { width: 96px; flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; flex: none; }
.toolbar input[type="search"], .toolbar input[type="text"] { flex: 1 1 200px; width: auto; }
.toolbar select { width: auto; }
.inline { display: inline-flex; align-items: center; gap: 6px; }
.inline input { width: 90px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tile { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.tile-label { color: var(--muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.05em; }
.tile-value { font-size: 1.25rem; font-weight: 650; margin-top: 2px; overflow-wrap: anywhere; }
.tile-sub { color: var(--faint); font-size: 0.8rem; min-height: 1.2em; overflow-wrap: anywhere; }
.trend { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.spark { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 10px 12px; }
.spark-head { display: flex; gap: 10px; align-items: baseline; font-size: 0.84rem; color: var(--muted); }
.spark-head strong { color: var(--fg); font-size: 1rem; }
.spark-head span:last-child { margin-left: auto; }
.spark-svg { width: 100%; height: 56px; display: block; margin-top: 6px; }
.attention { display: flex; gap: 10px; flex-wrap: wrap; }
.attn { display: inline-flex; align-items: baseline; gap: 8px; padding: 8px 14px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); cursor: pointer; }
.attn.hot { border-color: var(--warn); background: var(--warn-soft); }
.attn-value { font-size: 1.2rem; font-weight: 700; }
.overview-meta { font-size: 0.8rem; }
.qc-group { display: flex; flex-direction: column; gap: 6px; }
.qc-label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
.activity { display: flex; flex-direction: column; gap: 6px; }
.act-row { display: flex; gap: 8px; align-items: center; min-width: 0; }
.act-args { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0; font-family: var(--mono); font-size: 0.8rem; }

.split { display: grid; grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); gap: 14px; flex: 1 1 auto; min-height: 0; }
.split-side { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.split-main { min-width: 0; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.side-tools { padding: 10px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--line-soft); flex: none; }
.side-tools h3 { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
.split-side > .il, .split-side > .cmd-list, .split-side > .group-list { flex: 1 1 auto; min-height: 0; overflow: auto; }
.split-side > .root-list { flex: 0 0 auto; max-height: 190px; overflow: auto; }
.panel-fill { display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; min-height: 0; }
.mod-page { display: flex; flex-direction: column; gap: 12px; flex: 1 1 auto; min-height: 0; }
.mod-panels { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.mod-panel { flex: 1 1 auto; min-height: 0; overflow: auto; }
.mod-panel.hidden { display: none; }
.tall-list { min-height: 160px; }
.panel-fill > .il, .mod-panel > .il { min-height: 200px; }
.card-body > .il { max-height: 420px; }
.short-list { max-height: 260px; }
.grid-cards.wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); }

.list-row { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.list-row code { overflow-wrap: anywhere; }
.log-item { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.log-item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.note-line { overflow-wrap: anywhere; }
.recent-list { font-family: var(--mono); font-size: 0.8rem; }
.warn-summary { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.cmd-count { padding: 0 2px; font-size: 0.8rem; }
.cmd-list { padding: 4px 6px 10px; }
.cmd-group { padding: 10px 8px 4px; color: var(--accent); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; }
.cmd-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 8px; border: 0; background: transparent; border-radius: var(--radius-sm); cursor: pointer; text-align: left; font-family: var(--mono); font-size: 0.86rem; }
.cmd-row:hover { background: var(--panel-2); }
.cmd-row.active { background: var(--accent-soft); color: var(--accent); }
.cmd-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.cmd-detail { display: flex; flex-direction: column; gap: 12px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 16px; }
.cmd-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cmd-desc { color: var(--muted); }
.request-preview { max-height: 180px; }
.preview-wrap { display: flex; flex-direction: column; gap: 6px; }
.recent-row { display: flex; gap: 8px; align-items: center; padding: 4px 6px; border: 0; background: transparent; cursor: pointer; border-radius: var(--radius-sm); width: 100%; text-align: left; }
.recent-row:hover { background: var(--panel-2); }
.cmd-recent { display: flex; flex-direction: column; }

.term-wrap { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-height: 0; }
.term-hint { font-size: 0.82rem; }
.term-box { flex: 1 1 auto; min-height: 0; background: var(--term); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 8px; overflow: hidden; }
.term-box .xterm { height: 100%; }

.roster { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.roster-count { font-size: 0.8rem; }
.roster-scroll { min-height: 0; }
.roster-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; cursor: pointer; text-align: left; min-width: 0; flex-wrap: wrap; }
.roster-row:hover { background: var(--panel-2); }
.roster-row.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.roster-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0; }
.roster-meta { font-size: 0.78rem; flex: 1 1 100%; padding-left: 16px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--faint); }
.dot.on { background: var(--ok); }
.player-detail { display: flex; flex-direction: column; min-width: 0; min-height: 0; gap: 10px; }
.player-header { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); flex: none; }
.ph-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.player-panels { flex: 1 1 auto; min-height: 0; position: relative; display: flex; flex-direction: column; }
.player-panel { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 2px 2px 20px; }
.player-panel:has(.map-view) { overflow: hidden; display: flex; flex-direction: column; padding: 0; }
.sprite { image-rendering: pixelated; flex: none; }
.profile-head { display: flex; gap: 14px; align-items: center; }
.profile-id { display: flex; flex-direction: column; gap: 6px; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 14px; align-items: start; }
.edit-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; align-items: center; }
.edit-row label { color: var(--muted); }
.equip { display: flex; flex-direction: column; gap: 6px; }
.equip-row { display: flex; gap: 10px; align-items: center; }
.equip-text { display: flex; flex-direction: column; line-height: 1.25; }

.item-icon { flex: none; display: inline-block; width: 32px; height: 32px; background-size: 200% 100%; background-position: 0 0; background-repeat: no-repeat; image-rendering: pixelated; }
.item-icon.none { background: var(--bg-2); border: 1px dashed var(--line); border-radius: 3px; }
.item-icon.loading { background: var(--bg-2); border-radius: 3px; }
.inv-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: 14px; align-items: start; }
.inv-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.inv-head h3 { flex: 1; }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, 46px); gap: 5px; }
.inv-slot { position: relative; display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; padding: 5px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.inv-slot.empty { background: var(--bg-2); border-style: dashed; }
.inv-slot.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.inv-num { color: var(--faint); font-size: 0.7rem; }
.inv-qty { position: absolute; right: 3px; bottom: 1px; font-size: 0.68rem; font-weight: 700; text-shadow: 0 0 2px #000, 0 0 2px #000; color: #fff; }
.inv-sub { margin: 14px 0 8px; }
.inv-current { display: flex; gap: 10px; align-items: center; }
.inv-picked { display: flex; gap: 8px; align-items: center; }
.item-results { max-height: 240px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.item-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 8px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; cursor: pointer; text-align: left; }
.item-row:hover { background: var(--panel-2); }
.item-name { flex: 1 1 auto; font-weight: 600; }
.chip-ok b { color: var(--ok); }
.chip-bad b { color: var(--bad); }
.actions-list { display: flex; flex-direction: column; }
.action-item { border: 1px solid var(--line-soft); border-radius: var(--radius-sm); margin-bottom: 6px; background: var(--panel); }
.action-item summary { display: flex; align-items: center; gap: 10px; padding: 7px 12px; cursor: pointer; }
.action-item.disabled { opacity: 0.55; }
.action-desc { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.84rem; min-width: 0; }
.action-body { padding: 4px 12px 12px; }

.map-view { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 12px; flex: 1 1 auto; min-height: 420px; }
.map-side { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.map-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 10px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; cursor: pointer; text-align: left; }
.map-row:hover { background: var(--panel-2); }
.map-row.active { background: var(--accent-soft); }
.map-id { font-family: var(--mono); color: var(--muted); min-width: 34px; }
.map-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.map-row .tag { display: none; }
.map-count { font-size: 0.78rem; background: var(--panel-2); border-radius: 99px; padding: 0 7px; }
.map-viewer { position: relative; display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; }
.map-toolbar { display: flex; align-items: center; gap: 6px; }
.map-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; background: var(--term); border: 1px solid var(--line-soft); border-radius: var(--radius); display: flex; }
.map-stage { margin: auto; padding: 4px; }
.map-canvas { display: block; image-rendering: pixelated; }
.map-status { font-size: 0.8rem; }
.map-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.78rem; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-item i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.map-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; box-shadow: var(--shadow); font-size: 0.84rem; min-width: 150px; }
.tip-flags { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }

.lg-panel { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; overflow: hidden; }
.lg-sub { display: flex; flex-direction: column; gap: 8px; padding: 10px; min-height: 0; flex: 1 1 auto; }
.lg-sub.hidden { display: none; }
.lg-sub > .il { margin: 0 -10px -10px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0; }
.lg-list { min-height: 0; }
.lg-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 12px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; cursor: pointer; text-align: left; flex-wrap: wrap; }
.lg-row:hover { background: var(--panel-2); }
.lg-row.active { background: var(--accent-soft); }
.lg-row.folder .lg-name::before { content: "> "; color: var(--accent); }
.lg-name { overflow-wrap: anywhere; flex: 1 1 auto; font-family: var(--mono); font-size: 0.86rem; }
.viewer-main { overflow: hidden; }
.lv { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-height: 0; }
.lv-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: none; }
.lv-title { font-weight: 650; font-family: var(--mono); font-size: 0.9rem; overflow-wrap: anywhere; }
.lv-range { font-size: 0.8rem; }
.lv-toolbar .lv-search { width: 200px; }
.lv-toolbar .lv-goto { width: 84px; }
.lv-stage { display: flex; gap: 10px; flex: 1 1 auto; min-height: 0; }
.lv-main { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; }
.lv-term { flex: 1 1 auto; min-height: 0; background: var(--term); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 6px 4px 6px 8px; overflow: hidden; }
.lv-term .xterm { height: 100%; }
.lv-banner { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 3px 14px; font-size: 0.8rem; box-shadow: var(--shadow); z-index: 3; }
.lv-results { position: absolute; top: 0; right: 0; bottom: 0; width: min(380px, 80%); z-index: 4; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-height: 0; overflow: hidden; box-shadow: var(--shadow); }
.lv-results.hidden { display: none; }
.lv-results-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); flex: none; }
.hit-row { display: flex; gap: 8px; width: 100%; padding: 5px 10px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; cursor: pointer; text-align: left; align-items: baseline; }
.hit-row:hover { background: var(--panel-2); }
.hit-line { color: var(--accent); font-family: var(--mono); font-size: 0.8rem; flex: none; min-width: 54px; }
.hit-text { font-family: var(--mono); font-size: 0.8rem; overflow-wrap: anywhere; }

.group-list, .root-list { padding: 4px; }
.group-row { display: flex; align-items: baseline; gap: 8px; width: 100%; padding: 8px 10px; border: 0; background: transparent; border-radius: var(--radius-sm); cursor: pointer; text-align: left; flex-wrap: wrap; }
.group-row:hover { background: var(--panel-2); }
.group-row.active { background: var(--accent-soft); }
.group-name { font-weight: 600; flex: 1 1 auto; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 10px; max-height: 52vh; overflow: auto; }
.perm-item { display: flex; align-items: center; gap: 6px; padding: 2px 6px; border-radius: 4px; font-family: var(--mono); font-size: 0.82rem; cursor: pointer; overflow-wrap: anywhere; }
.perm-item:hover { background: var(--panel-2); }
.perm-item.changed { background: var(--warn-soft); }
.perm-item input { accent-color: var(--accent); flex: none; }
.mine summary { cursor: pointer; padding: 10px 14px; font-weight: 600; }
.mine .chips { padding: 0 14px 14px; }
.diag-out { max-height: 380px; overflow: auto; }

@media (max-width: 1100px) {
  .inv-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; grid-template-rows: auto auto; }
  .roster { max-height: 46vh; }
  .split-side { max-height: 46vh; }
  .map-view { grid-template-columns: 1fr; grid-template-rows: 190px minmax(380px, 1fr); }
  .edit-row { grid-template-columns: 90px 1fr auto; }
}

.tile-spark { height: 34px; color: var(--accent); margin-top: 6px; }
.tile-spark svg { width: 100%; height: 34px; display: block; }
.spark-wait { color: var(--faint); font-size: 0.74rem; }
.info-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 14px; align-items: start; }
.info-sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; align-items: start; }
details.card > summary.card-head { cursor: pointer; }
@media (max-width: 860px) { .info-grid { grid-template-columns: 1fr; } }

.world { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; flex: 1 1 auto; min-height: 0; }
.world-stage { position: relative; min-height: 360px; background: var(--term); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.world-canvas { display: block; cursor: grab; touch-action: none; }
.world-side { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow: auto; }
.world-hint { font-size: 0.82rem; }
.world-legend { display: flex; align-items: center; gap: 8px; }
.world-legend-bar { flex: 1 1 auto; height: 10px; border-radius: 5px; }
.world-ranking { display: flex; flex-direction: column; max-height: 300px; overflow: auto; }
.rank-row { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; cursor: pointer; text-align: left; }
.rank-row:hover { background: var(--panel-2); }
.rank-row.active { background: var(--accent-soft); }
.rank-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.rank-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-value { font-family: var(--mono); font-size: 0.84rem; color: var(--muted); }
.region-canvas { image-rendering: pixelated; max-width: 100%; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.region-note { font-size: 0.82rem; }
@media (max-width: 1000px) { .world { grid-template-columns: 1fr; } .world-stage { min-height: 420px; } }
