/* elk knowledge base. Used by the app and by client share pages (body.share). */
/* Guru-style palette: black text and links, plain grays, one blue accent (focus and small labels only). */
:root {
  --red: #D1242F;
  --accent: #005DFF;
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F5F5F5;
  --text: #0B0B0B;
  --muted: #585858;
  --line: #D2D2D2;
  --link: var(--text);
  --focus: #005DFF;
  --shadow: 0 8px 14px rgb(68 52 77 / 16%), 0 4px 6px rgb(46 32 54 / 24%);
  --solid: #0B0B0B;
  --btn-bg: #0B0B0B; --btn-fg: #FFFFFF;
  --ok: #14783a; --ok-bg: #e3f4e9;
  --warn: #9a4a00; --warn-bg: #fdeed9;
  --bad: #b3141b; --bad-bg: #fde6e6;
  --none: #585858; --none-bg: #EEEEEE;
  --info: #0B0B0B; --info-bg: #EEEEEE;
  --mark: #fff1a8;
  --side-bg: #1A1B1C; --side-text: #EEEEEE; --side-muted: #9A9B9C; --side-line: #46484A; --side-sel: #2E3032;
  --font: "Proxima Nova", Proxima, "Helvetica Neue", Helvetica, Arial, system-ui, -apple-system, "Segoe UI", sans-serif;
  --head: var(--font);
  --gutter: 24px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212; --surface: #1A1A1A; --surface-2: #262626; --text: #F5F5F5; --muted: #A8A8A8; --line: #333333; --solid: #333333;
    --focus: #6B9BFF; --accent: #6B9BFF; --shadow: 0 8px 14px rgb(0 0 0 / 40%), 0 4px 6px rgb(0 0 0 / 50%);
    --btn-bg: #F5F5F5; --btn-fg: #0B0B0B;
    --ok: #6fdc97; --ok-bg: #123a27; --warn: #ffb866; --warn-bg: #3f2a0e; --bad: #ff8b90; --bad-bg: #431519;
    --none: #d4d4d4; --none-bg: #333333; --info: #F5F5F5; --info-bg: #333333; --mark: #6b5a00;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121212; --surface: #1A1A1A; --surface-2: #262626; --text: #F5F5F5; --muted: #A8A8A8; --line: #333333; --solid: #333333;
  --focus: #6B9BFF; --accent: #6B9BFF; --shadow: 0 8px 14px rgb(0 0 0 / 40%), 0 4px 6px rgb(0 0 0 / 50%);
  --btn-bg: #F5F5F5; --btn-fg: #0B0B0B;
  --ok: #6fdc97; --ok-bg: #123a27; --warn: #ffb866; --warn-bg: #3f2a0e; --bad: #ff8b90; --bad-bg: #431519;
  --none: #d4d4d4; --none-bg: #333333; --info: #F5F5F5; --info-bg: #333333; --mark: #6b5a00;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/1.4 var(--font); overflow-wrap: anywhere; }
h1, h2, h3, h4 { font-family: var(--head); line-height: 1.25; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: 1.875rem; } h2 { font-size: 1.125rem; } h3 { font-size: 1rem; }
a { color: var(--link); text-underline-offset: 2px; }
p { margin: 0 0 .8em; }
img, video, svg { max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
.elk { font-variant: small-caps; text-transform: lowercase; letter-spacing: .02em; }
kbd { font: 600 .75rem var(--font); background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--muted); }
.boot { padding: 40px; text-align: center; color: var(--muted); }
.empty { padding: 8px 0; }

/* buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); font: 600 14px var(--font); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn[aria-pressed="true"] { border-color: var(--text); background: var(--surface-2); }
.btn.primary { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }
.btn.primary:hover { opacity: .85; }
.btn.small { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn.link { border: 0; background: none; color: var(--link); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; min-height: 36px; max-width: 100%; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; }
textarea { width: 100%; font: .92rem/1.5 ui-monospace, "Cascadia Code", Consolas, monospace; resize: vertical; }
textarea.drop { border-color: var(--accent); background: var(--info-bg); }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9rem; margin-bottom: 12px; }
.field input, .field select { width: 100%; font-weight: 400; }
.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; margin-bottom: 12px; }
.check input { min-height: 0; width: 18px; height: 18px; }
label.inline { display: inline-flex; gap: 8px; align-items: center; font-size: .9rem; }
.form-error { color: var(--bad); background: var(--bad-bg); border-radius: 8px; padding: 8px 12px; font-size: .9rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* badges and banners */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font: 700 .75rem/1.6 var(--font); white-space: nowrap; }
.badge.verified { background: var(--ok-bg); color: var(--ok); }
.badge.expired { background: var(--warn-bg); color: var(--warn); }
.badge.unverified, .badge.neutral { background: var(--none-bg); color: var(--none); }
.badge.flagged { background: var(--bad-bg); color: var(--bad); }
.badge.client { background: var(--info-bg); color: var(--info); }
.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--text); border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; }
.banner.flagged { border-left-color: var(--red); background: var(--bad-bg); }
.banner.expired { border-left-color: #d97706; background: var(--warn-bg); }
.banner.required { border-left-color: var(--accent); }

/* verification icon: green check, gray or amber "?", red "!" */
.state-icon { flex: none; width: 18px; height: 18px; vertical-align: middle; }
.state-icon circle { fill: var(--none); }
.state-icon path { fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.state-icon.verified circle { fill: var(--ok); }
.state-icon.expired circle { fill: var(--warn); }
.state-icon.flagged circle { fill: var(--bad); }
:root[data-theme="dark"] .state-icon path { stroke: #0B0B0B; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .state-icon path { stroke: #0B0B0B; } }

/* shell */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; border-radius: 8px; }
.skip:focus { left: 8px; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 8px var(--gutter); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 600 1.25rem var(--head); }
.elk-logo { display: block; height: 26px; width: auto; }
.auth-brand .elk-logo { height: 40px; }
.auth-brand .brand-sub { font-size: 1.3rem; }
.brand-sub { font: 600 .95rem var(--head); color: var(--muted); }
.search-trigger { flex: 1; max-width: 520px; margin: 0 auto 0 12px; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font: inherit; cursor: pointer; text-align: left; }
.search-trigger:hover { border-color: var(--muted); }
.st-text { flex: 1; }
.icon-btn { display: none; width: 40px; height: 40px; align-items: center; justify-content: center; border: 0; border-radius: 8px; background: none; color: var(--text); cursor: pointer; }
.user-menu { position: relative; display: flex; align-items: center; gap: 6px; }
.theme-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 1px solid var(--line); border-radius: 50%; color: var(--text); font-size: 1.1rem; cursor: pointer; }
.theme-btn:hover { background: var(--surface-2); }
.user-btn { display: flex; align-items: center; gap: 8px; min-height: 40px; background: none; border: 1px solid transparent; border-radius: 999px; padding: 2px 10px 2px 2px; color: var(--text); font: 600 14px var(--font); cursor: pointer; }
.user-btn:hover { border-color: var(--line); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--solid); color: #fff; display: inline-flex; align-items: center; justify-content: center; font: 600 .85rem var(--head); }
.avatar.xs { width: 20px; height: 20px; font-size: .7rem; flex: none; }
:root[data-theme="dark"] .avatar { color: #F5F5F5; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 40; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 9px 10px; color: var(--text); font: inherit; cursor: pointer; }
.menu button:hover { background: var(--surface-2); }
.menu-who { padding: 6px 10px; margin: 0; font-weight: 600; border-bottom: 1px solid var(--line); }
.menu-who .muted { font-weight: 400; font-size: .8rem; }
.body { display: flex; flex: 1; min-height: 0; }
.backdrop { display: none; }
.sidebar { --text: var(--side-text); --muted: var(--side-muted); --line: var(--side-line); --surface-2: var(--side-sel); --focus: #8FB2FF; width: 272px; flex: none; padding: 16px 12px 40px; background: var(--side-bg); color: var(--side-text); border-right: 1px solid var(--side-line); overflow-y: auto; position: sticky; top: 57px; align-self: flex-start; max-height: calc(100vh - 57px); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.nav-group { margin-bottom: 18px; }
.nav-h { font: 600 .72rem var(--head); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px 10px; }
.nav-link { position: relative; display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 7px 10px; border: 1px solid transparent; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14px; }
.nav-link:hover { background: var(--surface-2); }
.nav-link.active { background: var(--side-sel); border-color: var(--side-line); font-weight: 600; }
.nav-link.col { justify-content: flex-start; align-items: flex-start; }
.col-icon { flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 4px; background: #6B7280; }
.col-icon[data-c="1"] { background: #4F8A6B; } .col-icon[data-c="2"] { background: #C58B2A; } .col-icon[data-c="3"] { background: #4A7FB5; } .col-icon[data-c="4"] { background: #B5584A; } .col-icon[data-c="5"] { background: #7A8A3E; }
.col-text { display: flex; flex-direction: column; min-width: 0; }
.nav-link.mini { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-link.folder { margin-left: 26px; font-size: 13px; }
.nav-link.folder.d1 { margin-left: 40px; } .nav-link.folder.d2 { margin-left: 54px; } .nav-link.folder.d3 { margin-left: 68px; }
.count { font-size: 12px; color: var(--muted); }
.tree-row { display: flex; align-items: center; }
.tree-row .nav-link { flex: 1; min-width: 0; }
.twisty { width: 24px; height: 28px; flex: none; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: .8rem; }
.twisty:disabled { cursor: default; }
.main { flex: 1; min-width: 0; padding: 24px var(--gutter) 64px; max-width: 1100px; margin: 0 auto; width: 100%; outline: none; }

/* lists and panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.panel h2 { font-size: 1.125rem; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; align-items: start; margin-top: 18px; }
.home-grid .panel { margin: 0; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }
.sub { font-size: 14px; color: var(--muted); margin: 18px 0 8px; font-weight: 600; }
.card-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.card-list li { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.card-list a { display: grid; grid-template-columns: 18px 1fr; gap: 2px 10px; padding: 12px 16px; color: var(--text); text-decoration: none; border-radius: 12px; align-items: center; }
.card-list a:hover, .card-list li.active a { background: var(--surface-2); }
.card-list .state-icon { grid-column: 1; grid-row: 1; }
.card-list .ct { grid-column: 2; font-size: 16px; font-weight: 600; }
.card-list .cm { grid-column: 2; font-size: 14px; color: var(--muted); }
.card-list .by { grid-column: 2; display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.card-list .snip { grid-column: 2; font-size: 14px; color: var(--muted); }
mark { background: var(--mark); color: inherit; border-radius: 2px; }
.card-list li.with-action { display: flex; align-items: center; gap: 8px; padding-right: 12px; }
.card-list li.with-action a { flex: 1; }
.card-list li.extra a { display: block; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 6px 0; }
.question { border-top: 1px solid var(--line); }
.question:first-child { border-top: 0; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 12px 0; }
.chip, .tag { display: inline-block; padding: 3px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); text-decoration: none; font-size: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.searchbox { display: flex; gap: 8px; margin: 12px 0 16px; }
.searchbox input { flex: 1; min-width: 0; }
.searchbox.big input { min-height: 52px; font-size: 1rem; border-radius: 12px; padding: 0 16px; }
.searchbox.big .btn { min-height: 52px; border-radius: 12px; }
.no-results { background: var(--surface); border: 1px dashed var(--line); border-radius: 12px; padding: 18px; }
.ask-box { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin: 18px 0 0; }
.ask-box label { font: 600 1.125rem var(--head); display: block; margin-bottom: 6px; }
.ask-box input { flex: 1; min-width: 200px; }
.answer { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--text); border-radius: 12px; padding: 14px 18px; margin: 12px 0; }
.streaming { white-space: pre-wrap; margin: 0; }

/* card page */
.card-head h1 { margin-bottom: 8px; }
.card-head .crumbs { margin-bottom: 8px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .85rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.inline-form label { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
.card-page .prose, .editor .prose { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 22px; margin-bottom: 16px; }
.versions li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); }
.version-view { margin-top: 12px; }
details { margin-top: 10px; }
summary { cursor: pointer; font-weight: 600; }

/* rendered Markdown */
.prose { font-size: 14px; line-height: 1.6; }
.prose h1 { font-size: 1.5rem; margin-top: 1.2em; } .prose h2 { font-size: 1.125rem; margin-top: 1.2em; } .prose h3 { font-size: 1rem; margin-top: 1.1em; }
.prose a { color: var(--muted); }
.prose img, .prose video.media { display: block; max-width: 100%; height: auto; border-radius: 8px; margin: 12px 0; }
.prose audio { width: 100%; }
.prose pre { background: var(--solid); color: #F5F5F5; padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
.prose code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { margin: 12px 0; padding: 2px 16px; border-left: 4px solid var(--line); color: var(--muted); }
.prose .table-wrap { overflow-x: auto; margin: 12px 0; }
.prose table { border-collapse: collapse; min-width: 100%; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); }
.prose .embed { position: relative; aspect-ratio: 16 / 9; margin: 14px 0; border-radius: 8px; overflow: hidden; background: #000; }
.prose .embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* editor */
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.attach { position: relative; cursor: pointer; }
.attach input:focus-visible + * { outline: 0; }
.attach:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.split { display: grid; grid-template-columns: 1fr; gap: 16px; }
.split .grow { min-width: 0; }
.hint { font-size: .85rem; }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgb(26 27 28 / 65%); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; overflow-y: auto; }
.dialog { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; width: min(100%, 520px); box-shadow: var(--shadow); }
.palette { width: min(100%, 640px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.palette > input { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; min-height: 54px; padding: 0 18px; font-size: 1.05rem; }
.palette > input:focus-visible { outline-offset: -3px; }
.palette ul { margin: 0; padding: 6px; gap: 2px; max-height: 50vh; overflow-y: auto; }
.palette li a { border-radius: 8px; padding-left: 12px; padding-right: 12px; }
.palette .card-list li { border: 0; border-radius: 8px; }
.palette li.active > a { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--text); }
.palette .extra a { display: block; padding: 10px 12px; color: var(--text); text-decoration: none; }
.pal-empty, .pal-help { padding: 4px 18px; margin: 0 0 6px; font-size: .85rem; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast { background: var(--solid); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); font-size: .9rem; }
.toast.err { background: var(--red); }

/* sign in */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px var(--gutter); }
.auth-card { width: min(100%, 400px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 1.8rem; }

/* client share pages (src/shares.js) */
body.share { background: var(--surface); }
.share-top { padding: 14px var(--gutter); border-bottom: 1px solid var(--line); display: flex; }
.share-top .brand { color: var(--text); }
.share-main { max-width: 820px; margin: 0 auto; padding: 28px var(--gutter) 40px; min-height: 60vh; }
.share-foot { max-width: 820px; margin: 0 auto; padding: 18px var(--gutter) 32px; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }
.share-title { margin-bottom: 18px; }
.share-folder { margin: 24px 0 8px; font-size: 1rem; color: var(--muted); }
.share-list { list-style: none; padding: 0; margin: 0 0 12px; }
.share-list li { border-top: 1px solid var(--line); }
.share-list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 4px; color: var(--text); text-decoration: none; }
.share-list a:hover { background: var(--surface-2); }
.share-card-title { font-weight: 600; }
.share-empty, .share-lock { max-width: 440px; margin: 10vh auto 0; padding: 0 4px; }
.share-lock label { display: flex; flex-direction: column; gap: 4px; margin: 14px 0; font-weight: 500; }
.share-lock input { width: 100%; }
.back { display: inline-block; margin-bottom: 14px; font-size: .9rem; }
.card-view .meta { margin: 6px 0 16px; }
.card-view .prose { padding: 0; border: 0; background: none; }

/* tablet and phone */
@media (max-width: 1000px) {
  .grid2 { grid-template-columns: 1fr; }
}
@media (min-width: 1000px) {
  .split { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 800px) {
  :root { --gutter: 16px; }
  .icon-btn { display: inline-flex; }
  .brand-sub, .st-text + kbd, .un { display: none; }
  .search-trigger { margin-left: 0; }
  .sidebar { position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; max-height: none; width: min(86vw, 320px); transform: translateX(-102%); transition: transform .18s ease; padding-top: 20px; }
  .drawer-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .drawer-open .backdrop { display: block; position: fixed; inset: 0; z-index: 45; border: 0; background: rgb(26 27 28 / 65%); }
  .palette-wrap { padding: 0; }
  .palette { width: 100%; border-radius: 0 0 12px 12px; }
  .searchbox.big .btn { padding: 8px 12px; }
  h1 { font-size: 1.5rem; }
  .card-page .prose, .editor .prose { padding: 4px 14px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* piece 2: tables, tiles, tabs, switch, share dialog, danger button */
.btn.danger { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.row.between { justify-content: space-between; }
.row.end, td.end, .end > .row { justify-content: flex-end; }
td.end { text-align: right; }
.table-wrap { overflow-x: auto; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; }
.panel .table-wrap { border: 0; border-radius: 0; margin: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-weight: 600; color: var(--muted); font-size: .8rem; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.off td { opacity: .6; }
.table select { min-height: 34px; padding: 4px 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.tile p { margin: 0; }
.tile-n { font: 600 1.7rem var(--head); }
.tile-l { font-size: .85rem; color: var(--muted); }
.tile-note { font-size: .78rem; }
.tabs { display: flex; flex-wrap: wrap; gap: 20px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--muted); font: 400 14px var(--font); padding: 10px 0; min-height: 40px; cursor: pointer; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
.questions { display: grid; gap: 12px; }
.questions .question { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.question p { margin: 0 0 6px; }
.question .actions { margin: 8px 0 0; }
.switch { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.switch input { appearance: none; width: 40px; height: 22px; min-height: 0; padding: 0; border-radius: 999px; background: var(--none-bg); border: 1px solid var(--line); position: relative; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / 35%); transition: transform .15s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(18px); }
.share-dialog h3 { font-size: 1rem; margin: 18px 0 8px; }
.share-links li { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dialog { max-height: 86vh; overflow-y: auto; }
@media (prefers-reduced-motion: reduce) { .switch input, .switch input::after { transition: none; } }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }

/* ask an expert, notifications, expert groups */
.expert-form { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin: 8px 0; max-width: 520px; }
.expert-form .hint { margin: -6px 0 12px 26px; }
.answer-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.q-answer { border-left: 3px solid var(--ok); padding-left: 12px; margin: 8px 0; }
.question.with-action { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.question.with-action .btn { flex: none; }
.member-pick { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; max-height: 260px; overflow-y: auto; }
.member-pick legend { font-weight: 600; font-size: .9rem; padding: 0 6px; }
.member-pick .check { margin-bottom: 6px; }
.bell { position: relative; }
.bell .theme-btn { position: relative; }
.bell-count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font: 600 .7rem/18px var(--font); text-align: center; }
.bell-list { width: 340px; max-width: calc(100vw - 24px); max-height: 70vh; overflow-y: auto; padding: 0; }
.bell-empty { padding: 14px; margin: 0; }
.bell-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: .88rem; overflow-wrap: anywhere; }
.bell-item:hover { background: var(--surface-2); }
.bell-item.unread { border-left: 3px solid var(--text); }
.bell-item .muted { font-size: .78rem; }
@media (max-width: 640px) { .bell-list { position: fixed; left: 12px; right: 12px; top: 56px; width: auto; max-width: none; } }

/* card pop-up sheet (js/sheet.js): large white sheet over the page, URL is #/card/<id> */
html.sheet-open { overflow: hidden; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 55; background: rgb(26 27 28 / 65%); }
.sheet { position: absolute; top: 40px; bottom: 16px; left: 0; right: 0; width: min(1296px, calc(100% - 144px)); margin: 0 auto; overflow-y: auto; overscroll-behavior: contain; background: var(--surface); color: var(--text); border-radius: 12px; box-shadow: var(--shadow); outline: none; }
.sheet > .muted, .sheet > .form-error { padding: 24px; margin: 0; }
.sheet-bar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); border-radius: 12px 12px 0 0; }
.sheet-state { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.sheet-who { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.sheet-actions { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.close-btn { padding: 4px 10px; }
.in-sheet > :not(.sheet-bar) { max-width: 734px; margin-left: auto; margin-right: auto; width: 100%; }
.in-sheet > .card-head { padding-top: 32px; }
.in-sheet > :last-child { margin-bottom: 40px; }
.in-sheet .prose { border: 0; border-radius: 0; background: none; padding: 0; }
.in-sheet > .panel { margin-top: 16px; }
@media (max-width: 1000px) { .sheet { width: calc(100% - 48px); } }
@media (max-width: 640px) {
  .sheet-backdrop { background: var(--surface); }
  .sheet { top: 0; bottom: 0; width: 100%; border-radius: 0; box-shadow: none; }
  .sheet-bar { border-radius: 0; padding: 8px 56px 8px 12px; }
  .close-btn { position: absolute; top: 8px; right: 12px; }
  .in-sheet > :not(.sheet-bar) { padding-left: 16px; padding-right: 16px; }
  .in-sheet > .panel { width: calc(100% - 32px); padding-left: 14px; padding-right: 14px; }
}

/* "+" after a video link inside text: opens the player under the paragraph */
.watch-btn { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin: 0 2px 0 6px; padding: 0; vertical-align: text-bottom; font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 4px; cursor: pointer; }
.watch-btn:hover { border-color: var(--text); }
.watch-btn[aria-expanded="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
li > .watch-embed, td > .watch-embed { margin: 8px 0; }
