/* Approvals: one small stylesheet. Calm, quiet, readable on a phone.
   Colour is used sparingly: ink for actions, a single blue for links and focus,
   and muted green / amber / red only to say what state something is in. */

:root {
  color-scheme: light;
  --bg: #fbfbfa;
  --surface: #ffffff;
  --ink: #18181b;
  --ink-2: #52525b;
  --ink-3: #71717a;
  --line: #ececea;
  --line-2: #d9d9d4;
  --accent: #1f3f68;
  --on-ink: #ffffff;
  --good: #1f7a4d;
  --warn: #a8610a;
  --bad: #b3261e;
  --idle: #8e8e96;
  --good-bg: #eef7f1;
  --bad-bg: #fdf1f0;
  --warn-bg: #fdf6ea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(24, 24, 27, .04);
}

/* Light is the default. The theme switch sets data-theme on <html> to light, dark or auto
   (auto follows the device). The dark palette is written twice on purpose: once for an
   explicit choice and once inside the media query for "auto". */

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101012;
  --surface: #17171a;
  --ink: #f4f4f5;
  --ink-2: #b4b4bc;
  --ink-3: #8f8f99;
  --line: #26262a;
  --line-2: #36363c;
  --accent: #9dbbe6;
  --on-ink: #101012;
  --good: #5fc18b;
  --warn: #e0a040;
  --bad: #f08b84;
  --idle: #7a7a84;
  --good-bg: #14231b;
  --bad-bg: #2a1716;
  --warn-bg: #2a2012;
  --shadow: none;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --bg: #101012;
    --surface: #17171a;
    --ink: #f4f4f5;
    --ink-2: #b4b4bc;
    --ink-3: #8f8f99;
    --line: #26262a;
    --line-2: #36363c;
    --accent: #9dbbe6;
    --on-ink: #101012;
    --good: #5fc18b;
    --warn: #e0a040;
    --bad: #f08b84;
    --idle: #7a7a84;
    --good-bg: #14231b;
    --bad-bg: #2a1716;
    --warn-bg: #2a2012;
    --shadow: none;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: .875rem; }
.stack > * + * { margin-top: 12px; }

/* ---------- Header ---------- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 720px; margin: 0 auto; padding: 0 20px;
  height: 56px; display: flex; align-items: center; gap: 22px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 650; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand svg { width: 20px; height: 20px; }
.brand svg rect { fill: #54c247; }
.brand svg path { stroke: #fff; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav a, .menu > summary {
  color: var(--ink-2); font-size: .9375rem; padding: 6px 10px; border-radius: 8px; white-space: nowrap;
  list-style: none; cursor: pointer;
}
.nav a:hover, .menu > summary:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.menu { position: relative; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 8px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); opacity: .6; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; z-index: 20;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .12); padding: 6px;
}
.menu-panel a, .menu-panel button {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px;
  color: var(--ink); background: none; border: 0; font: inherit; font-size: .9375rem; cursor: pointer;
}
.menu-panel a:hover, .menu-panel button:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); text-decoration: none; }
.menu-panel hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu-panel form { margin: 0; }
.menu-panel .seg { display: flex; gap: 4px; padding: 2px 6px 8px; }
.menu-panel .seg button {
  flex: 1; width: auto; text-align: center; padding: 6px 4px; font-size: .8125rem;
  border: 1px solid var(--line-2); border-radius: 8px; color: var(--ink-2);
}
.menu-panel .seg button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.menu-panel .seg button[aria-pressed="true"]:hover { background: var(--ink); }
.menu-label { padding: 8px 12px 4px; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- Page ---------- */

.page { max-width: 720px; margin: 0 auto; padding: 32px 20px 96px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 8px; flex-wrap: wrap; }
h1 { font-size: 1.625rem; line-height: 1.2; font-weight: 650; letter-spacing: -.02em; margin: 0; }
h2 { font-size: .8125rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin: 40px 0 8px; }
.lede { color: var(--ink-3); margin: 6px 0 0; max-width: 56ch; }
.back { display: inline-block; margin-top: 40px; color: var(--ink-3); font-size: .9375rem; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 10px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--on-ink); font: inherit; font-weight: 600; font-size: .9375rem;
  cursor: pointer; white-space: nowrap; transition: opacity .15s, background .15s;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn:active { opacity: .78; }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-quiet:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); opacity: 1; }
