/* Reimburse Buddy — one design layer for every screen.
 *
 * Tokens first, then layout, then components. Page-specific sections (login, Q&A, plan
 * confirmation) are part of this file: there is no second stylesheet.
 */

:root {
  color-scheme: light;

  --ink: #161b22;
  --muted: #5b6573;
  --line: #dfe3ea;
  --line-strong: #c3cad5;
  --control-line: #8a93a3;
  --surface: #ffffff;
  --surface-2: #f1f3f7;
  --bg: #f5f6f9;

  --brand: #1a5fb4;
  --brand-hover: #154e95;
  --brand-ink: #ffffff;
  --brand-soft: #eaf1fb;

  --success: #1c6b3f;
  --success-soft: #e3f4ea;
  --warn: #8a5300;
  --warn-soft: #fff3dc;
  --danger: #a3232b;
  --danger-soft: #fdeaea;
  --focus: #1a5fb4;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.08);

  --header-h: 65px; /* sticky site header: 44px links + 2 x 10px padding + 1px border */
  --summary-line-h: 64px; /* the one-line sticky summary on the finance claim page */
  --page-max: 1100px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 var(--sp-3);
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1.25rem;
}

h3 {
  font-size: 1.0625rem;
}

p {
  margin: 0 0 var(--sp-3);
}

main p {
  max-width: 72ch;
}

time {
  white-space: nowrap;
}

a {
  color: var(--brand);
  text-underline-offset: 2px;
}

img,
pre {
  max-width: 100%;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: var(--sp-3);
  border-radius: var(--r-sm);
  margin: var(--sp-1) 0;
  font-family: var(--mono);
  font-size: 0.85rem;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--sp-5) 0;
}

/* --- layout ------------------------------------------------------------------ */

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--brand);
  color: var(--brand-ink);
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 8px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 10px 16px;
  font-size: 0.95rem;
}

nav .brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: var(--ink);
  text-decoration: none;
}

nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  padding: 0 10px;
  border-radius: var(--r-sm);
}

nav a:hover {
  background: var(--surface-2);
}

nav a[aria-current="page"] {
  color: var(--brand);
  background: var(--brand-soft);
  font-weight: 600;
}

.nav-toggle {
  display: none;
}

.nav-toggle-label {
  display: none;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid var(--control-line);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 0.95rem;
}

#nav-toggle:focus-visible + .nav-toggle-label {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1);
}

.nav-account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}

.nav-account form {
  margin: 0;
}

.nav-account button {
  min-height: 44px;
  padding: 4px 12px;
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  .nav-toggle {
    display: block;
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  .nav-toggle-label {
    display: inline-flex;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    flex-basis: 100%;
    padding-top: var(--sp-2);
  }

  #nav-toggle:checked ~ .nav-links {
    display: flex;
  }

  .nav-account {
    flex: 1 1 100%;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    padding-top: var(--sp-2);
  }
}

main {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--sp-5) 16px var(--sp-6);
}

main:focus {
  outline: none;
}

.site-footer {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 16px var(--sp-5);
}

/* --- type helpers ------------------------------------------------------------ */

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

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

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

.demo {
  background: var(--warn-soft);
  border: 1px dashed var(--warn);
  padding: var(--sp-2);
  border-radius: var(--r-sm);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- surfaces ---------------------------------------------------------------- */

.card,
.box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin: 0 0 var(--sp-4);
  box-shadow: var(--shadow-sm);
}

.card h2:last-child,
.box h2:last-child {
  margin-bottom: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--sp-4);
  margin: 0 0 var(--sp-4);
}

.cards .card {
  margin: 0;
}

.cards .card label {
  display: block;
  font-size: 0.85rem;
  margin-top: var(--sp-1);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.page-head h1 {
  margin: 0;
}

.page-head .sub {
  color: var(--muted);
  margin: var(--sp-1) 0 0;
}

.page-head .actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-left: auto;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-3);
  margin: 0 0 var(--sp-4);
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-sm);
}

