/* SEEP Claims - visual style
   Built from the SEEP logo: an open book in orange, green and sky blue, with bold black lettering.
   Look: school notebook. Warm paper, ink outlines, solid offset "stamp" shadows, chunky headings. */
:root {
  /* logo colours */
  --orange: #f08a1c;
  --orange-deep: #c96500;
  --orange-soft: #ffe9cf;
  --green: #88c038;
  --green-deep: #3f7a0a;
  --green-soft: #e5f3d0;
  --blue: #00a8f0;
  --blue-deep: #006fa3;
  --blue-soft: #d6f0fc;
  --red: #e5484d;
  --red-deep: #a8222a;
  --red-soft: #fde2e1;
  --amber-soft: #fff3c4;
  --amber-deep: #8a5a00;

  --ink: #1d1b18;
  --ink-2: #4a463f;
  --muted: #6f695e;
  --paper: #fbf6ec;
  --card: #ffffff;
  --line: #e6dccb;

  /* names used by inline styles in app.js */
  --brand: var(--orange);
  --brand-dark: var(--ink);
  --brand-soft: var(--orange-soft);
  --text: var(--ink);
  --bg: var(--paper);
  --danger: var(--red-deep);
  --danger-soft: var(--red-soft);
  --ok: var(--green-deep);
  --ok-soft: var(--green-soft);
  --warn-soft: var(--amber-soft);

  --radius: 14px;
  --stamp: 3px 3px 0 var(--ink);
  --stamp-lg: 5px 5px 0 var(--ink);
  --nav-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font-head: "Bricolage Grotesque", "Poppins", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background-color: var(--paper);
  /* faint notebook dots */
  background-image: radial-gradient(rgba(29, 27, 24, .07) 1px, transparent 1.2px);
  background-size: 22px 22px;
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--blue-deep); font-weight: 600; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 750; }
h3 { font-size: 1.02rem; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); font-family: var(--font-head); }

/* ------------------------------------------------------------ shell */
.shell { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--card);
  display: flex; align-items: center; gap: .75rem; padding: .55rem 1rem;
  padding-top: calc(.55rem + env(safe-area-inset-top, 0px));
  border-bottom: 2px solid var(--ink);
}
/* the three book colours as a stripe under the header */
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 6px;
  background: linear-gradient(90deg, var(--orange) 0 33.3%, var(--green) 33.3% 66.6%, var(--blue) 66.6% 100%);
}
.brand-logo { height: 30px; width: auto; display: block; }
.topbar .title {
  font-family: var(--font-head); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em;
  background: var(--ink); color: #fff; padding: .2rem .5rem; border-radius: 6px; white-space: nowrap;
}
.topbar .spacer { flex: 1; }
.topbar .who {
  font-size: .8rem; font-weight: 600; color: var(--ink-2); max-width: 45%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 420px) { .brand-logo { height: 28px; } .topbar .who { display: none; } }

.sidebar { display: none; }
main { padding: 1.5rem 1rem; padding-bottom: calc(var(--nav-h) + 2rem + var(--safe-b)); max-width: 980px; margin: 0 auto; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card);
  border-top: 2px solid var(--ink); display: flex; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
}
.bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: .7rem; font-weight: 700; position: relative;
}
.bottomnav a svg { width: 23px; height: 23px; }
.bottomnav a.active { color: var(--ink); }
.bottomnav a.active:not(.primary)::before {
  content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 4px; background: var(--orange); border-radius: 0 0 4px 4px;
}
.bottomnav a.primary span.dot {
  background: var(--orange); color: var(--ink); width: 52px; height: 52px; border-radius: 16px;
  display: grid; place-items: center; margin-top: -24px; border: 2px solid var(--ink); box-shadow: var(--stamp);
  transform: rotate(-4deg); transition: transform .15s;
}
.bottomnav a.primary:active span.dot { transform: rotate(0) translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.bottomnav a.primary span.dot svg { width: 26px; height: 26px; stroke-width: 2.6; }
.badge-count {
  position: absolute; top: 7px; left: 50%; margin-left: 6px; background: var(--red); color: #fff; border: 2px solid var(--card);
  border-radius: 999px; font-size: .66rem; font-weight: 800; padding: 0 5px; min-width: 18px; text-align: center; line-height: 15px;
}

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 250px 1fr; grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / -1; padding: .7rem 1.5rem; }
  .brand-logo { height: 36px; }
  .bottomnav { display: none; }
  .sidebar { display: block; padding: 1.6rem .9rem; border-right: 2px solid var(--ink); background: rgba(255, 255, 255, .55); }
  .sidebar a {
    display: flex; align-items: center; gap: .7rem; padding: .62rem .8rem; border-radius: 10px; margin-bottom: .2rem;
    color: var(--ink); text-decoration: none; font-weight: 600; position: relative; border: 2px solid transparent;
  }
  .sidebar a svg { width: 20px; height: 20px; }
  .sidebar a:hover { background: var(--card); border-color: var(--line); }
  .sidebar a.active { background: var(--orange-soft); border-color: var(--ink); box-shadow: var(--stamp); }
  .sidebar .sep { font-family: var(--font-head); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 1.2rem .8rem .4rem; }
  .sidebar .badge-count { position: static; margin-left: auto; border-color: transparent; }
  main { padding: 2.2rem 2.4rem 3rem; width: 100%; }
}