.btn-danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn-danger:hover { background: var(--bad-bg); opacity: 1; }
.btn-good { background: var(--good); border-color: var(--good); color: #fff; }
.btn-sm { height: 34px; padding: 0 14px; font-size: .875rem; border-radius: 8px; }
.btn-block { width: 100%; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.actions > * { flex: 1 1 auto; }
.actions form { display: contents; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.linkbtn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Lists ---------- */

.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.list > li { border-bottom: 1px solid var(--line); }
.item { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 16px 4px; color: inherit; }
a.item:hover { text-decoration: none; background: color-mix(in srgb, var(--ink) 3%, transparent); }
.item-main { min-width: 0; }
.item-title { font-weight: 600; letter-spacing: -.005em; overflow: hidden; text-overflow: ellipsis; }
.item-sub { color: var(--ink-3); font-size: .875rem; margin-top: 2px; }
.item-side { text-align: right; flex-shrink: 0; }
.item-amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.empty { color: var(--ink-3); padding: 20px 4px; border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); }

/* ---------- Status ---------- */

.status { display: inline-flex; align-items: center; gap: 7px; font-size: .8125rem; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--idle); }
.status.pending_approval::before, .status.pending_verification::before, .status.pending::before { background: var(--warn); }
.status.completed::before, .status.approved::before, .status.active::before { background: var(--good); }
.status.rejected::before, .status.closed::before { background: var(--bad); }
.pill { display: inline-block; font-size: .75rem; padding: 1px 8px; border: 1px solid var(--line-2); border-radius: 99px; color: var(--ink-3); }

/* ---------- Panels, forms ---------- */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 12px; }

label { display: block; margin: 18px 0 6px; font-size: .8125rem; font-weight: 600; color: var(--ink-2); }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: .9375rem; color: var(--ink); margin: 18px 0 0; }
label.check input { margin-top: 5px; width: 16px; height: 16px; accent-color: var(--ink); }
.panel > label:first-child, .panel > form > label:first-child { margin-top: 0; }

input[type=text], input[type=email], input[type=number], input[type=tel], input[type=password], input[type=search], input[type=date], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: inherit; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type=file] { width: 100%; font: inherit; font-size: .9375rem; color: var(--ink-2); }
input[type=file]::file-selector-button {
  margin-right: 12px; height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2);
  background: transparent; color: var(--ink); font: inherit; font-size: .875rem; cursor: pointer;
}
.help { color: var(--ink-3); font-size: .8125rem; margin-top: 6px; }
.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--bad); font-size: .875rem; }
.errorlist.nonform { margin: 0 0 12px; }

/* ---------- Notices ---------- */

