:root {
  --bg: #0d1016;
  --bg-soft: #11151d;
  --panel: #161b25;
  --panel-2: #1c2230;
  --line: #262e3d;
  --line-soft: #1f2633;
  --text: #e7eaf0;
  --text-2: #b4bccb;
  --muted: #8691a5;
  --accent: #7086ff;
  --accent-2: #5b6ef0;
  --accent-soft: rgba(112, 134, 255, 0.14);
  --ok: #2fbf71;
  --ok-soft: rgba(47, 191, 113, 0.14);
  --warn: #f0a92e;
  --warn-soft: rgba(240, 169, 46, 0.14);
  --bad: #ef5350;
  --bad-soft: rgba(239, 83, 80, 0.14);
  --info: #3ba7f0;
  --info-soft: rgba(59, 167, 240, 0.14);
  --gold: #e8c15a;
  --gold-soft: rgba(232, 193, 90, 0.14);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 12px;
  --radius-sm: 8px;
  --side: 248px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f5f9;
    --bg-soft: #eceff5;
    --panel: #ffffff;
    --panel-2: #f6f7fb;
    --line: #dde2ec;
    --line-soft: #e8ebf2;
    --text: #161a23;
    --text-2: #3b4456;
    --muted: #6b7489;
    --accent: #4f5fe8;
    --accent-2: #3e4ed6;
    --accent-soft: rgba(79, 95, 232, 0.1);
    --ok: #16924f;
    --ok-soft: rgba(22, 146, 79, 0.1);
    --warn: #b9770c;
    --warn-soft: rgba(185, 119, 12, 0.12);
    --bad: #d32f2f;
    --bad-soft: rgba(211, 47, 47, 0.1);
    --info: #1677c2;
    --info-soft: rgba(22, 119, 194, 0.1);
    --gold: #a37b0c;
    --gold-soft: rgba(163, 123, 12, 0.12);
    --shadow: 0 10px 30px rgba(20, 30, 60, 0.12);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
.hidden { display: none !important; }

/* ---- layout -------------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--bg-soft); border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column; padding: 16px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-icon {
  width: 36px; height: 36px; border-radius: 10px; flex: none; overflow: hidden;
  background: linear-gradient(135deg, var(--accent), #9b6dff); display: grid; place-items: center; color: #fff;
}
.brand-icon img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-weight: 650; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--text); }
.nav a.on svg { color: var(--accent); }
.nav .count {
  margin-left: auto; background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px;
  min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 6px; font-weight: 650;
}
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; }
.me .who { min-width: 0; }
.me .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .lvl { font-size: 12px; color: var(--muted); }

.main { min-width: 0; padding: 28px 32px 120px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; line-height: 1.25; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 760px; }
.page-head .grow { flex: 1; min-width: 240px; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.crumb a { color: var(--muted); }

.topbar { display: none; }

/* ---- surfaces ------------------------------------------------------------------------ */
.card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.grid > .card, .grid > * > .card:first-child, .stack > .card { margin-top: 0; }
.stack > * + * { margin-top: 16px !important; }
.card h2 { font-size: 15px; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.card .sub { color: var(--muted); margin: 0 0 14px; font-size: 13px; }
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head .grow { flex: 1; min-width: 200px; }
.card-head h2 + .sub { margin-bottom: 0; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; }
.divider { height: 1px; background: var(--line-soft); margin: 14px 0; }

.stat { padding: 16px 18px; }
.stat .k { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 26px; font-weight: 650; margin-top: 2px; letter-spacing: -.02em; }

.status-card { display: flex; flex-direction: column; gap: 10px; }
.status-card .top { display: flex; align-items: center; gap: 10px; }
.status-card .title { font-weight: 600; }
.status-card .desc { color: var(--muted); font-size: 13px; flex: 1; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--muted); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.dot.info { background: var(--info); box-shadow: 0 0 0 4px var(--info-soft); }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 16px; }
.banner.warn { background: var(--warn-soft); border-color: rgba(240, 169, 46, .35); }
.banner.bad { background: var(--bad-soft); border-color: rgba(239, 83, 80, .35); }
.banner.info { background: var(--accent-soft); border-color: rgba(112, 134, 255, .3); }
.banner.ok { background: var(--ok-soft); border-color: rgba(47, 191, 113, .3); }
.banner b { display: block; }

/* ---- controls ------------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; font-weight: 550;
  white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-ghost { color: var(--bad); border-color: rgba(239, 83, 80, .4); background: transparent; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 34px; padding: 0; justify-content: center; }

.input, select.input, textarea.input {
  height: 36px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--bg-soft); color: var(--text); outline: none; min-width: 0;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search { position: relative; flex: 1; min-width: 200px; max-width: 420px; }
.search svg { position: absolute; left: 11px; top: 9px; color: var(--muted); }
.search .input { width: 100%; padding-left: 36px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: transparent;
  cursor: pointer; color: var(--text-2); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; cursor: pointer; transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:disabled + span { opacity: .45; cursor: not-allowed; }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-soft); flex: none; }
.seg button { border: 0; background: transparent; padding: 0 10px; height: 28px; cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 550; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--text); }
.seg button.on.default { background: var(--panel-2); color: var(--text); }
.seg button.on.blocked { background: var(--bad-soft); color: var(--bad); }
.seg button.on.see { background: var(--info-soft); color: var(--info); }
.seg button.on.talk { background: var(--ok-soft); color: var(--ok); }
.seg button:disabled { cursor: not-allowed; opacity: .5; }

/* ---- badges -------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 550; background: var(--panel-2); color: var(--text-2); border: 1px solid var(--line-soft); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.gold { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.badges { display: flex; gap: 5px; flex-wrap: wrap; }
.role-dot { width: 10px; height: 10px; border-radius: 50%; background: #99a1b3; flex: none; }
.role-tag { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line-soft); font-size: 13px; max-width: 100%; }
.role-tag .x { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 0 0 2px; display: grid; place-items: center; }
.role-tag .x:hover { color: var(--bad); }
.role-tag.add { border-style: dashed; color: var(--ok); }
.role-tag.remove { border-style: dashed; color: var(--bad); text-decoration: line-through; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--panel-2); flex: none; object-fit: cover; display: grid; place-items: center; font-weight: 650; font-size: 13px; color: var(--text-2); overflow: hidden; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }

/* ---- tables -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--panel); }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line-soft); background: var(--panel); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
table.t td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--panel-2); }
table.t td.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-name .n { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.cell-name .s { font-size: 12px; color: var(--muted); }
tr.boundary td { background: var(--accent-soft) !important; padding: 8px 14px; color: var(--text); font-size: 13px; }
tr.boundary td .line { display: flex; align-items: center; gap: 10px; }

/* ---- channel tree -------------------------------------------------------------------- */
.tree { border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.tree-cat { border-top: 1px solid var(--line-soft); }
.tree-cat:first-child { border-top: 0; }
.tree-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; min-height: 44px; }
.tree-row.cat { background: var(--panel-2); font-weight: 650; font-size: 12.5px; letter-spacing: .03em; text-transform: uppercase; color: var(--text-2); }
.tree-row.ch { padding-left: 30px; }
.tree-row.click { cursor: pointer; }
.tree-row.click:hover { background: var(--panel-2); }
.tree-row.changed { background: var(--warn-soft) !important; }
.tree-row .nm { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.tree-row .nm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.result { text-transform: none; letter-spacing: 0; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); min-width: 92px; }
.result.see { color: var(--info); }
.result.talk { color: var(--ok); }
.result.none { color: var(--muted); }

.matrix th.rot { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; padding: 10px 6px; max-height: 160px; }
.matrix td.cellx { text-align: center; padding: 6px; width: 46px; }
.mcell { width: 30px; height: 22px; border-radius: 5px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; }
.mcell.none { background: var(--panel-2); color: var(--muted); }
.mcell.see { background: var(--info-soft); color: var(--info); }
.mcell.talk { background: var(--ok-soft); color: var(--ok); }
.mcell.explicit { outline: 2px solid currentColor; outline-offset: -2px; }

/* ---- abilities ----------------------------------------------------------------------- */
.abilities { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.ability { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); cursor: pointer; background: var(--bg-soft); }
.ability:hover { border-color: var(--line); }
.ability.on { border-color: var(--accent); background: var(--accent-soft); }
.ability.dis { cursor: not-allowed; opacity: .6; }
.ability input { margin-top: 3px; accent-color: var(--accent); }
.ability .l { font-weight: 600; }
.ability .d { font-size: 12.5px; color: var(--muted); }
.ab-mark { width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 6px; font-size: 12px; font-weight: 700; }
.ab-mark.full { background: var(--ok-soft); color: var(--ok); }
.ab-mark.partly { background: var(--warn-soft); color: var(--warn); }
.ab-mark.none { color: var(--line); }

.perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.perm-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px; }
.perm { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; color: var(--muted); }
.perm.on { color: var(--text); }
.perm .mark { width: 16px; text-align: center; font-weight: 700; }
.perm.on .mark { color: var(--ok); }
.perm.on.power .mark { color: var(--warn); }