.stat .label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat .value {
  font-size: 1.45rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.stat .hint {
  color: var(--muted);
  font-size: 0.8rem;
}

.stat[data-tone="warn"] .value {
  color: var(--warn);
}

.stat[data-tone="danger"] .value {
  color: var(--danger);
}

.stat[data-tone="success"] .value {
  color: var(--success);
}

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  padding: var(--sp-5);
  text-align: center;
  color: var(--muted);
  background: var(--surface);
}

.empty p {
  margin: 0 0 var(--sp-3);
}

.item-list {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  margin: 0 0 var(--sp-4);
}

.item-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
}

.item-card .item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
}

.item-card .amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.item-card form {
  margin: 0;
}

.item-card .btn-row {
  margin-top: auto;
  padding-top: var(--sp-2);
}

.item-card details {
  margin: 0;
}

.item-card .item-title {
  font-weight: 600;
}

.item-card ul {
  margin: 0;
  padding-left: 18px;
}

/* The summary section has no box of its own: its one-line bar sticks under the site header while the
   rest scrolls with the page (ADR 0009 #6). */
.claim-summary {
  display: contents;
}

.claim-summary .summary-line {
  position: sticky;
  top: var(--header-h);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
  align-items: center;
  min-height: var(--summary-line-h);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: var(--sp-2) var(--sp-4);
  margin: 0 0 var(--sp-3);
}

.claim-summary .summary-id {
  white-space: nowrap;
}

.claim-summary .summary-money {
  flex: 1 1 12rem; /* shrinks and wraps its own text, so the bar stays one row */
  min-width: 0;
  font-size: 0.95rem;
}

.claim-summary .summary-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--sp-2);
}

.claim-summary .summary-actions form {
  margin: 0;
}

.claim-summary .summary-rest {
  margin: 0 0 var(--sp-4);
}

.claim-summary h2 {
  margin-bottom: var(--sp-1);
}

.claim-summary p {
  margin-bottom: var(--sp-1);
}

/* Every anchor target clears the sticky header (and, on the finance claim page, the summary bar). */
[id^="card-"],
[id^="item-"],
#draft-cards,
#claim-items {
  scroll-margin-top: calc(var(--header-h) + var(--sp-3));
}

.sticky-offset [id^="item-"],
#claim-items {
  scroll-margin-top: calc(var(--header-h) + var(--summary-line-h) + var(--sp-3));
}

@media (max-width: 720px) {
  .claim-summary .summary-line {
    position: static;
  }

  .sticky-offset [id^="item-"],
  #claim-items {
    scroll-margin-top: calc(var(--header-h) + var(--sp-3));
  }
}

.alert {
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--r-sm);
  padding: var(--sp-3) var(--sp-4);
  margin: 0 0 var(--sp-4);
  background: var(--brand-soft);
}

.alert[data-tone="success"] {
  border-left-color: var(--success);
  background: var(--success-soft);
}

.alert[data-tone="warn"] {
  border-left-color: var(--warn);
  background: var(--warn-soft);
}

.alert[data-tone="danger"] {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

/* --- tags and badges --------------------------------------------------------- */

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
  margin: 1px 2px 1px 0;
}

.tag.ok {
  background: var(--success-soft);
  border-color: #b9dfc8;
  color: var(--success);
}

.tag.warn,
.tag.low {
  background: var(--warn-soft);
  border-color: #ecd39a;
  color: var(--warn);
}

.tag.bad {
  background: var(--danger-soft);
  border-color: #efc2c2;
  color: var(--danger);
}

.tag.info {
  background: var(--brand-soft);
  border-color: #c4d8f2;
  color: var(--brand);
}

.tag.low {
  outline: 1px solid #e0a800;
}

.badge {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.75rem;
  line-height: 20px;
  text-align: center;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

/* --- buttons ----------------------------------------------------------------- */

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--control-line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

button:hover,
.btn:hover {
  background: var(--surface-2);
}

button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.primary,
button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
  font-weight: 600;
}

.btn.primary:hover,
button.primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

.btn.quiet-danger,
button.quiet-danger {
  color: var(--danger);
  border-color: #e5b5b8;
  background: var(--surface);
}

.btn.quiet-danger:hover,
button.quiet-danger:hover {
  background: var(--danger-soft);
}

.btn.block,
button.block {
  width: 100%;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
  margin: var(--sp-2) 0;
}