/* ------------------------------------------------------------ building blocks */
.card {
  background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--stamp); padding: 1.1rem; margin-bottom: 1.1rem;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }

.btn {
  appearance: none; border: 2px solid var(--ink); background: var(--card); color: var(--ink);
  padding: .62rem 1rem; border-radius: 10px; font: inherit; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; text-decoration: none; min-height: 44px;
  box-shadow: var(--stamp); transition: transform .08s, box-shadow .08s, background .15s;
}
.btn:hover { background: #fffaf2; }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: var(--stamp); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.primary { background: var(--orange); color: var(--ink); }
.btn.primary:hover { background: #f59a35; }
.btn.danger { color: var(--red-deep); }
.btn.danger.solid { background: var(--red); color: #fff; }
.btn.ok { background: var(--green); color: var(--ink); }
.btn.small { padding: .32rem .7rem; min-height: 34px; font-size: .85rem; box-shadow: 2px 2px 0 var(--ink); }
.btn.small svg { width: 16px; height: 16px; }
.btn.block { width: 100%; }
.btn.big { padding: 1rem 1.1rem; font-size: 1.08rem; font-family: var(--font-head); font-weight: 800; box-shadow: var(--stamp-lg); }
.btn-row { display: flex; gap: .55rem; flex-wrap: wrap; }

/* ------------------------------------------------------------ forms */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 700; font-size: .88rem; margin-bottom: .32rem; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.req { color: var(--orange-deep); }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 2px solid #cfc4b2; border-radius: 10px;
  padding: .62rem .75rem; min-height: 46px; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 3px 3px 0 var(--orange); }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--green-deep); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .75rem; }
@media (max-width: 520px) { .grid3 { grid-template-columns: 1fr 1fr; } }
.section-title {
  display: flex; align-items: center; gap: .6rem; margin: 1.5rem 0 .8rem;
  font-family: var(--font-head); font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--ink);
}
.section-title::after { content: ""; flex: 1; height: 2px; background: repeating-linear-gradient(90deg, var(--ink) 0 6px, transparent 6px 11px); opacity: .35; }
.fixed-field {
  min-height: 46px; display: flex; align-items: center; padding: .6rem .75rem; border-radius: 10px;
  background: var(--blue-soft); border: 2px dashed var(--blue-deep); font-weight: 800; font-family: var(--font-head); color: var(--blue-deep); user-select: none;
}
.fixed-field.bad { color: var(--red-deep); background: var(--red-soft); border-color: var(--red-deep); font-size: .85rem; }
.lock { font-weight: 600; font-size: .74rem; color: var(--muted); }
.form-error { color: var(--red-deep); font-weight: 600; font-size: .9rem; margin-top: .5rem; }

