:root {
  --bg: #f4f6fa; --panel: #ffffff; --panel-2: #f8fafc; --line: #e3e8ef; --line-2: #d3dae4;
  --text: #0f172a; --muted: #5b6678; --faint: #8a94a6;
  --brand: #2563eb; --brand-ink: #ffffff; --brand-soft: #e8efff;
  --ok: #16a34a; --ok-soft: #e7f7ec; --bad: #dc2626; --bad-soft: #fdecec; --warn: #d97706; --warn-soft: #fff4e0;
  --side: #0b1220; --side-2: #131c2e; --side-text: #c7d0de; --side-faint: #7d8aa1;
  --radius: 10px; --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1018; --panel: #121a26; --panel-2: #0f1620; --line: #223044; --line-2: #2c3b52;
    --text: #e6ebf3; --muted: #9aa7bb; --faint: #6f7d93; --brand: #4f8bff; --brand-soft: #172540;
    --ok-soft: #10271a; --bad-soft: #2c1414; --warn-soft: #2b2111; --side: #070b12; --side-2: #0f1724;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .mono { font-family: var(--mono); font-size: 12.5px; }
.small { font-size: 12.5px; } .nowrap { white-space: nowrap; } .grow { flex: 1; } .right { margin-left: auto; }
.row { display: flex; align-items: center; gap: 8px; } .wrap { flex-wrap: wrap; } .col { display: flex; flex-direction: column; gap: 10px; }
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon.lg { width: 20px; height: 20px; }

/* ---- layout ---- */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-text); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; padding: 14px 10px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: #fff; font-weight: 700; letter-spacing: -.01em; font-size: 15px; }
.brand .mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #2563eb, #0ea5e9); display: grid; place-items: center; color: #fff; }
.nav a, .nav button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 7px; color: var(--side-text); background: none; border: 0; cursor: pointer; text-align: left; font-size: 13.5px; }
.nav a:hover, .nav button:hover { background: var(--side-2); color: #fff; text-decoration: none; }
.nav a.on { background: #1d2a44; color: #fff; }
.nav .sec { margin: 16px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-faint); }
.nav .biz > button .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.nav .biz .chev { margin-left: auto; transition: transform .15s; opacity: .6; }
.nav .biz.open .chev { transform: rotate(90deg); }
.nav .biz .sub { display: none; padding-left: 18px; }
.nav .biz.open .sub { display: block; }
.nav .sub a { font-size: 13px; padding: 5px 10px; }
.side .foot { margin-top: auto; padding: 12px 8px 0; font-size: 12.5px; color: var(--side-faint); display: flex; align-items: center; gap: 6px; }
.side .foot a { color: var(--side-text); display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; }
.side .foot .btn { color: var(--side-faint); }
.side .foot .btn:hover { color: #fff; background: var(--side-2); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 22px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.menu-btn { display: none; }
.searchbox { position: relative; flex: 1; max-width: 640px; }
.searchbox input { width: 100%; padding: 9px 12px 9px 36px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel); outline: none; }
.searchbox input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.searchbox > .icon { position: absolute; left: 11px; top: 11px; color: var(--faint); }
.searchbox kbd { position: absolute; right: 9px; top: 8px; }
kbd { font: 11px var(--mono); padding: 2px 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; color: var(--muted); background: var(--panel-2); }
.sresults { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 70vh; overflow-y: auto; padding: 6px; }
.sr { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.sr:hover, .sr.sel { background: var(--brand-soft); }
.sr .t { font-weight: 600; } .sr .s { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.sr mark, .snip mark { background: #fde68a; color: #111; border-radius: 2px; padding: 0 1px; }
.content { padding: 22px; max-width: 1280px; width: 100%; }
h1 { font-size: 21px; letter-spacing: -.015em; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 22px 0 10px; }
h3 { font-size: 13px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.head .sub { color: var(--muted); }

/* ---- controls ---- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; font-weight: 500; white-space: nowrap; color: var(--text); }
.btn:hover { border-color: var(--faint); text-decoration: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: default; }
.ibtn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--muted); }
.ibtn:hover { background: var(--panel-2); border-color: var(--line); color: var(--text); }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
label.f.inline { flex-direction: row; align-items: center; font-weight: 500; color: var(--text); font-size: 13.5px; }
input.i, select.i, textarea.i { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel); outline: none; font-weight: 400; color: var(--text); font-size: 14px; }
input.i:focus, select.i:focus, textarea.i:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea.i { min-height: 80px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.light { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--faint) 20%, transparent); }
.light.up { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.light.down { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); animation: pulse 1.6s infinite; }
.light.lan { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 22%, transparent); }
@keyframes pulse { 50% { opacity: .45; } }

/* ---- cards & tables ---- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.link-card { padding: 13px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.link-card .name { font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.link-card .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-card .url { font: 12px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-card .notes { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link-card .acts { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat { padding: 14px 16px; }
.stat .n { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 12.5px; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); position: sticky; top: 0; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line); 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); }
.tablewrap { overflow-x: auto; }
.secret { font-family: var(--mono); background: var(--panel-2); border: 1px dashed var(--line-2); border-radius: 6px; padding: 2px 7px; user-select: all; word-break: break-all; }
.empty { padding: 34px; text-align: center; color: var(--muted); }

/* ---- documents ---- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; margin-bottom: 12px; }
.crumbs a { color: var(--muted); } .crumbs a:last-child { color: var(--text); font-weight: 600; }
.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-bottom: 16px; }
.folder { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; min-width: 0; color: var(--text); }
.folder:hover { border-color: var(--brand); text-decoration: none; }
.folder .icon { color: #e0a526; }
.folder .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.folder .ct { font-size: 11.5px; color: var(--faint); }
.drop { border: 2px dashed var(--line-2); border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); transition: .15s; }
.drop.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
.preview { width: 100%; height: 72vh; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
img.preview { object-fit: contain; height: auto; max-height: 72vh; }
.textbox { white-space: pre-wrap; font: 12px/1.45 var(--mono); max-height: 260px; overflow: auto; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; color: var(--muted); }
.dest { font: 12.5px var(--mono); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; word-break: break-all; }
.dest b { color: var(--text); }

/* ---- dialogs, toasts, auth ---- */
.overlay { position: fixed; inset: 0; background: rgba(8, 12, 20, .55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.dialog { background: var(--panel); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); width: min(560px, 100%); max-height: 92vh; overflow-y: auto; padding: 20px; }
.dialog.wide { width: min(980px, 100%); }
.dialog h2 { margin-top: 0; font-size: 17px; }
.dialog .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #0f172a; color: #fff; padding: 10px 14px; border-radius: 9px; box-shadow: var(--shadow); max-width: 380px; font-size: 13.5px; }
.toast.bad { background: var(--bad); }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 18px; background: radial-gradient(1200px 600px at 10% -10%, #1e3a8a55, transparent), var(--bg); }
.auth .box { width: min(400px, 100%); padding: 26px; }
.auth .brand { color: var(--text); padding: 0 0 18px; }
.auth .qr { display: block; margin: 8px auto; border-radius: 8px; background: #fff; padding: 6px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font: 14px var(--mono); background: var(--panel-2); border: 1px solid var(--line); padding: 12px; border-radius: 9px; }
.code-in { font: 22px var(--mono); letter-spacing: .3em; text-align: center; }
.perm-grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.perm-grid th, .perm-grid td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: center; }
.perm-grid th:first-child, .perm-grid td:first-child { text-align: left; }
.perm-grid input { width: 17px; height: 17px; accent-color: var(--brand); }
.banner { padding: 10px 14px; border-radius: 9px; background: var(--warn-soft); color: var(--warn); display: flex; gap: 10px; align-items: center; margin-bottom: 14px; font-weight: 500; }
.banner.info { background: var(--brand-soft); color: var(--brand); }

/* ---- install kit ---- */
.nav a.pinned { background: linear-gradient(90deg, #1d4ed8, #0e7490); color: #fff; margin: 4px 0; }
.nav a.pinned .pin { margin-left: auto; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; opacity: .75; }
.kitstrip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 14px; border-left: 4px solid var(--brand); }
.kitgrid { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 12px; margin-bottom: 8px; }
.kitfiles { display: contents; }
.addr { display: grid; grid-template-columns: minmax(120px, 1fr) auto 30px; gap: 8px; align-items: center; }
.addr .mono { word-break: break-all; text-align: right; }
.guide-head { margin-top: 22px; align-items: center; }
.guide-head h2 { margin: 0 0 2px; }
.progress { width: 180px; height: 8px; border-radius: 9px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .2s; }
.guide-sec { margin-bottom: 12px; }
.guide-step { display: flex; gap: 12px; align-items: flex-start; padding: 10px 6px; border-top: 1px solid var(--line); cursor: pointer; }
.guide-sec h3 + .guide-step { border-top: 0; }
.guide-step input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--ok); flex: none; }
.guide-step .t { font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.guide-step .num { font: 600 11px var(--mono); color: var(--faint); min-width: 18px; }
.guide-step .d { color: var(--muted); font-size: 13.5px; margin: 2px 0 6px 26px; }
.guide-step .btn { margin-left: 26px; }
.guide-step.done .t { color: var(--muted); text-decoration: line-through; }
.guide-step.done .d { opacity: .55; }

@media (max-width: 900px) {
  .kitgrid { grid-template-columns: 1fr; }
  .guide-step input { width: 26px; height: 26px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .app.menu .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); }
  .menu-btn { display: inline-grid; }
  .content { padding: 14px; }
  .top { padding: 8px 12px; }
  .split, .grid2, .grid3 { grid-template-columns: 1fr; }
  .preview { height: 60vh; }
  .searchbox kbd { display: none; }
  .hide-sm { display: none; }
}