.notices { margin-bottom: 20px; }
.notice { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: .9375rem; }
.notice + .notice { margin-top: 8px; }
.notice.success { background: var(--good-bg); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.notice.error { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.notice.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.quote { border-left: 2px solid var(--bad); padding: 2px 0 2px 14px; margin: 16px 0; }
.quote strong { display: block; font-size: .8125rem; color: var(--ink-3); font-weight: 500; }

/* ---------- Request detail ---------- */

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px 24px; margin: 22px 0 0; }
.facts dt { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.facts dd { margin: 2px 0 0; font-weight: 500; }
.amount { font-size: 2.25rem; line-height: 1.1; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: 22px; }
.amount small { font-size: 1rem; font-weight: 500; color: var(--ink-3); letter-spacing: 0; margin-right: 6px; }
.desc { color: var(--ink-2); margin: 18px 0 0; max-width: 62ch; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 22px 28px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: -2px; width: 1px; background: var(--line-2); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--bg); border: 1.5px solid var(--idle); }
.timeline li.approved::after { background: var(--good); border-color: var(--good); }
.timeline li.pending::after { border-color: var(--warn); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 18%, transparent); }
.timeline li.rejected::after { background: var(--bad); border-color: var(--bad); }
.timeline li.cancelled { opacity: .55; }
.t-title { font-weight: 600; }
.t-sub { color: var(--ink-3); font-size: .875rem; }
.t-note { color: var(--ink-2); font-size: .9375rem; margin-top: 4px; }
.sig { display: block; height: 40px; margin-top: 8px; padding: 2px 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.round-note { color: var(--ink-3); font-size: .8125rem; margin: 6px 0 14px 28px; }

.files { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.files > li { border-bottom: 1px solid var(--line); }
.files .row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 4px; }
.files summary { cursor: pointer; list-style: none; color: var(--accent); font-size: .875rem; padding: 0 4px 10px; }
.files summary::-webkit-details-marker { display: none; }
.preview { display: block; max-width: 100%; border-radius: 10px; border: 1px solid var(--line); margin: 0 4px 14px; }
.files object { width: calc(100% - 8px); height: 420px; margin: 0 4px 14px; border: 1px solid var(--line); border-radius: 10px; }

.decision { margin-top: 36px; }
.decision textarea { min-height: 84px; }

details.fold > summary { cursor: pointer; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2 { display: inline-block; margin: 40px 0 8px; }
details.fold > summary h2::after { content: "  +"; }
details.fold[open] > summary h2::after { content: "  \2212"; }
.log { width: 100%; border-collapse: collapse; font-size: .875rem; }
.log td { padding: 8px 6px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
.log td:first-child { color: var(--ink-3); white-space: nowrap; }

/* ---------- Tabs, comments ---------- */

.tabs { display: flex; gap: 22px; margin: 28px 0 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { color: var(--ink-3); padding: 10px 0; font-size: .9375rem; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.count { display: inline-block; min-width: 1.4em; padding: 0 6px; margin-left: 4px; border-radius: 99px; background: var(--ink); color: var(--on-ink); font-size: .75rem; font-weight: 600; text-align: center; }

.comments { list-style: none; margin: 0; padding: 0; }
.comments li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.comments .who { font-weight: 600; }
.comments .when { color: var(--ink-3); font-size: .8125rem; margin-left: 8px; }
.comments .body { margin-top: 4px; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-form { margin-top: 14px; }

/* ---------- Location pickers, chips ---------- */

.checklist > div, .checklist ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 14px; list-style: none; margin: 0; padding: 0; }
.checklist label { display: flex; gap: 8px; align-items: center; margin: 0; font-weight: 400; font-size: .9375rem; color: var(--ink); }
.checklist input { width: 16px; height: 16px; accent-color: var(--ink); }
.chip { display: inline-flex; align-items: center; gap: 2px; margin: 0 6px 6px 0; padding: 2px 4px 2px 10px; border: 1px solid var(--line-2); border-radius: 99px; font-size: .8125rem; background: var(--surface); }
.chip button { border: 0; background: none; color: var(--ink-3); font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0 6px; border-radius: 99px; }
.chip button:hover { color: var(--bad); }

/* ---------- Admin pieces ---------- */

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.step-card { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 4px 16px 16px; margin-top: 12px; }
.step-card .check { margin-top: 14px; }
.tier-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.tier-head h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.tier-steps { list-style: none; margin: 10px 0 0; padding: 0; color: var(--ink-2); font-size: .9375rem; }
.tier-steps li { display: flex; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.tier-steps .n { color: var(--ink-3); width: 1.4em; }
.tier-steps .meta { margin-left: auto; color: var(--ink-3); font-size: .8125rem; text-align: right; }
.inline-actions { display: flex; gap: 14px; font-size: .875rem; }
.inline-actions form { margin: 0; }
.search { margin-top: 20px; }
.badges { display: inline-flex; gap: 6px; flex-wrap: wrap; }

@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } .tier-steps li { flex-wrap: wrap; } .tier-steps .meta { margin-left: 2.4em; text-align: left; } }

/* ---------- Tables (admin) ---------- */

.table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.table th { text-align: left; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; padding: 0 8px 8px 0; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 8px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table form { margin: 0; }
.scroll-x { overflow-x: auto; }

/* ---------- Sign-in ---------- */

.nav .short { display: none; }
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 36px 36px 32px; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.04); }
.auth-logo { display: flex; justify-content: center; margin: 4px 0 20px; }
.auth-logo img { display: block; width: 260px; max-width: 80%; height: auto; }
:root[data-theme="dark"] .auth-logo img { background: #fff; padding: 10px 14px; border-radius: 10px; box-sizing: content-box; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .auth-logo img { background: #fff; padding: 10px 14px; border-radius: 10px; box-sizing: content-box; }
}
.auth-tagline { text-align: center; color: var(--ink-2); font-size: .9375rem; margin: 0 0 26px; line-height: 1.45; }
.auth-copy { margin: 18px 0 0; font-size: .8125rem; color: var(--ink-3); text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 520px) { .auth-card { padding: 28px 22px 24px; } }

@media (max-width: 520px) {
  .page { padding-top: 24px; }
  .topbar-in { gap: 12px; padding: 0 14px; }
  .brand span { display: none; }
  .nav .long { display: none; }
  .nav .short { display: inline; }
  .amount { font-size: 2rem; }
  .actions > * { flex: 1 1 100%; }
  .decision-bar { position: sticky; bottom: 0; margin: 24px -20px -96px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
}

@media print {
  .topbar, .actions, .decision { display: none !important; }
  body { background: #fff; color: #000; }
}
