/* THE AI-ASSISTED INBOX AND ITS ALERT SETTINGS (2026-10-23; restyled to the app on feat/inbox-read-on-arrival).
   Colours come only from the app's tokens, applied from the user's saved palette and display mode by /appTheme.js
   (the same functions as public/index.html). The :root block below is the Yarrow light fallback for the instant
   before the palette applies, and the danger and warning colours, which the main app also keeps constant across
   palettes. The draft, "not sent" and "Could not assess" notices are never colour only. */
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 100 1000; font-display: swap; src: url('/fonts/dm-sans-latin-wght-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 100 1000; font-display: swap; src: url('/fonts/dm-sans-latin-ext-wght-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/fraunces-latin-500-normal.woff2') format('woff2'); }
:root {
  --app-font: 'DM Sans', system-ui, sans-serif; --app-header-h: 56px; --card-radius: 12px; --radius-sm: 8px;
  --bg: #F7F7F3; --surface: #FFFFFF; --surface2: #EFF0EA; --surface3: #E8E9E2; --border: #E2E3DC;
  --accent: #4F6B47; --accent-rgb: 79, 107, 71; --accent-hover: #3F5A39; --accent-tint: #E8EEE3; --accent2: #7A9670;
  --text: #1F2A44; --text2: #4D5056; --text3: #64676C; --logo-ink: #1F2A44;
  --success: #2F7D74; --success-rgb: 47, 125, 116; --success-ink: #2A7068; --warning: #f59e0b; --danger: #ef4444;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.06); --shadow-md: 0 4px 16px rgba(15,23,42,0.08);
  --banner-grad: linear-gradient(90deg, #FFFFFF 0%, #F7F7F3 58%, rgba(122, 150, 112, 0.10) 100%);
}
:root {
  --card-border: var(--border);
  /* readable inks and soft fills for the risk colours, in both modes */
  --danger-ink: color-mix(in srgb, var(--danger) 70%, var(--text)); --danger-tint: color-mix(in srgb, var(--danger) 11%, var(--surface));
  --warning-ink: color-mix(in srgb, var(--warning) 55%, var(--text)); --warning-tint: color-mix(in srgb, var(--warning) 13%, var(--surface));
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--app-font); font-size: 14px; line-height: 1.55; min-height: 100vh; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
.ib-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ib-muted { color: var(--text2); }
.ib-err { color: var(--danger-ink); font-weight: 600; }

/* the app header (public/index.html .app-header) */
.app-header { background-color: var(--bg); background-image: var(--banner-grad); border-bottom: 1px solid var(--border); padding: 0 20px; display: flex; align-items: center; gap: 16px; height: var(--app-header-h); position: sticky; top: 0; z-index: 100; }
.app-header .logo { display: flex; align-items: center; gap: 9px; min-width: 0; text-decoration: none; border-radius: 10px; }
.app-header .logo:hover { opacity: .85; }
.nn-logo { width: 42px; height: 42px; flex: none; display: block; object-fit: contain; transition: filter .3s ease; }
.brand-name { font-family: 'Fraunces', Georgia, serif; font-weight: 500; font-size: 25px; letter-spacing: -0.5px; color: var(--logo-ink); }
.ib-page-title { font-size: 15px; font-weight: 600; color: var(--text2); margin: 0; padding-left: 14px; border-left: 1px solid var(--border); white-space: nowrap; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* buttons: the app's own classes (public/index.html .btn, .btn-primary, .btn-ghost, .btn-sm) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm); font-family: var(--app-font); font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all .15s; text-decoration: none; min-height: 34px; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
/* dark mode: dark text on the light accent fill (white on it is about 2:1; this is above 7:1), the same on every page */
:root[data-mode="dark"] .btn-primary { color: var(--bg); }
:root[data-mode="dark"] .btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; min-height: 30px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-danger { background: var(--danger); color: white; }
.ib-link { background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 4px; font-size: 13px; }

/* badges (public/index.html .nn-badge): critical = danger, high = warning, routine = neutral */
.nn-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px; border: 1px solid var(--border); white-space: nowrap; color: var(--text2); background: var(--surface2); margin: 2px 4px 0 0; }
.nn-badge.is-crit { background: var(--danger); border-color: var(--danger); color: white; }
.nn-badge.is-cna { background: var(--danger-tint); border-color: var(--danger); color: var(--danger-ink); font-weight: 700; }
.nn-badge.is-high, .nn-badge.is-low { background: var(--warning-tint); border-color: var(--warning); color: var(--warning-ink); }
.nn-badge.is-ok { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); }
.nn-badge.is-nd, .nn-badge.is-quiet { background: var(--surface2); color: var(--text2); }
.nn-badge.ai { background: var(--surface2); color: var(--text2); }

/* tabs */
.ib-tabs { display: flex; gap: 4px; overflow-x: auto; }
.ib-tab { border: 1px solid transparent; background: none; padding: 6px 12px; border-radius: 999px; cursor: pointer; color: var(--text2); font-size: 13px; font-weight: 500; white-space: nowrap; }
.ib-tab.is-on { background: var(--accent-tint); color: var(--accent); border-color: var(--accent); font-weight: 600; }

.ib-msg { padding: 0 20px; }
.ib-msg:not(:empty) { padding: 8px 20px; background: var(--surface2); border-bottom: 1px solid var(--border); }
.ib-msg.is-bad { background: var(--danger-tint); color: var(--danger-ink); font-weight: 600; }

/* the persistent alert banner (public/inbox/alertBanner.js) */
.ib-alerts:empty { display: none; }
.ib-alerts { padding: 10px 20px 0; display: grid; gap: 8px; }
.ib-alert { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; border-radius: var(--card-radius); padding: 10px 14px; border: 1px solid var(--danger); background: var(--danger-tint); color: var(--danger-ink); box-shadow: var(--shadow-sm); }
.ib-alert.is-warn { border-color: var(--warning); background: var(--warning-tint); color: var(--warning-ink); }
.ib-alert-text { flex: 1 1 260px; min-width: 0; }
.ib-alert-text b { display: block; font-size: 13px; letter-spacing: .02em; }
.ib-alert-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ib-alert .btn-ghost { color: inherit; border-color: currentColor; background: var(--surface); }

/* the list and the split view */
.ib-main { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: calc(100vh - var(--app-header-h) - 46px); min-height: 0; }
.ib-list { border-right: 1px solid var(--border); overflow: auto; padding: 12px; background: var(--bg); }
.ib-drop { border: 1.5px dashed var(--border); border-radius: var(--card-radius); padding: 14px; text-align: center; color: var(--text2); margin-bottom: 10px; background: var(--surface); }
.ib-drop.is-over { border-color: var(--accent); background: var(--accent-tint); color: var(--accent); }
.ib-group { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text3); margin: 12px 2px 6px; }
.ib-group.is-risk { color: var(--danger-ink); }
.ib-item { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--card-radius); padding: 10px 12px; margin-bottom: 8px; cursor: pointer; color: inherit; box-shadow: var(--shadow-sm); }
.ib-item:hover { box-shadow: var(--shadow-md); }
.ib-item.is-open { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-tint); }
.ib-item.is-risk { border-left: 4px solid var(--danger); }
.ib-item.is-unread .ib-kind::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: middle; }
.ib-item > span { display: block; }
.ib-item-top { display: flex !important; justify-content: space-between; gap: 8px; font-weight: 600; }
.ib-when { font-weight: 400; color: var(--text3); font-size: 12px; white-space: nowrap; }
.ib-item-meta { font-size: 12px; color: var(--text2); overflow-wrap: anywhere; }
.ib-item-chips { margin-top: 4px; }

