:root {
  --black: #080808;
  --header: #0A0A0A;
  --panel: #171717;
  --panel-2: #121212;
  --border: #292929;
  --border-2: #393939;
  --lime: #DFFF00;
  --white: #FFFFFF;
  --grey: #C7C7C7;
  --muted: #8a8a8a;
  --red: #EC0B19;
  --amber: #FEB808;
  --green: #00A250;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --accent: #DFFF00; --accent-soft: rgba(223,255,0,.09); --accent-line: rgba(223,255,0,.38); --accent-ring: rgba(223,255,0,.14);
  --text: #e3e3e3; --amber-text: #FEB808; --err: #ff8a8a; --offline-bg: #3a2a00;
  --btn-edge: transparent;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --black: #eef0e8; --header: #ffffff; --panel: #ffffff; --panel-2: #f5f6f1; --border: #dcded3; --border-2: #c4c7b8;
  --white: #0d0d0d; --grey: #373a33; --muted: #666960;
  --accent: #4a5f00; --accent-soft: rgba(74,95,0,.09); --accent-line: rgba(74,95,0,.42); --accent-ring: rgba(74,95,0,.2);
  --text: #23251f; --amber-text: #86570a; --err: #b3202a; --offline-bg: #fff0c2;
  --btn-edge: rgba(0,0,0,.18);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--black); }
body { height: 100vh; height: 100dvh; }
body {
  background: var(--black); color: var(--grey);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px; line-height: 1.45; display: flex; flex-direction: column;
  overscroll-behavior: none; touch-action: manipulation; -webkit-font-smoothing: antialiased;
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }

/* header */
.top {
  background: var(--header); border-bottom: 1px solid var(--border);
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px; display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.wordmark { font-weight: 900; color: var(--white); letter-spacing: .02em; font-size: 20px; line-height: 1; }
.wordmark small { display: block; font-size: 7.5px; letter-spacing: .32em; font-weight: 800; margin-top: 3px; color: var(--white); }
.dots { display: flex; flex-direction: column; gap: 2px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.dots i:nth-child(1) { background: var(--red); } .dots i:nth-child(2) { background: var(--amber); } .dots i:nth-child(3) { background: var(--green); }
.go { background: var(--lime); color: #000; font-weight: 900; font-size: 15px; padding: 3px 9px; border-radius: 6px; letter-spacing: .04em; }
.sos {
  min-height: 44px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; background: var(--red); color: #fff;
  font-weight: 800; font-size: 14px; padding: 9px 12px; border-radius: 10px; white-space: nowrap;
}
.sos svg { width: 16px; height: 16px; }

/* chat area */
main { flex: 1; overflow-y: auto; padding: 18px 14px 8px; scroll-behavior: smooth; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.wrap { max-width: 720px; margin: 0 auto; }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.hero h1 { color: var(--white); font-size: 34px; line-height: 1.05; margin: 8px 0 10px; font-weight: 900; letter-spacing: -.01em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { margin: 0 0 18px; }
.chips { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 18px; }
.chip {
  text-align: left; background: var(--panel); border: 1px solid var(--border-2); border-radius: 14px; padding: 14px 16px;
  color: var(--white); font-weight: 600;
}
.chip:active { border-color: var(--accent); }
.note { font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 12px; margin-top: 10px; }

.msg { margin: 14px 0; display: flex; }
.msg.user { justify-content: flex-end; }
.bubble { max-width: 88%; border-radius: 18px; padding: 12px 15px; word-wrap: break-word; }
.user .bubble { background: var(--lime); color: #000; font-weight: 600; border-bottom-right-radius: 6px; }
.bot .bubble { background: var(--panel); border: 1px solid var(--border-2); border-bottom-left-radius: 6px; max-width: 94%; color: var(--text); }
.bubble p { margin: 0 0 8px; } .bubble p:last-child { margin-bottom: 0; }
.bubble ul { margin: 6px 0 4px; padding-left: 20px; } .bubble li { margin: 4px 0; }
.src { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border-2); font-size: 13px; color: var(--muted); }
.src b { color: var(--grey); font-weight: 700; }
.warn {
  margin-top: 10px; background: rgba(254,184,8,.1); border: 1px solid var(--amber); color: var(--amber-text);
  border-radius: 12px; padding: 10px 12px; font-size: 14px; font-weight: 600;
}
.warn a { color: var(--amber-text); }
.fb { display: flex; gap: 8px; margin-top: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.fb button { background: none; border: 1px solid var(--border-2); border-radius: 999px; padding: 9px 18px; min-height: 40px; color: var(--grey); }
.fb button[disabled] { opacity: .5; } .fb button.sel { border-color: var(--accent); color: var(--accent); }
.typing { display: inline-flex; gap: 5px; padding: 4px 2px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); opacity: .3; animation: p 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes p { 50% { opacity: 1; transform: translateY(-3px); } }
.err { color: var(--err); }

/* composer */
.composer { background: var(--header); border-top: 1px solid var(--border); padding: 10px 12px; }
.composer .wrap { display: flex; gap: 8px; align-items: flex-end; }
textarea {
  flex: 1; resize: none; background: var(--panel); border: 1px solid var(--border-2); color: var(--white); border-radius: 16px;
  padding: 13px 15px; font: inherit; max-height: 130px; outline: none; line-height: 1.3;
}
textarea:focus { border-color: var(--accent); }
.icon-btn {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--border-2); background: var(--panel);
  display: grid; place-items: center; flex: none;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.send { background: var(--lime); border-color: var(--accent); color: #000; }
.icon-btn.rec { background: var(--red); border-color: var(--red); color: #fff; }
.icon-btn[disabled] { opacity: .45; }
.mic[hidden] { display: none; }

/* dialogs */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.8); display: grid; place-items: center; padding: 20px; z-index: 10; }
.overlay[hidden] { display: none; }
.card { background: var(--panel); border: 1px solid var(--border-2); border-radius: 20px; padding: 22px; width: 100%; max-width: 380px; }
.card h2 { color: var(--white); margin: 6px 0 8px; font-size: 24px; line-height: 1.1; }
.card input { width: 100%; background: var(--black); border: 1px solid var(--border-2); border-radius: 12px; padding: 14px; color: var(--white); font: inherit; margin: 10px 0; outline: none; }
.card input:focus { border-color: var(--accent); }
.btn { display: block; width: 100%; background: var(--lime); color: #000; font-weight: 800; border: 1px solid var(--btn-edge); border-radius: 12px; padding: 14px; }
.btn.ghost { background: none; color: var(--accent); border: 1px solid var(--accent); margin-top: 8px; }
.demo { background: var(--amber); color: #000; text-align: center; font-size: 12px; font-weight: 800; padding: 4px; letter-spacing: .06em; }
.demo[hidden] { display: none; }
.toolbar { display: flex; justify-content: flex-end; }
.link { background: none; border: 0; color: var(--muted); font-size: 14px; text-decoration: underline; padding: 12px 0; min-height: 44px; }

/* layout for tabbed views */
.brand { text-decoration: none; }
.views { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view[hidden] { display: none; }
.view.scroll[hidden] { display: none; }
.view.scroll { display: block; overflow-y: auto; padding: 18px 14px 28px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.tabs { display: flex; background: var(--header); border-top: 1px solid var(--border); padding-bottom: var(--safe-bottom); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 58px; padding: 7px 2px 6px; color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.tabs a svg { width: 24px; height: 24px; }
.tabs a.on { color: var(--accent); }

/* content pages */
.pagehead h1 { color: var(--white); font-size: 30px; line-height: 1.1; margin: 6px 0 8px; font-weight: 900; letter-spacing: -.01em; }
.pagehead p { margin: 0 0 14px; }
h2 { color: var(--white); font-size: 18px; margin: 24px 0 10px; }
.back { background: none; border: 0; color: var(--accent); font-weight: 700; padding: 10px 14px 10px 0; margin-bottom: 4px; min-height: 44px; font-size: 16px; }
.muted { color: var(--muted); } .pad { padding: 8px 2px; }
.body { color: var(--text); margin: 0 0 12px; }
ul.body { padding-left: 22px; } ul.body li { margin: 6px 0; }
.search { width: 100%; background: var(--panel); border: 1px solid var(--border-2); border-radius: 14px; padding: 14px 16px; color: var(--white); font: inherit; outline: none; margin: 4px 0 6px; }
.search:focus { border-color: var(--accent); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--panel); border: 1px solid var(--border-2); border-radius: 16px; padding: 14px; text-decoration: none; display: flex; flex-direction: column; gap: 6px; min-height: 104px; }
.tile b { color: var(--white); font-size: 16px; line-height: 1.15; }
.tile span { color: var(--muted); font-size: 13px; line-height: 1.3; }
.tile:active, .rowitem:active { border-color: var(--accent); }
.list { display: flex; flex-direction: column; gap: 8px; }
.rowitem { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px 15px; text-decoration: none; color: var(--grey); }
.rowitem.col { flex-direction: column; align-items: flex-start; gap: 4px; }
.rowtext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.rowtext b { color: var(--white); font-size: 16px; }
.rowtext span { color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rowitem.col b { color: var(--white); } .rowitem.col span { color: var(--muted); font-size: 13.5px; }
.chev { color: var(--accent); font-size: 26px; line-height: 1; }
.sectiontext { background: var(--panel); border: 1px solid var(--border-2); border-radius: 16px; padding: 16px; margin: 6px 0 14px; color: var(--text); }
.sectiontext p { margin: 0 0 10px; } .sectiontext p:last-child { margin: 0; }
.linkbtn { text-decoration: none; text-align: center; margin: 8px 0; }
.btn.small { width: auto; display: inline-block; padding: 9px 14px; margin-top: 10px; }
.sosbtn { background: var(--red); color: #fff; text-decoration: none; text-align: center; margin: 18px 0 6px; }
details.qa { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 0 15px; margin-bottom: 8px; }
details.qa summary { cursor: pointer; padding: 14px 0; color: var(--white); font-weight: 700; list-style: none; display: flex; flex-direction: column; gap: 3px; }
details.qa summary::-webkit-details-marker { display: none; }
details.qa[open] { border-color: var(--border-2); }
details.qa > p { margin: 0 0 14px; color: var(--text); }
details.hist .when { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.histans { padding-bottom: 6px; color: var(--text); } .histans p { margin: 0 0 8px; } .histans ul { margin: 4px 0; padding-left: 20px; }
details.hist .src { margin: 6px 0 0; padding-top: 8px; border-top: 1px solid var(--border-2); }
details.hist .btn { margin-bottom: 14px; }
.tagrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.tag { background: var(--panel); border: 1px solid var(--border-2); border-radius: 999px; padding: 5px 11px; font-size: 13px; color: var(--accent); font-weight: 700; }

/* ---- document picker bar (above the composer) ---- */
.composer { display: flex; flex-direction: column; gap: 8px; }
.scopewrap { display: block !important; }
.scopebar {
  width: 100%; display: flex; align-items: center; gap: 8px; background: var(--panel-2); border: 1px solid var(--border-2);
  border-radius: 12px; padding: 9px 12px; color: var(--grey); text-align: left; font-size: 14px;
}
.scopebar svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
.scopelabel { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--white); }
.scopechange { color: var(--accent); font-weight: 800; font-size: 13px; }
.scopebar.on { border-color: var(--accent); }

/* bottom sheet */
.sheetbg { align-items: end; padding: 0; }
.sheet { background: var(--panel); border: 1px solid var(--border-2); border-radius: 22px 22px 0 0; width: 100%; max-width: 720px; max-height: 88vh; max-height: 88dvh; display: flex; flex-direction: column; margin: 0 auto; }
.sheethead { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 18px 6px; }
.sheethead h2 { margin: 4px 0 0; }
.sheetbody { overflow-y: auto; padding: 6px 14px 10px; display: flex; flex-direction: column; gap: 8px; }
.sheetfoot { padding: 10px 14px calc(14px + var(--safe-bottom)); border-top: 1px solid var(--border); }
.grouphead { color: var(--muted); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; margin: 14px 2px 6px; }
h3.grouphead { margin-top: 20px; }
.pick { display: flex; gap: 12px; align-items: center; text-align: left; background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 14px; padding: 12px 14px; width: 100%; }
.pick .tick { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--border-2); flex: none; display: grid; place-items: center; }
.pick.all .tick { border-radius: 50%; }
.pick.on { border-color: var(--accent); background: var(--accent-soft); }
.pick.on .tick { background: var(--lime); border-color: var(--accent); }
.pick.on .tick::after { content: ''; width: 6px; height: 11px; border: solid #000; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.ptxt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ptxt b { color: var(--white); font-size: 16px; }
.ptxt span { color: var(--muted); font-size: 13px; }
.ptxt b .badge { margin-left: 8px; }

.badge { display: inline-block; font-size: 10.5px; font-weight: 900; letter-spacing: .08em; padding: 2px 7px; border-radius: 6px; vertical-align: middle; }
.badge.draft { background: var(--amber); color: #000; }
.draftnote { background: rgba(254,184,8,.1); border: 1px solid var(--amber); color: var(--amber-text); border-radius: 12px; padding: 10px 12px; font-size: 14px; font-weight: 600; margin: 0 0 12px; }

/* source cards in answers */
.refs { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border-2); display: flex; flex-direction: column; gap: 8px; }
.refshead { font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.refcard { display: block; text-decoration: none; background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 12px; padding: 10px 12px; color: var(--grey); }
.refcard:active { border-color: var(--accent); }
.reftop { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reftop b { color: var(--white); font-size: 15px; }
.pg { background: var(--lime); color: #000; font-weight: 900; font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.refhead { color: var(--grey); font-size: 13.5px; font-weight: 600; margin-top: 3px; }
.refsnip { color: var(--muted); font-size: 13px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.refgo { color: var(--accent); font-weight: 800; font-size: 13px; margin-top: 6px; }
details.hist .refs { border-top: 1px solid var(--border-2); margin: 6px 0 10px; }

/* library cards */
.doccard { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.dochead { text-decoration: none; display: flex; flex-direction: column; gap: 4px; }
.doctitle { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doctitle b { color: var(--white); font-size: 17px; }
.docblurb { color: var(--grey); font-size: 14px; }
.docmeta { color: var(--muted); font-size: 12.5px; }
.docbtns { display: flex; gap: 8px; }
.docbtns .btn.small { margin-top: 0; flex: 1; text-align: center; text-decoration: none; }
.docbtns.big { flex-direction: column; margin-bottom: 12px; }
.docbtns.big .btn { text-align: center; text-decoration: none; margin: 0; }
.jump { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; }
.jump label { color: var(--muted); font-size: 14px; }
.jump input { width: 110px; background: var(--panel); border: 1px solid var(--border-2); border-radius: 10px; padding: 10px; color: var(--white); font: inherit; }
.jump .btn.small { margin: 0; }

/* viewer */
.vhead h1 { color: var(--white); font-size: 26px; line-height: 1.1; margin: 4px 0 10px; font-weight: 900; }
.vhead h1 .badge { margin-left: 10px; font-size: 12px; }
.vbar { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.vbar2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 0 10px; }
.pglabel { flex: 1; text-align: center; color: var(--white); font-weight: 800; }
.navbtn { width: 48px; height: 44px; background: var(--panel); border: 1px solid var(--border-2); border-radius: 12px; color: var(--accent); font-size: 26px; line-height: 1; font-weight: 700; }
.navbtn[disabled] { opacity: .35; }
.jumpin { width: 76px; background: var(--panel); border: 1px solid var(--border-2); border-radius: 12px; padding: 11px 8px; color: var(--white); font: inherit; text-align: center; }
.segs { display: inline-flex; background: var(--panel); border: 1px solid var(--border-2); border-radius: 12px; overflow: hidden; }
.seg { background: none; border: 0; padding: 9px 18px; font-weight: 800; color: var(--grey); }
.seg.on { background: var(--lime); color: #000; }
.zoombar { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.zoombar[hidden] { display: none; }
.zoombar .navbtn { width: 40px; height: 38px; font-size: 22px; }
.stage { background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; min-height: 200px; overflow: auto; -webkit-overflow-scrolling: touch; }
.canvaswrap { background: #fff; width: max-content; min-width: 100%; }
.pdfcanvas { display: block; }
.pagetext { padding: 14px 16px; color: var(--text); font-size: 16px; }
.pagetext p { margin: 0 0 10px; white-space: pre-line; }
.pagenote { color: var(--amber-text); font-size: 13.5px; font-weight: 600; }
.vactions { margin-top: 14px; }
.vactions .btn { margin-top: 8px; }
.bottomnav { flex: 1; }
.composer .wrap { width: 100%; }
.docbtns .btn { display: flex; align-items: center; justify-content: center; line-height: 1.15; }
.docbtns .btn.small { padding: 11px 10px; }

/* field tools view */
.view.tools { padding: 0; }
.view.tools[hidden] { display: none; }
#toolsFrame { flex: 1; width: 100%; min-height: 0; border: 0; background: #080808; display: block; }
.tabs a { min-width: 0; }
.tabs a span, .tabs a { font-size: 11px; }

/* ---------- mobile polish ---------- */
.top { position: relative; z-index: 5; padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
.btn, .chip, .rowitem, .tile, .pick, .seg, .scopebar { min-height: 48px; }
.search, .jumpin, .jump input, .card input, textarea, .homeq { font-size: 16px; }
.hero h1 { font-size: clamp(28px, 8.4vw, 36px); }
.pagehead h1 { font-size: clamp(25px, 7.4vw, 32px); }
.offline { background: var(--offline-bg); color: var(--amber-text); font-size: 13px; font-weight: 700; text-align: center; padding: 7px 12px; }
.offline[hidden] { display: none; }
.rowitem { text-align: left; width: 100%; font: inherit; }
button.rowitem { cursor: pointer; }
body.kb .tabs { display: none; }
body.kb .composer { padding-bottom: 10px; }
.composer { padding-bottom: calc(10px + 0px); }
.refcard, .doccard .btn { min-height: 48px; }
.stage { touch-action: pan-x pan-y pinch-zoom; overscroll-behavior: contain; }
.vbar, .vbar2 { flex-wrap: wrap; }
.view.tools { overscroll-behavior: contain; }

/* ---------- Home ---------- */
#page.home { padding-top: 6px; }
.homehead { padding: 8px 2px 14px; }
.homedate { color: var(--muted); font-size: 14px; font-weight: 600; letter-spacing: .02em; }
.homehead h1 { color: var(--white); font-size: clamp(34px, 10.5vw, 44px); line-height: 1.02; margin: 4px 0 0; font-weight: 900; letter-spacing: -.02em; }
.homehead .dot { color: var(--accent); }
.askbar { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1.5px solid var(--border-2); border-radius: 20px; padding: 7px 7px 7px 18px; box-shadow: 0 0 0 0 rgba(223,255,0,0); transition: border-color .15s, box-shadow .15s; }
.askbar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.homeq { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--white); padding: 12px 0; font: inherit; font-size: 17px; }
.homeq::placeholder { color: var(--muted); }
.resume { display: flex; align-items: center; gap: 12px; margin-top: 12px; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 16px; padding: 12px 14px; text-decoration: none; color: var(--grey); min-height: 60px; }
.resume .rowtext b { color: var(--white); font-size: 15px; }
.resume .rowtext span { -webkit-line-clamp: 1; }
.resumeicon { width: 36px; height: 36px; border-radius: 50%; background: var(--lime); color: #000; display: grid; place-items: center; flex: none; }
.resumeicon svg { width: 17px; height: 17px; }
.sectionhead { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 10px; }
.sectionhead h2 { margin: 0; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.sectionhead a { color: var(--accent); font-weight: 800; font-size: 14px; text-decoration: none; padding: 8px 0 8px 12px; }
.qgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.qtile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; text-align: center; text-decoration: none; background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 14px 6px 12px; min-height: 100px; }
.qtile:active { border-color: var(--accent); background: var(--panel-2); transform: scale(.98); }
.qtile b { color: var(--white); font-size: 13.5px; line-height: 1.15; font-weight: 700; }
.qicon { width: 44px; height: 44px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.qicon svg { width: 24px; height: 24px; }
.qtile.more { background: none; border-style: dashed; border-color: var(--border-2); }
.qtile.more .qicon { background: none; color: var(--grey); }
.docscroll { display: flex; gap: 10px; overflow-x: auto; margin: 0 -14px; padding: 2px 14px 8px; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.docscroll::-webkit-scrollbar { display: none; }
.doccardmini { flex: none; scroll-snap-align: start; width: 148px; min-height: 84px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 13px; text-decoration: none; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }
.doccardmini:active { border-color: var(--accent); }
.doccardmini b { color: var(--white); font-size: 15px; line-height: 1.15; }
.docpub { color: var(--muted); font-size: 12px; }
.doccardmini .badge { align-self: flex-start; }
.rowitem.sug { cursor: pointer; }
.rowitem.sug b { font-weight: 600; line-height: 1.3; }
.emerg { margin-top: 26px; display: flex; flex-direction: column; gap: 12px; background: linear-gradient(180deg, rgba(236,11,25,.14), rgba(236,11,25,.06)); border: 1px solid rgba(236,11,25,.55); border-radius: 18px; padding: 16px; }
.emergtext b { display: block; color: var(--white); font-size: 17px; }
.emergtext span { color: var(--grey); font-size: 14px; }
.emergbtn { display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--red); color: #fff; text-decoration: none; font-weight: 900; font-size: 18px; border-radius: 14px; min-height: 54px; letter-spacing: .01em; }
.emergbtn svg { width: 20px; height: 20px; }
.installcard { position: relative; margin-top: 14px; display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--border-2); border-radius: 16px; padding: 14px 40px 14px 14px; }
.installcard[hidden] { display: none; }
.installcard .rowtext b { color: var(--white); font-size: 15px; }
.installcard .btn.small { margin: 0; flex: none; min-height: 44px; }
.xbtn { position: absolute; top: 2px; right: 2px; width: 40px; height: 40px; background: none; border: 0; color: var(--muted); font-size: 24px; line-height: 1; }

/* small phones */
@media (max-width: 370px) {
  body { font-size: 16px; }
  .wordmark { font-size: 18px; } .go { font-size: 13px; padding: 3px 7px; }
  .sos { padding: 9px 10px; font-size: 13px; }
  .qgrid { gap: 8px; } .qtile b { font-size: 12.5px; }
  .tabs a { font-size: 10.5px; }
  .doccardmini { width: 136px; }
}
/* landscape phones: reclaim vertical space */
@media (max-height: 480px) and (orientation: landscape) {
  .top { padding-top: calc(4px + env(safe-area-inset-top, 0px)); padding-bottom: 4px; }
  .tabs a { min-height: 44px; flex-direction: row; justify-content: center; gap: 6px; }
  .tabs a svg { width: 20px; height: 20px; }
  .composer { padding: 6px 12px; }
  .scopebar { display: none; }
}
@media (min-width: 720px) {
  .qgrid { grid-template-columns: repeat(3, 1fr); }
  .view.scroll > .wrap { max-width: 640px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
.brand { min-height: 44px; }
.sectionhead a { min-height: 44px; display: inline-flex; align-items: center; margin: -10px 0; }
.docscroll { scroll-padding-left: 14px; }
.docpub { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

/* theme toggle */
.themebtn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border-2); background: var(--panel); color: var(--white); display: grid; place-items: center; flex: none; }
.themebtn svg { width: 22px; height: 22px; }
.homehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.segbar { display: flex; background: var(--panel); border: 1px solid var(--border-2); border-radius: 14px; padding: 4px; gap: 4px; }
.segbar button { flex: 1; min-height: 46px; border: 0; border-radius: 10px; background: none; color: var(--grey); font-weight: 800; }
.segbar button.on { background: var(--lime); color: #000; }
:root[data-theme="light"] .bot .bubble, :root[data-theme="light"] .bubble { box-shadow: 0 1px 2px rgba(0,0,0,.05); }
:root[data-theme="light"] .qtile, :root[data-theme="light"] .rowitem, :root[data-theme="light"] .doccard, :root[data-theme="light"] .doccardmini { box-shadow: 0 1px 2px rgba(0,0,0,.05); }