/* --- forms ------------------------------------------------------------------- */

label {
  font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
input:not([type]),
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--control-line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

input[type="file"] {
  max-width: 100%;
}

table a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.field {
  display: block;
  margin: 0 0 var(--sp-3);
}

.field > .label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.field .hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 4px;
}

.field.invalid input,
.field.invalid select,
.field.invalid textarea {
  border-color: var(--danger);
}

.filter {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-3);
}

.filter label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0;
}

.filter select {
  width: auto;
  min-width: 180px;
}

/* --- tables ------------------------------------------------------------------ */

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  margin: 0 0 var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.94rem;
}

caption {
  text-align: left;
  padding: var(--sp-3) var(--sp-4) 0;
  color: var(--muted);
  font-size: 0.85rem;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-2);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fafbfd;
}

@media (max-width: 720px) {
  table.responsive thead {
    display: none;
  }

  table.responsive,
  table.responsive tbody,
  table.responsive tr,
  table.responsive td {
    display: block;
    width: 100%;
  }

  table.responsive tr {
    border-bottom: 1px solid var(--line);
    padding: var(--sp-2) var(--sp-3);
  }

  table.responsive tr:last-child {
    border-bottom: 0;
  }

  table.responsive td {
    display: grid;
    grid-template-columns: minmax(88px, 36%) minmax(0, 1fr);
    gap: var(--sp-3);
    align-items: start;
    border: 0;
    padding: 4px 0;
    text-align: left;
    white-space: normal;
  }

  table.responsive td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }

  table.responsive td > .cell {
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: right;
  }

  table.responsive td[data-label=""] {
    display: block;
  }

  table.responsive td[data-label=""]::before {
    content: none;
  }

  table.responsive td[data-label=""] > .cell {
    text-align: left;
  }

  table.responsive td > .cell:empty {
    display: none;
  }

  table.responsive td .chips {
    justify-content: flex-end;
  }

  /* The plan confirmation card holds a definition table and a nested per-person table. */
  .card table:not(.responsive) tr,
  .card table:not(.responsive) th[scope="row"],
  .card table:not(.responsive) td {
    display: block;
    width: 100%;
  }

  .card table:not(.responsive) th[scope="row"],
  .card table:not(.responsive) td {
    border: 0;
    padding: 2px 0;
    background: none;
  }

  .card table:not(.responsive) th[scope="row"] {
    color: var(--muted);
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: normal;
  }

  .card table:not(.responsive) table tr {
    display: flex;
    justify-content: space-between;
    gap: var(--sp-3);
  }

  .card table:not(.responsive) table td {
    display: block;
    width: auto;
    padding: 4px 0;
  }

  .card table:not(.responsive) table td:last-child {
    text-align: right;
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  .card table:not(.responsive) table tr {
    display: block;
    padding: 6px 0;
  }

  .card table:not(.responsive) table td,
  .card table:not(.responsive) table td:last-child {
    display: block;
    width: 100%;
    text-align: left;
  }
}

@media (max-width: 360px) {
  h1 {
    font-size: 1.5rem;
  }
}

/* --- disclosure / stepper ---------------------------------------------------- */

details {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: var(--sp-2) var(--sp-3);
  margin: var(--sp-2) 0;
  background: var(--surface);
}

details > summary {
  cursor: pointer;
  font-weight: 600;
}

details > summary + * {
  margin-top: var(--sp-2);
}

.stepper {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  list-style: none;
  padding: 0;
  margin: 0 0 var(--sp-4);
  counter-reset: step;
}

.stepper li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.stepper li::before {
  counter-increment: step;
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--control-line);
  background: var(--surface);
  font-size: 0.8rem;
  font-weight: 700;
}

.stepper li[aria-current="step"] {
  color: var(--ink);
  font-weight: 600;
}