.ib-view { overflow: hidden; min-width: 0; }
.ib-empty { padding: 48px 24px; text-align: center; color: var(--text2); }
.ib-empty p:first-child { color: var(--text); font-weight: 600; }
.ib-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 46%); height: 100%; }
.ib-doc { display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--surface3); min-height: 0; }
.ib-doc-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text2); }
.ib-pages { overflow: auto; padding: 12px; flex: 1; }
.ib-page { display: block; max-width: 100%; height: auto; margin: 0 auto 12px; background: white; box-shadow: var(--shadow-md); border-radius: 4px; }
.ib-ai { overflow: auto; padding: 14px 16px 24px; background: var(--bg); display: flex; flex-direction: column; gap: 12px; }
.ib-banner { background: var(--warning-tint); color: var(--warning-ink); border: 1px solid var(--warning); border-radius: var(--radius-sm); padding: 8px 12px; font-weight: 600; margin: 0; font-size: 13px; }

/* cards (public/measuresReview.js): small-caps section titles */
.ib-sec { background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--card-radius); box-shadow: var(--shadow-sm); padding: 14px 16px; }
.ib-sec h3 { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text3); margin: 0 0 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ib-sec p { margin: 4px 0; }
.ib-draft { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--warning-tint); color: var(--warning-ink); border: 1px solid var(--warning); border-radius: 20px; padding: 0 7px; }
.ib-crit { border-color: var(--danger); background: var(--danger-tint); }
.ib-crit h3 { color: var(--danger-ink); }
.ib-crit ul { margin: 0; padding-left: 18px; }
.ib-cna { border: 2px solid var(--danger); background: var(--danger-tint); color: var(--danger-ink); }
.ib-cna h3 { color: var(--danger-ink); font-size: 13px; letter-spacing: .06em; }
.ib-triage { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--text2); }
q { color: var(--text2); font-family: ui-monospace, Menlo, monospace; font-size: 12px; quotes: '"' '"'; overflow-wrap: anywhere; }

