/* DocDesk — https://zimin.dev */
:root {
  --bg: #111111;
  --bg2: #151515;
  --surface: #1a1a1a;
  --surface2: #222222;
  --surface3: #2a2a2a;
  --border: #2f2f2f;
  --border2: #4f4f4f;
  --text: #f8f8f8;
  --muted: #a6a6a6;
  --faint: #6f6f6f;
  --accent: #b98cff;
  --accent-ink: #111;
  --accent2: #ff00f7;
  --ok: #a3ff8d;
  --warn: #f5b942;
  --danger: #ff5f6d;
  --word: #4c8dff;
  --excel: #3fc27a;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --radius: 12px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f6f6f8;
  --bg2: #ffffff;
  --surface: #ffffff;
  --surface2: #f3f2f6;
  --surface3: #e9e7ef;
  --border: #e3e2e8;
  --border2: #cfcdd6;
  --text: #1a1a1a;
  --muted: #55545c;
  --faint: #8a8a8a;
  --accent: #7d3ed0;
  --accent-ink: #fff;
  --accent2: #c000b8;
  --ok: #1f9d55;
  --warn: #b7791f;
  --danger: #d33a48;
  --word: #2b62d6;
  --excel: #1d8a50;
  --shadow: 0 10px 30px rgba(17, 17, 17, .08);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
:root { --top-h: 63px; }   /* top bar: 42px logo + 2×10px padding + 1px border */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.15rem; display: flex; align-items: center; gap: 8px; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 10px 0; }
code { font-family: var(--mono); background: var(--surface3); padding: .1em .4em; border-radius: 5px; font-size: .9em; }
.i { width: 18px; height: 18px; flex: none; vertical-align: middle; fill: none; }
.i.big { width: 30px; height: 30px; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .mono { font-family: var(--mono); } .nowrap { white-space: nowrap; } .center { text-align: center; }

/* header */
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 18px; padding: 10px 22px; background: color-mix(in srgb, var(--bg2) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); font-weight: 700; font-size: 1.2rem; flex: none; }
.brand:hover { text-decoration: none; }
.brand img { height: 42px; width: auto; max-width: 180px; object-fit: contain; border-radius: 10px; }
.nav { display: flex; gap: 4px; flex: 1; align-items: center; min-width: 0; }
.nav a { display: flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 9px; color: var(--muted); white-space: nowrap; }
.nav a:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--surface3); color: var(--text); }
.top-r { display: flex; align-items: center; gap: 6px; }
.top-r form { margin: 0; }
.me { display: flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 9px; color: var(--text); }
.me:hover { background: var(--surface2); text-decoration: none; }
.iconbtn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.iconbtn:hover { background: var(--surface3); color: var(--text); text-decoration: none; }
[data-theme-toggle] .moon { display: none; }
[data-theme="light"] [data-theme-toggle] .sun { display: none; }
[data-theme="light"] [data-theme-toggle] .moon { display: inline; }