/* the RM 80 bar that sticks above the bottom nav */
.estimate {
  position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + .7rem); z-index: 5; margin-top: 1rem;
  background: var(--ink); color: #fff; border-radius: var(--radius); padding: .8rem .9rem .8rem 1.1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; box-shadow: 4px 4px 0 var(--orange);
}
@media (min-width: 900px) { .estimate { bottom: 1rem; } }
.estimate .amt { font-family: var(--font-head); font-size: 1.45rem; font-weight: 800; color: var(--orange); }
.estimate .break { font-size: .76rem; opacity: .8; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.estimate .btn { box-shadow: none; border-color: #fff; }

/* ------------------------------------------------------------ stats */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; margin-bottom: 1.4rem; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--stamp);
  padding: .8rem .95rem; text-decoration: none; color: inherit; position: relative; overflow: hidden;
  border-top-width: 7px;
}
a.stat:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.stat .label { font-size: .78rem; color: var(--ink-2); font-weight: 700; }
.stat .value { font-family: var(--font-head); font-size: 1.55rem; font-weight: 800; line-height: 1.2; }
.stat .sub { font-size: .76rem; color: var(--muted); }
.stats > .stat:nth-child(2) { border-top-color: var(--green); }
.stats > .stat:nth-child(3) { border-top-color: var(--orange); }
.stats > .stat:nth-child(4) { border-top-color: var(--blue); }
.stats > .stat:nth-child(5) { border-top-color: var(--red); }
.stat.hero {
  grid-column: 1 / -1; background: var(--orange); border-top-width: 2px; padding: 1.1rem 1.2rem; box-shadow: var(--stamp-lg);
}
.stat.hero .label, .stat.hero .sub { color: var(--ink); }
.stat.hero .value { font-size: 2.3rem; letter-spacing: -.02em; }
/* book pages fanning out from the corner of the hero card */
.stat.hero::before, .stat.hero::after {
  content: ""; position: absolute; right: -28px; bottom: -40px; width: 150px; height: 110px; border-radius: 12px;
  border: 2px solid var(--ink); transform: rotate(-22deg); background: var(--green);
}
.stat.hero::after { right: -48px; bottom: -58px; transform: rotate(-8deg); background: var(--blue); }
.stat.hero > * { position: relative; z-index: 1; }
.stat.hero .sub, .stat.hero .label { max-width: calc(100% - 110px); }

