/* Trip expenses: styled to match the Zenith tutor page (printer-monitor/public/tutor):
   navy header with the white Zenith logo and amber rule, Zenith blue actions. */
:root {
  --bg: #f6f7fb; --card: #ffffff; --ink: #0f172a; --muted: #475569; --line: #e5e7eb;
  --brand: #2f4ac0; --brand-ink: #ffffff; --brand-soft: #eef2ff; --brand-100: #dce3fb;
  --nav: #23477d; --nav-ink: #ffffff; --accent: #f59e0b;
  --warn: #8a5a00; --warn-bg: #fef3c7; --bad: #b42318; --bad-bg: #fde7e4; --good: #15803d; --good-bg: #dcfce7;
  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --card: #131c2e; --ink: #e5e9f2; --muted: #94a3b8; --line: #26324a;
    --brand: #7c93f0; --brand-ink: #0b1220; --brand-soft: #1b2647; --brand-100: #24315a;
    --nav: #16305a; --nav-ink: #ffffff; --accent: #fbbf24;
    --warn: #fbbf24; --warn-bg: #3a2c0e; --bad: #f2877b; --bad-bg: #3d1d1a; --good: #4ade80; --good-bg: #0f2e1d;
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 8px; z-index: 30; background: var(--card); color: var(--ink); padding: 8px; border-radius: 8px; }

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

:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }

[hidden] { display: none !important; }

/* Header: navy bar, white logo, amber rule; tabs sit underneath */
.top {
  position: sticky; top: 0; z-index: 5; background: var(--nav); color: var(--nav-ink); border-bottom: 3px solid var(--accent);
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
}
.top-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px 6px; max-width: 560px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.brand img { height: 30px; width: auto; display: block; }
.brand span { padding-left: 10px; border-left: 1px solid rgba(255,255,255,.35); opacity: .95; }
.who { margin-left: auto; font-size: 14px; font-weight: 600; opacity: .95; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.top .btn-plain { color: var(--nav-ink); white-space: nowrap; flex: 0 0 auto; }
.brand { flex: 0 0 auto; white-space: nowrap; }
.who { flex: 0 1 auto; }
.top-row { flex-wrap: nowrap; }
/* Phones: the name does not fit beside logo + label + Log out, so hide it rather than show "K…". */
@media (max-width: 480px) {
  .who { display: none; }
  .top .btn-plain { margin-left: auto; }
}
@media (max-width: 380px) {
  .top-row { padding-left: 12px; padding-right: 8px; gap: 8px; }
  .brand { gap: 8px; font-size: 15px; }
  .brand img { height: 24px; }
  .brand span { padding-left: 8px; }
  .top .btn-plain { padding: 8px 6px; }
}
.top :focus-visible { outline-color: #fff; }
/* Event name: its own row under the brand row so it fits at 320px */
.event-row-top { max-width: 560px; margin: 0 auto; padding: 0 16px; }
.event-btn {
  display: block; width: 100%; min-height: 44px; padding: 6px 12px; margin: 0; text-align: left;
  font: inherit; font-weight: 700; color: var(--nav-ink); background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.3); border-radius: 12px; cursor: pointer; touch-action: manipulation;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.event-btn:hover { background: rgba(255,255,255,.16); }
@media (max-width: 380px) { .event-row-top { padding: 0 12px; } }
nav { display: flex; max-width: 560px; margin: 0 auto; padding: 0 8px; }
nav a {
  flex: 1; display: flex; align-items: center; justify-content: center; min-height: 44px;
  color: var(--nav-ink); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -3px; opacity: .8;
}
nav a[aria-current="page"] { border-bottom-color: var(--accent); opacity: 1; }

main {
  max-width: 560px; margin: 0 auto;
  padding: 16px max(16px, env(safe-area-inset-right, 0px)) 120px max(16px, env(safe-area-inset-left, 0px));
}
main:focus { outline: none; }
@media (max-width: 380px) {
  main { padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
  .card { padding: 14px; }
}

h1 { font-size: 22px; line-height: 1.2; margin: 4px 0 14px; }
h1:focus { outline: none; }
h2 { font-size: 15px; margin: 24px 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
h3 { font-size: 17px; margin: 0; }
p { margin: 8px 0; }

a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.block { display: block; }
.big { font-size: 1.6rem; font-weight: 700; margin: 4px 0; }

/* Buttons: .btn = tutor .btn (brand fill), .btn-secondary = tutor .btn.ghost, .btn-danger = --bad outline */
.btn, .btn-small, .btn-plain, .link, .chip, .seg {
  font: inherit; cursor: pointer; border-radius: 12px; min-height: 44px; touch-action: manipulation;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink);
  font-weight: 700; text-decoration: none; text-align: center;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 30%, transparent);
}
.btn-secondary { background: transparent; color: var(--brand); box-shadow: none; }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--bad); box-shadow: none; }
.btn-wide { display: flex; width: 100%; margin: 8px 0; padding: 12px 22px; font-weight: 800; font-size: 17px; }
.btn-wide.btn-secondary, .btn-wide.btn-plain { font-weight: 700; font-size: 16px; }
.btn:disabled, .btn-small:disabled { opacity: .45; cursor: default; box-shadow: none; }
.btn-small {
  min-width: 44px; padding: 6px 14px; border: 1px solid var(--brand); background: transparent; color: var(--brand); font-weight: 700;
}
.btn-plain {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--brand); padding: 8px 10px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; box-shadow: none;
}
.link {
  background: none; border: none; color: var(--brand); padding: 10px 0; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-align: left;
}
@media (prefers-reduced-motion: no-preference) { .btn, .btn-small, .chip, .seg { transition: background-color .15s, opacity .15s; } }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions .btn { flex: 1 1 140px; }

