/* TGISL Knowledge Hub — interface styles
   Palette drawn from the terminal: harbour teal, deep ocean ink, LPG safety amber. */
:root {
  --ink: #0E2A3B;
  --ink-2: #16384C;
  --ink-3: #24506A;
  --teal: #0F7C7A;
  --teal-strong: #0A6361;
  --teal-tint: #DDEEEB;
  --teal-wash: #EEF6F4;
  --amber: #C98318;
  --amber-tint: #FBEFD9;
  --green: #2E8B57;
  --green-tint: #E1F2E8;
  --red: #C8443A;
  --red-tint: #FBE6E3;
  --violet: #5B4FA8;

  --bg: #F3F6F5;
  --surface: #FFFFFF;
  --surface-2: #F8FAF9;
  --line: #DCE3E2;
  --line-strong: #C5D0CF;
  --text: #17262E;
  --text-2: #4C5E66;
  --text-3: #7A8B92;
  --focus: #0F7C7A;
  --shadow-pop: 0 14px 40px -12px rgba(14, 42, 59, .28), 0 2px 6px rgba(14, 42, 59, .08);

  --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --side: 256px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1A23; --surface: #102330; --surface-2: #0E1F2A; --line: #1F3A4A; --line-strong: #2B4B5D;
    --text: #E5EEF0; --text-2: #A9BCC3; --text-3: #7D939B; --teal-tint: #12403F; --teal-wash: #0F2D33;
    --amber-tint: #3A2C12; --green-tint: #14352A; --red-tint: #3D1E1C; --ink: #071219; --ink-2: #0C1E29; --ink-3: #18394B;
    --shadow-pop: 0 14px 40px -12px rgba(0,0,0,.6); color-scheme: dark; --teal-strong: #7ED8D1;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1A23; --surface: #102330; --surface-2: #0E1F2A; --line: #1F3A4A; --line-strong: #2B4B5D;
  --text: #E5EEF0; --text-2: #A9BCC3; --text-3: #7D939B; --teal-tint: #12403F; --teal-wash: #0F2D33;
  --amber-tint: #3A2C12; --green-tint: #14352A; --red-tint: #3D1E1C; --ink: #071219; --ink-2: #0C1E29; --ink-3: #18394B;
  --shadow-pop: 0 14px 40px -12px rgba(0,0,0,.6); color-scheme: dark; --teal-strong: #7ED8D1;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 400 14.5px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--teal-tint); }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.012em; line-height: 1.2; }
h1 { font-size: 26px; font-weight: 650; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
.mono { font-family: var(--mono); font-size: .9em; letter-spacing: -.01em; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hidden { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 22px; height: 22px; }

/* ---------- Boot ---------- */
.boot { height: 100vh; display: grid; place-items: center; }
.boot-mark { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--teal-tint); border-top-color: var(--teal); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, .85fr); background: var(--surface); }
.login-art { background: var(--ink); color: #DCEBEA; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 44px 52px; }
.login-art svg.plant { display: block; width: calc(100% + 104px); margin: 0 -52px -44px; height: auto; opacity: .95; }
.login-brand { position: relative; display: flex; align-items: center; gap: 12px; font-weight: 600; letter-spacing: .01em; }
.login-quote { position: relative; max-width: 30ch; font-size: 30px; line-height: 1.18; font-weight: 600; color: #fff; font-stretch: 92%; letter-spacing: -.02em; }
.login-quote small { display: block; margin-top: 14px; font-size: 14.5px; font-weight: 400; color: #9FC4C2; letter-spacing: 0; line-height: 1.5; font-stretch: 100%; max-width: 46ch; }
.login-form { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(28px, 6vw, 84px); }
.login-form h1 { font-size: 28px; margin-bottom: 6px; }
.login-form form { margin-top: 28px; display: grid; gap: 16px; max-width: 380px; }
.login-foot { margin-top: 34px; font-size: 12.5px; color: var(--text-3); }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-art { min-height: 260px; padding: 28px; } .login-quote { font-size: 23px; } }

.mark { width: 34px; height: 34px; border-radius: 9px; background: var(--teal); display: grid; place-items: center; flex: none; }
.mark svg { width: 22px; height: 22px; stroke: #fff; fill: none; stroke-width: 1.8; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--ink); color: #C9DBDD; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; z-index: 30; }
.side-head { display: flex; align-items: center; gap: 11px; padding: 18px 18px 14px; color: #fff; }
.side-head b { font-size: 15px; font-weight: 650; line-height: 1.15; display: block; }
.side-head span { font-size: 11.5px; color: #8FB2B4; display: block; }
.side-scroll { overflow-y: auto; flex: 1; padding: 6px 10px 18px; scrollbar-width: thin; scrollbar-color: var(--ink-3) transparent; }
.nav-label { font-size: 12px; color: #7F9FA6; padding: 16px 10px 6px; display: flex; justify-content: space-between; align-items: center; }
.nav-label button { background: none; border: 0; color: #7F9FA6; cursor: pointer; padding: 2px; border-radius: 4px; display: grid; }
.nav-label button:hover { color: #fff; background: var(--ink-3); }
.nav a { display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: 8px; color: #C9DBDD; font-size: 14px; text-decoration: none; position: relative; }
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a.on { background: var(--ink-3); color: #fff; }
.nav a.on::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #5FC9C3; }
.nav a .count { margin-left: auto; font-size: 11.5px; font-weight: 600; min-width: 20px; text-align: center; padding: 1px 6px; border-radius: 10px; background: var(--ink-3); color: #fff; }
.nav a .count.hot { background: var(--amber); color: #1E1405; }
.nav .swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; margin: 0 4.5px; box-shadow: 0 0 0 1px rgba(255,255,255,.28); }
.nav .lib-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot { border-top: 1px solid var(--ink-3); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.side-foot .who { min-width: 0; flex: 1; }
.side-foot .who b { display: block; color: #fff; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { font-size: 12px; color: #8FB2B4; }
.side-foot button { background: none; border: 0; color: #9FC4C2; cursor: pointer; padding: 6px; border-radius: 6px; display: grid; }
.side-foot button:hover { background: var(--ink-3); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 10px 28px; height: 60px; }
.top .menu-btn { display: none; }
.search-trigger { flex: 1; max-width: 620px; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; color: var(--text-3); cursor: text; text-align: left; }
.search-trigger:hover { border-color: var(--line-strong); }
.search-trigger kbd { margin-left: auto; }
kbd { font: 500 11.5px var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--text-2); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--text-2); }
.icon-btn:hover { background: var(--surface); border-color: var(--line); color: var(--text); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.page { padding: 26px 28px 60px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .grow { flex: 1; min-width: 240px; }
.page-head p { margin: 6px 0 0; color: var(--text-2); max-width: 70ch; }
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--text-3); margin-bottom: 8px; }
.crumbs a { color: var(--text-2); }
.crumbs svg { width: 13px; height: 13px; }

@media (max-width: 1020px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-pop); }
  .shell.nav-open .side { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(7,18,25,.45); z-index: 25; }
  .top .menu-btn { display: grid; }
  .top { padding: 10px 16px; }
  .page { padding: 20px 16px 50px; }
}

/* ---------- Controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-weight: 550; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { border-color: var(--text-3); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-strong); border-color: var(--teal-strong); }
.btn.approve { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); }
.btn.danger.solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--surface); border-color: var(--line); }
.btn.sm { height: 31px; padding: 0 11px; font-size: 13px; border-radius: 7px; gap: 6px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12.5px; color: var(--text-3); }
.input, select.input, textarea.input { width: 100%; height: 40px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); outline: none; }
textarea.input { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-tint); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237A8B92' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 16px; }
@media (max-width: 680px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--teal); width: 16px; height: 16px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 7px 12px; cursor: pointer; font-size: 13px; font-weight: 550; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--teal-wash); color: var(--teal-strong); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 550; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; gap: 7px; align-items: center; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--teal-strong); border-bottom-color: var(--teal); }
.tabs .n { font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--line); padding: 0 6px; border-radius: 9px; color: var(--text-2); }

/* ---------- Pills & status ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }
.pill .sw { width: 7px; height: 7px; border-radius: 2px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.published { color: var(--green); }
.status.pending { color: var(--amber); }
.status.draft { color: var(--text-3); }
.status.rejected { color: var(--red); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; background: var(--teal-wash); color: var(--teal-strong); font-size: 12.5px; font-weight: 550; border: 1px solid transparent; cursor: default; }
button.chip { cursor: pointer; }
button.chip:hover { border-color: var(--teal); }
.chip.add { background: none; border: 1px dashed var(--teal); }
.chip.ghost { background: var(--surface-2); color: var(--text-2); border-color: var(--line); }
.chip .x { display: grid; cursor: pointer; opacity: .7; }
.chip .x:hover { opacity: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.conf { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 4px; border: 1px solid; }
.conf.confidential { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.conf.restricted { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.conf.public { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.conf.internal { color: var(--text-3); border-color: var(--line-strong); }

/* ---------- Cards & panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-h h2, .panel-h h3 { flex: 1; }
.panel-b { padding: 16px 18px; }
.empty { padding: 40px 20px; text-align: center; color: var(--text-2); }
.empty svg.i { width: 34px; height: 34px; stroke-width: 1.4; color: var(--text-3); margin-bottom: 10px; }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty p { margin: 0 auto 16px; max-width: 46ch; }

/* ---------- Home ---------- */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
@media (max-width: 1200px) { .home-grid { grid-template-columns: 1fr; } }
.hello { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.hello h1 { font-size: 30px; font-stretch: 94%; }
.hello p { margin: 6px 0 0; color: var(--text-2); max-width: 64ch; }
.queue { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 22px; }
.queue a { display: flex; gap: 14px; align-items: center; padding: 16px 18px; color: var(--text); text-decoration: none; border-right: 1px solid var(--line); }
.queue a:last-child { border-right: 0; }
.queue a:hover { background: var(--surface-2); }
.queue .n { font: 600 28px/1 var(--font); font-stretch: 85%; min-width: 34px; color: var(--text-3); }
.queue .attn .n { color: var(--amber); }
.queue b { display: block; font-weight: 600; }
.queue span { font-size: 13px; color: var(--text-2); }
.libs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.lib-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 16px 16px 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--text); text-decoration: none !important; overflow: hidden; min-height: 110px; }
.lib-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.lib-card:hover { border-color: var(--line-strong); box-shadow: 0 4px 14px -8px rgba(14,42,59,.25); }
.lib-card .lc-top { display: flex; align-items: center; gap: 10px; }
.lib-card .lc-ico { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 13%, transparent); color: var(--c); }
.lib-card b { font-weight: 600; line-height: 1.25; }
.lib-card p { margin: 6px 0 0; font-size: 13px; color: var(--text-2); line-height: 1.4; }
.lib-card .lc-meta { margin-top: auto; padding-top: 10px; display: flex; gap: 10px; font-size: 12.5px; color: var(--text-3); }
.section-h { display: flex; align-items: baseline; gap: 12px; margin: 26px 0 12px; }
.section-h h2 { flex: 1; }
.section-h a { font-size: 13.5px; }

.doc-rows { display: grid; }
.doc-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 18px; border-top: 1px solid var(--line); color: var(--text); text-decoration: none !important; }
.doc-row:first-child { border-top: 0; }
.doc-row:hover { background: var(--surface-2); }
.doc-row .t { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-row .s { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-row .r { text-align: right; font-size: 12.5px; color: var(--text-3); }

.ficon { width: 34px; height: 40px; position: relative; flex: none; }
.ficon svg { width: 100%; height: 100%; }
.ficon span { position: absolute; left: 0; right: 0; bottom: 5px; text-align: center; font: 700 8.5px var(--mono); color: #fff; letter-spacing: .02em; }
.ficon.sm { width: 26px; height: 31px; }
.ficon.sm span { font-size: 7px; bottom: 4px; }

.feed { list-style: none; margin: 0; padding: 4px 0; }
.feed li { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 10px 18px; font-size: 13.5px; }
.feed .av { width: 30px; height: 30px; font-size: 11px; }
.feed .when { display: block; font-size: 12px; color: var(--text-3); }
.ann { padding: 14px 18px; border-top: 1px solid var(--line); }
.ann:first-child { border-top: 0; }
.ann b { display: block; }
.ann p { margin: 4px 0 6px; color: var(--text-2); font-size: 13.5px; white-space: pre-line; }
.ann .pin { color: var(--amber); }

.av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: 12.5px; color: #fff; flex: none; letter-spacing: .02em; }
.av.lg { width: 64px; height: 64px; font-size: 22px; }

/* ---------- Library ---------- */
.lib-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 22px; align-items: start; }
.lib-layout.with-peek { grid-template-columns: 250px minmax(0, 1fr) 360px; }
@media (max-width: 1600px) { .lib-layout.with-peek { grid-template-columns: 250px minmax(0, 1fr); } .peek { position: fixed !important; right: 0; top: 0; bottom: 0; width: min(400px, 100vw); z-index: 40; border-radius: 0 !important; box-shadow: var(--shadow-pop); max-height: none !important; } }
@media (max-width: 900px) { .lib-layout, .lib-layout.with-peek { grid-template-columns: 1fr; } .lib-nav { order: 2; } }
.lib-nav { position: sticky; top: 80px; display: grid; gap: 16px; max-height: calc(100vh - 100px); overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.lib-nav h4 { font-size: 12.5px; font-weight: 650; color: var(--text-2); margin: 0 0 6px; display: flex; justify-content: space-between; align-items: center; }
.tree { list-style: none; margin: 0; padding: 0; }
.tree ul { list-style: none; margin: 0; padding-left: 14px; }
.tree a, .tree button.node { display: flex; align-items: center; gap: 7px; padding: 5px 8px; border-radius: 7px; color: var(--text-2); font-size: 13.5px; width: 100%; border: 0; background: none; cursor: pointer; text-align: left; text-decoration: none; }
.tree a:hover, .tree button.node:hover { background: var(--surface); color: var(--text); }
.tree a.on, .tree button.node.on { background: var(--teal-wash); color: var(--teal-strong); font-weight: 600; }
.tree .n { margin-left: auto; font-size: 11.5px; color: var(--text-3); }
.tree .lock { color: var(--amber); }
.tree .caret { width: 14px; display: grid; place-items: center; color: var(--text-3); }
.facet { display: grid; gap: 1px; }
.facet label { display: flex; gap: 8px; align-items: center; padding: 4px 6px; border-radius: 6px; font-size: 13.5px; cursor: pointer; color: var(--text-2); }
.facet label:hover { background: var(--surface); color: var(--text); }
.facet input { accent-color: var(--teal); }
.facet .n { margin-left: auto; font-size: 11.5px; color: var(--text-3); }
.facet .more { font-size: 12.5px; background: none; border: 0; color: var(--teal); cursor: pointer; padding: 4px 6px; text-align: left; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .filter-input { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.toolbar .filter-input svg { position: absolute; left: 11px; top: 11px; color: var(--text-3); }
.toolbar .filter-input input { padding-left: 36px; height: 38px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.bulk { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--ink); color: #fff; border-radius: 10px; margin-bottom: 12px; position: sticky; top: 70px; z-index: 5; }
.bulk .btn { background: transparent; color: #fff; border-color: var(--ink-3); }
.bulk .btn:hover { background: var(--ink-3); }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: auto; }
table.docs { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.docs th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--text-2); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; }
table.docs th button { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
table.docs td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.docs tr:last-child td { border-bottom: 0; }
table.docs tbody tr { cursor: pointer; }
table.docs tbody tr:hover td { background: var(--surface-2); }
table.docs tbody tr.sel td { background: var(--teal-wash); }
table.docs tbody tr.focus td { box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--teal) 6%, transparent); }
table.docs .cb { width: 34px; }
table.docs input[type=checkbox] { accent-color: var(--teal); width: 15px; height: 15px; cursor: pointer; }
.doc-title { display: flex; align-items: center; gap: 11px; min-width: 260px; }
.doc-title .tt { font-weight: 550; color: var(--text); line-height: 1.3; }
.doc-title .nn { font: 500 12px var(--mono); color: var(--text-3); }
.doc-title .flags { display: inline-flex; gap: 5px; margin-left: 6px; vertical-align: middle; color: var(--amber); }
.folder-row td { color: var(--text); }
.folder-ico { width: 34px; height: 30px; color: var(--teal); display: grid; place-items: center; }
.ver { font: 500 12.5px var(--mono); }

.grid-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.gcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; position: relative; }
.gcard:hover { border-color: var(--line-strong); }
.gcard.sel { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal-tint); }
.gcard .gt { font-weight: 550; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gcard .gm { font-size: 12px; color: var(--text-3); display: flex; justify-content: space-between; margin-top: auto; }
.gcard input { position: absolute; top: 12px; right: 12px; accent-color: var(--teal); }

.dropzone-overlay { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--ink) 70%, transparent); display: grid; place-items: center; pointer-events: none; }
.dropzone-overlay div { border: 2px dashed #8FD3CE; border-radius: 20px; padding: 46px 60px; color: #fff; text-align: center; font-size: 18px; font-weight: 600; }

/* ---------- Peek / Title block ---------- */
.peek { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; display: flex; flex-direction: column; }
.peek-h { display: flex; gap: 10px; align-items: flex-start; padding: 16px 16px 12px; }
.peek-h h3 { font-size: 16px; line-height: 1.3; flex: 1; }
.peek .sect { padding: 12px 16px; border-top: 1px solid var(--line); }
.peek .sect h4 { font-size: 12.5px; color: var(--text-2); margin: 0 0 8px; }
.kv { margin: 0; display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* The title block — modelled on an engineering drawing's title block */
.titleblock { border: 1.5px solid var(--text); border-radius: 4px; display: grid; grid-template-columns: 1.45fr .75fr 1fr; font-size: 12.5px; background: var(--surface); position: relative; }
.titleblock > div { padding: 7px 10px; border-right: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); min-width: 0; }
.titleblock > div:nth-child(3n) { border-right: 0; }
.titleblock > div.last { border-bottom: 0; }
.titleblock small { display: block; font-size: 10.5px; color: var(--text-3); letter-spacing: .02em; margin-bottom: 2px; }
.titleblock .v { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titleblock .v.mono { font-family: var(--mono); font-weight: 600; }
.titleblock .big { font: 600 20px/1 var(--mono); }
.titleblock .span2 { grid-column: span 2; }
.stamp { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; padding: 3px 9px; border: 2px solid currentColor; border-radius: 5px; font-weight: 700; font-size: 11.5px; letter-spacing: .06em; line-height: 1.15; transform: rotate(-4deg); }
.stamp::after { content: attr(data-sub); font-size: 9px; font-weight: 600; letter-spacing: .02em; opacity: .85; }
.stamp.published { color: var(--green); } .stamp.pending { color: var(--amber); } .stamp.draft { color: var(--text-3); } .stamp.rejected { color: var(--red); }
.stamp.big { font-size: 15px; padding: 5px 14px; border-width: 2.5px; }

/* ---------- Document page ---------- */
.doc-page { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 22px; align-items: start; }
@media (max-width: 1180px) { .doc-page { grid-template-columns: 1fr; } }
.doc-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; flex-wrap: wrap; }
.doc-head h1 { font-size: 24px; flex: 1; min-width: 260px; }
.doc-head .ficon { width: 44px; height: 52px; }
.doc-head .ficon span { font-size: 10px; bottom: 7px; }
.preview { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.preview-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.preview iframe, .preview embed { width: 100%; height: 72vh; border: 0; display: block; background: #525659; }
.preview img { display: block; max-width: 100%; margin: 0 auto; max-height: 75vh; }
.preview .img-wrap { background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0/20px 20px; padding: 20px; }
.preview pre { margin: 0; padding: 24px 28px; max-height: 72vh; overflow: auto; white-space: pre-wrap; font: 13.5px/1.65 var(--font); color: var(--text); }
.preview mark, .snippet mark { background: color-mix(in srgb, var(--amber) 28%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
.side-stack { display: grid; gap: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); border: 1px solid; font-size: 13.5px; }
.alert svg.i { margin-top: 1px; }
.alert.amber { background: var(--amber-tint); border-color: color-mix(in srgb, var(--amber) 35%, transparent); }
.alert.red { background: var(--red-tint); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.alert.teal { background: var(--teal-wash); border-color: color-mix(in srgb, var(--teal) 30%, transparent); }
.alert .grow { flex: 1; }
.alert b { display: block; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 26px; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.timeline li::after { content: ""; position: absolute; left: 10px; top: 18px; bottom: 0; width: 1.5px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.pub::before { border-color: var(--green); background: var(--green); }
.timeline li.cur::before { border-color: var(--teal); }
.timeline .when { color: var(--text-3); font-size: 12.5px; }

.ver-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ver-table td, .ver-table th { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.ver-table th { font-size: 12.5px; color: var(--text-2); font-weight: 600; }

.comment { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.comment:first-child { border-top: 0; }
.comment .meta { font-size: 12.5px; color: var(--text-3); }
.comment p { margin: 3px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.mention { color: var(--teal-strong); font-weight: 600; }

.diff { font: 13px/1.6 var(--font); max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; background: var(--surface-2); white-space: pre-wrap; }
.diff ins { background: var(--green-tint); text-decoration: none; color: var(--green); }
.diff del { background: var(--red-tint); color: var(--red); }

/* ---------- Search ---------- */
.search-hero { margin-bottom: 18px; }
.search-box { position: relative; }
.search-box svg.i { position: absolute; left: 16px; top: 16px; color: var(--text-3); width: 20px; height: 20px; }
.search-box input { width: 100%; height: 54px; padding: 0 130px 0 48px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 17px; outline: none; }
.search-box input:focus { border-color: var(--teal); box-shadow: 0 0 0 4px var(--teal-tint); }
.search-box .btn { position: absolute; right: 8px; top: 8px; }
.search-tips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--text-3); align-items: center; }
.search-tips code { font: 500 12px var(--mono); background: var(--surface); border: 1px solid var(--line); padding: 2px 7px; border-radius: 5px; color: var(--text-2); cursor: pointer; }
.search-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 900px) { .search-layout { grid-template-columns: 1fr; } }
.result { padding: 16px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; }
.result .rt { font-size: 16.5px; font-weight: 600; color: var(--text); }
.result .rt:hover { color: var(--teal); }
.result .rm { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12.5px; color: var(--text-3); margin-top: 3px; align-items: center; }
.snippet { margin: 6px 0 0; color: var(--text-2); font-size: 13.5px; line-height: 1.55; }
.people-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.person-chip { display: flex; gap: 10px; align-items: center; padding: 8px 14px 8px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 30px; color: var(--text); text-decoration: none !important; }
.person-chip small { display: block; color: var(--text-3); font-size: 12px; }

/* ---------- Command palette ---------- */
.palette-back { position: fixed; inset: 0; background: rgba(7,18,25,.45); z-index: 80; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.palette { width: min(640px, 100%); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-pop); overflow: hidden; border: 1px solid var(--line); }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 18px 20px; font-size: 17px; outline: none; background: var(--surface); }
.palette .res { max-height: 56vh; overflow-y: auto; padding: 6px; }
.palette .grp { font-size: 12px; font-weight: 600; color: var(--text-3); padding: 10px 12px 4px; }
.palette .it { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; cursor: pointer; color: var(--text); }
.palette .it.on { background: var(--teal-wash); }
.palette .it small { color: var(--text-3); margin-left: auto; font-size: 12px; white-space: nowrap; }
.palette .it .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette .foot { display: flex; gap: 14px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); background: var(--surface-2); }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(7,18,25,.5); z-index: 70; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; max-height: 88vh; animation: rise .18s ease; }
@keyframes rise { from { transform: translateY(10px); opacity: .6; } }
.modal.wide { width: min(860px, 100%); }
.modal.xwide { width: min(1100px, 100%); }
.modal-h { display: flex; align-items: center; gap: 12px; padding: 18px 22px 12px; }
.modal-h h2 { flex: 1; }
.modal-b { padding: 6px 22px 18px; overflow-y: auto; display: grid; gap: 16px; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.modal-f .left { margin-right: auto; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Upload */
.drop { border: 2px dashed var(--line-strong); border-radius: 14px; padding: 28px; text-align: center; color: var(--text-2); cursor: pointer; background: var(--surface-2); }
.drop:hover, .drop.over { border-color: var(--teal); background: var(--teal-wash); color: var(--teal-strong); }
.drop svg.i { width: 30px; height: 30px; color: var(--teal); }
.drop b { display: block; color: var(--text); margin-top: 6px; font-size: 15px; }
.uq { display: grid; gap: 8px; }
.uq-item { display: grid; grid-template-columns: 30px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.uq-item .nm { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uq-item .st { font-size: 12.5px; color: var(--text-3); }
.uq-item .st.v { color: var(--teal-strong); }
.uq-item .st.err { color: var(--red); }
.uq-item .st.ok { color: var(--green); }
.bar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--teal); width: 0; transition: width .2s; }
.mode-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 600px) { .mode-pick { grid-template-columns: 1fr; } }
.mode-pick label { border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; cursor: pointer; font-size: 13px; color: var(--text-2); display: block; }
.mode-pick label b { display: block; color: var(--text); font-size: 14px; }
.mode-pick input { display: none; }
.mode-pick label:has(input:checked) { border-color: var(--teal); background: var(--teal-wash); box-shadow: 0 0 0 1px var(--teal); }

/* Term picker */
.tp { position: relative; }
.tp-box { min-height: 40px; border: 1px solid var(--line-strong); border-radius: 9px; padding: 6px 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--surface); cursor: text; }
.tp-box:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-tint); }
.tp-box input { border: 0; outline: none; flex: 1; min-width: 90px; height: 26px; background: transparent; }
.tp-menu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop); max-height: 260px; overflow-y: auto; z-index: 90; padding: 4px; }
.tp-menu button { display: flex; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13.5px; gap: 8px; align-items: center; }
.tp-menu button:hover, .tp-menu button.on { background: var(--teal-wash); }
.tp-menu .path { color: var(--text-3); font-size: 12px; }
.tp-menu .sel { margin-left: auto; color: var(--teal); }

/* Permissions editor */
.perm-list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.perm-row { display: grid; grid-template-columns: 30px minmax(0,1fr) 160px 36px; gap: 10px; align-items: center; padding: 9px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.perm-row:first-child { border-top: 0; }
.perm-row .pt { font-size: 12px; color: var(--text-3); }
.perm-row select { height: 34px; }
.pt-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.levels-legend { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; font-size: 12.5px; color: var(--text-2); }
.levels-legend b { display: block; color: var(--text); }
@media (max-width: 700px) { .levels-legend { grid-template-columns: 1fr 1fr; } .perm-row { grid-template-columns: 30px minmax(0,1fr) 120px 30px; } }

/* Admin tables */
table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list th { text-align: left; font-size: 12.5px; color: var(--text-2); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
table.list td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--surface-2); }
.role { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 5px; }
.role.admin { background: var(--ink); color: #fff; }
.role.head { background: var(--amber-tint); color: #7A4E0A; }
.role.member { background: var(--teal-wash); color: var(--teal-strong); }
.role.viewer { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
:root[data-theme="dark"] .role.head { color: #F4C77A; }
.admin-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.admin-nav a { padding: 7px 13px; border-radius: 8px; font-size: 13.5px; font-weight: 550; color: var(--text-2); border: 1px solid transparent; text-decoration: none; }
.admin-nav a:hover { background: var(--surface); border-color: var(--line); }
.admin-nav a.on { background: var(--surface); border-color: var(--line-strong); color: var(--text); }

.tax-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .tax-layout { grid-template-columns: 1fr; } }
.term-tree li > div { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 7px; font-size: 13.5px; }
.term-tree li > div:hover { background: var(--surface-2); }
.term-tree li > div .acts { margin-left: auto; display: none; gap: 2px; }
.term-tree li > div:hover .acts { display: flex; }
.term-tree .syn { font-size: 12px; color: var(--text-3); }
.term-tree .dep { text-decoration: line-through; color: var(--text-3); }
.mini-btn { border: 0; background: none; padding: 4px; border-radius: 5px; cursor: pointer; color: var(--text-3); display: grid; }
.mini-btn:hover { background: var(--line); color: var(--text); }

/* Charts */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.stat b { display: block; font-size: 24px; font-weight: 650; font-stretch: 88%; }
.stat span { font-size: 13px; color: var(--text-2); }
.stat.warn b { color: var(--amber); }
.hbars { display: grid; gap: 9px; }
.hbar { display: grid; grid-template-columns: 150px minmax(0, 1fr) 46px; gap: 10px; align-items: center; font-size: 13px; }
.hbar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.hbar .trk { height: 12px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.hbar .trk i { display: block; height: 100%; border-radius: 3px; }
.hbar .v { text-align: right; font-variant-numeric: tabular-nums; }
.cols { display: flex; align-items: flex-end; gap: 8px; height: 170px; padding-top: 10px; }
.cols .c { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; font-size: 11.5px; color: var(--text-3); }
.cols .c i { width: 100%; max-width: 38px; background: var(--teal); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.cols .c i b { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1000px) { .two-col { grid-template-columns: 1fr; } }

/* Notifications drawer */
.notif-pop { position: absolute; right: 16px; top: 56px; width: min(400px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop); z-index: 50; overflow: hidden; }
.notif-pop .list { max-height: 60vh; overflow-y: auto; }
.notif { display: grid; grid-template-columns: 10px 1fr; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); cursor: pointer; font-size: 13.5px; }
.notif:hover { background: var(--surface-2); }
.notif .d { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: transparent; }
.notif.unread .d { background: var(--teal); }
.notif.unread b { font-weight: 650; }
.notif b { font-weight: 550; display: block; }
.notif small { color: var(--text-3); font-size: 12px; }
.notif p { margin: 2px 0; color: var(--text-2); }

/* Toasts */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; justify-items: center; width: min(520px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-pop); display: flex; gap: 10px; align-items: center; font-size: 14px; animation: rise .2s ease; }
.toast.err { background: #7D231C; }
.toast a { color: #8FD3CE; font-weight: 600; }

.loading { padding: 50px; display: grid; place-items: center; }
.skel { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 6px; height: 14px; }
@keyframes sh { to { background-position: -200% 0; } }
.profile-head { display: flex; gap: 18px; align-items: center; margin-bottom: 22px; }
.dir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.dir-card { display: flex; gap: 12px; align-items: center; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--text); text-decoration: none !important; }
.dir-card:hover { border-color: var(--line-strong); }
.dir-card small { display: block; color: var(--text-3); font-size: 12.5px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 14px; font-size: 13px; color: var(--text-2); }

@media (max-width: 1560px) { .lib-layout table.docs .c-size { display: none; } }

@media (max-width: 640px) {
  .search-trigger span, .search-trigger kbd { display: none; }
  .search-trigger { flex: 0 0 auto; }
  .grant { grid-template-columns: 1fr 1fr !important; }
  .page-head .btn-row { width: 100%; }
  .hello h1 { font-size: 24px; }
  .queue a { border-right: 0; border-bottom: 1px solid var(--line); }
  .doc-head h1 { font-size: 20px; }
  .titleblock { font-size: 12px; }
}
