:root {
  --bg: #f6f7f8;
  --surface: #ffffff;
  --border: #e3e6ea;
  --text: #1c2228;
  --muted: #66707a;
  /* AyeSay teal (#30C1BF) is the logo colour; --brand is a darker shade so white text on it stays readable. */
  --brand-logo: #30C1BF;
  --brand: #138583;
  --brand-ink: #ffffff;
  --brand-soft: #e4f6f6;
  --brand-grey: #5a5858;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #b45309;
  --warn-soft: #fdf3e2;
  --err: #c2262b;
  --err-soft: #fce9e9;
  --radius: 10px;
  --font: "Inter", "Padauk", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161a; --surface: #1a2025; --border: #2b333a; --text: #e6e9ec; --muted: #98a2ab;
    --brand: #30C1BF; --brand-ink: #062322; --brand-soft: #123634; --brand-grey: #c9c7c7;
    --ok: #4ade80; --ok-soft: #12291b; --warn: #f5a524; --warn-soft: #2e2412; --err: #f87171; --err-soft: #331b1b;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.pre { white-space: pre-line; }

/* Layout */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem; padding: .45rem 1rem;
  background: var(--surface); border-bottom: 1px solid var(--border); }
/* Thin stripe in the logo's colours under the header. */
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 3px;
  background: linear-gradient(90deg, #1fa3e0 0 25%, #2fb34a 25% 50%, #e6ec1e 50% 75%, var(--brand-logo) 75% 100%); }
.brand { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; text-decoration: none !important; }
.brand img { height: 42px; width: auto; display: block; }
.brand span { font-weight: 700; font-size: 1.05rem; color: var(--brand-grey); letter-spacing: .01em; }
.login-brand { text-align: center; margin-bottom: 1.25rem; }
.login-brand img { height: 80px; width: auto; }
.login-brand div { font-weight: 700; font-size: 1.1rem; color: var(--brand-grey); margin-top: .1rem; letter-spacing: .08em; text-transform: uppercase; }
.nav { display: flex; gap: .25rem; overflow-x: auto; flex: 1; }
.nav a { padding: .4rem .7rem; border-radius: 8px; color: var(--muted); white-space: nowrap; }
.nav a.active, .nav a:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.bell { position: relative; padding: .4rem .6rem; color: var(--muted); }
.bell .count { position: absolute; top: -2px; right: -4px; background: var(--err); color: #fff; border-radius: 999px;
  font-size: .7rem; padding: 0 .35rem; line-height: 1.3rem; min-width: 1.3rem; text-align: center; }
main { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.cols { display: grid; gap: 1rem; grid-template-columns: 2fr 1fr; align-items: start; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.card + .card { margin-top: 1rem; }
dl.fields { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
dl.fields dt { color: var(--muted); }
dl.fields dd { margin: 0; overflow-wrap: anywhere; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--brand-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Controls */
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--brand); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.danger { color: var(--err); }
.btn.small { padding: .3rem .6rem; font-size: .85rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.actions form { display: inline; margin: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: .35rem; }
.tabs a { padding: .35rem .75rem; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); background: var(--surface); }
.tabs a.active { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.tabs a .n { font-weight: 700; margin-left: .25rem; }
.search { display: flex; gap: .5rem; flex-wrap: nowrap; }
.search input { min-width: 0; width: 280px; }
.page-head .actions { align-items: center; }
input, select, textarea { width: 100%; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; }
input[type=checkbox] { width: auto; }
textarea { resize: vertical; }
.form-grid { display: grid; gap: .9rem 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
.field.wide { grid-column: 1 / -1; }
.field .err { color: var(--err); font-size: .85rem; }
.field .help { color: var(--muted); font-size: .8rem; }
.checks > div { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.checks > div label { display: inline-flex; align-items: center; gap: .3rem; color: var(--text); font-size: .95rem; }
.checks ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .25rem; }

/* Badges & alerts */
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--brand-soft); color: var(--brand); }
.badge.completed, .badge.sent, .badge.success { background: var(--ok-soft); color: var(--ok); }
.badge.cancelled, .badge.failed, .badge.error { background: var(--err-soft); color: var(--err); }
.badge.dry_run, .badge.queued, .badge.warning, .badge.overdue { background: var(--warn-soft); color: var(--warn); }
.badge.muted { background: var(--bg); color: var(--muted); }
.alerts { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.alert { padding: .6rem .9rem; border-radius: 8px; background: var(--brand-soft); }
.alert.success { background: var(--ok-soft); color: var(--ok); }
.alert.warning { background: var(--warn-soft); color: var(--warn); }
.alert.error { background: var(--err-soft); color: var(--err); }

/* Pickers, timelines */
.picker-results { border: 1px solid var(--border); border-radius: 8px; margin-top: .35rem; overflow: hidden; }
.picker-results button { display: block; width: 100%; text-align: left; padding: .5rem .7rem; border: 0; border-bottom: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.picker-results button:hover { background: var(--brand-soft); }
.selected-customer { display: flex; justify-content: space-between; gap: .5rem; padding: .6rem .8rem; border-radius: 8px; background: var(--brand-soft); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .6rem 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.notif.unread { border-left: 3px solid var(--brand); }
.pagination { display: flex; gap: .5rem; align-items: center; justify-content: center; margin-top: 1rem; }
.empty { text-align: center; padding: 2rem; color: var(--muted); }

/* Money direction: green = money coming to AyeSay, amber = AyeSay has to pay out. */
.owe-in { color: var(--ok); font-weight: 600; }
.owe-out { color: var(--warn); font-weight: 600; }
td.num.in { color: var(--ok); }
td.num.out { color: var(--warn); }
.subnav { display: flex; gap: .35rem; margin-bottom: 1rem; flex-wrap: wrap; }
.stat-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stages { display: flex; gap: .25rem; align-items: center; flex-wrap: wrap; margin-top: .35rem; }
.stages .step { padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.stages .step.done { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.stages .step.now { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); font-weight: 600; }
.stages .arrow { color: var(--muted); font-size: .8rem; }
.badge.incomplete, .badge.unsettled { background: var(--warn-soft); color: var(--warn); }
.badge.settled { background: var(--ok-soft); color: var(--ok); }
.badge.scheduled { background: var(--brand-soft); color: var(--brand); }
.monthly-message h3 { font-size: 1.1rem; margin: 0 0 .5rem; }
.monthly-message h4 { font-size: 1rem; margin: 1rem 0 .25rem; }
.monthly-message img { max-width: 100%; height: auto; }
.monthly-message ul { padding-left: 1.2rem; }

/* Booking history */
.history li { display: grid; gap: .15rem; }
.history .h-head { display: flex; gap: .6rem; flex-wrap: wrap; font-size: .82rem; }
.history .h-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.history .h-who { font-weight: 600; }
.history .h-changes { list-style: none; margin: .2rem 0 0; padding: 0 0 0 .75rem; border-left: 2px solid var(--border); font-size: .88rem; }
.history .h-changes del { color: var(--muted); }
.history .h-message .h-what, .history .h-viewed .h-what { color: var(--muted); }