main.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 26px 22px 40px; flex: 1; }
main.full { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.narrow { max-width: 760px; margin: 0 auto; }
.foot { text-align: center; color: var(--faint); font-size: .82rem; padding: 18px; border-top: 1px solid var(--border); }
.foot a { color: var(--muted); }
.langs a, .langs b { margin: 0 2px; }

/* components */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--border2); background: var(--surface2); color: var(--text); font: inherit; font-size: .92rem; cursor: pointer; white-space: nowrap; line-height: 1.3; }
.btn:hover { background: var(--surface3); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: transparent; }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.wide { width: 100%; justify-content: center; padding: 11px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-style: normal; font-size: .72rem; font-weight: 600; padding: 2px 7px; border-radius: 99px; background: var(--surface3); color: var(--muted); vertical-align: middle; }
.badge .i { width: 13px; height: 13px; }
.badge.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.alert { padding: 11px 14px; border-radius: 9px; margin-bottom: 16px; border: 1px solid; }
.alert-ok { border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.alert-err { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 9%, transparent); }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); margin-bottom: 12px; font-size: .9rem; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: .88rem; color: var(--muted); }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: .92rem; cursor: pointer; }
.form.row { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--border2); border-radius: 9px; padding: 9px 12px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 0; border-color: var(--accent); }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); padding: 0; }
input.code { font-family: var(--mono); font-size: 1.25rem; letter-spacing: .18em; text-align: center; max-width: 220px; }
.hint { font-size: .8rem; color: var(--faint); }
fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 0; }
legend { padding: 0 6px; color: var(--muted); font-size: .85rem; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.folder-boxes { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.folder-boxes.off { opacity: .4; pointer-events: none; }

.phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.phead h1 { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); } .crumbs .sep { color: var(--faint); }

/* dropdown */
.dd { position: relative; }
.dd summary { list-style: none; }
.dd summary::-webkit-details-marker { display: none; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 290px; background: var(--surface); border: 1px solid var(--border2); border-radius: 12px; box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.dd-menu form { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.dd-menu .btn { justify-content: flex-start; }

/* files */
.files-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
.files-layout > *, .grid2 > * { min-width: 0; }
.side { position: sticky; top: 76px; }
.search { position: relative; margin-bottom: 12px; }
.search input { width: 100%; padding-left: 36px; }
.search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.tree ul { list-style: none; margin: 0; padding: 0 0 0 14px; }
.tree > ul { padding-left: 0; }
.tree a { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; color: var(--muted); }
.tree a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree a:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.tree a.on { background: var(--surface3); color: var(--text); }
.tree .i { color: var(--warn); }
.fc { display: inline-flex; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 18px; }
.card .table-wrap { border: 0; margin: 0 -10px; background: transparent; }
table.list { width: 100%; border-collapse: collapse; }
.list th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.list td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.list tr:last-child td { border-bottom: 0; }
.list tbody tr:hover { background: var(--surface2); }
.list tr.off { opacity: .5; }
.list td.name a, .list td.name > span { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.list td.name a:hover .fname { text-decoration: underline; }
.list .acts { text-align: right; white-space: nowrap; }
.list .acts form { display: inline; margin: 0; }
.list .empty { text-align: center; color: var(--muted); padding: 34px; }
.list tr.cur { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.fi { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; flex: none; }
.fi .i { width: 19px; height: 19px; }
.fi-word { background: color-mix(in srgb, var(--word) 16%, transparent); color: var(--word); }
.fi-excel { background: color-mix(in srgb, var(--excel) 16%, transparent); color: var(--excel); }
.fi-folder { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.fi-file, .fi-user { background: var(--surface3); color: var(--muted); }
.fi-pdf { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.fi-video { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.watch-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.watch-title h1 { margin: 0; overflow-wrap: anywhere; }
.player video { display: block; width: 100%; max-height: calc(100vh - 220px); background: #000; border-radius: 12px; }
.player-err { margin: 12px 0 0; color: var(--muted); }
.drop { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 16px; border: 1.5px dashed var(--border2); border-radius: var(--radius); color: var(--muted); font-size: .9rem; cursor: pointer; transition: .15s; }
.drop.over, .drop:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); color: var(--text); }
.uplist { width: 100%; display: flex; flex-direction: column; gap: 4px; }
.uplist:empty { display: none; }
.upitem { display: flex; justify-content: space-between; gap: 10px; font-size: .85rem; padding: 4px 0; }
.upitem.ok b { color: var(--ok); } .upitem.err b { color: var(--danger); }
.pager { display: flex; gap: 6px; flex-wrap: wrap; }
.pager a, .pager b { padding: 4px 10px; border-radius: 7px; background: var(--surface2); }
.manage { display: flex; flex-direction: column; gap: 12px; }
.manage form { margin: 0; }

.role { font-size: .8rem; padding: 3px 9px; border-radius: 99px; background: var(--surface3); white-space: nowrap; }
.role-admin { background: color-mix(in srgb, var(--accent2) 16%, transparent); color: var(--accent2); }
.role-editor { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.role-author { background: color-mix(in srgb, var(--word) 16%, transparent); color: var(--word); }
.role-viewer { background: color-mix(in srgb, var(--excel) 16%, transparent); color: var(--excel); }
.roles-help { padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: .9rem; color: var(--muted); }
.perms-list { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; font-size: .9rem; }
.perms-list li::before { content: "✓"; display: inline-block; width: 20px; color: var(--ok); font-weight: 700; }
.perms-list li.no { color: var(--faint); }
.perms-list li.no::before { content: "—"; color: var(--faint); }

/* auth */
.auth { min-height: 80vh; display: grid; place-items: center; }
.auth .card { width: 100%; max-width: 410px; padding: 30px; }
.auth-logo { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; margin-bottom: 20px; font-size: 1.3rem; }
.auth-logo img { height: 88px; width: auto; max-width: 260px; object-fit: contain; border-radius: 16px; }
.auth-logo .i { color: var(--accent); }
.enroll { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.qrbox { background: #fff; padding: 8px; border-radius: 12px; line-height: 0; }
.steps { padding-left: 20px; margin: 0 0 14px; display: flex; flex-direction: column; gap: 8px; }
.secret { display: inline-block; margin-top: 6px; letter-spacing: .08em; cursor: copy; user-select: all; }
.ok-line { color: var(--ok); display: flex; align-items: center; gap: 8px; }
.codes { font-family: var(--mono); font-size: 1.05rem; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; columns: 2; letter-spacing: .06em; }
.codes-card { border-color: var(--warn); }

/* ===== editor ===== */
body.is-editor { height: 100vh; height: 100dvh; overflow: hidden; }
body.is-editor main.full { min-height: 0; }
.editor { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ed-top { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--bg2); border-bottom: 1px solid var(--border); }
.ed-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.ed-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-status { font-size: .8rem; }
.ed-status.dirty { color: var(--warn); } .ed-status.err { color: var(--danger); } .ed-status.ok { color: var(--ok); }
.ed-actions { display: flex; gap: 8px; }
.ed-bar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--border); min-height: 46px; }
.ed-bar:empty { display: none; }
.ed-bar .tb svg { width: 18px; height: 18px; }
.ed-bar .tb { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 7px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font: 600 14px/1 var(--font); cursor: pointer; }
.ed-bar .tb:hover { background: var(--surface3); }
.ed-bar .tb.on { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
.ed-bar .sep { width: 1px; height: 22px; background: var(--border2); margin: 0 6px; }
.ed-bar select { padding: 5px 8px; font-size: .88rem; }
.ed-bar .color { position: relative; }
.ed-bar .color input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.ed-bar .color .sw { display: block; width: 16px; height: 4px; margin-top: 2px; border-radius: 2px; }
.ed-body { flex: 1; overflow: auto; background: var(--bg); position: relative; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* Word page */
.page { max-width: 820px; min-height: calc(100% - 48px); margin: 24px auto; padding: 64px 72px; background: #fff; color: #111; box-shadow: 0 4px 24px rgba(0,0,0,.35); border-radius: 3px; font: 11pt/1.45 Calibri, Carlito, "Segoe UI", Arial, sans-serif; white-space: pre-wrap; tab-size: 6; outline: none; overflow-wrap: break-word; }
[data-theme="light"] .page { box-shadow: 0 2px 16px rgba(0,0,0,.12); }
.page p, .page h1, .page h2, .page h3, .page h4, .page h5, .page h6 { margin: 0 0 8px; }
.page h1 { font-size: 16pt; color: #1f3763; } .page h2 { font-size: 13pt; color: #2f5496; } .page h3 { font-size: 12pt; color: #1f3763; }
.page h4, .page h5, .page h6 { font-size: 11pt; }
.page a { color: #0563c1; text-decoration: underline; }
.page [data-list] { position: relative; padding-left: 26px; }
.page [data-list]::before { position: absolute; left: 8px; }
.page [data-list="bullet"]::before { content: "•"; }
.page [data-list="decimal"] { counter-increment: dl; }
.page [data-list="decimal"]::before { content: counter(dl) "."; left: 2px; }
.page :not([data-list="decimal"]) + [data-list="decimal"] { counter-reset: dl; }
.page [data-list="decimal"]:first-child { counter-reset: dl; }
.page [data-lvl="1"] { margin-left: 24px; } .page [data-lvl="2"] { margin-left: 48px; } .page [data-lvl="3"] { margin-left: 72px; }
.page table.dt { border-collapse: collapse; width: 100%; margin: 0 0 10px; white-space: normal; }
.page table.dt td { border: 1px solid #9aa0aa; padding: 4px 7px; vertical-align: top; white-space: pre-wrap; }
.page table.dt td.vm { background: #f6f6f6; }
.page table.dt td p:last-child { margin-bottom: 0; }
.page .ox { background: #eef1ff; border-radius: 4px; padding: 0 3px; color: #334; cursor: default; user-select: none; }
.page .ox-mark { display: inline; padding: 0; background: none; }
.page .ox-img { background: none; padding: 0; display: inline-block; }
.page .ox-img img { max-width: 100%; height: auto; vertical-align: bottom; }
.page .ox-break { display: inline-block; font-size: 8pt; color: #889; background: #f4f4f6; }
.page .ox-block { margin: 0 0 8px; padding: 6px 10px; background: #f4f5fb; border-left: 3px solid #b8bde0; color: #445; user-select: none; }
.page .ox-block.ox-empty { padding: 0; margin: 0; border: 0; height: 0; }
.page[contenteditable="false"] { cursor: default; }

/* Sheet grid */
.fbar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.fbar .ref { width: 78px; text-align: center; font-family: var(--mono); font-size: .85rem; padding: 5px; }
.fbar input.formula { flex: 1; font-family: var(--mono); font-size: .9rem; padding: 6px 10px; }
.sheet-host { flex: 1; overflow: auto; position: relative; background: #fff; }
.editor.is-sheet .ed-body { display: flex; flex-direction: column; overflow: hidden; }
table.grid { border-collapse: separate; border-spacing: 0; font: 13px/1.3 Calibri, Carlito, "Segoe UI", Arial, sans-serif; color: #111; table-layout: fixed; }
.grid th, .grid td { border-right: 1px solid #e1e3e8; border-bottom: 1px solid #e1e3e8; height: 22px; padding: 1px 4px; white-space: nowrap; overflow: hidden; text-overflow: clip; max-width: 0; }
.grid thead th { position: sticky; top: 0; z-index: 3; background: #f3f4f7; color: #555; font-weight: 500; text-align: center; font-size: 12px; }
.grid tbody th { position: sticky; left: 0; z-index: 2; background: #f3f4f7; color: #555; font-weight: 500; text-align: center; font-size: 12px; width: 46px; }
.grid thead th.corner { left: 0; z-index: 4; }
.grid td { cursor: cell; background: #fff; }
.grid td.num { text-align: right; }
.grid td.wrap { white-space: pre-wrap; }
.grid td.sel { outline: 2px solid #2b6be6; outline-offset: -2px; position: relative; z-index: 1; }
.grid td.inrange { background-color: rgba(43, 107, 230, .1) !important; }
.grid td.chg { box-shadow: inset 3px 0 0 #f5b942; }
.grid td.err { color: #c62828; }
.grid th.hl { background: #dfe6f7; color: #1f3f99; }
.cell-input { position: absolute; z-index: 10; border: 2px solid #2b6be6; border-radius: 0; padding: 1px 3px; font: 13px/1.3 Calibri, Carlito, "Segoe UI", Arial, sans-serif; background: #fff; color: #111; outline: none; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.tabs { display: flex; gap: 2px; padding: 0 10px; background: var(--surface); border-top: 1px solid var(--border); overflow-x: auto; flex: none; }
.tabs button { border: 0; background: transparent; color: var(--muted); padding: 8px 16px; font: inherit; font-size: .88rem; cursor: pointer; border-top: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--text); border-top-color: var(--excel); background: var(--bg2); }
.grid-note { padding: 8px 14px; font-size: .85rem; color: #555; background: #fff8e6; }

@media (max-width: 960px) {
  .files-layout, .grid2 { grid-template-columns: 1fr; }
  .side { position: static; }
  .tree { max-height: 220px; overflow: auto; }
}
@media (max-width: 680px) {
  .top { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .nav { order: 3; width: 100%; flex: none; }
  .nav a span, .me span { display: none; }
  main.wrap { padding: 18px 14px 30px; }
  .cols2, .perm-grid, .perms-list { grid-template-columns: 1fr; }
  .list th:nth-child(2), .list td:nth-child(2), .list th:nth-child(4), .list td:nth-child(4) { display: none; }
  .page { padding: 28px 22px; margin: 0; border-radius: 0; }
  .ed-actions .btn span { display: none; }
  .card { padding: 16px; }
}
@media print {
  .ed-top, .ed-bar, .top, .foot { display: none !important; }
  body.is-editor, .editor { height: auto; overflow: visible; }
  .ed-body { overflow: visible; background: #fff; }
  .page { box-shadow: none; margin: 0; padding: 0; max-width: none; }
}

/* modal */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(0, 0, 0, .55); padding: 16px; }
.modal-box { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border2); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); }
.modal-box p { margin: 0 0 14px; }
.modal-box input { width: 100%; margin-bottom: 16px; }
.modal-box .actions { justify-content: flex-end; }

/* storage */
.alert-warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 9%, transparent); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.tile b { font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; }
.tile span { color: var(--muted); font-size: .85rem; }
.tile.ok b { color: var(--ok); } .tile.warn b { color: var(--warn); } .tile.danger b { color: var(--danger); }
.gauge { display: flex; height: 22px; border-radius: 99px; overflow: hidden; background: var(--surface3); }
.gauge i, .legend i { display: block; height: 100%; }
.g-files { background: var(--accent); } .g-ver { background: var(--warn); } .g-db { background: var(--word); } .g-free { background: var(--surface3); border: 1px solid var(--border2); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 12px; font-size: .88rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(70px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: .88rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 9px; border-radius: 99px; background: var(--surface3); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.bar i.b-word { background: var(--word); } .bar i.b-excel { background: var(--excel); } .bar i.b-other { background: var(--faint); } .bar i.b-pdf { background: var(--danger); } .bar i.b-video { background: var(--accent); } .bar i.b-user { background: var(--word); }
.bar-val { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.stepper { display: flex; gap: 8px; align-items: center; }
.stepper input { width: 130px; text-align: center; font-size: 1.15rem; font-weight: 600; }
.stepper .btn { width: 42px; justify-content: center; font-size: 1.2rem; padding: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border2); background: var(--surface2); color: var(--text); border-radius: 99px; padding: 4px 12px; font: inherit; font-size: .85rem; cursor: pointer; }
.chip:hover:not(:disabled) { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip:disabled { opacity: .35; cursor: default; }
.quota.off .stepper, .quota.off .chips { opacity: .4; pointer-events: none; }
.side-meter { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.side-meter a { display: flex; flex-direction: column; gap: 6px; text-decoration: none; }
.meter { display: block; height: 6px; border-radius: 99px; background: var(--surface3); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); }
.meter i.warn { background: var(--warn); } .meter i.danger { background: var(--danger); }
@media (max-width: 960px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* folder colours */
:root { --f-yellow: #f5b942; --f-red: #ff5f6d; --f-blue: #4c8dff; --f-green: #3fc27a; --f-purple: #a970ff; --f-pink: #ff6fb5; }
[data-theme="light"] { --f-yellow: #d99a12; --f-red: #e0313f; --f-blue: #2b62d6; --f-green: #1d8a50; --f-purple: #7d3ed0; --f-pink: #d6338a; }
.fc-yellow, .tree .fc-yellow .i { color: var(--f-yellow); }
.fc-red, .tree .fc-red .i { color: var(--f-red); }
.fc-blue, .tree .fc-blue .i { color: var(--f-blue); }
.fc-green, .tree .fc-green .i { color: var(--f-green); }
.fc-purple, .tree .fc-purple .i { color: var(--f-purple); }
.fc-pink, .tree .fc-pink .i { color: var(--f-pink); }
.fi-folder.fc-yellow { background: color-mix(in srgb, var(--f-yellow) 15%, transparent); }
.fi-folder.fc-red { background: color-mix(in srgb, var(--f-red) 15%, transparent); }
.fi-folder.fc-blue { background: color-mix(in srgb, var(--f-blue) 15%, transparent); }
.fi-folder.fc-green { background: color-mix(in srgb, var(--f-green) 15%, transparent); }
.fi-folder.fc-purple { background: color-mix(in srgb, var(--f-purple) 15%, transparent); }
.fi-folder.fc-pink { background: color-mix(in srgb, var(--f-pink) 15%, transparent); }
.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.swatches label { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border: 1px solid var(--border2); border-radius: 9px; cursor: pointer; font-size: .75rem; color: var(--muted); }
.swatches label:hover { background: var(--surface2); }
.swatches input { position: absolute; opacity: 0; pointer-events: none; }
.swatches label:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--text); }
.swatches label:has(input:focus-visible) { outline: 2px solid var(--accent); }
.swatches .i { width: 22px; height: 22px; }
.sw-yellow .i { color: var(--f-yellow); } .sw-red .i { color: var(--f-red); } .sw-blue .i { color: var(--f-blue); }
.sw-green .i { color: var(--f-green); } .sw-purple .i { color: var(--f-purple); } .sw-pink .i { color: var(--f-pink); }

/* backups */
.legend-more { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.legend-more .i { width: 15px; height: 15px; }
details.dd.inline { display: inline-block; vertical-align: middle; }
details.dd.inline .dd-menu { width: 300px; text-align: left; white-space: normal; }
.auth { gap: 18px; align-content: center; }
.auth > .card + .card { margin-top: 0; }
.table-wrap.open { overflow: visible; }
.bk-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bk-name .fname { word-break: break-all; }
details.dd.inline .dd-menu { right: -40px; }

/* backup list actions: one aligned row */
.act-row { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.act-row > form, .act-row > details { display: flex; margin: 0; }
.act-row .iconbtn { width: 34px; height: 34px; }
.act-row details > summary { list-style: none; }
.act-row details > summary::-webkit-details-marker { display: none; }
.act-row details[open] > summary { background: var(--surface3); color: var(--text); }
.iconbtn.done { color: var(--ok); }
.badge.mega-badge { background: color-mix(in srgb, #d9272e 16%, transparent); color: #ff5c63; }
/* schedule + MEGA */
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 10px 0; }
.days.off { opacity: .35; pointer-events: none; }
.day input { position: absolute; opacity: 0; pointer-events: none; }
.day span { display: grid; place-items: center; height: 32px; border: 1px solid var(--border2); border-radius: 7px; font-size: .85rem; cursor: pointer; color: var(--muted); font-variant-numeric: tabular-nums; }
.day span:hover { border-color: var(--accent); color: var(--text); }
.day input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.day input:focus-visible + span { outline: 2px solid var(--accent); }
.row-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-inline form { margin: 0; }
.row-inline select { width: auto; }
.inline-form { margin: 0 0 6px; }
.err-line { color: var(--danger); display: flex; align-items: center; gap: 8px; }
.cron-help summary { cursor: pointer; color: var(--muted); font-size: .88rem; margin-top: 8px; }
code.cron { display: block; padding: 8px 10px; margin: 6px 0; word-break: break-all; cursor: copy; }
.mega-logo { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #d9272e; color: #fff; font-weight: 800; font-size: .85rem; }
.meter-wrap { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.card.mega .row-inline, .card.s4 .row-inline { margin-top: 10px; }
.card.s4 .mega-logo { width: auto; padding: 0 7px; border-radius: 12px; font-size: .75rem; }
input[type=checkbox]:disabled { opacity: .4; cursor: not-allowed; }
.days { max-width: 420px; }

/* ===== chat ===== */
.nav a { position: relative; }
.nbadge { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--accent2); color: #fff; font-style: normal; font-size: .7rem; font-weight: 700; line-height: 1; }
.nbadge[hidden] { display: none; }
.g-chat { background: var(--excel); }
body.is-chat { height: 100vh; height: 100dvh; overflow: hidden; }
body.is-chat main.full { min-height: 0; }
.chat { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px minmax(0, 1fr); }
.chat-side { border-right: 1px solid var(--border); background: var(--bg2); display: flex; flex-direction: column; min-height: 0; }
.chat-search { position: relative; padding: 12px; border-bottom: 1px solid var(--border); }
.chat-search input { width: 100%; padding-left: 34px; }
.chat-search > .i { position: absolute; left: 23px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; }
.chat-list { flex: 1; overflow-y: auto; padding: 6px; }
.chat-c { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--text); }
.chat-c:hover { background: var(--surface2); text-decoration: none; }
.chat-c.on { background: var(--surface3); }
.chat-c.off { opacity: .5; }
.chat-c-t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.chat-c-t b, .chat-c-t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-c-t b { font-weight: 600; font-size: .93rem; }
.chat-none { padding: 10px; }
.ava { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex: none; background: color-mix(in srgb, var(--accent) 22%, var(--surface3)); color: var(--text); font-weight: 650; font-size: .95rem; }
.ava-all { background: color-mix(in srgb, var(--accent2) 22%, var(--surface3)); }
.chat-main { position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); background: var(--bg2); }
.chat-head b { font-size: 1rem; }
.chat-back { display: none; }
.chat-thread { flex: 1; overflow-y: auto; padding: 14px 18px 8px; }
.chat-msgs { display: flex; flex-direction: column; gap: 2px; max-width: 900px; margin: 0 auto; }
.chat-more { align-self: center; margin-bottom: 10px; }
.chat-empty { text-align: center; margin: 60px 0; }
.m-day { display: flex; justify-content: center; margin: 14px 0 8px; }
.m-day span { font-size: .78rem; color: var(--muted); background: var(--surface2); border: 1px solid var(--border); padding: 2px 12px; border-radius: 99px; }
.m { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; }
.m.cont { margin-top: 0; }
.m.cont > .ava { visibility: hidden; height: 0; }
.m.cont .m-h { display: none; }
.m-b { position: relative; max-width: min(640px, 80%); background: var(--surface); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; padding: 7px 12px 8px; }
.m.cont .m-b { border-radius: 14px; }
.m.mine { flex-direction: row-reverse; }
.m.mine .m-b { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); border-radius: 14px 4px 14px 14px; }
.m.mine.cont .m-b { border-radius: 14px; }
.m-h { display: flex; align-items: baseline; gap: 8px; font-size: .8rem; margin-bottom: 2px; }
.m-h b { color: var(--accent); font-weight: 600; }
.m-h time { color: var(--faint); font-size: .75rem; }
.m.mine .m-h { flex-direction: row-reverse; }
.m.mine .m-h b { color: var(--muted); }
.m-t { white-space: normal; overflow-wrap: anywhere; line-height: 1.45; }
.m-files { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.m-t + .m-files { margin-top: 8px; }
.m-file { display: flex; align-items: center; gap: 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 6px 6px 6px 8px; min-width: 220px; }
.m-file-t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.m-file-t a { color: var(--text); font-weight: 550; font-size: .9rem; overflow-wrap: anywhere; }
.m-file .iconbtn { width: 30px; height: 30px; }
.m-video { display: block; width: 100%; max-width: 420px; max-height: 300px; border-radius: 10px; background: #000; }
.m-img img { display: block; max-width: 100%; max-height: 300px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface2); }
.m-del { position: absolute; top: 4px; right: -40px; opacity: 0; width: 30px; height: 30px; }
.m.mine .m-del { right: auto; left: -40px; }
.m:hover .m-del, .m-del:focus-visible { opacity: 1; }
.chat-form { border-top: 1px solid var(--border); background: var(--bg2); padding: 10px 18px 12px; }
.chat-form > p { margin: 6px 0 0; text-align: center; }
.chat-row { display: flex; align-items: flex-end; gap: 8px; max-width: 900px; margin: 0 auto; }
.chat-row textarea { flex: 1; resize: none; max-height: 180px; line-height: 1.4; padding: 9px 12px; }
.chat-row .iconbtn { width: 40px; height: 40px; }
.chat-send { width: 44px; height: 40px; justify-content: center; padding: 0; }
.chat-form.sending textarea { opacity: .6; }
.chat-att { display: flex; flex-wrap: wrap; gap: 8px; max-width: 900px; margin: 0 auto 8px; }
.chat-att[hidden] { display: none; }
.att { display: inline-flex; align-items: center; gap: 8px; background: var(--surface2); border: 1px solid var(--border2); border-radius: 10px; padding: 4px 4px 4px 6px; max-width: 320px; }
.att > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; }
.att b { font-weight: 550; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .fi { width: 28px; height: 28px; }
.att .iconbtn { width: 28px; height: 28px; font-size: 1.2rem; }
.att-prog { flex-basis: 100%; display: flex; align-items: center; gap: 10px; }
.att-prog i { display: block; height: 4px; width: 0; background: var(--accent); border-radius: 4px; transition: width .2s; max-width: 70%; }
.chat-drop { position: absolute; inset: 8px; z-index: 5; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; border: 2px dashed var(--accent); border-radius: 14px; background: color-mix(in srgb, var(--bg) 85%, transparent); color: var(--accent); font-weight: 600; pointer-events: none; }
.chat-drop.on { display: flex; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 120; background: var(--surface); border: 1px solid var(--border2); box-shadow: var(--shadow); border-radius: 10px; padding: 10px 16px; max-width: calc(100% - 32px); transition: opacity .4s; }
.toast.err { border-color: color-mix(in srgb, var(--danger) 55%, transparent); color: var(--danger); }
.toast.out { opacity: 0; }
.modal-box select { width: 100%; margin-bottom: 16px; }
@media (max-width: 760px) {
  .chat { grid-template-columns: minmax(0, 1fr); }
  .chat-side { display: none; border-right: 0; }
  .chat.show-list .chat-side { display: flex; }
  .chat.show-list .chat-main { display: none; }
  .chat-back { display: inline-grid; }
  .chat-thread { padding: 10px 12px 6px; }
  .chat-form { padding: 8px 10px 10px; }
  .m-b { max-width: 86%; }
  .m-del { position: static; opacity: 1; float: right; margin: -2px -6px 0 6px; }
  .m-file { min-width: 0; }
}
/* group chats */
.ava-group { background: color-mix(in srgb, var(--excel) 24%, var(--surface3)); }
.chat-search { display: flex; gap: 8px; align-items: center; }
.chat-search input { flex: 1; }
.chat-new { padding: 8px 10px; }
.chat-new span { display: none; }
.chat-head-t { flex: 1; min-width: 0; }
.chat-head-t b, .chat-head-t .muted { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m.m-sys { justify-content: center; margin: 10px 0; }
.m.m-sys span { font-size: .8rem; color: var(--muted); text-align: center; background: var(--surface2); border-radius: 99px; padding: 3px 12px; max-width: 90%; }
.modal-box.wide { max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-box.wide form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.modal-box.wide h2 { margin: 0; }
.modal-box.wide input { margin-bottom: 0; }
.modal-box.wide .row-inline { flex-direction: row; flex-wrap: nowrap; }
.modal-box.wide .row-inline input { flex: 1; width: auto; }
.pick input[type=checkbox] { width: 17px; flex: none; }
.modal-box.wide p { margin: 0; }
.pick { display: flex; flex-direction: column; gap: 2px; max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; color: var(--text); }
.pick-row:hover { background: var(--surface2); }
.pick-row[hidden] { display: none; }
.pick-row .ava { width: 30px; height: 30px; font-size: .85rem; }
.pick-filter { width: 100%; }
.add-members { display: flex; flex-direction: column; gap: 8px; }
.add-members > summary { list-style: none; align-self: flex-start; }
.add-members > summary::-webkit-details-marker { display: none; }
.add-members[open] > summary { margin-bottom: 8px; }
.add-members .pick-filter, .add-members .pick { margin-bottom: 8px; }
.actions.spread { justify-content: space-between; }
.actions.spread > span { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 760px) { .chat-head .btn span { display: none; } }
.hint.warn-text { color: var(--warn); }
/* own logo */
.logo-row { display: flex; align-items: center; gap: 16px; }
.logo-prev { display: grid; place-items: center; width: 88px; height: 88px; flex: none; border: 1px dashed var(--border2); border-radius: 12px; background: var(--surface2); padding: 8px; }
.logo-prev img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.logo-form input[type=file] { padding: 7px; }
/* avatars */
.ava { overflow: hidden; }
.ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ava-sm { width: 26px; height: 26px; font-size: .75rem; }
.ava-list { width: 32px; height: 32px; font-size: .85rem; }
.ava-xl { width: 88px; height: 88px; font-size: 2rem; }
/* «Оновлення» */
.news-new > summary { cursor: pointer; list-style: none; display: flex; align-items: center; }
.news-new > summary::-webkit-details-marker { display: none; }
.news-new > summary b { display: inline-flex; align-items: center; gap: 6px; }
.news-new[open] > summary { margin-bottom: 14px; }
.news-form textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.news.pinned { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.news.is-new { box-shadow: inset 3px 0 0 var(--accent2); }
.news-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.news-h h2 { margin: 0 0 6px; font-size: 1.2rem; overflow-wrap: anywhere; }
.news-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.news-body { line-height: 1.6; overflow-wrap: anywhere; }
.news-body p { margin: 0 0 .8em; }
.news-body ul { margin: 0 0 .8em; padding-left: 22px; }
.news-body > :last-child { margin-bottom: 0; }
.news-edit { width: min(560px, calc(100vw - 40px)); }
/* «Підтримка» */
.wide-ish { max-width: 900px; }
.support-intro h2 { font-size: 1.1rem; }
.sp-h { margin-top: 26px; }
.sp-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.sp-tabs a.chip { color: var(--text); text-decoration: none; }
.sp-tabs a.chip.on { color: var(--accent-ink); }
.sp-kind { display: inline-block; font-size: .72rem; font-weight: 650; padding: 2px 8px; border-radius: 99px; margin-right: 8px; vertical-align: middle; background: var(--surface3); color: var(--muted); white-space: nowrap; }
.sp-bug { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.sp-idea { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.sp-question { background: color-mix(in srgb, var(--word) 16%, transparent); color: var(--word); }
.list tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--accent2); }
.list td.name .badge { margin-left: 8px; }
.sp-who { display: inline-flex; align-items: center; gap: 8px; }
.sp-thread { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.sp-msg { display: flex; gap: 12px; align-items: flex-start; }
.sp-b { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; padding: 10px 14px; }
.sp-msg.staff .sp-b { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.sp-mh { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.phead .actions form { margin: 0; }
.nav a .ext { width: 13px; height: 13px; opacity: .6; }
input[type=radio] { width: 17px; height: 17px; accent-color: var(--accent); padding: 0; flex: none; }
/* files page: full width like the chat — folder panel at the left edge, list fills the rest */
body.is-files main.full { flex: 1; }
body.is-files .files-layout { flex: 1; grid-template-columns: 300px minmax(0, 1fr); gap: 0; align-items: stretch; }
body.is-files .side { top: var(--top-h); align-self: start; height: calc(100vh - var(--top-h)); height: calc(100dvh - var(--top-h)); overflow-y: auto; display: flex; flex-direction: column; padding: 12px; background: var(--bg2); border-right: 1px solid var(--border); }
body.is-files .side .tree { flex: 1; }
body.is-files .side-meter { margin-top: 12px; }
body.is-files .content { padding: 22px 28px 32px; }
@media (max-width: 960px) {
  body.is-files .files-layout { grid-template-columns: minmax(0, 1fr); }
  body.is-files .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  body.is-files .side .tree { max-height: 220px; }
  body.is-files .content { padding: 18px 14px 28px; }
}
/* public profile */
a.person-link { color: inherit; text-decoration: none; }
a.person-link:hover b, b a.person-link:hover, .news-meta a.person-link:hover { text-decoration: underline; }
a.person-link:has(> .ava) { display: inline-flex; flex: none; }
.m.cont > a.person-link { visibility: hidden; height: 0; }
.person-top { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.person-t { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 4px; }
.person-t h1 { margin: 0; overflow-wrap: anywhere; }
.person h2 { margin-top: 6px; }
/* Analytics: server load laid out like Server Monitor (stats.zimin.dev) — green charts, five tiles, two columns */
:root { --sm-1: var(--accent); --sm-ok: var(--accent); --sm-warn: #f2b134; --sm-bad: #ff5d55; --sm-grid: #262626; }
[data-theme="light"] { --sm-1: var(--accent); --sm-ok: var(--accent); --sm-warn: #d98a00; --sm-bad: #dc3b33; --sm-grid: #ecebf0; }
.sm-host { display: flex; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; margin: -4px 0 12px; }
.sm-upd { white-space: nowrap; }
.sm-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.sm-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sm-tl { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-tv { font-size: clamp(1.25rem, 3.2vw, 1.75rem); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-tv small { font-size: .55em; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.sm-ts { font-size: .8rem; min-height: 2.4em; }
.sm-bar { display: block; height: 5px; border-radius: 5px; background: var(--surface2, var(--bg2)); overflow: hidden; margin-top: auto; }
.sm-bar[hidden] { display: none; }
.sm-bar > i { display: block; height: 100%; border-radius: 5px; background: var(--sm-ok); transition: width .4s; }
.sm-bar.warn > i { background: var(--sm-warn); } .sm-bar.bad > i { background: var(--sm-bad); }
.sm-head { display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap; margin-bottom: 12px; }
.sm-head h2 { margin: 0; }
.sm-meta { flex: 1; }
.sm-if { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.sm-if select { width: auto; padding: 5px 10px; }
.sm-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.sm-chart { margin: 0; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 10px 4px; min-width: 0; }
.sm-chart figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; padding: 0 6px 6px; font-size: .9rem; }
.sm-plot { position: relative; }
.sm-plot svg { display: block; width: 100%; height: 170px; overflow: visible; }
.sm-grid { stroke: var(--sm-grid); stroke-width: 1; }
.sm-ax { fill: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.sm-line { fill: none; stroke: var(--sm-1); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.sm-area { fill: var(--sm-1); stroke: none; opacity: .14; }
.sm-dot { fill: var(--sm-1); stroke: var(--bg2); stroke-width: 2; }
.sm-cross { stroke: var(--border2); stroke-width: 1; }
.sm-tip { position: absolute; top: 4px; z-index: 2; pointer-events: none; background: var(--surface); border: 1px solid var(--border2); border-radius: 8px; padding: 6px 10px; font-size: .8rem; box-shadow: var(--shadow); white-space: nowrap; }
.sm-tip b { font-variant-numeric: tabular-nums; }
.sm-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.sm-grid2 > .card { min-width: 0; }
.sm-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sm-cores { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px 18px; font-size: .85rem; }
.sm-core b { font-variant-numeric: tabular-nums; }
.sm-core .sm-bar { margin-top: 4px; }
.sm-table td, .sm-table th { white-space: nowrap; }
.sm-table td.r, .sm-table th.r { text-align: right; font-variant-numeric: tabular-nums; }
.sm-table td:has(> .sm-bar) { width: 64px; min-width: 48px; }
[data-sm-table="disks"] td:has(> .sm-bar) { width: 30%; }
.sm-table td.sm-dev { white-space: normal; overflow-wrap: anywhere; }
/* process tables sit in half a row: the program and user columns wrap instead of pushing the table wider */
[data-sm-table="pcpu"] td:first-child, [data-sm-table="pmem"] td:first-child, [data-sm-table="pcpu"] td:last-child, [data-sm-table="pmem"] td:last-child, [data-sm-table="pcpu"] th:last-child, [data-sm-table="pmem"] th:last-child { white-space: normal; overflow-wrap: anywhere; }
.sm-table .pill { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: .75rem; font-weight: 600; background: var(--surface2); color: var(--muted); white-space: nowrap; }
.sm-table .pill.ok { color: var(--sm-ok); background: color-mix(in srgb, var(--sm-ok) 14%, transparent); }
.sm-table .pill.warn { color: var(--sm-warn); background: color-mix(in srgb, var(--sm-warn) 14%, transparent); }
.sm-table .pill.bad { color: var(--sm-bad); background: color-mix(in srgb, var(--sm-bad) 14%, transparent); }
.sm-svc { display: inline-flex; align-items: center; gap: 8px; }
.sm-svc .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.sm-svc .dot.ok { background: var(--sm-ok); } .sm-svc .dot.warn { background: var(--sm-warn); } .sm-svc .dot.bad { background: var(--sm-bad); }
.sm-svc b { font-weight: 600; }
@media (max-width: 1200px) { .sm-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 960px) { .sm-charts, .sm-grid2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 680px) { .sm-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sm-tile[data-sm-tile="net"] { grid-column: 1 / -1; } }
.sec-h { margin: 26px 0 12px; }
form.inline-act { display: inline-flex; margin: 0; }
/* admin pages in the main bar: labels on wide screens, icons with a tooltip on narrower ones */
.nav-sep { width: 1px; align-self: stretch; margin: 6px 4px; background: var(--border); flex: none; }
@media (max-width: 1720px) {
  .nav a.nav-admin span { display: none; }
  .nav a.nav-admin { padding: 7px 10px; }
}
@media (max-width: 1100px) {
  .nav a span:not(.nbadge) { display: none; }
  .nav a { padding: 7px 10px; }
}
@media (max-width: 680px) { .brand img { height: 34px; } .brand { font-size: 1.1rem; } }
@media (max-width: 680px) {
  .nav { flex-wrap: wrap; gap: 0; justify-content: space-between; }
  .nav a, .nav a.nav-admin { padding: 7px 6px; gap: 4px; }
  .nav-sep { margin: 6px 2px; }
}
/* load history */
.sh-ranges { margin-bottom: 14px; }
.sys-hist.loading .sm-charts { opacity: .55; transition: opacity .2s; }
.sh-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.sh-foot .cron-help { flex: 1; min-width: 260px; }
.sh-foot select { width: auto; padding: 5px 10px; }
/* login captcha */
.captcha { display: flex; flex-direction: column; gap: 6px; }
.captcha-lbl { font-size: .88rem; color: var(--muted); }
.captcha-row { display: flex; align-items: center; gap: 8px; }
.captcha-row img { width: 200px; max-width: calc(100% - 44px); height: auto; aspect-ratio: 200 / 64; border-radius: 9px; border: 1px solid var(--border2); background: #f5f3fa; }
.captcha input { text-transform: uppercase; letter-spacing: .3em; font-family: var(--mono); font-size: 1.1rem; }
/* editors: new toolbar pieces */
.ed-bar .tb-size { width: 92px; }
.ed-bar .fmt-b { font: 700 12px/1 var(--mono); }
.ed-bar .tb sup, .ed-bar .tb sub { font-size: 9px; }
.ed-bar .wcount { margin-left: auto; padding-left: 10px; white-space: nowrap; }
.tb-menu { position: relative; }
.tb-menu > summary { list-style: none; }
.tb-menu > summary::-webkit-details-marker { display: none; }
.tb-menu .mk { padding: 1px 4px; border-radius: 3px; background: #ffff00; color: #111; font-weight: 700; }
.tb-pop { position: absolute; top: calc(100% + 4px); left: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 28px); gap: 6px; padding: 10px; background: var(--surface); border: 1px solid var(--border2); border-radius: 10px; box-shadow: var(--shadow); }
.tb-pop .sw-btn { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border2); cursor: pointer; }
.tb-pop .sw-none { grid-column: 1 / -1; justify-content: center; padding: 5px 8px; font-size: .82rem; }
.findbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 12px; background: var(--surface2); border-bottom: 1px solid var(--border); }
.findbar[hidden] { display: none; }
.findbar input { padding: 5px 10px; width: 200px; }
.findbar [data-r], .findbar [data-one], .findbar [data-all] { display: none; }
.findbar.with-r [data-r], .findbar.with-r [data-one], .findbar.with-r [data-all] { display: inline-flex; }
.findbar .tb { display: inline-grid; place-items: center; min-width: 30px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font: 600 15px/1 var(--font); cursor: pointer; }
.findbar .tb:hover { background: var(--surface3); }
.findbar .btn { padding: 5px 10px; font-size: .85rem; }
::highlight(dd-find) { background-color: #ffd54f; color: #111; }
/* language picker (footer) */
.lang-dd { display: inline-block; position: relative; vertical-align: middle; text-align: left; }
.lang-dd > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border: 1px solid var(--border2); border-radius: 99px; background: var(--surface); color: var(--text); font-size: .82rem; cursor: pointer; user-select: none; transition: border-color .15s, background .15s; }
.lang-dd > summary::-webkit-details-marker { display: none; }
.lang-dd > summary:hover { border-color: var(--accent); }
.lang-dd > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lang-dd > summary .i { width: 15px; height: 15px; color: var(--accent); }
.lang-dd > summary .chev { color: var(--muted); width: 13px; height: 13px; transition: transform .15s; transform: rotate(180deg); }
.lang-dd[open] > summary { border-color: var(--accent); background: var(--surface2); }
.lang-dd[open] > summary .chev { transform: rotate(0deg); }
.lang-menu { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 40; min-width: 210px; padding: 6px; background: var(--surface); border: 1px solid var(--border2); border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; }
.lang-menu a { display: grid; grid-template-columns: 1fr auto 16px; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: .9rem; }
.lang-menu a:hover { background: var(--surface2); text-decoration: none; }
.lang-menu a.on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.lang-menu .lang-code { font: 600 .7rem/1 var(--mono); color: var(--faint); letter-spacing: .04em; }
.lang-menu .lang-check { color: var(--accent); font-weight: 700; text-align: right; }
