:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --sidebar: #eef3f9;
  --line: #e3e8ef;
  --text: #1c2430;
  --muted: #6b7686;
  --faint: #9aa4b2;
  --accent: #8ec5f5;
  --accent-strong: #2f7fc6;
  --accent-soft: #e6f2fd;
  --accent-ink: #0f2f4d;
  --nas: #b7b2f2;
  --nas-soft: #efeefe;
  --danger: #e0675f;
  --hover: #f1f5fa;
  --shadow: 0 1px 2px rgba(20, 35, 60, .05), 0 6px 24px rgba(20, 35, 60, .06);
  --shadow-pop: 0 10px 40px rgba(20, 35, 60, .16);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #14171c;
  --surface: #1b1f26;
  --sidebar: #171a20;
  --line: #2a303a;
  --text: #e7ebf2;
  --muted: #9aa4b4;
  --faint: #6b7584;
  --accent: #9ccbfa;
  --accent-strong: #9ccbfa;
  --accent-soft: rgba(156, 203, 250, .13);
  --accent-ink: #0f2a44;
  --nas: #b9b4f7;
  --nas-soft: rgba(185, 180, 247, .13);
  --hover: #222833;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 24px rgba(0, 0, 0, .25);
  --shadow-pop: 0 12px 44px rgba(0, 0, 0, .5);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.4 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app { display: grid; grid-template-columns: 248px 1fr; height: 100vh; }

/* sidebar */
.sidebar { background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px 14px; gap: 4px; min-width: 0; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 650; font-size: 18px; letter-spacing: -.2px; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #b9dcfb, #8ec5f5 55%, #a9b8f6); display: grid; place-items: center; color: #0f2f4d; box-shadow: inset 0 0 0 1px rgba(255,255,255,.4); }
.logo-mark svg { width: 17px; height: 17px; stroke-width: 2.2; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; color: var(--muted); font-weight: 500; transition: background .12s, color .12s; width: 100%; text-align: left; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-strong); }
.nav-item .soon { margin-left: auto; font-size: 10.5px; font-weight: 600; color: var(--faint); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--faint); }
.nav-sep { height: 1px; background: var(--line); margin: 10px 8px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); padding: 14px 10px 4px; }
.spacer { flex: 1; }
.storage { padding: 12px 10px 4px; display: grid; gap: 12px; }
.store-row .top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.store-row .top b { font-weight: 600; }
.store-row .top span { color: var(--muted); }
.bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.bar.nas i { background: var(--nas); }
.store-note { font-size: 11.5px; color: var(--faint); margin-top: 5px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 10px; margin-top: 8px; border-radius: 12px; text-align: left; }
.user-chip:hover { background: var(--hover); }
.user-chip.active { background: var(--accent-soft); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #ffd3b0, #f5a3a3); display: grid; place-items: center; font-weight: 600; color: #5a2a1c; font-size: 13px; }
.user-chip .who { font-size: 13px; line-height: 1.2; }
.user-chip .who small { display: block; color: var(--faint); font-size: 11.5px; }

/* main */
main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--line); background: var(--bg); }
.icon-btn.burger { display: none; }
.crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; font-size: 15px; }
.crumb { padding: 5px 8px; border-radius: 8px; color: var(--muted); white-space: nowrap; }
.crumb:hover { background: var(--hover); color: var(--text); }
.crumb.last { color: var(--text); font-weight: 600; }
.crumbs .sep { color: var(--faint); }
.crumbs .sep svg { width: 14px; height: 14px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 0 10px; height: 36px; width: 300px; color: var(--faint); transition: border-color .15s, box-shadow .15s; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { border: 0; outline: 0; background: none; color: var(--text); font: inherit; flex: 1; min-width: 0; }
.kbd { font-size: 11px; border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; color: var(--faint); }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.btn { height: 36px; padding: 0 14px; border-radius: 10px; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.04); box-shadow: 0 4px 14px rgba(142, 197, 245, .45); }
.btn.ghost { border: 1px solid var(--line); background: var(--surface); }
.btn.ghost:hover { background: var(--hover); }