/* ------------------------------------------------------------ status pills */
.pill {
  display: inline-block; font-size: .72rem; font-weight: 800; padding: .14rem .55rem; border-radius: 999px; white-space: nowrap;
  border: 1.5px solid currentColor; text-transform: uppercase; letter-spacing: .04em;
}
.pill.approved { background: var(--green-soft); color: var(--green-deep); }
.pill.submitted { background: var(--amber-soft); color: var(--amber-deep); }
.pill.rejected { background: var(--red-soft); color: var(--red-deep); }
.pill.paid { background: var(--blue-soft); color: var(--blue-deep); }
.pill.inactive { background: #eee9df; color: #5d574d; }
.pill.att-ok { background: var(--green-soft); color: var(--green-deep); text-transform: none; letter-spacing: 0; }
.pill.att-low { background: var(--red-soft); color: var(--red-deep); text-transform: none; letter-spacing: 0; }
.pill.att-unknown { background: #eee9df; color: #5d574d; text-transform: none; letter-spacing: 0; }

.chips { display: flex; gap: .45rem; overflow-x: auto; padding: 2px 4px 6px 2px; margin-bottom: .8rem; scrollbar-width: none; }
.chips button {
  border: 2px solid var(--ink); background: var(--card); border-radius: 999px; padding: .32rem .9rem; font: inherit;
  font-size: .86rem; font-weight: 700; color: var(--ink); white-space: nowrap; cursor: pointer;
}
.chips button.on { background: var(--ink); color: #fff; box-shadow: 2px 2px 0 var(--orange); }

.filters { display: flex; gap: .55rem; flex-wrap: wrap; margin-bottom: .8rem; align-items: center; }
.filters > * { flex: 1 1 160px; width: auto; }

/* ------------------------------------------------------------ claim cards */
.list { display: flex; flex-direction: column; gap: .7rem; }
.claim {
  background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--stamp);
  padding: .85rem 1rem .85rem 1.15rem; display: flex; gap: .75rem; align-items: flex-start; text-decoration: none; color: inherit;
  position: relative; overflow: hidden;
}
/* coloured edge = status at a glance */
.claim::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--green); }
.claim:has(.pill.submitted)::before { background: #f3b400; }
.claim:has(.pill.rejected)::before, .claim.is-returned::before { background: var(--red); }
.claim:has(.pill.paid)::before { background: var(--blue); }
a.claim:active, .claim[data-id]:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.claim .body { flex: 1; min-width: 0; }
.claim .row1 { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.claim .when { font-family: var(--font-head); font-weight: 750; }
.claim .amt { font-family: var(--font-head); font-weight: 800; white-space: nowrap; }
.claim .meta { font-size: .85rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.claim .row3 { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .35rem; flex-wrap: wrap; }
.claim .actions { display: flex; gap: .35rem; }
.claim input[type=checkbox] { margin-top: .2rem; flex: none; }
.reason { font-size: .82rem; margin-top: .5rem; padding: .4rem .6rem; border-radius: 8px; line-height: 1.35; font-weight: 600; }
.reason.bad { background: var(--red-soft); color: var(--red-deep); }
.reason.warn { background: var(--amber-soft); color: var(--amber-deep); }

.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty svg { width: 46px; height: 46px; color: var(--orange); }

/* ------------------------------------------------------------ details */
.kv { display: grid; grid-template-columns: 10rem 1fr; gap: .5rem 1rem; margin: 0; }
.kv dt { color: var(--muted); font-size: .88rem; font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }
@media (max-width: 420px) { .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: .6rem; } }
.amount-table { width: 100%; border-collapse: collapse; }
.amount-table td { padding: .35rem 0; border-bottom: 1px dashed var(--line); }
.amount-table tr.total td { border-bottom: 0; font-weight: 800; font-size: 1.1rem; padding-top: .6rem; }
.photo-thumb { max-width: 100%; max-height: 360px; border-radius: 10px; display: block; border: 2px solid var(--ink); }
canvas.photo-thumb { width: 100%; height: auto; max-height: none; }

.notice { border-radius: 12px; padding: .8rem 1rem; margin-bottom: 1rem; font-size: .92rem; border: 2px solid currentColor; }
.notice b { font-family: var(--font-head); }
.notice.rejected { background: var(--red-soft); color: var(--red-deep); }
.notice.info { background: var(--blue-soft); color: var(--blue-deep); }
.notice.ok { background: var(--green-soft); color: var(--green-deep); }
.notice.warn { background: var(--amber-soft); color: var(--amber-deep); }
.notice .claim { color: var(--ink); }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 .85rem 1.5rem; font-size: .9rem; }
.timeline li::before { content: ""; position: absolute; left: 2px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--orange); border: 2px solid var(--ink); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 21px; bottom: 0; width: 2px; background: var(--ink); opacity: .25; }
.timeline li:last-child::after { display: none; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th, table.data td { padding: .6rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.data th { font-family: var(--font-head); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); border-bottom: 2px solid var(--ink); }
table.data td.num, table.data th.num { text-align: right; white-space: nowrap; }
table.data tfoot td { font-weight: 800; border-bottom: 0; border-top: 2px solid var(--ink); }

.menu-list a, .menu-list button {
  display: flex; align-items: center; gap: .75rem; width: 100%; padding: .9rem .25rem; border: 0; border-bottom: 1px solid var(--line);
  background: none; font: inherit; font-weight: 600; color: var(--ink); text-decoration: none; cursor: pointer; text-align: left;
}
.menu-list svg { width: 22px; height: 22px; color: var(--orange-deep); }
.menu-list a:last-child, .menu-list button:last-child { border-bottom: 0; }

/* ------------------------------------------------------------ attendance list */
.att-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.att-list { border: 2px solid var(--ink); border-radius: 12px; overflow: hidden; background: #fff; }
.att-item, .field .att-item {
  display: flex; align-items: center; gap: .7rem; padding: .7rem .85rem; border-bottom: 1px solid var(--line);
  cursor: pointer; font-weight: 600; margin: 0;
}
.att-item:last-child { border-bottom: 0; }
.att-item input { width: 22px; height: 22px; flex: none; }
.att-item:has(input:checked) { background: #fbfff5; }
.att-item:has(input:not(:checked)) { background: var(--red-soft); color: var(--red-deep); text-decoration: line-through; }
.att-no { color: var(--muted); width: 1.6rem; text-align: right; flex: none; font-size: .82rem; font-family: var(--font-head); }
#att-count b { font-family: var(--font-head); font-size: 1.1rem; color: var(--green-deep); }
.att-view { list-style: none; margin: 0; padding: 0; columns: 2 220px; }
.att-view li { padding: .25rem 0; break-inside: avoid; font-weight: 600; }
.att-view li span:first-child { display: inline-block; width: 1.4rem; font-weight: 800; }
.att-view li.in span:first-child { color: var(--green-deep); }
.att-view li.out { color: var(--red-deep); }

details.who-card summary { cursor: pointer; list-style: none; }
details.who-card summary::-webkit-details-marker { display: none; }
details.who-card summary::after { content: " ▾"; color: var(--muted); }

/* ------------------------------------------------------------ login / IC screens */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; position: relative; overflow: hidden; }
/* big book pages behind the card */
.auth-wrap::before, .auth-wrap::after {
  content: ""; position: absolute; border: 2px solid var(--ink); border-radius: 28px; z-index: 0;
}
.auth-wrap::before { width: 340px; height: 240px; background: var(--orange); top: -70px; left: -90px; transform: rotate(-18deg); box-shadow: 18px 18px 0 var(--green), 36px 36px 0 var(--ink); }
.auth-wrap::after { width: 300px; height: 220px; background: var(--blue); bottom: -80px; right: -90px; transform: rotate(14deg); }
.auth-card { width: 100%; max-width: 420px; position: relative; z-index: 1; box-shadow: 7px 7px 0 var(--ink); padding: 1.6rem 1.4rem; }
.auth-card .logo-wide { display: block; width: 100%; max-width: 300px; height: auto; margin: .2rem auto 1.2rem; }
.auth-card h1 { text-align: center; }
.auth-card .kicker {
  display: block; width: fit-content; margin: 0 auto .7rem; font-family: var(--font-head); font-size: .74rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .12em; background: var(--ink); color: #fff; padding: .2rem .6rem; border-radius: 6px;
}
.auth-card input[name=ic] { font-family: var(--font-head); font-size: 1.35rem; font-weight: 700; letter-spacing: .06em; text-align: center; }

/* ------------------------------------------------------------ toast + modal */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 1rem); transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: .75rem 1.1rem; border-radius: 12px; opacity: 0; pointer-events: none;
  transition: .2s; z-index: 100; max-width: calc(100% - 2rem); font-size: .92rem; font-weight: 600; box-shadow: 4px 4px 0 var(--green);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--red-deep); box-shadow: 4px 4px 0 var(--ink); }