/* ---- settings ------------------------------------------------------------------------ */
.field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 20px; padding: 14px 0; border-top: 1px solid var(--line-soft); align-items: center; }
.field:first-of-type { border-top: 0; }
.field .fl { font-weight: 600; }
.field .fh { color: var(--muted); font-size: 13px; grid-column: 1; }
.field .fc { grid-row: 1 / span 2; grid-column: 2; display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.field.changed .fl::after { content: "unsaved"; margin-left: 8px; font-size: 11px; color: var(--warn); background: var(--warn-soft); padding: 2px 6px; border-radius: 5px; font-weight: 600; }
.field input.input { width: 110px; text-align: right; }
.unit { color: var(--muted); font-size: 13px; min-width: 52px; }
.region-list { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 420px; }

/* ---- save bar, modal, toast ---------------------------------------------------------- */
.savebar {
  position: fixed; left: calc(var(--side) + 32px); right: 32px; bottom: 20px; z-index: 40;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--radius);
  padding: 12px 16px; display: flex; align-items: center; gap: 12px; animation: up .18s ease-out;
}
.savebar .msg { flex: 1; font-weight: 550; }
@keyframes up { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

.overlay { position: fixed; inset: 0; background: rgba(5, 8, 14, .62); z-index: 60; display: grid; place-items: center; padding: 16px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: min(560px, 100%); max-height: 86vh; overflow: auto; box-shadow: var(--shadow); }
.modal.wide { width: min(820px, 100%); }
.modal-head { padding: 18px 20px 6px; display: flex; gap: 12px; align-items: flex-start; }
.modal-head h3 { margin: 0; font-size: 17px; flex: 1; }
.modal-body { padding: 6px 20px 16px; color: var(--text-2); }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line-soft); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.picker-list { max-height: 360px; overflow-y: auto; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); margin-top: 10px; }
.picker-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; border-top: 1px solid var(--line-soft); }
.picker-item:first-child { border-top: 0; }
.picker-item:hover { background: var(--panel-2); }
.picker-item.on { background: var(--accent-soft); }
.picker-item input { accent-color: var(--accent); }