.toolbar { display: flex; align-items: center; gap: 12px; padding: 16px 22px 10px; }
.toolbar h1 { font-size: 22px; font-weight: 650; letter-spacing: -.3px; margin: 0; }
.toolbar .meta { color: var(--faint); font-size: 13px; }
.toolbar .grow { flex: 1; }
.seg { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { width: 34px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.seg button.on { background: var(--accent-soft); color: var(--accent-strong); }
.seg button:hover:not(.on) { color: var(--text); }
.sort { color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 9px; }
.sort:hover { background: var(--hover); color: var(--text); }


.content { flex: 1; overflow: auto; padding: 4px 22px 120px; min-height: 0; }

/* grid view */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.tile { border-radius: var(--radius); padding: 8px; transition: background .12s; position: relative; user-select: none; }
.tile:hover { background: var(--hover); }
.tile.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.thumb { aspect-ratio: 1; border-radius: 11px; display: grid; place-items: center; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); position: relative; }
.thumb.photo { box-shadow: none; }
.thumb.folder { background: none; box-shadow: none; }
.thumb .big { width: 100%; height: 100%; display: grid; place-items: center; }
.thumb .big svg { width: 44px; height: 44px; stroke-width: 1.4; }
.folder-shape { width: 78%; aspect-ratio: 1.25; position: relative; }
.folder-shape:before { content: ""; position: absolute; left: 0; top: 0; width: 42%; height: 18%; border-radius: 6px 6px 0 0; background: #a9d2f7; }
.folder-shape:after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; top: 12%; border-radius: 4px 10px 10px 10px; background: linear-gradient(180deg, #bfe0fc, #9bcbf6); box-shadow: 0 6px 16px rgba(80, 150, 220, .22); }
:root[data-theme="dark"] .folder-shape:before { background: #5f8fbf; }
:root[data-theme="dark"] .folder-shape:after { background: linear-gradient(180deg, #7fb1e2, #5d8fc4); box-shadow: 0 6px 16px rgba(0,0,0,.35); }
.folder-shape.shared:after { background: linear-gradient(180deg, #d2cdfb, #b7b2f2); }
.folder-shape.shared:before { background: #c6c1f8; }
.tname { margin-top: 8px; font-weight: 500; font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; text-align: center; }
.tmeta { color: var(--faint); font-size: 11.5px; text-align: center; margin-top: 2px; }
.badge-nas { position: absolute; right: 14px; top: 14px; background: var(--nas-soft); color: #6c64d8; border-radius: 7px; padding: 3px 5px; display: flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; backdrop-filter: blur(6px); }
:root[data-theme="dark"] .badge-nas { color: var(--nas); }
.badge-nas svg { width: 12px; height: 12px; }
.typechip { width: 54px; height: 64px; border-radius: 8px 16px 8px 8px; display: grid; place-items: end center; padding-bottom: 9px; font-size: 10.5px; font-weight: 700; letter-spacing: .4px; color: #fff; position: relative; }
.typechip:after { content: ""; position: absolute; top: 0; right: 0; width: 16px; height: 16px; border-radius: 0 16px 0 6px; background: rgba(255,255,255,.35); }

/* list view */
.list { width: 100%; border-collapse: separate; border-spacing: 0; }
.list th { text-align: left; font-weight: 500; color: var(--faint); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); }
.list td { padding: 7px 10px; border-bottom: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.list td.name { color: var(--text); font-weight: 500; width: 60%; }
.list tr:hover td { background: var(--hover); }
.list tr.sel td { background: var(--accent-soft); }
.rowname { display: flex; align-items: center; gap: 12px; }
.mini { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; flex: none; overflow: hidden; }
.mini svg { width: 17px; height: 17px; }
.where { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.dot.nas { background: var(--nas); }

/* columns view */
.columns { display: flex; height: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow-x: auto; overflow-y: hidden; box-shadow: var(--shadow); }
.content.cols { padding-bottom: 22px; display: flex; flex-direction: column; }
.col { width: 250px; flex: none; border-right: 1px solid var(--line); overflow-y: auto; padding: 6px; }
.crow { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 8px; user-select: none; }
.crow:hover { background: var(--hover); }
.crow.open { background: var(--hover); }
.crow.sel { background: var(--accent-soft); color: var(--accent-strong); }
.crow .mini { width: 24px; height: 24px; border-radius: 6px; }
.crow .mini svg { width: 15px; height: 15px; }
.crow .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow .chev { color: var(--faint); }
.crow .chev svg { width: 14px; height: 14px; }
.preview { width: 320px; flex: none; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.preview .pv { aspect-ratio: 4/3; border-radius: 12px; display: grid; place-items: center; overflow: hidden; background: var(--bg); }
.preview h3 { margin: 0; font-size: 16px; word-break: break-word; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 12.5px; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; color: var(--text); }
.pv-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* uploads panel */
.uploads { position: fixed; right: 20px; bottom: 20px; width: 340px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-pop); overflow: hidden; transform: translateY(20px); opacity: 0; pointer-events: none; transition: .22s cubic-bezier(.2, .8, .2, 1); }
.uploads.show { transform: none; opacity: 1; pointer-events: auto; }
.up-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; font-weight: 600; border-bottom: 1px solid var(--line); }
.up-head .grow { flex: 1; }
.up-list { max-height: 240px; overflow: auto; padding: 6px 0; }
.uploads.min .up-list { display: none; }
.up-item { display: flex; align-items: center; gap: 10px; padding: 8px 14px; }
.up-item .info { flex: 1; min-width: 0; }
.up-item .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.up-item .s { font-size: 11.5px; color: var(--faint); margin-top: 4px; display: flex; justify-content: space-between; }
.up-item .bar { height: 4px; margin-top: 5px; }
.up-item .ok { color: #3daa6e; }

/* context menu & modal */
.ctx { position: fixed; min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; display: none; z-index: 30; }
.ctx.show { display: block; animation: pop .12s ease-out; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.ctx button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; }
.ctx button:hover { background: var(--hover); }
.ctx button.danger { color: var(--danger); }
.ctx .k { margin-left: auto; color: var(--faint); font-size: 12px; }
.ctx hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.veil { position: fixed; inset: 0; background: rgba(15, 22, 35, .32); backdrop-filter: blur(3px); display: none; place-items: center; z-index: 40; }
.veil.show { display: grid; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(460px, calc(100vw - 32px)); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-pop); padding: 22px; display: grid; gap: 16px; }
.modal h2 { margin: 0; font-size: 17px; }
.modal .sub { color: var(--muted); font-size: 13px; margin-top: -10px; }
.linkbox { display: flex; gap: 8px; }
.linkbox input { flex: 1; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); padding: 0 12px; font: inherit; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.opt select { height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); color: var(--text); padding: 0 8px; font: inherit; }
.switch { width: 38px; height: 22px; border-radius: 99px; background: var(--line); position: relative; transition: .15s; }
.switch:after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch.on { background: var(--accent); }
.switch.on:after { left: 19px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.drop { position: fixed; inset: 12px; border: 2px dashed var(--accent); border-radius: 22px; background: color-mix(in srgb, var(--accent-soft) 85%, transparent); display: none; place-items: center; z-index: 50; backdrop-filter: blur(2px); }
.drop.show { display: grid; }
.drop div { text-align: center; color: var(--accent-strong); font-size: 18px; font-weight: 600; }
.drop svg { width: 40px; height: 40px; margin-bottom: 10px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 11px; font-weight: 500; opacity: 0; transition: .2s; pointer-events: none; z-index: 60; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 35; transform: translateX(-100%); transition: .2s; box-shadow: var(--shadow-pop); }
  .sidebar.open { transform: none; }
  .icon-btn.burger { display: grid; }
  .search { width: auto; flex: 1; }
  .crumbs { display: none; }
  .topbar { padding: 12px 16px; }
  .toolbar { padding: 14px 16px 8px; }
  .content { padding: 4px 16px 120px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
  .btn.primary span, .seg button[data-view="columns"] { display: none; }
  .list .hide-m { display: none; }
  .uploads { left: 12px; right: 12px; width: auto; }
}

/* ===== дополнения к макету: живое приложение ===== */
[hidden] { display: none !important; }
.content { position: relative; }
.toolbar { min-height: 64px; }
.tb-info { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.tb-info h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* действия с выделением живут в той же строке, что и заголовок: ничего не прыгает */
.tb-sel { display: none; align-items: center; gap: 4px; margin-left: 6px; padding: 3px 4px 3px 12px; background: var(--accent-soft); border-radius: 11px; color: var(--accent-strong); font-weight: 600; font-size: 13px; }
.tb-sel.show { display: flex; }
.tb-sel button { padding: 6px 9px; border-radius: 8px; display: inline-flex; gap: 6px; align-items: center; font-weight: 500; color: var(--text); font-size: 13px; }
.tb-sel button:hover { background: rgba(255,255,255,.55); }
:root[data-theme="dark"] .tb-sel button:hover { background: rgba(255,255,255,.07); }
.tb-sel button svg { width: 16px; height: 16px; }
.tb-sel .x { color: var(--accent-strong); padding: 6px; }
.tb-sel .cnt { margin-right: 6px; white-space: nowrap; }

.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.photo { background: var(--line); }
.thumb .vbadge { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.55); color: #fff; border-radius: 6px; padding: 2px 6px; font-size: 11px; display: flex; gap: 4px; align-items: center; }
.thumb .vbadge svg { width: 12px; height: 12px; }
.mini img { width: 100%; height: 100%; object-fit: cover; }
.tile.drop-target, tr.drop-target td, .crow.drop-target { background: var(--accent-soft) !important; box-shadow: inset 0 0 0 2px var(--accent); }
.tile.cut { opacity: .45; }
.path-hint { font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }

.empty { display: grid; place-items: center; text-align: center; padding: 80px 20px; color: var(--muted); gap: 10px; }
.empty .art { width: 120px; height: 96px; border-radius: 20px; background: linear-gradient(160deg, var(--accent-soft), transparent); display: grid; place-items: center; color: var(--accent-strong); }
.empty .art svg { width: 44px; height: 44px; stroke-width: 1.4; }
.empty b { color: var(--text); font-size: 16px; }
.loading { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.loading div { aspect-ratio: 1; border-radius: 12px; background: linear-gradient(90deg, var(--line), var(--hover), var(--line)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; opacity: .6; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* формы */
.field { display: grid; gap: 6px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.input { height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); padding: 0 12px; font: inherit; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.sm { height: 32px; width: 84px; padding: 0 8px; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; }
.btn.danger { background: rgba(224, 103, 95, .12); color: var(--danger); }
.btn.danger:hover { background: rgba(224, 103, 95, .2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.block { width: 100%; justify-content: center; height: 42px; }
/* форма приглашения: поля и кнопка в одну линию; на узком — по два поля, кнопка во всю ширину */
#users { overflow-x: auto; } /* таблица пользователей на телефоне прокручивается, а не обрезается */
.inv-card { container-type: inline-size; }
.inv-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 10px; align-items: end; }
.inv-form label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-form .btn { height: 40px; justify-content: center; }
@container (max-width: 660px) {
  .inv-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inv-form .btn { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .inv-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inv-form .btn { grid-column: 1 / -1; }
}

/* экран входа */
.auth { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(1200px 600px at 20% -10%, var(--accent-soft), transparent), var(--bg); z-index: 70; padding: 16px; }
.auth-card { width: min(380px, 100%); background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-pop); padding: 30px 28px 26px; display: grid; gap: 16px; }
.auth-card .logo { padding: 0 0 4px; justify-content: center; font-size: 22px; }
.auth-card .logo-mark { width: 38px; height: 38px; border-radius: 11px; }
.auth-card p { margin: -6px 0 2px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* меню */
.menu { position: fixed; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; z-index: 36; animation: pop .12s ease-out; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; }
.menu button:hover { background: var(--hover); }
.menu button.on { color: var(--accent-strong); font-weight: 600; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }

/* модалки */
.modal .row { display: flex; gap: 8px; align-items: center; }
.modal .list-box { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.modal .list-box button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 8px; text-align: left; }
.modal .list-box button:hover { background: var(--hover); }
.modal .list-box button.on { background: var(--accent-soft); color: var(--accent-strong); }
.modal .list-box .depth { color: var(--faint); }
.share-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--bg); font-size: 13px; }
.share-item .u { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-item .m { color: var(--faint); font-size: 12px; white-space: nowrap; }

/* просмотрщик */
.viewer { position: fixed; inset: 0; background: rgba(8, 11, 16, .94); z-index: 55; display: grid; grid-template-rows: auto 1fr; color: #e9edf3; animation: fade .15s; }
.viewer-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.viewer-top .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.viewer-top .s { color: #98a2b3; font-size: 12.5px; font-weight: 400; margin-left: 8px; }
.viewer .icon-btn { color: #c9d1dc; }
.viewer .icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.viewer-body { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 64px 24px; }
.viewer-body img, .viewer-body video { max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 10px 50px rgba(0,0,0,.5); }
.viewer-body iframe { width: min(1100px, 100%); height: 100%; border: 0; border-radius: 8px; background: #fff; }
.viewer-body pre { width: min(1000px, 100%); max-height: 100%; overflow: auto; background: #12161d; padding: 18px 20px; border-radius: 12px; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; margin: 0; }
.viewer-body audio { width: min(520px, 100%); }
.viewer .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.08); display: grid; place-items: center; color: #fff; }
.viewer .nav:hover { background: rgba(255,255,255,.16); }
.viewer .nav.prev { left: 10px; }
.viewer .nav.next { right: 10px; }
.viewer .nav.prev svg { transform: rotate(180deg); }
.viewer .nofile { text-align: center; display: grid; gap: 14px; justify-items: center; color: #b8c1cd; }

/* страницы-разделы */
.page { max-width: 1100px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat .v { font-size: 26px; font-weight: 650; letter-spacing: -.5px; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat .bar { margin-top: 10px; }
.svc { display: inline-flex; align-items: center; gap: 6px; margin: 0 14px 8px 0; font-size: 13px; }
.svc i { width: 8px; height: 8px; border-radius: 50%; background: #3daa6e; }
.svc i.bad { background: var(--danger); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--faint); font-weight: 500; font-size: 12px; padding: 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl .mini-bar { width: 120px; height: 5px; border-radius: 9px; background: var(--line); overflow: hidden; margin-top: 4px; }
.tbl .mini-bar i { display: block; height: 100%; background: var(--accent); }
.tag { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-strong); }
.month { font-size: 15px; font-weight: 650; margin: 18px 0 10px; }
.month:first-child { margin-top: 4px; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.pgrid .ph { aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--line); position: relative; cursor: zoom-in; }
.pgrid .ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.pgrid .ph:hover img { transform: scale(1.03); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions button { padding: 5px 9px; border-radius: 8px; font-size: 12.5px; color: var(--muted); border: 1px solid var(--line); background: var(--surface); }
.row-actions button:hover { color: var(--text); background: var(--hover); }
.up-item .err-t { color: var(--danger); }
.nav-item .count:empty { display: none; }
.nav-item .count.hot { color: #fff; background: var(--accent-strong); border-radius: 9px; padding: 0 7px; font-weight: 600; }
:root[data-theme="dark"] .nav-item .count.hot { color: var(--accent-ink); }
.store-row .top span { white-space: nowrap; }
.search-res .rowname { align-items: center; }
@media (max-width: 820px) {
  .tb-sel button span { display: none; }
  .viewer-body { padding: 0 8px 16px; }
  .viewer .nav { display: none; }
  .admin-hide-m { display: none; }
}
.tb-info { flex: 0 1 auto; min-width: 70px; }
.tb-sel { flex: none; }
.sort { white-space: nowrap; }
@media (max-width: 1300px) { .tb-sel button span { display: none; } .tb-sel button { padding: 7px; } }
@media (max-width: 820px) {
  .toolbar { flex-wrap: wrap; row-gap: 8px; min-height: 0; }
  .toolbar .grow { display: none; }
  #tb-tools { margin-left: auto; }
  .sort span, #newdir span { display: none; }
  .tb-sel { order: 3; width: 100%; justify-content: space-between; margin-left: 0; }
  .tb-info h1 { font-size: 19px; }
  .sidebar-shade { position: fixed; inset: 0; background: rgba(10, 15, 25, .35); z-index: 34; }
}

/* док-панель: третья колонка рядом с контентом, сайт не перекрывает */
.app.docked { grid-template-columns: 248px 1fr 340px; }
.dock { display: none; border-left: 1px solid var(--line); background: var(--surface); min-width: 0; min-height: 0; flex-direction: column; }
.app.docked .dock { display: flex; }
.dock-head { display: flex; align-items: center; gap: 8px; padding: 16px 16px 12px 20px; border-bottom: 1px solid var(--line); font-size: 15px; }
.dock-head .icon-btn { width: 30px; height: 30px; }
.dock-body { padding: 16px 20px 24px; overflow-y: auto; display: grid; gap: 12px; align-content: start; }
.dock-what { font-weight: 600; overflow-wrap: anywhere; }
.dock-sub { color: var(--muted); font-size: 13px; }
.dock-note { color: var(--muted); font-size: 13px; }
.dock-done { display: flex; gap: 8px; align-items: flex-start; color: var(--accent-strong); font-weight: 500; }
.dock-done svg { width: 18px; height: 18px; flex: none; }
.dock-err { color: var(--danger); font-size: 13px; }
.dock .opt { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.dock .bar { margin-top: 2px; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 6px; }
.person { display: grid; justify-items: center; gap: 8px; padding: 12px 6px; border-radius: 12px; font-size: 13px; transition: background .12s; }
.person:hover { background: var(--hover); }
.person.on { background: var(--accent-soft); color: var(--accent-strong); }
.person:disabled { opacity: .55; }
.person .avatar { width: 52px; height: 52px; font-size: 20px; }
.person span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.wide { width: 100%; justify-content: center; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--accent-strong); width: 16px; height: 16px; }

/* зона «перетащите файлы сюда» */
.dropzone { border: 1.5px dashed var(--line); border-radius: 18px; background: linear-gradient(180deg, var(--accent-soft), transparent 70%); display: grid; justify-items: center; text-align: center; gap: 8px; padding: 44px 20px; margin-bottom: 16px; color: var(--muted); }
.dropzone b { color: var(--text); font-size: 17px; }
.dz-art { width: 64px; height: 64px; border-radius: 18px; background: var(--surface); display: grid; place-items: center; color: var(--accent-strong); box-shadow: var(--shadow-pop); margin-bottom: 4px; }
.dz-art svg { width: 28px; height: 28px; }
.dz-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

/* компактная история */
.hist { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hrow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.hrow:first-of-type { border-top: 0; }
.hmain { min-width: 0; flex: 1; }
.hname, .ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }

/* мелкие исправления: модалка поверх просмотрщика, поиск сжимается на телефоне */
.veil { z-index: 57; }
.search { min-width: 0; }
.search input { width: 100%; }

@media (max-width: 1100px) { .hist { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .app.docked { grid-template-columns: 1fr; }
  .dock { position: fixed; left: 0; right: 0; bottom: 0; max-height: 78vh; z-index: 45; border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; box-shadow: var(--shadow-pop); }
  .search .kbd { display: none; }
  .dropzone { padding: 28px 16px; }
  .card { overflow-x: auto; }
  .hname, .ell { max-width: 220px; }
}
.dock .opt select { width: 100%; }

/* модалки: колонка не растягивается под длинный текст (ссылки съезжали за край) */
.modal { grid-template-columns: minmax(0, 1fr); }
.modal h2 { overflow-wrap: anywhere; }
.modal .opt > :last-child { max-width: 60%; }
#sh-list { grid-template-columns: minmax(0, 1fr); }

/* подключения в сайдбаре */
.nav-item.sub { padding-left: 22px; font-size: 13.5px; }
.badge-nas.shared { background: var(--accent-soft); color: var(--accent-strong); }

/* графики нагрузки (цвета — проверенная пара для светлой и тёмной темы) */
:root { --c1: #2a78d6; --c2: #eb6834; }
:root[data-theme="dark"] { --c1: #3987e5; --c2: #d95926; }
.ch-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.ch-head h3 { margin: 0; }
.seg button.on { background: var(--accent-soft); color: var(--accent-strong); }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; }
.ch-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.ch-cur { display: flex; gap: 12px; }
.ch-val { color: var(--muted); }
.ch-val b { color: var(--text); font-size: 15px; }
.ch-val i, .ch-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.ch-plot { position: relative; height: 110px; }
.ch-plot svg { width: 100%; height: 100%; display: block; overflow: visible; }
.ch-grid { stroke: var(--line); stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.ch-x { stroke: var(--faint); vector-effect: non-scaling-stroke; }
.ch-max { position: absolute; top: -2px; left: 0; font-size: 11px; color: var(--faint); }
.ch-tip { position: absolute; top: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 12px; box-shadow: var(--shadow-pop); pointer-events: none; white-space: nowrap; }
.ch-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 4px; }
.syno { display: grid; gap: 6px; font-size: 13px; }
.syno-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (max-width: 820px) { .charts { grid-template-columns: 1fr; } }

/* подключения: архив Synology — фиолетовый, общая папка — с иконкой людей */
.folder-shape.nas:before { background: #c6c1f8; }
.folder-shape.nas:after { background: linear-gradient(180deg, #d2cdfb, #b2acf0); box-shadow: 0 6px 16px rgba(120, 110, 220, .22); }
:root[data-theme="dark"] .folder-shape.nas:before { background: #6f68c4; }
:root[data-theme="dark"] .folder-shape.nas:after { background: linear-gradient(180deg, #8f88e0, #6c64c9); }
.fs-ic { position: absolute; inset: 12% 0 0; z-index: 1; display: grid; place-items: center; color: rgba(255, 255, 255, .92); }
.fs-ic svg { width: 34%; height: 34%; stroke-width: 1.6; }
.mini.m-nas, .mini.m-nas-dir { background: var(--nas-soft); color: #6c64d8; }
.mini.m-shared { background: var(--accent-soft); color: var(--accent-strong); }
:root[data-theme="dark"] .mini.m-nas, :root[data-theme="dark"] .mini.m-nas-dir { color: var(--nas); }
.pin-dot { position: absolute; left: 12px; top: 12px; color: var(--accent-strong); }
.pin-dot svg, .crow .pin svg { width: 13px; height: 13px; }
.crow .pin { color: var(--faint); display: grid; }

/* превью в столбцах: занимает всё свободное место */
.preview { width: auto; flex: 1 1 360px; min-width: 320px; max-width: 760px; overflow-y: auto; }
.preview .pv { aspect-ratio: auto; height: min(46vh, 460px); position: relative; }
.preview .pv img { width: 100%; height: 100%; object-fit: contain; }
.preview .pv .typechip { transform: scale(1.3); }
.pv-play { position: absolute; width: 54px; height: 54px; border-radius: 50%; background: rgba(0, 0, 0, .5); color: #fff; display: grid; place-items: center; }
.pv-play svg { width: 22px; height: 22px; fill: currentColor; }
.pv-actions .btn svg { width: 16px; height: 16px; }
.pv-conv { display: flex; gap: 8px; }
.pv-conv select { flex: 1; height: 36px; }
.preview .kv { font-size: 13px; gap: 8px 18px; padding-top: 4px; border-top: 1px solid var(--line); padding-top: 14px; }
.dock .kv { font-size: 13px; }
.kv dd { overflow-wrap: anywhere; }

/* загрузки: шире, остаток в одну строку, пауза */
.uploads { width: 400px; }
#uptitle { display: flex; flex-direction: column; line-height: 1.25; }
#uptitle small { font-size: 11.5px; color: var(--faint); font-weight: 500; }
.up-item .s span { white-space: nowrap; }
.up-b { width: 26px; height: 26px; flex: none; }
.up-b svg { width: 14px; height: 14px; }

/* видео в просмотрщике */
.vbox { position: relative; display: grid; place-items: center; max-width: 100%; max-height: 100%; }
.vbox video { max-width: 100%; max-height: calc(100vh - 120px); }
.vorig { position: absolute; top: 10px; right: 10px; background: rgba(20, 23, 28, .7); color: #fff; border-color: transparent; }
#vwrap .bar { margin: 6px auto; }

/* админка: 4 плитки с графиками, место, службы, люди */
.adm-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 10px; }
.adm-head h3 { margin: 0; font-size: 15px; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric { padding: 16px 18px 12px; }
.mt-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.mt-v { font-size: 26px; font-weight: 650; letter-spacing: -.5px; }
.mt-l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.mt-legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); }
.mt-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.metric .ch-plot { height: 90px; }
.disks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 20px; }
.disk { text-align: left; position: relative; display: block; width: 100%; font: inherit; color: inherit; cursor: default; }
.disk[data-disk="nas"], .disk[data-disk="nuc"] { cursor: pointer; transition: border-color .15s; }
.disk[data-disk="nas"]:hover, .disk[data-disk="nuc"]:hover { border-color: var(--accent); }
.disk .bar { margin-top: 12px; }
.disk-go { position: absolute; right: 16px; top: 18px; color: var(--faint); }
.disk-go svg { width: 16px; height: 16px; }
.adm-two { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; align-items: start; }
.inv-form.v { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.inv-form.v .btn { grid-column: 1 / -1; }
#adm-back svg { transform: rotate(180deg); }
@media (max-width: 1100px) { .adm-two { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .metrics { grid-template-columns: 1fr; } .inv-form.v { grid-template-columns: 1fr; } }

/* превью: картинка сама задаёт размер, ничего не обрезается */
.preview .pv { height: auto; aspect-ratio: auto; flex: none; min-height: 180px; max-height: 58vh; padding: 0; }
.preview .pv img { width: auto; height: auto; max-width: 100%; max-height: 58vh; object-fit: contain; display: block; }
/* страницы во всю ширину, без пустоты справа */
.page { max-width: none; }
#ch-range button { width: auto; padding: 0 12px; font-size: 13px; }
/* пользователи: аватар не съезжает, кнопки в одну строку */
#users .rowname { white-space: nowrap; }
#users .avatar { flex: none; }
#users td { vertical-align: middle; }
#users .row-actions { flex-wrap: nowrap; white-space: nowrap; }
.inv-card .inv-form { grid-template-columns: repeat(4, minmax(0, 1fr)) auto; }
@media (max-width: 820px) { .inv-card .inv-form { grid-template-columns: 1fr; } }

/* модели: чат и лог */
.chat-out { font-size: 14px; line-height: 1.55; min-height: 60px; max-height: 420px; overflow: auto; background: var(--bg); border-radius: 12px; padding: 12px; margin-bottom: 10px; display: grid; gap: 8px; align-content: start; }
.msg { white-space: pre-wrap; padding: 8px 12px; border-radius: 12px; max-width: 85%; overflow-wrap: anywhere; }
.msg.user { justify-self: end; background: var(--accent-soft); color: var(--accent-ink); }
:root[data-theme="dark"] .msg.user { color: var(--text); }
.msg.assistant { justify-self: start; background: var(--surface); border: 1px solid var(--line); }
.chat-form { display: flex; gap: 8px; }
.llm-log { font: 11.5px/1.4 ui-monospace, Menlo, monospace; white-space: pre-wrap; background: var(--bg); border-radius: 8px; padding: 8px; margin: 10px 0 0; max-height: 140px; overflow: auto; color: var(--muted); }
.bar i.indet { width: 35%; animation: indet 1.2s infinite ease-in-out; }
@keyframes indet { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.vnote { position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%); background: rgba(20, 23, 28, .75); color: #fff; font-size: 12.5px; padding: 6px 12px; border-radius: 10px; white-space: nowrap; pointer-events: none; }
.tag.nas { background: var(--nas-soft); color: #6c64d8; }

/* боковая панель: разделы групп, последние папки, сворачивание */
.nav-item > span:not(.count):not(.soon):not(.nav-tog) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-tog { margin-left: auto; color: var(--faint); display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; transform: rotate(90deg); transition: transform .15s; }
.nav-tog:hover { background: var(--hover); color: var(--text); }
.nav-tog.closed { transform: none; }
.nav-tog svg { width: 13px; height: 13px; }
.nav-item.sub svg { width: 15px; height: 15px; opacity: .8; }
.tbl.grp th, .tbl.grp td { text-align: center; }
.tbl.grp th:first-child, .tbl.grp td:first-child { text-align: left; }
.tbl.grp .icon-btn { width: 20px; height: 20px; display: inline-grid; vertical-align: middle; }
.tbl.grp .icon-btn svg { width: 12px; height: 12px; }
.tbl.grp input { width: 16px; height: 16px; accent-color: var(--accent-strong); }
.inv-card .inv-form { grid-template-columns: repeat(5, minmax(0, 1fr)) auto; }

/* настройки модели */
.seg.tabs button { width: auto; padding: 0 12px; font-size: 13px; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 18px; align-items: end; }
.opt-l { display: grid; gap: 6px; font-size: 13px; }
.opt-l span { display: grid; gap: 2px; }
.opt-l small { color: var(--faint); font-size: 11.5px; }
.opt-l.wide { margin-top: 12px; }
.opt-l input[type=range] { accent-color: var(--accent-strong); }
.opt-l textarea { height: auto; padding: 8px 12px; resize: vertical; }
pre.code { font: 12.5px/1.5 ui-monospace, Menlo, monospace; background: var(--bg); border-radius: 10px; padding: 12px; overflow: auto; margin: 0 0 10px; white-space: pre; }
.opt-l .input { width: 100%; }

/* установлено как приложение: не залезаем под чёлку и полоску жестов */
@media (display-mode: standalone) {
  .topbar { padding-top: calc(12px + env(safe-area-inset-top)); }
  .sidebar { padding-top: calc(18px + env(safe-area-inset-top)); }
  .content { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .uploads { bottom: calc(20px + env(safe-area-inset-bottom)); }
}

/* «В этот день» */
.otd { margin-bottom: 8px; }
.otd-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.otd-row .ph { flex: none; width: 150px; aspect-ratio: 1; position: relative; border-radius: 12px; overflow: hidden; cursor: pointer; }
.otd-row .ph img { width: 100%; height: 100%; object-fit: cover; }
.otd-y { position: absolute; left: 6px; bottom: 6px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 6px; }

/* редакторы таблиц и заметок — во весь экран поверх сайта */
.editor { position: fixed; inset: 0; z-index: 56; background: var(--bg); display: flex; flex-direction: column; }
.ed-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: var(--surface); }
.ed-n { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.ed-st { font-size: 12.5px; color: var(--faint); }
.ed-st.hot { color: var(--accent-strong); }
.ed-body { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.xs-box { position: absolute; inset: 0; background: #fff; }
.note { display: grid; grid-template-columns: 1fr 1fr; height: 100%; }
.note.plain { grid-template-columns: 1fr; }
.note textarea { border: 0; outline: 0; resize: none; padding: 24px 28px; font: 14.5px/1.6 ui-monospace, Menlo, monospace; background: var(--surface); color: var(--text); border-right: 1px solid var(--line); }
.md-view { overflow: auto; padding: 24px 32px; line-height: 1.65; font-size: 15px; }
.md-view h1, .md-view h2, .md-view h3 { line-height: 1.25; margin: 1.2em 0 .5em; }
.md-view h1:first-child, .md-view h2:first-child { margin-top: 0; }
.md-view code { background: var(--hover); border-radius: 5px; padding: 1px 5px; font-size: 13px; }
.md-view pre { background: var(--hover); border-radius: 10px; padding: 12px; overflow: auto; }
.md-view pre code { background: none; padding: 0; }
.md-view a { color: var(--accent-strong); }
.md-view blockquote { margin: 0; padding-left: 14px; border-left: 3px solid var(--line); color: var(--muted); }
.md-view table { border-collapse: collapse; } .md-view td, .md-view th { border: 1px solid var(--line); padding: 4px 10px; }
.md-view img { max-width: 100%; }
/* CSV в просмотрщике */
.csv-wrap { width: min(1200px, 94vw); max-height: calc(100vh - 120px); overflow: auto; background: var(--surface); border-radius: 12px; }
table.csv { border-collapse: collapse; font-size: 13px; color: var(--text); }
table.csv th, table.csv td { border: 1px solid var(--line); padding: 4px 10px; white-space: nowrap; text-align: left; }
table.csv th { position: sticky; top: 0; background: var(--hover); }
@media (max-width: 820px) { .note { grid-template-columns: 1fr; } .note .md-view { display: none; } }
.md-read { background: var(--surface); border-radius: 14px; width: min(860px, 94vw); max-height: calc(100vh - 120px); color: var(--text); }
.snip { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: normal; line-height: 1.45; }
.snip mark { background: var(--accent-soft); color: var(--accent-strong); border-radius: 3px; padding: 0 2px; }

/* аудит: список не шире экрана (длинные имена обрезаются), полоса выделения на телефоне не двигает контент */
.list { table-layout: fixed; }
.list td.name { width: auto; overflow: hidden; }
.list th:nth-child(2), .list td:nth-child(2) { width: 150px; }
.list th:nth-child(3), .list td:nth-child(3) { width: 110px; }
.list .rowname > div { min-width: 0; overflow: hidden; }
@media (max-width: 820px) {
  .list th:nth-child(3), .list td:nth-child(3) { width: 80px; }
  .toolbar { position: relative; }
  .tb-sel.show { position: absolute; left: 12px; right: 12px; top: 10px; z-index: 6; margin: 0; overflow-x: auto; box-shadow: var(--shadow-pop); }
  .tbl .row-actions { flex-wrap: wrap; }
}
.think { font-size: 12.5px; color: var(--muted); border-left: 2px solid var(--line); padding-left: 10px; margin-bottom: 8px; white-space: pre-wrap; } .think summary { cursor: pointer; color: var(--faint); }
.st-row { display: flex; gap: 10px; align-items: end; } .st-row .field { flex: 1; } @media (max-width: 820px) { .st-row { flex-direction: column; align-items: stretch; } }