.stepper li[aria-current="step"]::before {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

.stepper li[data-done="true"]::before {
  content: "✓";
  background: var(--success-soft);
  border-color: #b9dfc8;
  color: var(--success);
}

/* --- drop zone --------------------------------------------------------------- */

.drop {
  display: block;
  border: 2px dashed var(--control-line);
  border-radius: var(--r-lg);
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
  margin: var(--sp-3) 0;
  background: var(--surface);
  cursor: pointer;
}

.drop:hover,
.drop.over {
  border-color: var(--brand);
  background: var(--brand-soft);
}

/* --- login ------------------------------------------------------------------- */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  background: radial-gradient(1200px 600px at 50% -10%, #e8effa 0%, var(--bg) 55%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-md);
}

.login-card h1 {
  font-size: 1.4rem;
  margin: 0 0 2px;
}

.login-card .sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 var(--sp-4);
}

.login-card label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin: var(--sp-3) 0 6px;
}

.pw-row {
  display: flex;
  gap: var(--sp-2);
}

.pw-row input {
  flex: 1;
  min-width: 0;
}

.pw-row button {
  min-width: 96px;
  padding: 0 10px;
  font-size: 0.9rem;
}

.login-card .submit {
  width: 100%;
  margin-top: var(--sp-4);
}

.login-card .try-demo {
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line);
  text-align: center;
}

.login-card .try-demo .btn {
  display: block;
}

.login-card .try-demo .note {
  margin: var(--sp-2) 0 0;
}

.login-error {
  background: var(--danger-soft);
  color: #7f1d22;
  border: 1px solid #f1aeb5;
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 0.9rem;
  margin: 0 0 var(--sp-2);
}

/* Demo banner (ADR 0013): one thin line above everything while the picker is on. */
.demo-banner {
  background: var(--warn-soft);
  color: var(--warn);
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
  text-align: center;
  padding: 4px var(--sp-3);
}

/* The picker shell is a flex row, so the strip is pinned to the top there. */
.login-shell .demo-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
}

/* --- demo profile picker (ADR 0012) ------------------------------------------ */

/* Same shell as the login card, but wider and aligned to the top: the picker is a page, not a card. */
.demo-shell {
  align-items: flex-start;
  padding: calc(var(--sp-5) + 28px) var(--sp-4) var(--sp-5);
}

.demo-picker {
  width: 100%;
  max-width: 1040px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-md);
}

.demo-picker h1 {
  font-size: 1.5rem;
  margin: 0 0 4px;
}

.demo-picker .sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 var(--sp-4);
}

/* One column at 375 px, two rows at most on a 1080p screen: the track is fluid, never a fixed width. */
.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-3);
  list-style: none;
  margin: 0 0 var(--sp-4);
  padding: 0;
}

.demo-card {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.demo-card:hover,
.demo-card:focus-within {
  border-color: var(--brand);
  box-shadow: var(--shadow-sm);
}

.demo-card form {
  display: flex;
  flex: 1;
}

.demo-card-button {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  padding: var(--sp-3);
  background: none;
  border: 0;
  border-radius: var(--r-md);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.demo-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: var(--sp-2);
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.demo-name {
  font-weight: 600;
}

.demo-dept,
.demo-role-note {
  color: var(--muted);
  font-size: 0.85rem;
}

.demo-role {
  display: inline-block;
  margin: var(--sp-1) 0;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 600;
}

.demo-legend {
  margin: 0 0 var(--sp-4);
  padding: var(--sp-3);
  background: var(--surface-2);
  border-radius: var(--r-md);
}

.demo-legend h2 {
  font-size: 0.9rem;
  margin: 0 0 var(--sp-2);
}

.demo-legend ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.demo-email {
  border-top: 1px solid var(--line);
  padding-top: var(--sp-3);
}

.demo-email summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.demo-email label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin: var(--sp-3) 0 6px;
}

.demo-email .submit {
  width: 100%;
  margin-top: var(--sp-4);
}

@media (max-width: 480px) {
  .demo-picker {
    padding: var(--sp-4);
  }

  .demo-grid {
    grid-template-columns: 1fr;
  }
}

/* --- plan confirmation ------------------------------------------------------- */

.notice {
  background: var(--warn-soft);
  border: 2px solid #e08a00;
  border-radius: var(--r-md);
  padding: 10px 14px;
  margin: 10px 0;
}

.assume {
  background: var(--brand-soft);
  border-left: 4px solid var(--brand);
  padding: 6px 10px;
  margin: 6px 0;
}

.assume-badge {
  background: var(--brand-soft);
  border: 1px solid var(--brand);
  color: #1d4f91;
}

.influenced {
  background: var(--danger-soft);
  outline: 2px solid #d33;
}

.sentence {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
}

.decision {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin: var(--sp-2) 0;
}

.decision label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid var(--control-line);
  border-radius: var(--r-sm);
  font-size: 0.95rem;
  background: var(--surface);
  cursor: pointer;
}

