/* The portal's only stylesheet (portal pages ship no JavaScript and no inline style). */

:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2129;
  --muted: #5d6673;
  --border: #d9dde3;
  --accent: #1f5fbf;
  --accent-text: #ffffff;
  --error: #b42318;
  --radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151a;
    --surface: #1b2028;
    --text: #e6e9ee;
    --muted: #9aa3af;
    --border: #2e3540;
    --accent: #6ea2f0;
    --accent-text: #0d1117;
    --error: #f97066;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); }

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.signout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.who {
  color: var(--muted);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.address { overflow-wrap: anywhere; }

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card.narrow { max-width: 480px; margin: 0 auto; }

h1 { font-size: 1.375rem; margin: 0 0 12px; }

label { display: block; font-weight: 600; margin: 16px 0 4px; }

input[type="email"],
input[type="text"],
textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

button {
  margin-top: 16px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}

.link-button {
  margin: 0;
  padding: 0;
  font-weight: 400;
  color: var(--accent);
  background: none;
  text-decoration: underline;
}

.error { color: var(--error); font-weight: 600; }

.muted { color: var(--muted); font-size: 0.875rem; }

.client-list { list-style: none; margin: 0; padding: 0; }

.client-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }

.client-list li:last-child { border-bottom: 0; }

h2 { font-size: 1.125rem; margin: 24px 0 8px; }

.doc-list,
.count-list { list-style: none; margin: 0; padding: 0; }

.doc-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.doc-list li:last-child { border-bottom: 0; }

.doc-title { font-weight: 600; overflow-wrap: anywhere; }

.count-list li { padding: 6px 0; }

.count {
  display: inline-block;
  min-width: 2.5em;
  margin-right: 8px;
  padding: 2px 8px;
  font-weight: 600;
  text-align: center;
  color: var(--accent-text);
  background: var(--accent);
  border-radius: 999px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* --- Q&A pages: one calm reading column --- */

:root {
  --open-bg: #fff4e5;
  --open-text: #7a4100;
  --open-border: #f0c48a;
  --closed-bg: #e8f5ec;
  --closed-text: #1e5b32;
  --closed-border: #a8d5b6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --open-bg: #3a2a12;
    --open-text: #f7c983;
    --open-border: #6b4a1c;
    --closed-bg: #15301f;
    --closed-text: #93d6a8;
    --closed-border: #2c5a3b;
  }
}

.card.reading { max-width: 760px; margin: 0 auto; }

.crumbs { margin: 0 0 12px; color: var(--muted); font-size: 0.875rem; overflow-wrap: anywhere; }

.subnav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  margin: 16px 0;
}

.subnav a { display: inline-block; padding: 10px 0; }

a.button-link {
  padding: 10px 16px;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border-radius: var(--radius);
  text-decoration: none;
}

.qa-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0 12px;
  align-items: end;
  margin-bottom: 12px;
}

.qa-filters label { margin-top: 8px; }

.qa-filters button { margin-top: 8px; width: 100%; }

input[type="search"],
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

textarea { min-height: 10em; resize: vertical; }

input[type="file"] { width: 100%; padding: 8px 0; font: inherit; }

button { min-height: 44px; }

.qa-list { list-style: none; margin: 0; padding: 0; }

.qa-list li { padding: 14px 0; border-bottom: 1px solid var(--border); }

.qa-list li:last-child { border-bottom: 0; }

.qa-title { display: block; font-weight: 600; overflow-wrap: anywhere; }

.qa-id { font-weight: 700; font-variant-numeric: tabular-nums; }

.qa-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.tag {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.pill {
  display: inline-block;
  padding: 1px 10px;
  font-weight: 600;
  border: 1px solid;
  border-radius: 999px;
}

.pill-open { color: var(--open-text); background: var(--open-bg); border-color: var(--open-border); }

.pill-closed { color: var(--closed-text); background: var(--closed-bg); border-color: var(--closed-border); }

.flag {
  display: inline-block;
  padding: 1px 8px;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}

.prose { white-space: pre-wrap; overflow-wrap: anywhere; }

.facts { margin: 16px 0; }

.facts dt { margin-top: 10px; font-weight: 600; }

.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }

.plain { margin: 0; padding-left: 1.2em; }

.outcome {
  margin: 12px 0;
  padding: 4px 0 4px 12px;
  border-left: 3px solid var(--accent);
}

.outcome h2 { margin-top: 4px; }

.reply {
  margin: 24px 0;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.reply h2 { margin-top: 0; }

.choice { margin: 12px 0 0; padding: 0; border: 0; }

.choice legend { padding: 0; font-weight: 600; }

label.inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 0 20px 0 0;
  font-weight: 400;
}

.notice {
  margin: 12px 0 0;
  padding: 10px 12px;
  font-size: 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.submission { padding: 16px 0; border-top: 1px solid var(--border); }

.submission:target { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 2px; }

.submission-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-size: 0.875rem;
  color: var(--muted);
}

.submission-head strong { color: var(--text); font-size: 1rem; }

.attachments { margin: 8px 0; padding-left: 1.2em; overflow-wrap: anywhere; }

.attachments li { padding: 4px 0; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.pager a { display: inline-block; padding: 10px 0; }
