:root {
  --brand: #0b5d4e;
  --brand-pressed: #084236;
  --brand-soft: #e1f0eb;
  --ink: #101917;
  --ink-muted: #4a5855;
  --canvas: #f3f5f4;
  --surface: #ffffff;
  --line: #d9e0de;
  --danger: #b42318;
  --danger-soft: #fce1dd;
  --danger-pressed: #8f1c13;
  --waiting: #8a4b04;
  --waiting-soft: #fcebcb;
  --success: #166534;
  --success-soft: #d9f3e1;
  --neutral-soft: #e6e9ed;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 17px; margin: 0; }
a { color: var(--brand); }
.layout { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 12px; display: flex; flex-direction: column; gap: 4px; }
.sidebar .brand { font-weight: 700; font-size: 17px; padding: 4px 12px 16px; }
.sidebar a { padding: 9px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 500; }
.sidebar a.active { background: var(--brand-soft); color: var(--brand-pressed); }
.sidebar .spacer { flex: 1; }
.sidebar .who { padding: 4px 12px; }
.main { padding: 28px 32px; display: flex; flex-direction: column; gap: 20px; max-width: 1180px; width: 100%; min-width: 0; }
/* A wide table scrolls inside its card rather than widening the page. */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; overflow-x: auto; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.stat strong { display: block; font-size: 28px; margin-top: 4px; }
.muted { color: var(--ink-muted); }
/* Rails renders form.submit as <input type="submit">, so each rule names both.
   input[type="submit"] also has to outrank the plain input rule below. */
button, input[type="submit"], .button { font: inherit; font-weight: 600; min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1.5px solid var(--brand); background: var(--brand); color: #fff; cursor: pointer; }
button:hover:not(:disabled), input[type="submit"]:hover:not(:disabled) { background: var(--brand-pressed); }
button:disabled, input[type="submit"]:disabled { opacity: 0.5; cursor: not-allowed; }
button.secondary, input[type="submit"].secondary { background: var(--surface); color: var(--brand); }
button.secondary:hover:not(:disabled), input[type="submit"].secondary:hover:not(:disabled) { background: var(--brand-soft); }
button.danger, input[type="submit"].danger { background: var(--danger); border-color: var(--danger); }
button.danger:hover:not(:disabled), input[type="submit"].danger:hover:not(:disabled) { background: var(--danger-pressed); border-color: var(--danger-pressed); }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
input, select, textarea { font: inherit; min-height: 40px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 13px; color: var(--ink-muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
.badge { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 600; background: var(--neutral-soft); }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.waiting { background: var(--waiting-soft); color: var(--waiting); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.alert { border-radius: 8px; padding: 10px 12px; background: var(--danger-soft); color: var(--danger); font-weight: 500; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: 100%; max-width: 380px; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dt { color: var(--ink-muted); }
dd { margin: 0; }
form.inline { display: inline; }
.notice { border-radius: 8px; padding: 10px 12px; background: var(--success-soft); color: var(--success); font-weight: 500; }
.button-link { background: none; border: none; color: var(--brand); padding: 0; min-height: 0; text-decoration: underline; font-weight: 500; }
.button-link:hover:not(:disabled) { background: none; color: var(--brand-pressed); }

/* Phones and narrow windows: the sidebar becomes a wrapping bar at the top. */
@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; border-right: none; border-bottom: 1px solid var(--line); }
  .sidebar .brand { width: 100%; padding: 4px 12px 8px; }
  .sidebar .spacer { display: none; }
  .sidebar .who { margin-left: auto; }
  .main { padding: 20px 16px; }
  th, td { white-space: nowrap; }
}