.toasts { position: fixed; right: 20px; top: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(400px, calc(100vw - 32px)); }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: var(--radius-sm); padding: 12px 14px; box-shadow: var(--shadow); animation: up .18s ease-out; }
.toast.bad { border-left-color: var(--bad); }

/* ---- misc ---------------------------------------------------------------------------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { width: 36px; height: 36px; margin-bottom: 8px; color: var(--line); }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--panel-2), var(--line-soft), var(--panel-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; margin: 10px 0; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.list-plain { margin: 0; padding-left: 18px; }
.list-plain li { margin: 3px 0; }
.review { border-left: 4px solid var(--warn); }
.review.bot { border-left-color: var(--info); }
.review.flag { border-left-color: var(--accent); }
.review.jail, .review.raid { border-left-color: var(--bad); }
details summary { cursor: pointer; color: var(--accent); font-size: 13px; margin-top: 6px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-soft); margin-bottom: 18px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.sticky { position: sticky; top: 16px; }
.pick-col { max-height: calc(100vh - 140px); overflow-y: auto; padding: 0; }
.pick-col .pc-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.pick-col .pc-item { display: flex; align-items: center; gap: 9px; padding: 8px 14px; cursor: pointer; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
.pick-col .pc-item:hover { background: var(--panel-2); }
.pick-col .pc-item.on { background: var(--accent-soft); }
.pick-col .pc-item .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- locked screen ------------------------------------------------------------------- */
.locked { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.locked .card { max-width: 460px; text-align: center; padding: 32px 28px; }
.locked .big { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.locked .big svg { width: 28px; height: 28px; }
.locked h1 { font-size: 20px; margin: 0 0 8px; }
.locked p { color: var(--muted); margin: 6px 0; }
.locked code { background: var(--panel-2); padding: 2px 6px; border-radius: 5px; }

/* ---- small screens ------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .pick-col { max-height: 360px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 70; transform: translateX(-100%); transition: transform .18s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--bg-soft); border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; z-index: 30; }
  .topbar .t { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .main { padding: 18px 16px 120px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .savebar { left: 16px; right: 16px; bottom: 12px; }
  .field { grid-template-columns: 1fr; }
  .field .fc { grid-row: auto; grid-column: 1; justify-content: flex-start; }
  .tree-row { flex-wrap: wrap; }
  .tree-row.ch { padding-left: 20px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .cell-name .n { max-width: 180px; }
}
@media (max-width: 520px) {
  .grid.four { grid-template-columns: 1fr 1fr; }
  .stat .v { font-size: 22px; }
}