/* Cards: border + soft shadow */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 12px 0;
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 14px rgba(15,23,42,.05);
}
.card.claim { border-left: 5px solid var(--accent); }
/* Notice-style card (cancelled-claim notices on Home): amber, like .notice.warn */
.card.notice { background: var(--warn-bg); color: var(--warn); border-color: transparent; border-left: 5px solid var(--accent); box-shadow: none; font-size: 15px; }
.card.notice p { margin: 0; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.net { margin: 0; font-weight: 700; }
.status { font-weight: 600; margin: 6px 0; }
.status.muted { font-weight: 400; }
details.card > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }
details.card[open] > summary { margin-bottom: 8px; }
summary { padding: 6px 0; min-height: 44px; }

.paynow { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; }
.num { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }

.lines { list-style: none; padding: 0; margin: 8px 0; }
.lines li {
  display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line);
}
.lines li > :first-child { flex: 1 1 auto; }
.lines .who-owes { flex: 0 0 auto !important; color: var(--muted); }  /* also the "Refund:" label */
.lines .amt { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }

.plain { padding-left: 20px; }
.even { margin: 16px 0; color: var(--muted); }

.badge { display: inline-block; background: var(--brand-soft); color: var(--brand); padding: 2px 10px; border-radius: 999px; font-weight: 600; }
.warn { background: var(--warn-bg); color: var(--warn); padding: 12px 14px; border-radius: 12px; font-size: 15px; }
.error { background: var(--bad-bg); color: var(--bad); padding: 12px 14px; border-radius: 12px; font-size: 15px; font-weight: 600; }

/* Lists */
.rows { list-style: none; margin: 0; padding: 0; }
.row-link {
  display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; margin: 8px 0; min-height: 44px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; color: inherit; text-decoration: none;
}
.row-main, .row-side { display: flex; flex-direction: column; }
.row-main { min-width: 0; }
.row-side { text-align: right; white-space: nowrap; }

.history { list-style: none; padding: 0; margin: 8px 0; }
.history li { display: flex; flex-direction: column; padding: 8px 0; border-top: 1px solid var(--line); }
.history-box { margin-top: 24px; }

.photo img { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); margin-top: 8px; }

/* Forms: fields stay >= 16px so iOS does not zoom */
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack > h2 { margin-bottom: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-weight: 600; font-size: 14px; }
label { font-weight: 600; }
input, select, textarea {
  font: inherit; font-size: max(16px, 1em); min-height: 44px; padding: 10px 14px; width: 100%;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink);
}
input[readonly] { opacity: .8; }
input[type=file] { padding: 8px 10px; }
input[type=file]:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 359px) { .grid2 { grid-template-columns: 1fr; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border: 1px solid var(--brand); background: transparent; color: var(--brand); border-radius: 999px; font-weight: 600;
}
.chip[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.chip[aria-pressed="true"]::before { content: "✓ "; }

/* Segmented control: tutor .seg (aria-pressed = brand fill) */
.segmented {
  display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px;
}
.seg { flex: 1; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font-weight: 600; padding: 6px 8px; }
.seg[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }

.items { display: flex; flex-direction: column; gap: 10px; }
.item { border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 12px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.item-top { display: flex; gap: 8px; }
.item-top .grow { flex: 1 1 auto; }
.item-top .amt-field { flex: 0 0 8.5rem; }
.item > .btn-small { align-self: flex-end; }

.checks { display: flex; gap: 20px; margin: 8px 0; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 400; }
.check input { width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--brand); }

.rate { display: grid; grid-template-columns: 5rem 1fr auto; gap: 8px; align-items: end; margin: 8px 0; }

.preview { background: var(--brand-soft); border-radius: var(--radius); padding: 12px 14px; }
.preview:empty { display: none; }
.preview h3 { margin-bottom: 4px; }
.total { margin: 4px 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(200%);
  background: var(--nav); color: #fff; padding: 12px 16px; border-radius: 12px; max-width: calc(100% - 32px);
  box-shadow: 0 4px 14px rgba(15,23,42,.25); transition: transform 0.2s; z-index: 20;
}
.toast.show { transform: translateX(-50%) translateY(0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* Events and members */
.closed-banner { margin: 0 0 12px; font-weight: 600; }
button.row-link { width: 100%; font: inherit; text-align: left; cursor: pointer; align-items: center; }
button.row-link[aria-current="true"] { border-color: var(--brand); }
.plain-list { list-style: none; margin: 0; padding: 0; }
.event-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.event-item:first-child { border-top: 0; }
.event-item .row-main { flex: 1 1 auto; }
.btn-small.btn-danger { color: var(--bad); border-color: var(--bad); }
textarea { min-height: 9rem; resize: vertical; }
.check-row { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.check-row:first-child { border-top: 0; }
.check-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.check-row.skipped, .check-row.skipped strong { color: var(--muted); }
.check-row p { margin: 0; }
.tag {
  display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line); vertical-align: middle;
}