.decision label:hover {
  background: var(--surface-2);
}

.decision label input {
  margin-right: 6px;
}

.done {
  background: var(--success-soft);
}

.rej {
  background: var(--danger-soft);
}

.expired {
  background: var(--danger-soft);
  border: 2px solid var(--danger);
  border-radius: var(--r-md);
  padding: 10px 14px;
  margin: 10px 0;
}

.submit-bar {
  position: sticky;
  bottom: 0;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
  justify-content: flex-end;
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  margin: var(--sp-4) 0 0;
  box-shadow: 0 -6px 16px rgba(16, 24, 40, 0.08);
  backdrop-filter: blur(8px);
}

.submit-bar .counts {
  margin-right: auto;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.submit-spacer {
  height: 72px;
}

.draft-add {
  margin: var(--sp-3) 0;
}

.draft-bar {
  position: sticky;
  bottom: 0;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  margin: var(--sp-3) 0 0;
  box-shadow: 0 -6px 16px rgba(16, 24, 40, 0.08);
  backdrop-filter: blur(8px);
}

.draft-bar .bar-summary {
  margin: 0 auto 0 0;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.draft-spacer {
  height: 72px;
}

.file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
}

.manage {
  margin-top: var(--sp-2);
}

.manage-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
}

.manage-row select {
  width: auto;
  max-width: 220px;
}

.cat-field[hidden] {
  display: none;
}

.cards .card label.cat-field[hidden] {
  display: none;
}

.amount-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.amount-field .prefix {
  font-weight: 600;
  color: var(--muted);
}

.amount-field input {
  flex: 1;
  min-width: 0;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

.file-row .err {
  flex-basis: 100%;
}

.file-preview {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.thumb {
  display: block;
  max-height: 120px;
  width: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}

.doc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.date-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-2);
  margin: var(--sp-2) 0;
}

.date-row label {
  display: block;
}

tr:target {
  background: var(--brand-soft);
}

.claims-compact {
  display: none;
  list-style: none;
  margin: 0 0 var(--sp-4);
  padding: 0;
}

.claim-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  margin-bottom: var(--sp-2);
  overflow-wrap: anywhere;
}

.claim-card .line1 a {
  font-weight: 600;
}

.claim-card .line2,
.claim-card .line3 {
  margin-top: 2px;
}

.claims-wide td:first-child a {
  white-space: nowrap;
}

@media (max-width: 720px) {
  .claims-wide {
    display: none;
  }

  .claims-compact {
    display: block;
  }
}

.upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}

.file-pick {
  position: relative;
}

.file-pick:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.upload .file-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.picked {
  list-style: none;
  padding: 0;
  margin: 4px 0;
}

.picked li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}

.picked li .err {
  margin-left: auto;
}

@media (min-width: 480px) {
  .date-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .draft-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 8px;
  }

  .draft-bar .bar-summary {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 0.82rem;
  }

  .draft-bar button {
    width: 100%;
    padding: 0 10px;
    font-size: 0.85rem;
    white-space: nowrap;
  }
}

/* --- employee Q&A ------------------------------------------------------------ */

.qa {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  margin: var(--sp-4) 0;
  background: var(--surface);
  max-width: 100%;
}

.qa h2 {
  margin: 0;
}

.qa-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-1) var(--sp-3);
  margin-bottom: var(--sp-1);
}

.qa-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-3);
}

.qa-meta form.new {
  margin: 0;
}

.qa button.ghost {
  background: none;
  border: 0;
  box-shadow: none;
  padding: 2px var(--sp-2);
  min-height: 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--brand);
  border-radius: var(--r-sm);
  cursor: pointer;
}

