@import url("/static/fonts.css");
/* App shell shared by every page (issue #39): colour tokens, top bar, menu,
   "Ask Paralegal" chat drawer and the page frame.
   Look taken from docs/design/mission-control.html (look only, not its code
   or data). Fonts: IBM Plex is self-hosted (fonts.css, issue #26); the
   system fonts after it in each stack are the fallback.
   Light/dark follows the operating system setting (prefers-color-scheme).
   Yellow (--flag) is kept for "court date within 7 days" on the clients
   pages, so nothing in the shell uses it. */
:root {
  --bg: #EEF1F4; --panel: #FFFFFF; --ink: #16233A; --muted: #5B6778; --line: #D5DBE3; --soft: #F5F7FA;
  --accent: #1F4E8C; --accent-ink: #FFFFFF; --accent-soft: #E3ECF7;
  --flag: #F6E08A; --flag-ink: #5E4700; --ok: #2E7D4F; --ok-soft: #E2F2E8; --bad: #B3261E; --bad-soft: #FBE4E2;
  --ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 8px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1620; --panel: #17212E; --ink: #E6EBF2; --muted: #9AA6B6; --line: #2A3646; --soft: #1C2735;
    --accent: #86ACE3; --accent-ink: #0F1620; --accent-soft: #1F3150;
    --flag: #5A4A12; --flag-ink: #F6E3A0; --ok: #6CC08E; --ok-soft: #173526; --bad: #F08A82; --bad-soft: #3D1D1B;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--ui); font-size: 14px; line-height: 1.5; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
/* Elements given a display value elsewhere must still hide. */
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Top bar --- */
header.top { position: sticky; top: 0; z-index: 5; background: var(--panel); border-bottom: 1px solid var(--line); }
.topin { display: flex; align-items: center; gap: 8px 16px; padding: 10px 16px; max-width: 1280px; margin: 0 auto; flex-wrap: wrap; }
.brand { font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; min-width: 0; margin: 0; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 6px; white-space: nowrap; font-weight: 500; min-height: 36px; display: inline-flex; align-items: center; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current] { background: var(--accent-soft); color: var(--accent); }
.sample { font-family: var(--mono); font-size: 11px; color: var(--muted); background: var(--soft); border: 1px solid var(--line); padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
/* Signed-in person and Sign out go here later (issue #21). Empty for now. */
.account { display: flex; align-items: center; gap: 8px; }
.account:empty { display: none; }
.chatbtn { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 6px; padding: 8px 12px; cursor: pointer; font-weight: 600; white-space: nowrap; }

/* --- Page frame --- */
.page { max-width: 1280px; margin: 0 auto; padding: 16px 16px 48px; }
.page h1 { font-size: 22px; margin: 0 0 6px; font-weight: 600; }
.lead { color: var(--muted); margin: 0; max-width: 70ch; }

/* --- Ask Paralegal chat drawer --- */
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: min(380px, 100%); background: var(--panel); border-left: 1px solid var(--line); z-index: 10; display: flex; flex-direction: column; box-shadow: -8px 0 24px rgba(0, 0, 0, .12); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.drawer-head small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.drawer-btn { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
.drawer-btn:hover { border-color: var(--accent); }
.drawer-btn.pri { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.drawer-btn:disabled { opacity: .5; cursor: not-allowed; }
.msgs { flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 14px; display: grid; gap: 10px; align-content: start; }
.msg { padding: 8px 10px; border-radius: 8px; max-width: 90%; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-user { background: var(--accent); color: var(--accent-ink); justify-self: end; }
.msg-assistant { background: var(--soft); border: 1px solid var(--line); justify-self: start; }
.chat-error { margin: 0; padding: 0 14px 8px; color: var(--bad); font-size: 13px; }
.drawer-form { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); align-items: flex-end; }
.drawer-form textarea { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 8px; background: var(--bg); color: var(--ink); resize: vertical; }

/* Wide screens: while the drawer is open (chat.js sets .chat-open on <html>)
   the page, top bar included, leaves room on the right equal to the drawer
   width, so nothing is covered. Wide tables scroll inside their own box. */
html.chat-open body { padding-right: 380px; }

/* Phone width: the menu wraps onto its own full-width row; nothing is hidden. */
@media (max-width: 600px) {
  .topin { gap: 8px; }
  .nav { order: 5; flex-basis: 100%; }
  .nav a { padding: 6px 10px; }
  .chatbtn { margin-left: auto; }
}

/* Drawer modal width: must equal the matchMedia query in chat.js. Full-screen
   drawer, no reserved page space. */
@media (max-width: 760px) {
  .drawer { width: 100%; border-left: 0; }
  html.chat-open body { padding-right: 0; }
}