.ib-table-wrap { overflow-x: auto; }
.ib-values { width: 100%; border-collapse: collapse; font-size: 13px; }
.ib-values th, .ib-values td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ib-values tbody tr:last-child th, .ib-values tbody tr:last-child td { border-bottom: 0; }
.ib-values thead th { font-size: 11px; color: var(--text3); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.ib-values tr.is-crit { background: var(--danger-tint); }
.ib-num { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; text-align: right !important; }
.ib-flag { font-weight: 700; color: var(--warning-ink); }
.ib-ev { font-weight: 400; }
.ib-ev summary { cursor: pointer; color: var(--accent); font-size: 12px; }
.ib-values td:last-child { width: 80px; }
.ib-spark { color: var(--text2); vertical-align: middle; }
.ib-spark-now { fill: var(--accent); stroke: var(--surface); stroke-width: 1; }
.ib-spark-none { font-size: 12px; color: var(--text3); }

.ib-match p { margin: 4px 0; }
.ib-match.is-auto { background: var(--accent-tint); border: 1px solid var(--accent); border-radius: var(--radius-sm); padding: 8px 10px; }
.ib-sug { list-style: none; padding: 0; margin: 6px 0; }
.ib-sug li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ib-new summary { cursor: pointer; font-weight: 600; margin: 8px 0; }
.ib-field { display: block; margin: 8px 0; }
.ib-field > span { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 3px; }
.ib-input { width: 100%; min-height: 36px; padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 13px; }
.ib-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); outline: none; }
.ib-text { min-height: 110px; resize: vertical; }
.ib-dup { background: var(--warning-tint); border: 1px solid var(--warning); border-radius: var(--radius-sm); padding: 8px 10px; margin: 8px 0; }
.ib-dup ul { margin: 4px 0; padding-left: 18px; }
.ib-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ib-confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--warning-tint); border: 1px solid var(--warning); color: var(--warning-ink); border-radius: var(--radius-sm); padding: 8px 10px; margin-top: 8px; }
.ib-notice { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font-weight: 600; }
.ib-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.ib-tasks { padding: 16px 20px; overflow: auto; height: 100%; }
.ib-tasks h2 { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text3); }
.ib-tasks ul { list-style: none; padding: 0; }
.ib-tasks li { background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--card-radius); box-shadow: var(--shadow-sm); padding: 12px 14px; margin-bottom: 8px; }

/* the fax line panel: inline, under the header */
.ib-panel { margin: 12px 20px 0; max-width: 720px; }
.ib-panel[hidden] { display: none; }
.ib-panel h2 { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text3); margin: 0 0 8px; }
.ib-token code { word-break: break-all; background: var(--surface2); padding: 6px 8px; border-radius: 6px; display: block; }

/* the critical alert settings page (public/inbox/alerts.html) */
.al-wrap { max-width: 760px; margin: 0 auto; padding: 20px 16px 48px; display: grid; gap: 14px; }
.al-wrap h1 { font-size: 20px; margin: 4px 0 0; }
.al-lede { color: var(--text2); margin: 0; }
#alBody { display: grid; gap: 14px; }
.al-days { display: flex; flex-wrap: wrap; gap: 6px; }
.al-day { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 999px; padding: 5px 11px; cursor: pointer; background: var(--surface); font-size: 13px; }
.al-day:has(input:checked) { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.al-day input { accent-color: var(--accent); margin: 0; }
.al-times { display: grid; grid-template-columns: repeat(2, minmax(0, 160px)); gap: 10px; }
.al-who { display: grid; gap: 8px; }
.al-choice { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.al-choice label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.al-choice input[type=radio], .al-choice input[type=checkbox] { accent-color: var(--accent); }
.al-choice .ib-input { max-width: 260px; }
.al-status { display: grid; gap: 6px; }
.al-line { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.al-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

@media (max-width: 1000px) {
  .ib-main { grid-template-columns: 1fr; height: auto; }
  .ib-list { border-right: 0; border-bottom: 1px solid var(--border); max-height: 45vh; }
  .ib-split { grid-template-columns: 1fr; height: auto; }
  .ib-doc { max-height: 70vh; border-right: 0; border-bottom: 1px solid var(--border); }
  .ib-view { overflow: visible; }
}
@media (max-width: 640px) {
  .app-header { padding: 0 12px; gap: 10px; height: auto; min-height: var(--app-header-h); flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
  .brand-name { font-size: 21px; }
  .ib-page-title { padding-left: 10px; }
  .header-right { width: 100%; margin-left: 0; justify-content: flex-start; flex-wrap: wrap; }
  .ib-alerts, .ib-msg:not(:empty) { padding-left: 16px; padding-right: 16px; }
  .ib-panel { margin: 12px 16px 0; }
  .ib-list { padding: 10px 16px; }
  .ib-ai { padding: 12px 16px 24px; }
  .al-times { grid-template-columns: 1fr 1fr; }
}

/* the inbox page fills the window: the header, banners and tabs on top, the list and the document below */
.ib-app { height: 100vh; display: flex; flex-direction: column; }
.ib-app .ib-main { flex: 1; min-height: 0; height: auto; }
@media (max-width: 1000px) { .ib-app { height: auto; display: block; } }