.qa button.ghost:hover {
  background: var(--brand-soft);
  color: var(--brand-hover);
}

.qa-log {
  max-height: min(55vh, 480px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--sp-2);
  margin: var(--sp-2) 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.qa .q {
  align-self: flex-end;
  max-width: 85%;
  background: var(--brand);
  color: var(--brand-ink);
  border-radius: 14px 14px 2px 14px;
  padding: 6px 12px;
  overflow-wrap: anywhere;
}

.qa .a {
  align-self: flex-start;
  max-width: 92%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px 14px 14px 2px;
  padding: 8px 12px;
}

.qa .src {
  align-self: flex-start;
  font-size: 0.78rem;
  color: var(--muted);
  margin: -2px 0 6px 4px;
  overflow-wrap: anywhere;
}

.qa .refused {
  border-color: #e08a00;
  background: var(--warn-soft);
}

.qa .hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: var(--sp-1);
}

.qa form.ask {
  display: flex;
  gap: var(--sp-2);
  margin: var(--sp-2) 0 0;
}

.qa form.ask input[type="text"] {
  flex: 1;
  min-width: 0;
}

.qa form.quick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin: var(--sp-2) 0 0;
}

.qa .chips-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.qa form.quick button {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px var(--sp-3);
  min-height: 0;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: none;
  cursor: pointer;
}

.qa form.quick button:hover:not([disabled]) {
  background: var(--brand-soft);
  border-color: var(--brand);
}

.qa button[disabled] {
  opacity: 0.6;
  cursor: wait;
}

.qa .quota {
  font-size: 0.85rem;
  color: var(--muted);
}

.qa p.quota {
  margin: var(--sp-1) 0;
}

.qa .quota.limit {
  color: var(--warn);
  font-weight: 600;
}

/* --- focus and motion -------------------------------------------------------- */

a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,label:focus-visible,summary:focus-visible{outline:3px solid #1a5fb4;outline-offset:2px}

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

/* --- dark theme -------------------------------------------------------------- */

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --ink: #e7ebf2;
    --muted: #a2abba;
    --line: #2b3240;
    --line-strong: #3d4657;
    --control-line: #7d8aa0;
    --surface: #171c25;
    --surface-2: #1f2631;
    --bg: #0f1319;

    --brand: #6ea8f5;
    --brand-hover: #8bbcf7;
    --brand-ink: #0b1118;
    --brand-soft: #1b2a40;

    --success: #6fce97;
    --success-soft: #16301f;
    --warn: #e5b45f;
    --warn-soft: #2f2513;
    --danger: #f08a8f;
    --danger-soft: #341a1c;
    --focus: #8bbcf7;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  }

  .site-header {
    background: rgba(23, 28, 37, 0.94);
  }

  .submit-bar {
    background: rgba(23, 28, 37, 0.97);
  }

  .draft-bar {
    background: rgba(23, 28, 37, 0.97);
  }

  tbody tr:hover {
    background: #1d2430;
  }

  .login-shell {
    background: radial-gradient(1200px 600px at 50% -10%, #1a2433 0%, var(--bg) 55%);
  }

  .tag.ok {
    border-color: #2c5a3c;
  }

  .tag.warn,
  .tag.low {
    border-color: #5a4a22;
  }

  .tag.bad {
    border-color: #5a2a2d;
  }

  .tag.info {
    border-color: #2f4a70;
  }

  .login-error {
    border-color: #6b2f33;
  }

  .table-wrap,
  .drop {
    background: var(--surface);
  }
}

/* --- ADR 0009 ----------------------------------------------------------------------------- */
a.tag {
  text-decoration: underline;
}

.evidence-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin: var(--sp-2) 0;
}

.evidence-thumb {
  display: block;
  max-width: 96px;
  max-height: 96px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.evidence-pdf {
  display: inline-block;
  padding: var(--sp-1) var(--sp-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 700;
}

.ask-form {
  display: grid;
  gap: var(--sp-2);
  margin: var(--sp-2) 0;
}

.ask-form label {
  display: grid;
  gap: var(--sp-1);
}

.ask-form textarea,
.ask-form input {
  width: 100%;
  font: inherit;
}
