/* LSY AI Portal — visual system v2 (navy sidebar, slate text, restrained teal actions).
   Design reference: lsy-ai-portal-v2 prototype. No external fonts or assets; the CSP forbids
   inline style, so every visual rule lives here. Legacy class names used by screens not yet
   redesigned are kept and restyled at the end of the file. */
:root {
  --ink: #19283e; --muted: #65748a; --soft: #78869b; --line: #e1e6ee; --bg: #f4f6fa;
  --card: #fff; --panel: #fbfcfe; --teal: #176c68; --teal-dark: #125956; --teal-bright: #69c4b2;
  --wash: #eaf5f2; --side: #142338; --side-hover: #223750; --side-active: #2a4059;
  --ok-bg: #eaf5ef; --ok-ink: #2f6d55; --warn-bg: #fcf2df; --warn-ink: #885923;
  --bad-bg: #faebe8; --bad-ink: #a13431; --gray-bg: #eef2f7; --gray-ink: #67768b;
  --focus: #2f9a88; --shadow: 0 20px 70px #13263d21; --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
          "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.6 var(--font); letter-spacing: -.12px; color: var(--ink);
       background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--teal); }
img { max-width: 100%; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 16px; letter-spacing: -.6px; font-weight: 650; }
h2 { font-size: 1.05rem; margin: 20px 0 10px; font-weight: 620; }
h2:first-child { margin-top: 0; }
h3 { font-size: .95rem; margin: 16px 0 6px; font-weight: 620; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
           clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skiplink { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink);
            color: #fff; padding: 10px 14px; border-radius: 8px; text-decoration: none; }
.skiplink:focus { top: 12px; }
[hidden] { display: none !important; }

/* ── shell ─────────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.workspace { min-width: 0; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side);
        color: #e9eef7; padding: 30px 16px 22px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 13px; padding: 0 10px 32px; text-decoration: none; color: inherit; }
.mark { width: 40px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex: none;
        font: 700 22px/1 var(--font); background: #f7fafc; color: #18374b; box-shadow: 0 4px 12px #0002; }
.brandtext strong { display: block; font-size: 20px; letter-spacing: 2px; line-height: 1.1; }
.brandtext small { display: block; color: #a5b5ca; font-size: 9px; letter-spacing: 1.2px;
                   text-transform: uppercase; margin-top: 4px; }
.eyebrow { font-size: 10px; font-weight: 650; letter-spacing: 1.3px; color: #6f8198;
           text-transform: uppercase; margin: 0; }
.side .eyebrow { color: #8093ae; font-size: 9px; letter-spacing: 1.4px; }
.navlabel { padding: 14px 14px 10px; }
.navlist { list-style: none; margin: 0; padding: 0; }
.nav { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 14px; margin: 3px 0;
       border-radius: 8px; color: #b9c7d9; text-decoration: none; font-size: 13px; }
.nav:hover { background: var(--side-hover); color: #fff; }
.nav.active { background: var(--side-active); color: #fff; font-weight: 600; box-shadow: inset 3px 0 var(--teal-bright); }
.nav:focus-visible, .sidebtn:focus-visible, .subnav a:focus-visible, .personmeta a:focus-visible { outline-color: var(--teal-bright); }
.icon { width: 18px; height: 18px; flex: none; }
.subnav { list-style: none; margin: 0 0 6px 44px; padding: 0; }
.subnav a { display: block; color: #9fb0c6; font-size: 12px; text-decoration: none; padding: 5px 8px; border-radius: 6px; }
.subnav a:hover, .subnav a[aria-current] { color: #fff; background: var(--side-hover); }
.sidebottom { margin-top: auto; }
.private { color: #92a5bc; font-size: 11px; line-height: 1.8; padding: 20px 12px; margin: 0; }
.private strong { display: block; color: #c7d7e8; font-weight: 550; margin-bottom: 2px; }
.person { display: flex; align-items: center; gap: 10px; padding: 18px 12px 8px; border-top: 1px solid #ffffff16; }
.avatar { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex: none;
          font-size: 11px; font-weight: 700; background: #2b4660; color: #d9edf0; }
.personmeta { min-width: 0; }
.personmeta a { color: #fff; font-size: 12px; font-weight: 600; text-decoration: none; display: block;
                overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.personmeta small { display: block; color: #92a5bc; font-size: 11px; }
.signout { padding: 0 12px; }
.sidebtn { background: none; border: 1px solid #ffffff22; color: #c7d7e8; font: 600 12px var(--font);
           border-radius: 7px; padding: 6px 12px; cursor: pointer; margin-top: 6px; }
.sidebtn:hover { background: var(--side-hover); color: #fff; }

.top { height: 72px; display: flex; align-items: center; gap: 14px; padding: 0 44px;
       background: #ffffffeb; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.breadcrumb { margin: 0; color: #738197; font-size: 12px; display: flex; gap: 10px; align-items: center; min-width: 0; }
.breadcrumb strong { color: var(--ink); }
.breadcrumb .sep { color: #b7beb5; }
.topright { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.envtag { background: #f3f6fa; color: #64748b; border: 1px solid #e1e7ef; border-radius: 5px;
          padding: 4px 9px; font-size: 10px; letter-spacing: .6px; text-transform: uppercase; white-space: nowrap; }
.mobilemenu { display: none; background: #fff; color: var(--ink); border: 1px solid var(--line);
              border-radius: 8px; width: 40px; height: 40px; padding: 0; place-items: center; cursor: pointer; }
.scrim { position: fixed; inset: 0; background: #10223c55; z-index: 25; }
.main { max-width: 1360px; margin: 0 auto; padding: 38px 44px 60px; }
.main:focus { outline: none; }
.bare { max-width: 460px; margin: 0 auto; padding: 8vh 16px 48px; }

/* ── page furniture ────────────────────────────────────────────────────── */
.pagehead { margin-bottom: 26px; }
.pagehead h1 { font-size: 31px; margin: 8px 0 10px; letter-spacing: -1px; }
.sub { color: #748096; margin: 0; font-size: 13px; line-height: 1.7; }
.backlink { margin: 0 0 14px; font-size: 12px; }
.backlink a { text-decoration: none; font-weight: 600; }
.fine { font-size: 11px; color: var(--soft); line-height: 1.7; }
.helptext { color: var(--muted); font-size: 12px; line-height: 1.8; margin: 8px 0 0; }
.rowline { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sectiontitle { font-size: 14px; font-weight: 620; margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
        box-shadow: 0 2px 5px #182b4303; padding: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.badge { display: inline-block; padding: 3px 8px; font-size: 10px; line-height: 1.5; border-radius: 5px;
         font-weight: 620; white-space: nowrap; background: var(--ok-bg); color: var(--ok-ink); }
.badge.amber { background: var(--warn-bg); color: var(--warn-ink); }
.badge.gray { background: var(--gray-bg); color: var(--gray-ink); }
.badge.red { background: var(--bad-bg); color: var(--bad-ink); }
.btn, button, .button { font: 600 12px/1.2 var(--font); background: var(--teal); color: #fff;
       border: 1px solid var(--teal); border-radius: 7px; padding: 11px 17px; min-height: 40px;
       display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
       text-decoration: none; box-shadow: 0 2px 3px #183b3810; }
.btn:hover, button:hover, .button:hover { background: var(--teal-dark); }
button:disabled { opacity: .55; cursor: progress; }
.btn.secondary, button.secondary { background: #fff; color: var(--ink); border-color: var(--line); box-shadow: none; }
.btn.secondary:hover, button.secondary:hover { background: #f0f4f8; }
button.small, .btn.small { padding: 5px 10px; min-height: 30px; font-size: 11px; }
button.danger { background: var(--bad-ink); border-color: var(--bad-ink); }
.ghost { font-size: 12px; color: var(--teal); font-weight: 620; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; }
.ghost:hover { text-decoration: underline; }
.notice, .error, .warn { padding: 11px 14px; border-radius: 8px; font-size: 13px; line-height: 1.65; margin: 0 0 16px; border: 1px solid transparent; }
.notice { background: var(--ok-bg); color: var(--ok-ink); border-color: #cfe6da; }
.warn { background: #fcf6e9; color: #775524; border-color: #f0e3c8; }
.error { background: var(--bad-bg); color: var(--bad-ink); border-color: #f1d2cc; }
ul.error { padding-left: 32px; }
.statecard { max-width: 620px; margin: 6vh auto; padding: 30px; }
.statecard h1 { margin-top: 8px; }
.emptycard { background: #fff; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 18px; color: var(--muted); font-size: 12px; }

/* ── forms ─────────────────────────────────────────────────────────────── */
label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; }
label.check, .switchlabel { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
input, select, textarea { font: inherit; color: var(--ink); padding: 8px 10px; border: 1px solid var(--line);
                          border-radius: 7px; background: #fff; max-width: 100%; }
input[type=checkbox], input[type=radio] { accent-color: var(--teal); width: 16px; height: 16px; }
textarea { min-height: 90px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
legend { font-weight: 620; font-size: 13px; padding: 0 4px; }
.field { min-width: 0; }
.field label, .field .label { display: block; font-size: 9px; letter-spacing: .65px; font-weight: 650; color: #78869a;
                              text-transform: uppercase; margin: 0 0 7px; }
.field select, .field input { width: 100%; font-size: 12px; padding: 7px 9px; }
.field .static { margin: 0; font-size: 12px; font-weight: 600; color: #32465f; padding: 7px 0; }
progress { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border: 0; border-radius: 6px;
           background: #edf1f6; overflow: hidden; display: block; margin: 16px 0 10px; }
progress::-webkit-progress-bar { background: #edf1f6; border-radius: 6px; }
progress::-webkit-progress-value { background: #378e81; border-radius: 6px; }
progress::-moz-progress-bar { background: #378e81; border-radius: 6px; }
progress.over::-webkit-progress-value { background: var(--bad-ink); }
progress.over::-moz-progress-bar { background: var(--bad-ink); }

/* ── Ask AI ────────────────────────────────────────────────────────────── */
.welcome { display: grid; grid-template-columns: minmax(0, 1fr) 256px; gap: 24px; align-items: start; }
.compose { padding: 0; overflow: hidden; box-shadow: 0 5px 18px #17283f08; }
.context { display: grid; grid-template-columns: 1.3fr 1fr .8fr .9fr; gap: 14px; padding: 18px 22px;
           background: var(--panel); border-bottom: 1px solid var(--line); }
.compose textarea { display: block; width: calc(100% - 44px); margin: 0 22px; padding: 22px 0; min-height: 168px;
                    border: 0; border-radius: 0; resize: vertical; font-size: 16px; line-height: 1.6; background: transparent; }
.compose textarea:focus-visible { outline-offset: 0; }
.compose textarea::placeholder { color: #93a0b1; }
.composefoot { display: flex; justify-content: space-between; align-items: center; gap: 15px; flex-wrap: wrap;
               margin: 0 22px; padding: 16px 0; border-top: 1px solid #edf0f4; }
.composefoot .fine { display: block; padding-left: 24px; }
.busy { margin: 0 22px 18px; padding: 10px 12px; border-radius: 8px; background: var(--wash); color: #245e57; font-size: 12px; }
.busy::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%;
                border: 2px solid #9fcfc5; border-top-color: var(--teal); vertical-align: -1px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.contextnote { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--soft); padding: 12px 2px 4px; }
.contextnote .check::before { content: "✓"; color: #238776; margin-right: 6px; font-weight: 700; }
.guidance { margin: 6px 2px 0; }
.recent { margin-top: 28px; }
.recentlist { list-style: none; margin: 10px 0 0; padding: 0; }
.recentitem { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: #fff;
              border: 1px solid var(--line); border-radius: 9px; padding: 13px 16px; margin-top: 8px;
              text-decoration: none; color: var(--ink); font-size: 13px; }
.recentitem:hover { border-color: #a8c9c3; background: #f9fcfc; }
.recentitem .fine { display: block; }
.recentitem .icon { color: var(--teal); }
.askaside { display: flex; flex-direction: column; gap: 16px; }
.asideblock { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: 0 2px 5px #182b4303; }
.asidetitle { font-size: 12px; font-weight: 650; margin: 0 0 12px; }
.budgetfigure { font: 600 30px/1.2 var(--font); letter-spacing: -1px; font-variant-numeric: tabular-nums; margin: 0; }
.budgetfigure span { font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.limitlist { list-style: none; margin: 12px 0 0; padding: 0; font-size: 11px; color: var(--muted); }
.limitlist li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-top: 1px solid #eff2f6; }
.sourceitem { display: block; text-decoration: none; color: var(--ink); font-size: 12px; line-height: 1.6; padding: 10px 0; border-bottom: 1px solid #eff2f6; }
.sourceitem:hover { color: var(--teal); }
.sourceitem small { display: block; font-size: 10px; color: var(--soft); }

/* ── answers and sources ───────────────────────────────────────────────── */
.answer-card { padding: 0; overflow: hidden; margin-bottom: 20px; }
/* anchor targets (#exchange-…, #passage-…) must not hide under the sticky top bar */
[id^="exchange-"], [id^="passage-"], .main [id] { scroll-margin-top: 92px; }
.questionblock { padding: 20px 24px 14px; border-bottom: 1px solid var(--line); }
.questiontext { white-space: pre-wrap; word-break: break-word; font-size: 15px; margin: 6px 0; font-weight: 550; }
.answerbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 13px 24px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.answerbody { padding: 22px 24px 8px; }
.answertext { white-space: pre-wrap; line-height: 1.85; font-size: 13.5px; }
.answertext h3 { font-size: 14px; margin: 14px 0 2px; white-space: normal; }
.answertext.failed { opacity: .85; }
.reference { font-size: 10px; vertical-align: super; line-height: 0; margin-left: 2px; padding: 1px 5px; border-radius: 4px;
             background: #e5f2ee; color: var(--teal); text-decoration: none; font-weight: 650; }
.reference:hover { background: #cfe8e1; }
.claim-bad { background: var(--bad-bg); text-decoration: underline wavy var(--bad-ink); }
.sourcesblock { padding: 6px 24px 16px; }
.sourcelist { list-style: none; padding: 0; margin: 8px 0 0; }
.sourcelist li { padding: 10px 0; border-top: 1px solid #eff2f6; font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.sourcelist small { flex-basis: 100%; color: var(--soft); font-size: 11px; }
.sourcelink { font-weight: 620; text-decoration: none; }
.sourcelink:hover { text-decoration: underline; }
.answerbottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
                padding: 13px 24px; border-top: 1px solid var(--line); background: var(--panel); }
.usagedetails { padding: 0 24px 16px; }
.usagedetails summary { cursor: pointer; font-size: 12px; font-weight: 620; color: var(--teal); padding: 10px 0; }
.disclaimer { padding: 0 24px 18px; margin: 0; }
.overlay { display: none; position: fixed; inset: 0; z-index: 40; background: #10223c55; justify-content: flex-end; }
.overlay:target { display: flex; }
.scrimlink { position: absolute; inset: 0; }
.drawer { position: relative; width: 540px; max-width: 100%; height: 100%; overflow-y: auto; background: #f7f9fc;
          padding: 24px 26px 40px; box-shadow: var(--shadow); }
.drawer h2 { font-size: 22px; line-height: 1.35; letter-spacing: -.5px; margin: 14px 0 8px; }
.close { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line);
         border-radius: 8px; background: #fff; color: var(--ink); font-size: 20px; text-decoration: none; }
.passagequote { margin: 8px 0 14px; padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--teal);
                border-radius: 8px; white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.75; }
.quotes { margin: 6px 0 14px; padding-left: 18px; font-size: 12px; }
.quotes li { margin: 4px 0; }
.quotes mark { background: #fff1c9; padding: 0 2px; }
.paper { background: #e7ecf2; border: 1px solid #dbe2eb; border-radius: 10px; padding: 14px; margin: 10px 0 14px; }
.paper img { display: block; width: 100%; background: #fff; box-shadow: 0 3px 14px #213a5710; }
.followup textarea { width: 100%; }

/* ── knowledge bank ──────────────────────────────────────────────────────── */
.pagehead.rowline { align-items: flex-end; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px 24px; border-bottom: 1px solid var(--line); margin: 0 0 18px; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 0 12px; margin-bottom: -1px; font-size: 12px;
       color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); font-weight: 650; border-bottom-color: var(--teal); }
.tab .count { font-size: 10px; background: var(--gray-bg); color: var(--gray-ink); border-radius: 5px; padding: 0 6px; }
.filters { padding: 16px 18px; margin-bottom: 12px; }
.filtergrid { display: grid; grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)); gap: 12px; }
.filteractions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-top: 14px; }
.resultcount { margin: 4px 2px 12px; }
td small, .doctable small { display: block; color: var(--soft); font-size: 11px; margin-top: 3px; line-height: 1.5; }
.doclink { font-weight: 620; color: var(--ink); text-decoration: none; }
.doclink:hover { color: var(--teal); text-decoration: underline; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; font-size: 12px; margin: 14px 2px; }
.pager a { font-weight: 600; text-decoration: none; }
.docgrid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, 1fr); gap: 20px; align-items: start; }
.stackcol { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.cardhead { padding: 18px 20px 8px; margin: 0; }
.cardfoot { padding: 10px 20px 16px; margin: 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 14px 0 0; }
.reasons { padding-left: 18px; margin: 6px 0 12px; font-size: 13px; }
.reasons li { margin: 3px 0; }
.pagechips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 8px 0; }
.pagechip { display: inline-grid; place-items: center; min-width: 36px; height: 36px; padding: 0 6px; border-radius: 7px;
            border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 12px; text-decoration: none; }
.pagechip:hover { border-color: #a8c9c3; }
.pagechip.warning { background: var(--warn-bg); border-color: #f0dcae; }
.pagechip.blank { background: var(--gray-bg); border-style: dashed; color: var(--gray-ink); }
.pagechip.unreadable, .pagechip.error { background: var(--bad-bg); border-color: #f1d2cc; color: var(--bad-ink); }
.viewer { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.paperbar { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--muted); margin-bottom: 10px; }
.pageimage { display: block; width: 100%; height: auto; background: #fff; border-radius: 3px; box-shadow: 0 3px 14px #213a5710; }
.imagenote { margin: 10px 2px 0; }
.passage { border-left: 3px solid var(--line); padding: 8px 12px; margin-bottom: 12px; border-radius: 0 8px 8px 0; }
.passage.highlight { border-left-color: #d9a520; background: #fff8e1; }
.passage pre.text { margin: 6px 0 2px; }
.resultcard { margin-bottom: 12px; }
.snippet { margin: 6px 0 0; font-size: 13px; line-height: 1.7; }

/* ── upload, version review and review queue ─────────────────────────────── */
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 0; margin: 0 0 20px; counter-reset: step; }
.step { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.step small { display: block; font-size: 11px; color: var(--soft); overflow-wrap: anywhere; }
.step strong { font-size: 12px; }
.stepno { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700;
          background: var(--gray-bg); color: var(--gray-ink); }
.step.done .stepno { background: var(--ok-bg); color: var(--ok-ink); }
.step.current { border-color: #a8c9c3; box-shadow: inset 0 0 0 1px #a8c9c3; }
.step.current .stepno { background: var(--teal); color: #fff; }
.step.failed { border-color: #f1d2cc; }
.step.failed .stepno { background: var(--bad-bg); color: var(--bad-ink); }
.reviewlayout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.viewer.compare { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: 12px; }
.checklist { gap: 0; padding: 4px 14px; }
.checkrow { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; padding: 12px 0; border-top: 1px solid var(--line); font-size: 13px; }
.checklist legend + .checkrow { border-top: 0; }
.checkrow input { margin-top: 3px; flex: none; }
.checkrow small { display: block; color: var(--soft); font-size: 11px; margin-top: 2px; }
.blankform { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.blankform textarea { width: 100%; min-height: 70px; }
.clearform { margin-top: 8px; }
.error p { margin: 0; } .error p + p { margin-top: 6px; }
.returnform { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.returnform textarea { width: 100%; min-height: 80px; }
.twocol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.uploadgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.uploadgrid h2 { margin: 6px 0 0; }
.dropzone { display: flex; flex-direction: column; gap: 6px; padding: 22px 18px; border: 1px dashed #bdcbdc; border-radius: 10px; background: #f8fafc; font-weight: 400; }
.dropzone input[type=file] { margin-top: 6px; background: #fff; width: 100%; }
.dropzone:focus-within { border-color: var(--teal); background: var(--wash); }
.choices { gap: 8px; }
.choice { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.choice:has(input:checked) { border-color: var(--teal); background: var(--wash); }
.choice input { margin-top: 3px; flex: none; }
.choice small { display: block; color: var(--soft); font-size: 11px; }
.uploadfoot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.uploadfoot .fine { margin: 0; max-width: 60ch; }
.uploadfoot .busy { flex-basis: 100%; margin: 0; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.metric { display: block; text-decoration: none; color: var(--ink); padding: 16px 18px; }
.metric:hover { border-color: #a8c9c3; }
.metric strong { display: block; font-size: 28px; font-weight: 620; letter-spacing: -1px; font-variant-numeric: tabular-nums; margin-top: 4px; }
.queue { margin-bottom: 26px; }
.queue h2 { margin-bottom: 4px; }
.queue > .fine, .queue > .muted { margin: 0 0 10px; }

/* ── usage and budget ──────────────────────────────────────────────────────── */
.usagesection { margin-bottom: 30px; scroll-margin-top: 92px; }
.usagesection > .sectiontitle { margin-bottom: 12px; font-size: 16px; }
.usagesection > .card + .card, .usagesection > .twopanel + .card, .usagesection > .card + .twopanel,
.usagesection > .metrics + .card { margin-top: 16px; }
.metrics.three { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 16px; }
.metric small { display: block; font-size: 11px; color: var(--soft); line-height: 1.6; margin-top: 4px; }
.metric progress { margin: 10px 0 4px; }
.twopanel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; margin-top: 16px; }
.twopanel h3 { margin-top: 0; }
.spendchart { display: block; width: 100%; height: 140px; margin: 12px 0 4px;
              background: linear-gradient(#eef2f6 1px, transparent 1px) 0 0 / 100% 25%; border-bottom: 1px solid var(--line); }
.spendchart rect { fill: #b5d3cd; }
.spendchart rect.today { fill: var(--teal); }
.chartaxis { display: flex; justify-content: space-between; gap: 8px; }
.charttable { margin-top: 10px; }
.charttable summary { cursor: pointer; font-size: 12px; font-weight: 620; color: var(--teal); }
.spendlist { list-style: none; margin: 8px 0; padding: 0; }
.spendlist li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.spendlist li:first-child { border-top: 0; }
.spendlist small { display: block; font-size: 11px; color: var(--soft); }
.spendlist strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.limitbars { list-style: none; margin: 10px 0 0; padding: 0; }
.limitbars li { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(120px, 2fr) auto; gap: 6px 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.limitbars li:first-child { border-top: 0; }
.limitbars progress { margin: 0; }
.limitfigures { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.limitgroup { margin: 24px 0; }
.limitgroup > .sectiontitle { margin-bottom: 10px; }
.limitrow { display: grid; grid-template-columns: minmax(200px, 2fr) repeat(3, minmax(90px, 1fr)) auto; gap: 12px; align-items: end;
            padding: 16px 20px; border-top: 1px solid var(--line); }
.limitrow:first-child { border-top: 0; }
.limitwho small { display: block; font-size: 11px; color: var(--soft); line-height: 1.6; }
.limitwho .limitused { color: var(--muted); }
.limitwho progress { margin: 6px 0 0; }
.priceform { padding: 16px 20px 20px; border-top: 1px solid var(--line); }
.priceform h3 { margin-top: 0; }
.pricegrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.resolveform label { font-size: 11px; }

/* ── tables ────────────────────────────────────────────────────────────── */
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 12px; text-align: left; }
th { font-size: 9.5px; text-transform: uppercase; letter-spacing: .75px; color: #738197; font-weight: 650;
     background: #f8fafc; padding: 12px 14px; white-space: nowrap; border-bottom: 1px solid var(--line); vertical-align: bottom; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:hover { background: #fbfcfe; }
tr.denied td { background: var(--bad-bg); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── legacy screens (restyled until each is redesigned) ────────────────── */
.narrow { max-width: 460px; margin: 30px auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 14px; }
.bar h1 { margin: 0; }
.linkbtn { background: none; border: 0; box-shadow: none; color: var(--teal); padding: 0; min-height: 0; font-weight: 600; }
.linkbtn:hover { background: none; text-decoration: underline; }
form.inline { display: inline; }
code { font-size: 11px; word-break: break-word; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tag { display: inline-block; font-size: 10px; line-height: 1.5; background: var(--gray-bg); color: var(--gray-ink);
       padding: 1px 7px; border-radius: 5px; font-weight: 600; white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok-ink); }
.tag.bad { background: var(--bad-bg); color: var(--bad-ink); }
.tag.warn { background: var(--warn-bg); color: var(--warn-ink); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: 13px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.pageimg { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; }
pre.text { white-space: pre-wrap; word-break: break-word; font: inherit; margin: 4px 0 12px; }
.result { margin-bottom: 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.exchange { margin-bottom: 16px; }
ol.sources li { margin-bottom: 6px; }
.logincard { padding: 30px; }
.logincard .brand { padding: 0 0 22px; }
.logincard .mark { background: var(--side); color: #fff; }
.logincard .brandtext small { color: var(--muted); }

/* ── responsive ────────────────────────────────────────────────────────── */
/* ── People & access (UI v2 batch 5) ─────────────────────────────────────────── */
.member { display: flex; align-items: center; gap: 10px; min-width: 0; }
.member .avatar { width: 32px; height: 32px; font-size: 10px; background: #e8eef6; color: #3b5776; }
.membertext { min-width: 0; overflow-wrap: anywhere; }
.membertext a, .membertext strong { font-weight: 620; text-decoration: none; }
.membertext a:hover { text-decoration: underline; }
.membertext small { display: block; color: var(--soft); font-size: 11px; margin: 0; }
.flaglist { display: flex; flex-wrap: wrap; gap: 4px; }
.peoplemetrics .metric .fine { display: block; }
.filtergrid.peoplefilter { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.accessgroup { padding: 14px 20px 16px; border-top: 1px solid var(--line); }
.accessgroup h3 { margin: 0 0 8px; font-size: 12px; display: flex; align-items: center; gap: 8px; }
.accessgroup h3 .count, .countpill { font-size: 10px; background: var(--gray-bg); color: var(--gray-ink); border-radius: 5px; padding: 0 6px; font-weight: 600; }
.accessgroup .helptext { margin: 0 0 8px; }
.accessgroup .fine { margin: 8px 0 0; }
.accessnames { margin: 0; font-size: 13px; }
.accesswarn { margin: 0 20px 14px; }
.accesslist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.accesslist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; min-width: 0; }
.accesslist li > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.accesslist li > small { grid-column: 1 / -1; color: var(--soft); font-size: 11px; line-height: 1.6; }
.accesslist a { font-weight: 600; text-decoration: none; }
.accesslist a:hover { text-decoration: underline; }
.homelinks { margin-top: 12px; }
.card .homekv { margin-top: 12px; }
.doctable .ghost { white-space: nowrap; }
.policy { background: #fcf6e9; border: 1px solid #f0e3c8; border-radius: var(--radius); padding: 16px 20px; margin-top: 18px; }
.stackcol > .policy { margin-top: 0; }
.policy .sectiontitle { color: #5f4419; }
.policy .fine { margin: 4px 0 10px; color: #7a6440; }
.policy ul { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.7; color: #4e4130; }
.policy li + li { margin-top: 10px; }
.policy li strong { color: var(--ink); }
.policyq { display: block; color: #775524; font-weight: 600; }
.grantform { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 14px 20px 18px; border-top: 1px solid var(--line); }
.grantform .field { flex: 1 1 240px; }
.emptycard.inset { margin: 4px 20px 18px; }
.rolechoices .choice strong, .checkrow strong { display: block; font-size: 13px; font-weight: 620; }
.checkrow > span { min-width: 0; }
.toppanel { margin: 0 0 18px; }
.supervised + .supervised { margin-top: 16px; }
.cardhead .sectiontitle + .fine { margin: 2px 0 0; }
.celllabel { display: none; }
@media (max-width: 640px) { .doctable .celllabel { display: inline; color: var(--soft); } }
@media (max-width: 800px) { .metrics.peoplemetrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 430px) {
  .filtergrid.peoplefilter { grid-template-columns: minmax(0, 1fr); }
  .accessgroup { padding-left: 16px; padding-right: 16px; }
  .accesswarn { margin-left: 16px; margin-right: 16px; }
  .grantform { padding-left: 16px; padding-right: 16px; }
}

@media (min-width: 1500px) { .compose textarea { min-height: 195px; } }
@media (max-width: 1200px) {
  .shell { grid-template-columns: 218px minmax(0, 1fr); }
  .main { padding: 30px 28px 50px; } .top { padding: 0 28px; }
  .welcome { grid-template-columns: minmax(0, 1fr) 230px; gap: 20px; }
  .context { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1000px) {
  .docgrid, .viewer, .reviewlayout, .uploadgrid, .viewer.compare, .twopanel { grid-template-columns: minmax(0, 1fr); }
  .limitrow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .limitrow .limitwho { grid-column: 1 / -1; }
  .pricegrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps, .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filtergrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filtergrid .grow { grid-column: 1 / -1; }
  .welcome { grid-template-columns: minmax(0, 1fr); }
  .askaside { display: grid; grid-template-columns: 1fr 1fr; }
  .askaside .privacyblock { grid-column: 1 / -1; }
  .pagehead h1 { font-size: 28px; }
}
@media (max-width: 800px) {
  .shell { display: block; }
  .side { position: static; height: auto; padding: 18px 14px; }
  /* With JavaScript the navigation becomes an off-canvas menu. While closed it is also
     visibility:hidden, so its links cannot take keyboard focus or be read out; the delayed
     visibility change lets the slide-out animation finish first. Without JavaScript (no .js
     class) the navigation stays in the page above the content. */
  .js .side { position: fixed; top: 0; left: -270px; width: 256px; height: 100%; z-index: 30;
              visibility: hidden; transition: left .2s, visibility 0s linear .2s; }
  .js .side.open { left: 0; box-shadow: var(--shadow); visibility: visible; transition: left .2s, visibility 0s; }
  .js .mobilemenu { display: inline-grid; }
  .top { height: 64px; padding: 0 16px; }
  .main { padding: 24px 16px 44px; }
  .envtag { font-size: 9px; }
  .pagehead h1 { font-size: 26px; }
  .context { padding: 16px; }
  .compose textarea { margin: 0 16px; width: calc(100% - 32px); min-height: 140px; }
  .composefoot { margin: 0 16px; } .busy { margin: 0 16px 16px; }
  .askaside { grid-template-columns: 1fr; }
  .questionblock, .answerbody, .sourcesblock, .answerbottom, .usagedetails, .disclaimer, .answerbar { padding-left: 16px; padding-right: 16px; }
  .drawer { width: 100%; padding: 20px 16px 36px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .metrics.three { grid-template-columns: minmax(0, 1fr); }
  .limitbars li { grid-template-columns: minmax(0, 1fr); }
  .limitrow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doctable thead { display: none; }
  .doctable tr { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .doctable td { display: block; border: 0; padding: 3px 0; }
  .doctable td.num { text-align: left; }
  .versiontable { min-width: 620px; }
}
@media (max-width: 430px) {
  .filtergrid, .twocol { grid-template-columns: minmax(0, 1fr); }
  .context { grid-template-columns: 1fr; gap: 12px; }
  .breadcrumb span:first-child, .breadcrumb .sep { display: none; }
  .composefoot button { width: 100%; }
  .budgetfigure { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