dialog#modal { border: 2px solid var(--ink); border-radius: var(--radius); padding: 0; width: min(520px, calc(100% - 2rem)); box-shadow: 7px 7px 0 var(--ink); }
dialog#modal::backdrop { background: rgba(29, 27, 24, .55); }
dialog#modal form { padding: 1.3rem; max-height: 85vh; overflow-y: auto; }
dialog#modal .btn-row { justify-content: flex-end; margin-top: 1rem; }

/* ------------------------------------------------------------ admin bits */
.settings-row { display: grid; grid-template-columns: 1fr 7rem 8rem auto auto; gap: .5rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--line); }
@media (max-width: 640px) { .settings-row { grid-template-columns: 1fr 1fr; } .settings-row > :first-child { grid-column: 1 / -1; } }
.tag { display: inline-flex; align-items: center; gap: .35rem; background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: .15rem .35rem .15rem .75rem; margin: 0 .35rem .35rem 0; font-size: .9rem; font-weight: 600; }
.tag button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 1.1rem; line-height: 1; padding: 0 .3rem; }

/* ------------------------------------------------------------ printable receipt */
.receipt {
  background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--stamp-lg);
  padding: 1.4rem 1.3rem 1.1rem; max-width: 560px; margin: 0 auto; position: relative; overflow: hidden;
}
.receipt::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 7px;
  background: linear-gradient(90deg, var(--orange) 0 33.3%, var(--green) 33.3% 66.6%, var(--blue) 66.6% 100%); }
.receipt-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: .3rem 0 1rem; flex-wrap: wrap; }
.receipt-head img { height: 34px; width: auto; }
.receipt-kicker { font-family: var(--font-head); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); text-align: right; }
.receipt-no { font-family: var(--font-head); font-size: 1.35rem; font-weight: 800; text-align: right; }
/* rubber stamp */
.receipt-stamp {
  display: inline-block; font-family: var(--font-head); font-weight: 800; font-size: 1.5rem; letter-spacing: .12em;
  padding: .3rem 1rem; border: 4px double currentColor; border-radius: 10px; transform: rotate(-6deg); margin: .2rem 0 1.2rem .4rem;
}
.receipt-stamp.approved { color: var(--green-deep); }
.receipt-stamp.paid { color: var(--blue-deep); }
.receipt-stamp.submitted { color: var(--amber-deep); }
.receipt-stamp.rejected { color: var(--red-deep); }
.receipt-total {
  display: flex; justify-content: space-between; align-items: baseline; margin-top: 1.1rem; padding-top: .9rem;
  border-top: 2px dashed var(--ink); font-family: var(--font-head);
}
.receipt-total span { font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; }
.receipt-total b { font-size: 1.8rem; }
.receipt-total s { color: var(--muted); font-size: 1.1rem; margin-right: .4rem; }
.receipt-foot { font-size: .75rem; color: var(--muted); margin: 1rem 0 0; }

@media print {
  body { background: #fff; }
  .topbar, .sidebar, .bottomnav, .no-print, #toast { display: none !important; }
  .shell { display: block; }
  main { padding: 0; }
  .receipt { box-shadow: none; max-width: none; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
