:root {
  --ink: #102d32;
  --ink-2: #25434a;
  --muted: #667878;
  --paper: #f8f4eb;
  --paper-2: #f1ebdf;
  --card: #fffdf8;
  --line: #ded8cc;
  --line-dark: #c8c0b3;
  --teal: #197c72;
  --teal-bright: #35a596;
  --teal-soft: #deefea;
  --amber: #c7772c;
  --amber-soft: #f7e7cf;
  --red: #aa443d;
  --red-soft: #f7dfda;
  --green: #28715d;
  --shadow: 0 18px 50px rgba(21, 42, 42, .1);
  --sidebar: 252px;
  --radius: 14px;
  --serif: Iowan Old Style, Baskerville, Georgia, Times New Roman, serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); font-family: var(--sans); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); }
body.drawer-open { overflow: hidden; }
button, input, select, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }
a { color: var(--teal); }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid rgba(25, 124, 114, .35); outline-offset: 3px; }
.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; }
.skip-link { position: fixed; z-index: 1000; left: 16px; top: 12px; transform: translateY(-160%); background: var(--ink); color: white; padding: 10px 16px; border-radius: 8px; text-decoration: none; }
.skip-link:focus { transform: none; }

.eyebrow { margin: 0 0 8px; color: var(--teal); font-size: .7rem; font-weight: 800; letter-spacing: .14em; line-height: 1.2; text-transform: uppercase; }
.eyebrow.light { color: #91d2c7; }
.brand-mark { display: inline-flex; flex-direction: column; gap: 5px; width: 44px; margin-bottom: 32px; }
.brand-mark span { display: block; height: 3px; background: var(--teal-bright); border-radius: 3px; }
.brand-mark span:nth-child(2) { width: 75%; }
.brand-mark span:nth-child(3) { width: 52%; }
.brand-mark.compact { width: 27px; gap: 4px; margin: 0; flex: 0 0 auto; }
.brand-mark.compact span { height: 2px; }

.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(440px, 1.05fr) minmax(400px, .95fr); }
.login-card { display: flex; flex-direction: column; justify-content: center; width: min(540px, 100%); margin: 0 auto; padding: 70px 56px; }
.login-card h1 { max-width: 520px; margin: 0; font: 400 clamp(2.7rem, 5vw, 4.8rem)/.98 var(--serif); letter-spacing: -.045em; }
.login-intro { max-width: 470px; margin: 24px 0 32px; color: var(--muted); font-size: 1rem; line-height: 1.65; }
.login-form { display: grid; gap: 18px; }
.google-login { max-width: 420px; }
label { display: grid; gap: 7px; color: var(--ink-2); font-size: .8rem; font-weight: 700; }
label span em { color: var(--muted); font-weight: 500; }
input, select, textarea { width: 100%; border: 1px solid var(--line-dark); border-radius: 9px; background: #fffdfa; padding: 12px 13px; font-size: .93rem; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(25, 124, 114, .1); outline: 0; }
textarea { resize: vertical; line-height: 1.55; }
.login-note { margin: 22px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.login-aside { position: relative; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; background: var(--ink); color: #f8f4eb; padding: clamp(48px, 7vw, 100px); }
.login-aside::before { position: absolute; content: ""; width: 540px; height: 540px; right: -200px; top: -200px; border: 1px solid rgba(147, 213, 202, .18); border-radius: 50%; box-shadow: 0 0 0 70px rgba(147, 213, 202, .04), 0 0 0 140px rgba(147, 213, 202, .03); }
.login-aside blockquote { position: relative; max-width: 570px; margin: 0 0 50px; font: 400 clamp(2.15rem, 4vw, 4rem)/1.07 var(--serif); letter-spacing: -.035em; }
.privacy-note { display: flex; align-items: center; gap: 10px; color: #c8dad7; font-size: .78rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #5ac3a8; box-shadow: 0 0 0 5px rgba(90, 195, 168, .12); }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; display: flex; flex-direction: column; width: var(--sidebar); background: var(--ink); color: #eaf0ec; padding: 24px 15px 18px; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 9px; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand strong { display: block; font: 400 1rem/1.1 var(--serif); }
.brand small { display: block; margin-top: 3px; color: #8ca29f; font-size: .62rem; letter-spacing: .04em; }
.primary-nav { display: grid; gap: 4px; margin-top: 52px; }
.nav-link { display: flex; align-items: center; width: 100%; gap: 12px; border: 0; border-radius: 9px; background: transparent; color: #aebfbc; padding: 11px 13px; text-align: left; font-size: .82rem; font-weight: 600; }
.nav-link:hover { background: rgba(255,255,255,.055); color: white; }
.nav-link.active { background: rgba(53, 165, 150, .17); color: #effffb; }
.nav-icon { display: inline-grid; place-items: center; width: 19px; height: 19px; color: #83b8af; font-size: 1rem; }
.sidebar-foot { display: grid; gap: 14px; margin-top: auto; }
.user-block { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 8px 10px; align-items: center; border-top: 1px solid rgba(255,255,255,.1); padding: 18px 8px 0; }
.user-block strong, .user-block small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-block strong { font-size: .75rem; }
.user-block small { margin-top: 2px; color: #89a09d; font-size: .6rem; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; background: #244b4e; color: #c8e9e3; font-size: .7rem; font-weight: 800; }
.text-button { grid-column: 2; justify-self: start; border: 0; background: none; color: #8da6a2; padding: 0; font-size: .64rem; }
.text-button:hover { color: white; }
.close-menu { display: none; color: white; }

.main-content { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { position: sticky; z-index: 30; top: 0; display: flex; align-items: center; min-height: 70px; border-bottom: 1px solid var(--line); background: rgba(248, 244, 235, .92); padding: 12px clamp(24px, 4vw, 58px); backdrop-filter: blur(15px); }
.view-switch { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper-2); }
.view-switch button { border: 0; border-radius: 6px; background: transparent; color: var(--muted); padding: 8px 12px; font-size: .7rem; font-weight: 700; }
.view-switch button.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(20,40,40,.08); }
.topbar-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.icon-button { display: inline-grid; place-items: center; min-width: 38px; min-height: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font-size: 1.15rem; }
.icon-button:hover { background: rgba(16, 45, 50, .06); }
.search-button { display: flex; gap: 7px; width: auto; color: var(--muted); font-size: .75rem; font-weight: 700; }
.open-menu { display: none; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; border: 1px solid transparent; border-radius: 8px; padding: 10px 16px; font-size: .77rem; font-weight: 800; text-decoration: none; }
.button.primary { background: var(--ink); color: #fff; }
.button.primary:hover { background: #194148; }
.button.primary:disabled { cursor: not-allowed; background: #9cadab; }
.button.secondary { border-color: var(--line-dark); background: var(--card); color: var(--ink); }
.button.secondary:hover, .button.quiet:hover { border-color: var(--teal); color: var(--teal); }
.button.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.button.danger { border-color: #deb8b0; background: #fff8f5; color: var(--red); }
.button.small { min-height: 36px; padding: 8px 13px; font-size: .7rem; }
.button.wide { width: 100%; min-height: 48px; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }

.announcement { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: 400px; border: 1px solid #b6d5cf; border-radius: 10px; background: #eef8f5; color: var(--ink); box-shadow: var(--shadow); padding: 13px 16px; font-size: .78rem; line-height: 1.45; }
.announcement.error { border-color: #dfbbb5; background: #fff3f0; color: #772f2a; }
.page { width: min(1300px, 100%); margin: 0 auto; padding: 44px clamp(24px, 4vw, 58px) 72px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; margin-bottom: 36px; }
.page-head h1 { margin: 0; font: 400 clamp(2.3rem, 4.6vw, 4rem)/1 var(--serif); letter-spacing: -.045em; }
.page-head p:not(.eyebrow) { max-width: 640px; margin: 12px 0 0; color: var(--muted); font-size: .87rem; line-height: 1.55; }
.page-meta { color: var(--muted); font-size: .7rem; white-space: nowrap; }

.connection-banner { display: flex; align-items: center; justify-content: space-between; gap: 24px; border: 1px solid #24555a; border-radius: var(--radius); background: linear-gradient(120deg, #102d32, #16464a); color: white; box-shadow: var(--shadow); margin: -10px 0 24px; padding: 21px 24px; }
.connection-banner .eyebrow { margin: 0 0 5px; color: #a9d7d0; }
.connection-banner h2 { margin: 0; font: 400 1.45rem/1.2 var(--serif); }
.connection-banner p:not(.eyebrow) { max-width: 680px; margin: 7px 0 0; color: #d5e5e3; font-size: .75rem; line-height: 1.5; }
.connection-banner .button { flex: 0 0 auto; border-color: rgba(255,255,255,.55); background: white; color: var(--ink); }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin-bottom: 40px; overflow: hidden; }
.summary-grid.three-up { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.summary-card { position: relative; min-height: 123px; border-right: 1px solid var(--line); padding: 19px 20px; }
.summary-card:last-child { border-right: 0; }
.summary-card small { display: block; color: var(--muted); font-size: .66rem; font-weight: 750; letter-spacing: .03em; }
.summary-card strong { display: block; margin: 7px 0 3px; font: 400 2.15rem/1 var(--serif); }
.summary-card span { color: var(--muted); font-size: .67rem; }
.summary-card::after { position: absolute; content: ""; left: 20px; right: 20px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--teal-bright); opacity: .75; transform: scaleX(var(--meter, .25)); transform-origin: left; }
.summary-card.meter-0 { --meter: .08; }
.summary-card.meter-1 { --meter: .12; }
.summary-card.meter-2 { --meter: .2; }
.summary-card.meter-3 { --meter: .3; }
.summary-card.meter-4 { --meter: .4; }
.summary-card.meter-5 { --meter: .5; }
.summary-card.meter-6 { --meter: .6; }
.summary-card.meter-7 { --meter: .7; }
.summary-card.meter-8 { --meter: .8; }
.summary-card.meter-9 { --meter: .9; }
.summary-card.meter-10 { --meter: .98; }

.section { margin-top: 42px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font: 400 1.35rem/1.2 var(--serif); }
.section-head p, .section-head a, .section-head button { margin: 0; color: var(--muted); font-size: .68rem; }
.section-head button { border: 0; background: none; text-decoration: underline; }
.split-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(270px, .65fr); gap: 34px; align-items: start; }
.item-list { display: grid; border-top: 1px solid var(--line); }
.item-card { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; column-gap: 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 18px 7px 18px 0; color: inherit; text-align: left; }
.item-card:hover { background: linear-gradient(90deg, transparent, rgba(255,255,255,.55)); }
.priority-marker { width: 7px; height: 7px; margin-top: 7px; border-radius: 50%; background: #9aa9a7; }
.priority-marker.high { background: var(--amber); box-shadow: 0 0 0 5px rgba(199, 119, 44, .1); }
.priority-marker.low { background: #9dacaa; }
.item-main { min-width: 0; }
.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; color: var(--muted); font-size: .63rem; }
.item-meta .source-label { color: var(--teal); font-weight: 800; }
.item-main h3 { margin: 7px 0 5px; font-size: .9rem; line-height: 1.35; }
.item-main p { display: -webkit-box; margin: 0; overflow: hidden; color: #5d6d6d; font-size: .76rem; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.reason { display: inline-flex; align-items: center; gap: 6px; margin-top: 9px; color: #845124; font-size: .63rem; font-weight: 700; }
.reason::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--amber); }
.item-aside { min-width: 92px; color: var(--muted); font-size: .63rem; text-align: right; }
.item-aside strong { display: block; margin-bottom: 8px; color: var(--ink-2); font-size: .67rem; font-weight: 750; }
.pill { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.55); padding: 4px 8px; color: var(--muted); font-size: .59rem; font-weight: 800; letter-spacing: .025em; text-transform: uppercase; }
.pill.high, .pill.error { border-color: #e0bda2; background: var(--amber-soft); color: #89521d; }
.pill.connected, .pill.live_api, .pill.confirmed { border-color: #a9d0c6; background: var(--teal-soft); color: #1d6c61; }
.pill.shared { border-color: #a8c3cc; background: #e7f0f2; color: #376974; }
.pill.stale, .pill.disputed { border-color: #e3c89a; background: #f8edd7; color: #7c5c24; }
.pill.not_connected, .pill.superseded { background: #eeeae1; color: #6e7774; }
.review-status { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; background: #edf2ef; padding: 3px 7px; color: #536763; font-size: .56rem; font-weight: 750; letter-spacing: .01em; }
.review-status.pending { background: var(--amber-soft); color: #80551f; }
.review-status.excluded { background: #eeeae1; color: #6e7774; }
.table-item .review-status { margin-top: 6px; }

.coverage-panel { position: sticky; top: 94px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 21px; }
.coverage-panel h2 { margin: 0; font: 400 1.25rem/1.2 var(--serif); }
.coverage-panel > p { margin: 8px 0 18px; color: var(--muted); font-size: .7rem; line-height: 1.5; }
.source-mini { display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 9px; border-top: 1px solid var(--line); padding: 13px 0; }
.source-mini-dot { width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: #a5aeac; }
.source-mini-dot.connected { background: var(--teal-bright); }
.source-mini-dot.error { background: var(--red); }
.source-mini-dot.stale { background: var(--amber); }
.source-mini strong { display: block; font-size: .72rem; }
.source-mini span { display: block; margin-top: 3px; color: var(--muted); font-size: .61rem; line-height: 1.35; }
.review-coverage { border-top: 1px solid var(--line); margin-top: 7px; padding-top: 16px; }
.review-coverage h3 { margin: 0 0 10px; font-size: .72rem; }
.review-coverage dl { display: grid; gap: 7px; margin: 0; }
.review-coverage dl div { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .61rem; }
.review-coverage dt, .review-coverage dd { margin: 0; }
.review-coverage dd { color: var(--ink-2); font-weight: 800; }
.review-coverage p { margin: 10px 0 0; color: var(--muted); font-size: .59rem; line-height: 1.4; }
.coverage-link { width: 100%; margin-top: 8px; }
.result-limit-note { border-top: 1px solid var(--line); margin: 30px 0 0; padding-top: 14px; color: var(--muted); font-size: .66rem; text-align: center; }

.empty-state { display: grid; place-items: start; min-height: 180px; border: 1px dashed var(--line-dark); border-radius: var(--radius); background: rgba(255,255,255,.3); padding: 30px; }
.empty-state.compact { min-height: 130px; padding: 22px; }
.empty-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--teal-soft); color: var(--teal); font: 400 1.1rem var(--serif); }
.empty-state h3 { margin: 15px 0 7px; font: 400 1.15rem var(--serif); }
.empty-state p { max-width: 530px; margin: 0 0 17px; color: var(--muted); font-size: .73rem; line-height: 1.55; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 19px; }
.filter-button { border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); padding: 7px 11px; font-size: .65rem; font-weight: 700; }
.filter-button.active { border-color: var(--ink); background: var(--ink); color: white; }
.table-list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.table-item { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(150px, .8fr) 110px 100px; align-items: center; gap: 16px; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 16px 18px; color: inherit; text-align: left; }
.table-item:last-child { border-bottom: 0; }
.table-item:hover { background: #fbf8f1; }
.table-item strong { display: block; overflow: hidden; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.table-item small { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: .63rem; text-overflow: ellipsis; white-space: nowrap; }
.table-cell { color: var(--muted); font-size: .67rem; }

.fact-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.fact-card { display: flex; flex-direction: column; min-height: 175px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 18px; }
.fact-card p { margin: 13px 0 auto; font: 400 1rem/1.45 var(--serif); }
.fact-card footer { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; color: var(--muted); font-size: .61rem; }
.fact-card button { border: 0; background: none; color: var(--teal); padding: 0; font-size: .62rem; font-weight: 800; }

.source-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.source-card { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 18px; }
.source-glyph { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: var(--teal-soft); color: var(--teal); font: 400 1.2rem var(--serif); }
.source-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.source-card h3 { margin: 0; font-size: .82rem; }
.source-card .account { margin: 4px 0 0; color: var(--muted); font-size: .62rem; }
.source-card .detail { grid-column: 2; margin: 1px 0 0; color: var(--muted); font-size: .68rem; line-height: 1.5; }
.source-card footer { grid-column: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 11px; color: var(--muted); font-size: .6rem; }
.inline-action { border: 0; background: none; color: var(--teal); padding: 0; font-size: .62rem; font-weight: 800; }

.settings-stack { display: grid; gap: 18px; max-width: 820px; }
.settings-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 22px; }
.settings-card h2 { margin: 0; font: 400 1.2rem var(--serif); }
.settings-card > p { margin: 7px 0 19px; color: var(--muted); font-size: .7rem; line-height: 1.5; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 22px; border-top: 1px solid var(--line); padding: 14px 0; }
.setting-row:last-child { padding-bottom: 0; }
.setting-row strong { display: block; font-size: .75rem; }
.setting-row small { display: block; margin-top: 3px; color: var(--muted); font-size: .62rem; line-height: 1.4; }
.setting-value { flex: 0 0 auto; color: var(--muted); font-size: .69rem; text-align: right; }
.warning-banner { display: grid; grid-template-columns: 27px 1fr; gap: 12px; border: 1px solid #e4c692; border-radius: 10px; background: #fff8e9; color: #704e19; padding: 14px 16px; }
.warning-banner strong { display: block; font-size: .74rem; }
.warning-banner p { margin: 3px 0 0; font-size: .66rem; line-height: 1.45; }

.modal { width: min(680px, calc(100vw - 28px)); max-height: calc(100vh - 40px); border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink); box-shadow: 0 30px 90px rgba(10, 30, 30, .27); padding: 0; }
.modal::backdrop { background: rgba(7, 28, 31, .58); backdrop-filter: blur(4px); }
.modal-shell { display: grid; gap: 19px; max-height: calc(100vh - 42px); overflow-y: auto; padding: 25px; }
.compact-modal { max-width: 560px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.modal-head h2 { margin: 0; font: 400 1.6rem/1.15 var(--serif); }
.modal-close { margin: -7px -7px 0 0; font-size: 1.4rem; }
.modal-intro { margin: -7px 0 0; color: var(--muted); font-size: .73rem; line-height: 1.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); padding-top: 17px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.span-2 { grid-column: span 2; }
.form-error { border-radius: 7px; background: var(--red-soft); color: #7b322c; padding: 10px 12px; font-size: .7rem; line-height: 1.45; }
.field-help { margin: -9px 0 0; color: var(--muted); font-size: .66rem; line-height: 1.5; }
.confirm-row { display: grid; grid-template-columns: 18px 1fr; gap: 10px; align-items: start; font-weight: 600; line-height: 1.45; }
.confirm-row input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--teal); }
.notice-card { border-left: 3px solid var(--teal); background: var(--teal-soft); padding: 12px 14px; }
.notice-card strong { font-size: .72rem; }
.notice-card p { margin: 3px 0 0; color: #416861; font-size: .66rem; line-height: 1.45; }

.search-modal { width: min(760px, calc(100vw - 28px)); align-self: start; margin-top: 10vh; }
.search-field { display: grid; grid-template-columns: 24px 1fr; align-items: center; border: 1px solid var(--line-dark); border-radius: 10px; padding: 3px 9px; color: var(--muted); }
.search-field:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(25,124,114,.1); }
.search-field input { border: 0; background: transparent; box-shadow: none; padding: 11px 5px; font-size: 1rem; }
.search-scope { margin: -10px 0 0; color: var(--muted); font-size: .62rem; }
.search-results { display: grid; max-height: 50vh; overflow-y: auto; }
.search-limit-note { border: 1px solid #e4c692; border-radius: 8px; background: #fff8e9; color: #704e19; margin: 0 0 8px; padding: 10px 12px; font-size: .66rem; line-height: 1.45; }
.search-result { display: grid; grid-template-columns: 1fr auto; gap: 8px; border: 0; border-top: 1px solid var(--line); background: transparent; padding: 13px 4px; color: inherit; text-align: left; }
.search-result:hover { background: #faf7f0; }
.search-result strong { font-size: .76rem; }
.search-result span { color: var(--muted); font-size: .62rem; }
.search-result p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: .68rem; line-height: 1.4; }

.detail-drawer { position: fixed; z-index: 70; top: 0; right: 0; bottom: 0; width: min(580px, 100vw); overflow-y: auto; border-left: 1px solid var(--line); background: var(--card); box-shadow: -20px 0 60px rgba(12, 37, 38, .16); transform: translateX(105%); visibility: hidden; transition: transform .22s ease, visibility .22s; }
.detail-drawer.open { transform: none; visibility: visible; }
.drawer-scrim { position: fixed; z-index: 60; inset: 0; background: rgba(7, 28, 31, .38); }
.drawer-head { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 62px; border-bottom: 1px solid var(--line); background: rgba(255,253,248,.94); padding: 10px 21px; backdrop-filter: blur(12px); }
.source-label { color: var(--teal); font-size: .63rem; font-weight: 800; }
.drawer-content { padding: 25px 29px 55px; }
.drawer-content h2 { margin: 7px 0 12px; font: 400 2rem/1.08 var(--serif); letter-spacing: -.025em; }
.drawer-summary { margin: 0 0 20px; color: var(--muted); font-size: .82rem; line-height: 1.55; }
.drawer-metadata { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 21px; }
.priority-callout { border-left: 3px solid var(--amber); background: #fff8ed; padding: 11px 13px; margin: 0 0 21px; color: #77512d; font-size: .7rem; line-height: 1.45; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 15px 0; margin-bottom: 26px; }
.drawer-section { margin-top: 28px; }
.drawer-section h3 { margin: 0 0 12px; font: 400 1.1rem var(--serif); }
.message { position: relative; border-left: 1px solid var(--line-dark); padding: 0 0 22px 17px; }
.message::before { position: absolute; content: ""; width: 7px; height: 7px; left: -4px; top: 4px; border-radius: 50%; background: var(--teal-bright); }
.message:last-child { padding-bottom: 0; }
.message-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.message-head strong { font-size: .7rem; }
.message-head time { color: var(--muted); font-size: .6rem; }
.message p { margin: 0; color: #43595b; font-size: .74rem; line-height: 1.58; white-space: pre-wrap; }
.draft-card { border: 1px solid #add2ca; border-radius: 10px; background: #f4fbf8; padding: 15px; }
.draft-card header { display: flex; justify-content: space-between; gap: 10px; }
.draft-card strong { font-size: .72rem; }
.draft-card p { margin: 10px 0; color: #3e5d59; font-size: .72rem; line-height: 1.55; white-space: pre-wrap; }
.draft-recipients { color: var(--muted); font-size: .6rem; line-height: 1.45; }
.draft-job { display: flex; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 9px; background: #faf7f0; padding: 13px; color: var(--muted); font-size: .69rem; }
.spinner { width: 17px; height: 17px; border: 2px solid #c8d5d1; border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.snooze-menu { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.loading-block { display: grid; gap: 12px; padding: 10px 0; }
.loading-block span { display: block; width: 100%; height: 17px; border-radius: 4px; background: linear-gradient(90deg, #e9e3d8 20%, #f7f3ea 40%, #e9e3d8 60%); background-size: 300% 100%; animation: shimmer 1.4s infinite; }
.loading-block span:nth-child(2) { width: 78%; }
.loading-block span:nth-child(3) { width: 55%; }
@keyframes shimmer { to { background-position: -100% 0; } }

@media (max-width: 1050px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .summary-grid.three-up { grid-template-columns: repeat(2, 1fr); }
  .summary-grid.three-up .summary-card:last-child { grid-column: 1 / -1; }
  .summary-card:nth-child(2) { border-right: 0; }
  .summary-card:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .split-layout { grid-template-columns: 1fr; }
  .coverage-panel { position: static; }
}

@media (max-width: 820px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-card { min-height: 70vh; padding: 55px 30px; }
  .login-aside { min-height: 30vh; padding: 42px 30px; }
  .login-aside blockquote { margin-bottom: 30px; }
  .sidebar { transform: translateX(-105%); transition: transform .22s ease; }
  .sidebar.open { transform: none; }
  .menu-scrim { position: fixed; z-index: 35; inset: 0; background: rgba(7,28,31,.45); }
  .close-menu, .open-menu { display: inline-grid; }
  .main-content { margin-left: 0; }
  .topbar { padding: 11px 18px; }
  .open-menu { margin-right: 6px; }
  .page { padding: 34px 22px 58px; }
  .fact-list, .source-grid { grid-template-columns: 1fr; }
  .table-item { grid-template-columns: minmax(0,1fr) 100px; }
  .table-item .table-cell:nth-child(2) { display: none; }
}

@media (max-width: 560px) {
  .topbar { min-height: 62px; }
  .view-switch button { padding: 7px 9px; font-size: .62rem; }
  .search-label { display: none; }
  .topbar-actions { gap: 2px; }
  .topbar .button.small { width: 36px; overflow: hidden; padding: 0; white-space: nowrap; }
  .topbar .button.small .add-glyph { color: white; font-size: 1rem; }
  .topbar .button.small .add-label { display: none; }
  .page { padding: 29px 17px 50px; }
  .page-head { display: block; margin-bottom: 27px; }
  .page-meta { display: block; margin-top: 12px; }
  .connection-banner { display: grid; margin-top: 0; padding: 19px; }
  .connection-banner .button { width: 100%; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-card { min-height: 105px; padding: 15px; }
  .summary-card strong { font-size: 1.8rem; }
  .summary-card::after { left: 15px; right: 15px; }
  .item-card { grid-template-columns: 7px minmax(0,1fr); padding-right: 0; }
  .item-aside { grid-column: 2; margin-top: 8px; text-align: left; }
  .item-aside strong { display: inline; margin-right: 8px; }
  .field-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .modal-shell { padding: 20px; }
  .modal-actions { position: sticky; bottom: -20px; background: var(--card); margin: 0 -20px -20px; padding: 14px 20px; }
  .drawer-content { padding: 22px 20px 50px; }
  .drawer-content h2 { font-size: 1.7rem; }
  .table-item { padding: 14px; }
  .table-item .table-cell:nth-child(3) { display: none; }
  .announcement { right: 14px; bottom: 14px; left: 14px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
