:root {
  color-scheme: light;
  --ink: #18283b;
  --muted: #526176;
  --line: #dbe3ec;
  --paper: #fff;
  --surface: #f3f6fa;
  --nav: #142438;
  --blue: #214f91;
  --accent: #327c70;
  --radius: 12px;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--surface);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a, select { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #569ce6; outline-offset: 3px;
}
button:disabled { cursor: wait; opacity: .6; }
a { color: var(--blue); text-underline-offset: 3px; }
.shell { display: grid; min-height: 100vh; grid-template-columns: 236px minmax(0, 1fr); }
.rail {
  background: var(--nav); color: #fff; padding: 28px 17px 20px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 11px; align-items: center; margin: 0 10px 44px; font-size: 17px; font-weight: 650; line-height: 1.15; }
.mark { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 9px; background: #b7e0d8; color: #12293a; font-size: 25px; }
nav p { margin: 0 10px 10px; color: #a8bbce; font-size: 12px; }
nav button {
  width: 100%; text-align: left; padding: 11px 9px; color: #d3dfed; background: transparent; border: 0;
  border-radius: 8px; margin-bottom: 4px; font-size: 14px; display: flex; align-items: center; gap: 9px;
}
nav button span { font-size: 17px; width: 20px; text-align: center; }
nav button:hover, nav button[aria-current] { background: #293d55; color: #fff; }
.rail-bottom { margin: auto 10px 0; padding-top: 15px; border-top: 1px solid #3c5066; font-size: 13px; color: #d3dfed; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #58a99a; margin-right: 5px; }
.top { min-height: 70px; padding: 12px 32px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); background: white; }
.demo { flex: 1; font-size: 13px; color: var(--muted); }
.mode { border: 1px solid #c8d3df; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 650; color: #3f5268; background: #f3f6fa; }
.mode.live { color: #155a4d; background: #e1f1e9; border-color: #b9ddce; }
.mode.unknown { color: #7a3c00; background: #fff1d6; border-color: #e6bd77; }
.sep { padding: 0 5px; color: #69788a; }
.top label { font-size: 13px; font-weight: 600; }
.content { max-width: 1240px; margin: auto; padding: 32px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(24px, 3vw, 34px); letter-spacing: -.035em; margin-bottom: 6px; }
h2 { font-size: 18px; letter-spacing: -.01em; margin-bottom: 10px; }
h3 { font-size: 15px; margin-bottom: 7px; }
p { line-height: 1.55; }
.sub, .meta { color: var(--muted); }
.meta { font-size: 13px; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 22px; }
.head p, .card p:last-child { margin-bottom: 0; }
.card { padding: 19px; margin-bottom: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.summary { background: #e8eff8; border-color: #d5e1ef; }
.grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr); gap: 16px; align-items: start; }
.stack { min-width: 0; }
.card ul { padding-left: 20px; }
.claim { padding: 12px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.claim:first-of-type { margin-top: 12px; }
.claim p { margin: 5px 0; }
.tag { display: inline-flex; white-space: nowrap; background: #e8eef7; color: #254875; border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 650; }
.tag.ok { background: #e1f1e9; color: #23604f; }
.tag.warn { background: #f7eddb; color: #704817; }
.tag.no { background: #f7e5e5; color: #813333; }
.btn, .secondary, input, select, textarea { border: 1px solid #aebed0; border-radius: 7px; padding: 8px 11px; color: var(--ink); background: #fff; }
.btn { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 650; }
.btn:hover { background: #173f79; }
.secondary:hover { background: #edf3fa; }
.link { background: transparent; border: 0; padding: 4px 0; color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.refs, .controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gmail-search { display: grid; grid-template-columns: minmax(180px, 2fr) repeat(2, minmax(130px, 1fr)) auto; gap: 10px; align-items: end; }
.gmail-search label { display: grid; gap: 4px; margin: 0; }
.mail-card .controls { margin-top: 10px; }
.card label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 650; }
.review { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.review textarea { width: 100%; resize: vertical; font-weight: 400; }
.import-form { display: grid; gap: 12px; margin-top: 14px; }
.import-form input:not([type='checkbox']), .import-form select, .import-form textarea { width: 100%; }
.import-form textarea { width: 100%; resize: vertical; font-weight: 400; }
.checkbox-label { display: flex !important; align-items: flex-start; gap: 8px; font-weight: 400 !important; }
.checkbox-label input { margin-top: 3px; }
.review-fields { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0; }
.review-fields label { margin: 0; }
.review-fields select, .review-fields input { display: block; margin-top: 4px; max-width: 100%; }
#notice { padding: 10px 14px; background: #e5edf9; border-radius: 8px; }
#notice.error { background: #f9eaea; color: #813333; }
dialog { width: min(650px, calc(100vw - 32px)); padding: 23px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); }
dialog::backdrop { background: #14243899; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.dialog-head h2 { margin: 0; }
.source-line { display: grid; grid-template-columns: 22px 1fr; gap: 8px; margin: 3px 0; padding: 7px; background: var(--surface); overflow-wrap: anywhere; }
.source-line.active { background: #dcefeb; }
.source-body { white-space: pre-wrap; overflow-wrap: anywhere; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 5px 12px; font-size: 14px; }
dd { margin: 0; overflow-wrap: anywhere; }
details { margin-top: 12px; }
summary { cursor: pointer; }
.audit-entry { padding: 9px 0; border-top: 1px solid var(--line); }
@media (max-width: 900px) {
  .shell { grid-template-columns: 190px minmax(0, 1fr); }
  .top, .content { padding-inline: 20px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .gmail-search { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .shell { display: block; }
  .rail { position: static; height: auto; padding: 12px; }
  .brand { margin: 0 0 9px; }
  .brand br { display: none; }
  nav p, .rail-bottom { display: none; }
  nav { display: grid; grid-template-columns: 1fr 1fr; }
  .top { flex-wrap: wrap; }
  .demo { flex: 1 0 100%; }
  .content { padding: 20px 14px; }
}
