/* RWRC Help Desk — bright & fun */
@font-face { font-family: 'Baloo 2'; src: url('/fonts/baloo2.woff2') format('woff2'); font-weight: 400 800; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('/fonts/nunito.woff2') format('woff2'); font-weight: 200 1000; font-display: swap; }

:root {
  --sun: #FFC93C; --sun-d: #E0A400; --sun-l: #FFF3C4;
  --grass: #3DBE6B; --grass-d: #2A9150; --grass-l: #DDF6E5;
  --sky: #4CC3FF; --sky-d: #1E98D6; --sky-l: #E1F5FF;
  --berry: #FF5DA2; --berry-d: #D93A7E; --berry-l: #FFE3EF;
  --grape: #8B5CF6; --grape-d: #6D3FE0; --grape-l: #EEE7FF;
  --tomato: #FF6B5B; --tomato-d: #D9483A; --tomato-l: #FFE4E0;
  --ink: #2B2148; --ink-2: #5E557A; --muted: #8C84A6;
  --cream: #FFF8E7; --card: #FFFFFF; --line: #EDE6F7;
  --radius: 22px; --radius-s: 14px;
  --shadow: 0 6px 0 rgba(43, 33, 72, .08), 0 14px 28px -12px rgba(43, 33, 72, .18);
  --head: 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--body); font-size: 16px; line-height: 1.5; color: var(--ink);
  background-color: #EAF7FF;
  background-image:
    radial-gradient(circle at 12% 8%, rgba(255, 201, 60, .35) 0 90px, transparent 91px),
    radial-gradient(circle at 92% 18%, rgba(255, 93, 162, .18) 0 70px, transparent 71px),
    radial-gradient(circle at 85% 92%, rgba(61, 190, 107, .18) 0 120px, transparent 121px),
    radial-gradient(rgba(76, 195, 255, .18) 2px, transparent 2.5px);
  background-size: auto, auto, auto, 26px 26px;
  background-attachment: fixed;
  min-height: 100vh; min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { font-family: var(--head); line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 2rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.2rem; }
p { margin: 0 0 .8em; }
a { color: var(--grape-d); font-weight: 700; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Layout ---------- */
.app { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(110px + var(--safe-b)); outline: none; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--safe-t)) 16px 10px; background: rgba(255, 201, 60, .96);
  border-bottom: 4px solid var(--sun-d); box-shadow: 0 6px 18px -10px rgba(43, 33, 72, .35);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { border-radius: 12px; box-shadow: 0 3px 0 var(--sun-d); background: #fff; }
.brand span { display: flex; flex-direction: column; line-height: 1; }
.brand b { font-family: var(--head); font-size: 1.35rem; font-weight: 800; }
.brand small { font-weight: 800; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; opacity: .75; }
.topnav { display: none; gap: 6px; margin-left: auto; }
.topnav a { text-decoration: none; color: var(--ink); padding: 8px 14px; border-radius: 999px; font-weight: 800; }
.topnav a.active { background: #fff; box-shadow: 0 3px 0 var(--sun-d); }
.avatar-btn { margin-left: auto; text-decoration: none; }
@media (min-width: 820px) { .topnav + .avatar-btn { margin-left: 8px; } }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  padding: 8px 8px calc(8px + var(--safe-b)); background: #fff; border-top: 3px solid var(--line);
  box-shadow: 0 -8px 24px -14px rgba(43, 33, 72, .3);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none;
  color: var(--muted); font-size: .72rem; font-weight: 800; padding: 6px 4px; border-radius: 16px;
}
.tabbar a .ti { font-size: 1.45rem; line-height: 1; transition: transform .2s; }
.tabbar a.active { color: var(--ink); background: var(--sun-l); }
.tabbar a.active .ti { transform: translateY(-2px) scale(1.12); }
.tabbar a.fab .ti {
  width: 52px; height: 52px; margin-top: -26px; display: grid; place-items: center; border-radius: 50%;
  background: var(--berry); color: #fff; font-size: 1.8rem; box-shadow: 0 5px 0 var(--berry-d), 0 10px 18px -6px rgba(217, 58, 126, .6);
  border: 4px solid #fff;
}
@media (min-width: 820px) {
  .topnav { display: flex; }
  .tabbar { display: none !important; }
  .app { padding-bottom: 48px; }
}

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border: 2px solid var(--line); }
.card + .card { margin-top: 16px; }
.card.sunny { background: linear-gradient(135deg, #FFE27A, #FFC0D9); border-color: transparent; }
.card.minty { background: linear-gradient(135deg, #C9F4D7, #BFE9FF); border-color: transparent; }
.card.flat { box-shadow: none; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 24px 4px 12px; }
.section-title h2, .section-title h3 { margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  --b: var(--grape); --bd: var(--grape-d); --c: #fff;
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 800; font-family: var(--head); font-size: 1.05rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px;
  color: var(--c); background: var(--b); border-radius: 999px; box-shadow: 0 5px 0 var(--bd); text-decoration: none;
  transition: transform .08s, box-shadow .08s, filter .15s; user-select: none; position: relative;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--bd); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn.primary { --b: var(--grass); --bd: var(--grass-d); }
.btn.sun { --b: var(--sun); --bd: var(--sun-d); --c: var(--ink); }
.btn.sky { --b: var(--sky); --bd: var(--sky-d); }
.btn.berry { --b: var(--berry); --bd: var(--berry-d); }
.btn.danger { --b: var(--tomato); --bd: var(--tomato-d); }
.btn.ghost { --b: #fff; --bd: var(--line); --c: var(--ink); border: 2px solid var(--line); }
.btn.big { min-height: 58px; font-size: 1.2rem; padding: 12px 26px; }
.btn.block { width: 100%; }
.btn.small { min-height: 38px; font-size: .92rem; padding: 6px 14px; box-shadow: 0 3px 0 var(--bd); }
.btn.busy { color: transparent !important; pointer-events: none; }
.btn.busy::after {
  content: ''; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .5); border-top-color: #fff; animation: spin .7s linear infinite;
}
.btn.sun.busy::after, .btn.ghost.busy::after { border-color: rgba(43, 33, 72, .25); border-top-color: var(--ink); }
.linkbtn { background: none; border: 0; padding: 4px; font: inherit; font-weight: 800; color: var(--grape-d); cursor: pointer; text-decoration: underline; }
.icon-btn { background: #fff; border: 2px solid var(--line); width: 42px; height: 42px; border-radius: 50%; font-size: 1.1rem; cursor: pointer; display: grid; place-items: center; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
label.field { display: block; font-weight: 800; font-size: .95rem; }
label.field > span { display: block; margin: 0 0 6px 4px; }
.field + .field { margin-top: 14px; }
input, textarea, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: #FBF9FF;
  border: 2.5px solid var(--line); border-radius: var(--radius-s); padding: 12px 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--sky); box-shadow: 0 0 0 4px rgba(76, 195, 255, .2); background: #fff; }
textarea { min-height: 130px; resize: vertical; line-height: 1.5; }
.hint { font-size: .82rem; color: var(--muted); font-weight: 600; margin: 6px 4px 0; }
.counter { text-align: right; }
.form-error { background: var(--tomato-l); color: var(--tomato-d); font-weight: 700; border-radius: var(--radius-s); padding: 10px 14px; margin: 12px 0 0; }
.form-ok { background: var(--grass-l); color: var(--grass-d); font-weight: 700; border-radius: var(--radius-s); padding: 12px 14px; }
.grid2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.grid2 .field + .field { margin-top: 0; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: center; font-weight: 700; }
.check input { width: 22px; height: 22px; accent-color: var(--grass); }

/* ---------- Auth ---------- */
.auth { max-width: 440px; margin: 0 auto; padding-top: calc(12px + var(--safe-t)); }
.auth-hero { text-align: center; margin: 12px 0 18px; }
.auth-hero img { width: 104px; height: 104px; border-radius: 28px; box-shadow: 0 7px 0 var(--sun-d); animation: bob 3s ease-in-out infinite; }
.auth-hero h1 { margin-top: 16px; font-size: 2.2rem; }
.auth-hero p { color: var(--ink-2); font-weight: 600; }
.auth-links { display: flex; justify-content: space-between; margin-top: 14px; font-size: .92rem; }
.auth .btn.block { margin-top: 18px; }
.auth-foot { text-align: center; margin-top: 18px; font-weight: 700; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
.tabs { display: flex; background: var(--line); padding: 5px; border-radius: 999px; margin-bottom: 16px; }
.tabs a, .tabs button { flex: 1; text-align: center; padding: 9px 10px; border-radius: 999px; text-decoration: none; color: var(--ink-2); font-weight: 800; border: 0; background: none; font: inherit; font-weight: 800; cursor: pointer; }
.tabs .active { background: #fff; color: var(--ink); box-shadow: 0 3px 0 rgba(43, 33, 72, .1); }

/* ---------- Chips & badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: 999px; font-weight: 800; font-size: .8rem; white-space: nowrap; }
.st-open { background: var(--sun-l); color: #8A6300; }
.st-acknowledged { background: var(--sky-l); color: #0D6E9F; }
.st-in_progress { background: var(--grape-l); color: var(--grape-d); }
.st-closed { background: var(--grass-l); color: var(--grass-d); }
.type-badge { width: 52px; height: 52px; flex: none; border-radius: 18px; display: grid; place-items: center; font-size: 1.7rem; }
.ty-livery { background: var(--grass-l); box-shadow: inset 0 -4px 0 rgba(61, 190, 107, .35); }
.ty-medical { background: var(--berry-l); box-shadow: inset 0 -4px 0 rgba(255, 93, 162, .35); }
.ty-school { background: var(--sky-l); box-shadow: inset 0 -4px 0 rgba(76, 195, 255, .4); }
.role-admin { background: var(--grape-l); color: var(--grape-d); }
.role-client { background: var(--line); color: var(--ink-2); }

.filters { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter {
  flex: none; border: 2.5px solid var(--line); background: #fff; color: var(--ink-2); border-radius: 999px;
  padding: 7px 14px; font: inherit; font-weight: 800; font-size: .9rem; cursor: pointer;
}
.filter.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.filter .n { opacity: .7; margin-left: 4px; }

/* ---------- Hello / stats ---------- */
.hello { display: flex; align-items: center; gap: 16px; }
.hello h1 { font-size: 1.75rem; margin-bottom: 2px; }
.hello p { margin: 0 0 12px; font-weight: 600; color: var(--ink-2); }
.hello .emoji-big { font-size: 3.4rem; animation: bob 3s ease-in-out infinite; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { border: 0; text-align: left; font: inherit; cursor: pointer; color: var(--ink); border-radius: 20px; padding: 14px; box-shadow: 0 5px 0 rgba(43, 33, 72, .1); transition: transform .1s; }
.stat:active { transform: translateY(3px); }
.stat b { display: block; font-family: var(--head); font-size: 2rem; line-height: 1; }
.stat span { font-weight: 800; font-size: .85rem; }
.stat.st-open { background: var(--sun-l); } .stat.st-acknowledged { background: var(--sky-l); }
.stat.st-in_progress { background: var(--grape-l); } .stat.st-closed { background: var(--grass-l); }
.stat.selected { outline: 3px solid var(--ink); }

/* ---------- Ticket list ---------- */
.tlist { display: flex; flex-direction: column; gap: 12px; }
.titem {
  display: flex; gap: 14px; align-items: flex-start; text-decoration: none; color: inherit; background: #fff;
  border-radius: var(--radius); padding: 14px; border: 2px solid var(--line); box-shadow: 0 4px 0 rgba(43, 33, 72, .06);
  transition: transform .1s, box-shadow .1s;
}
.titem:active { transform: translateY(3px); box-shadow: none; }
.titem .tbody { flex: 1; min-width: 0; }
.titem .ttop { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.titem .tref { font-family: var(--head); font-weight: 800; font-size: 1.05rem; }
.titem .tdesc { margin: 4px 0 6px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.titem .tmeta { font-size: .8rem; color: var(--muted); font-weight: 700; display: flex; gap: 12px; flex-wrap: wrap; }

.empty { text-align: center; padding: 34px 16px; }
.empty .big { font-size: 4rem; display: block; animation: bob 3s ease-in-out infinite; }
.empty h3 { margin-top: 8px; }

/* ---------- New ticket ---------- */
.step { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.step i { font-style: normal; width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-family: var(--head); font-weight: 800; }
.step h2 { margin: 0; font-size: 1.3rem; }
.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px) { .type-grid { grid-template-columns: 1fr; } }
.type-opt { position: relative; cursor: pointer; }
.type-opt input { position: absolute; opacity: 0; pointer-events: none; }
.type-opt .box {
  display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 16px; border-radius: 20px; border: 3px solid var(--line);
  background: #fff; transition: transform .12s, border-color .12s, box-shadow .12s;
}
.type-opt .box .e { font-size: 2.2rem; line-height: 1; }
.type-opt .box b { font-family: var(--head); font-size: 1.2rem; }
.type-opt .box small { color: var(--ink-2); font-weight: 600; line-height: 1.35; }
@media (max-width: 560px) {
  .type-opt .box { flex-direction: row; align-items: center; gap: 14px; }
  .type-opt .box > div { display: flex; flex-direction: column; }
}
.type-opt input:focus-visible + .box { box-shadow: 0 0 0 4px rgba(76, 195, 255, .35); }
.type-opt input:checked + .box { transform: translateY(-3px); }
.type-opt.livery input:checked + .box { border-color: var(--grass); background: var(--grass-l); box-shadow: 0 5px 0 var(--grass); }
.type-opt.medical input:checked + .box { border-color: var(--berry); background: var(--berry-l); box-shadow: 0 5px 0 var(--berry); }
.type-opt.school input:checked + .box { border-color: var(--sky); background: var(--sky-l); box-shadow: 0 5px 0 var(--sky); }

/* ---------- Photos ---------- */
.photo-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.photo-add {
  aspect-ratio: 1; border: 3px dashed var(--sky); border-radius: 18px; background: var(--sky-l); color: var(--sky-d);
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; font-size: .82rem; cursor: pointer; text-align: center; gap: 2px;
}
.photo-add .e { font-size: 1.8rem; }
.photo-add input { display: none; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 18px; overflow: hidden; background: var(--line); box-shadow: 0 4px 0 rgba(43, 33, 72, .1); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .x {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(43, 33, 72, .8);
  color: #fff; font-weight: 900; cursor: pointer; display: grid; place-items: center; font-size: .9rem;
}
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 10px; }
.photos button { padding: 0; border: 0; background: var(--line); border-radius: 14px; overflow: hidden; aspect-ratio: 1; cursor: zoom-in; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Ticket detail ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 800; color: var(--ink-2); margin: 0 0 10px; }
.thead { display: flex; gap: 14px; align-items: center; }
.thead h1 { font-size: 1.6rem; margin: 0; }
.thead .meta { color: var(--muted); font-weight: 700; font-size: .88rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin-top: 14px; font-size: .93rem; }
.kv dt { color: var(--muted); font-weight: 800; } .kv dd { margin: 0; font-weight: 700; word-break: break-word; }
.progress { display: flex; justify-content: space-between; position: relative; margin: 20px 4px 4px; }
.progress::before { content: ''; position: absolute; left: 14px; right: 14px; top: 14px; height: 6px; background: var(--line); border-radius: 6px; }
.progress .bar { position: absolute; left: 14px; top: 14px; height: 6px; background: linear-gradient(90deg, var(--sun), var(--grass)); border-radius: 6px; transition: width .5s; }
.progress .p { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .72rem; font-weight: 800; color: var(--muted); width: 25%; text-align: center; }
.progress .p i { font-style: normal; width: 34px; height: 34px; border-radius: 50%; background: #fff; border: 3px solid var(--line); display: grid; place-items: center; font-size: 1rem; margin-top: -0px; }
.progress .p.done { color: var(--ink); }
.progress .p.done i { border-color: var(--grass); background: var(--grass-l); }
.progress .p.now i { border-color: var(--sun-d); background: var(--sun); transform: scale(1.15); }
.progress .p:first-child { align-items: flex-start; } .progress .p:last-child { align-items: flex-end; }

.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ''; position: absolute; left: 21px; top: 10px; bottom: 10px; width: 4px; background: var(--line); border-radius: 4px; }
.tl { position: relative; padding-left: 58px; margin-bottom: 16px; }
.tl .dot { position: absolute; left: 0; top: 0; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 1.3rem; border: 4px solid #EAF7FF; }
.tl .bubble { background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 12px 14px; box-shadow: 0 3px 0 rgba(43, 33, 72, .05); }
.tl.mine .bubble { background: #FFFDF5; }
.tl .who { font-weight: 800; } .tl .when { font-size: .8rem; color: var(--muted); font-weight: 700; }
.tl .msg { white-space: pre-wrap; word-break: break-word; margin-top: 6px; }
.k-created .dot { background: var(--sun-l); } .k-acknowledged .dot { background: var(--sky-l); }
.k-update .dot { background: var(--grape-l); } .k-comment .dot { background: #F2F0F7; }
.k-closed .dot { background: var(--grass-l); } .k-reopened .dot { background: var(--berry-l); }

.composer textarea { min-height: 96px; }
.composer .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.composer .actions .btn { flex: 1 1 140px; }
.closed-note { text-align: center; padding: 18px; border-radius: var(--radius); background: var(--grass-l); font-weight: 700; color: var(--grass-d); }

/* ---------- Users (swipe) ---------- */
.ulist { display: flex; flex-direction: column; gap: 10px; }
.swipe { position: relative; border-radius: 20px; overflow: hidden; }
.swipe .under {
  position: absolute; inset: 1px; border-radius: 20px; background: var(--tomato); display: flex; align-items: center; padding-left: 22px; color: #fff; font-weight: 900; font-family: var(--head); font-size: 1.1rem; gap: 8px;
}
.swipe .under .e { font-size: 1.4rem; transition: transform .15s; }
.swipe.armed .under .e { transform: scale(1.35) rotate(-12deg); }
.swipe.locked .under { background: var(--line); color: transparent; }
.urow {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border: 2px solid var(--line);
  border-radius: 20px; touch-action: pan-y; user-select: none; cursor: pointer; transition: transform .25s cubic-bezier(.2, .9, .3, 1.2);
}
.urow.dragging { transition: none; }
.avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; font-family: var(--head); font-weight: 800; font-size: 1.15rem; color: #fff; box-shadow: 0 3px 0 rgba(43, 33, 72, .15); }
.avatar.sm { width: 38px; height: 38px; font-size: 1rem; }
.urow .ubody { flex: 1; min-width: 0; }
.urow .uname { font-weight: 800; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.urow .usub { font-size: .82rem; color: var(--muted); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.urow .ucount { text-align: center; font-weight: 800; font-size: .75rem; color: var(--muted); }
.urow .ucount b { display: block; font-family: var(--head); font-size: 1.3rem; color: var(--ink); line-height: 1; }
.urow .del { display: none; }
@media (hover: hover) and (pointer: fine) {
  .urow .del { display: grid; opacity: 0; transition: opacity .15s; }
  .urow:hover .del { opacity: 1; }
}
.swipe-hint { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink-2); font-size: .9rem; margin: 0 4px 12px; }
.swipe-hint .e { display: inline-block; animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(8px); } }

/* ---------- Toasts / banners / modal ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + var(--safe-b)); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 16px; font-weight: 700; box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .5); animation: pop .25s ease-out; pointer-events: auto; }
.toast.ok { background: var(--grass-d); } .toast.err { background: var(--tomato-d); }
@keyframes pop { from { transform: translateY(12px) scale(.96); opacity: 0; } }
@media (min-width: 820px) { .toasts { bottom: 24px; } }

.banners { position: relative; z-index: 30; }
.banner { display: flex; align-items: center; gap: 12px; padding: calc(10px + var(--safe-t)) 16px 10px; font-weight: 700; font-size: .92rem; }
.banner + .banner { padding-top: 10px; }
.banner.update { background: var(--grape); color: #fff; }
.banner.install { background: var(--grass-l); color: var(--grass-d); }
.banner.offline { background: var(--ink); color: #fff; }
.banner .grow { flex: 1; }
.banner .btn { min-height: 36px; font-size: .9rem; padding: 4px 14px; box-shadow: 0 3px 0 var(--bd); }
.banner .x { background: none; border: 0; font-size: 1.2rem; color: inherit; cursor: pointer; padding: 4px; }
body.has-banner .topbar { padding-top: 10px; }

.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(43, 33, 72, .55); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; padding: 0; }
.modal {
  background: #fff; width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; border-radius: 28px 28px 0 0;
  padding: 22px 20px calc(20px + var(--safe-b)); animation: up .25s cubic-bezier(.2, .9, .3, 1.1);
}
.modal h2 { margin-bottom: 10px; }
.modal .actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.modal .actions .btn { flex: 1 1 120px; }
@media (min-width: 620px) { .modal-bg { align-items: center; padding: 20px; } .modal { border-radius: 28px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(20, 14, 36, .92); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
.lightbox img { max-width: 100%; max-height: 86vh; border-radius: 16px; }
.lightbox button { position: absolute; top: calc(14px + var(--safe-t)); right: 14px; }

.splash { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-weight: 800; color: var(--ink-2); }
.splash img { border-radius: 26px; animation: bob 1.6s ease-in-out infinite; }
.loading { display: flex; justify-content: center; padding: 40px; }
.loading::after { content: '🐴'; font-size: 2.4rem; animation: gallop .6s ease-in-out infinite alternate; }
@keyframes gallop { from { transform: translateY(0) rotate(-8deg); } to { transform: translateY(-12px) rotate(8deg); } }
.searchbar { position: relative; }
.searchbar input { padding-left: 42px; border-radius: 999px; background: #fff; }
.searchbar::before { content: '🔍'; position: absolute; left: 15px; top: 50%; transform: translateY(-50%); font-size: .95rem; }
.version { text-align: center; color: var(--muted); font-size: .8rem; font-weight: 700; margin-top: 18px; }
.ios-steps { margin: 8px 0 0; padding-left: 20px; } .ios-steps li { margin-bottom: 6px; }
.progress-text { font-weight: 800; color: var(--grape-d); margin-top: 10px; text-align: center; }

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

/* ===== theme: formal ===== */
/* RWRC Help Desk — formal theme: soft & elegant, in the style of the Protea Dome site
   (off-white / cream / clay / sand / sage / warm brown, Cormorant Garamond + Jost, hairlines, airy spacing).
   Appended after the base (kiddie) app.css at build time, so it only overrides. */
@font-face { font-family: 'Cormorant Garamond'; src: url('/fonts/cormorant.woff2') format('woff2'); font-weight: 300 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Cormorant Garamond'; src: url('/fonts/cormorant-italic.woff2') format('woff2'); font-weight: 300 700; font-style: italic; font-display: swap; }
@font-face { font-family: 'Jost'; src: url('/fonts/jost.woff2') format('woff2'); font-weight: 300 600; font-display: swap; }

:root {
  /* the base palette names are re-mapped onto soft, earthy tones */
  --sun: #D4B896; --sun-d: #B89A72; --sun-l: #F5EDE0;        /* sand */
  --grass: #7A8C6E; --grass-d: #5F6F55; --grass-l: #ECF0E7;  /* sage */
  --sky: #8798A0; --sky-d: #5E7079; --sky-l: #EDF1F2;        /* mist */
  --berry: #A0784A; --berry-d: #86623A; --berry-l: #F4EBE0;  /* clay */
  --grape: #5C4A2A; --grape-d: #47391F; --grape-l: #EFE9E0;  /* warm brown */
  --tomato: #B0644F; --tomato-d: #924F3D; --tomato-l: #F7E9E4;
  --ink: #2C2416; --ink-2: #5C4A2A; --muted: #93846C;
  --cream: #F5EFE6; --card: #FFFFFF; --line: #ECE4D8;
  --paper: #FAF7F2; --hair: rgba(44, 36, 22, .09);
  --radius: 4px; --radius-s: 2px;
  --shadow: 0 1px 2px rgba(44, 36, 22, .04), 0 12px 32px -18px rgba(44, 36, 22, .18);
  --head: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --body: 'Jost', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --caps: .14em;
}

body { background: var(--paper); background-image: none; color: var(--ink-2); font-weight: 400; font-variant-numeric: lining-nums; }
h1, h2, h3, h4 { font-weight: 400; color: var(--ink); letter-spacing: 0; line-height: 1.1; }
h1 { font-size: 2.35rem; font-weight: 300; } h2 { font-size: 1.75rem; } h3 { font-size: 1.4rem; }
a, .linkbtn { color: var(--berry-d); font-weight: 500; text-underline-offset: 3px; text-decoration-thickness: 1px; }
b, strong { font-weight: 500; }

/* hairline accent under section headings (Dome-style eyebrow line) */
.section-title { margin-top: 30px; }
.section-title h2::after, .section-title h3::after { content: ''; display: block; width: 30px; height: 1px; background: var(--berry); margin-top: 10px; }

/* ---------- Top bar: light, translucent, hairline ---------- */
.topbar { background: rgba(250, 247, 242, .94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--hair); box-shadow: none; }
.brand { color: var(--ink); }
.brand img { content: url('/icons/mark-bold.svg'); width: 36px; height: 44px; object-fit: contain; border-radius: 0; box-shadow: none; background: none; }
.brand b { font-weight: 500; font-size: 1.45rem; letter-spacing: .04em; }
.brand small { font-family: var(--body); font-weight: 400; font-size: .62rem; letter-spacing: .28em; color: var(--berry); opacity: 1; }
.topnav a { color: var(--ink-2); border-radius: 0; font-weight: 400; font-size: .74rem; text-transform: uppercase; letter-spacing: var(--caps); padding: 8px 12px; border-bottom: 1px solid transparent; }
.topnav a.active { background: none; box-shadow: none; color: var(--ink); border-bottom-color: var(--berry); }
.topnav a:hover { color: var(--berry-d); }

/* ---------- Bottom tab bar ---------- */
.tabbar { background: rgba(250, 247, 242, .96); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-top: 1px solid var(--hair); box-shadow: none; }
.tabbar a { font-weight: 400; font-size: .62rem; text-transform: uppercase; letter-spacing: .12em; border-radius: 0; color: var(--muted); }
.tabbar a .ti { filter: grayscale(1) sepia(.35); opacity: .6; }
.tabbar a.active { background: none; color: var(--ink); }
.tabbar a.active .ti { filter: sepia(.15); opacity: 1; transform: none; }
.tabbar a.fab .ti { background: var(--berry); box-shadow: 0 8px 20px -8px rgba(134, 98, 58, .7); border: 3px solid var(--paper); filter: none; opacity: 1; font-weight: 300; font-size: 1.6rem; }

/* ---------- Cards ---------- */
.card { border: 1px solid var(--hair); box-shadow: var(--shadow); padding: 22px; }
.card.sunny { background: var(--cream); border: 1px solid var(--hair); box-shadow: none; }
.card.minty { background: var(--grass-l); border: 1px solid var(--hair); }

/* ---------- Buttons: slim caps, gentle ---------- */
.btn {
  font-family: var(--body); font-weight: 500; font-size: .74rem; text-transform: uppercase; letter-spacing: .15em;
  border-radius: 999px; box-shadow: none; min-height: 48px; padding: 10px 28px;
  transition: background-color .3s, transform .3s, box-shadow .3s;
}
.btn:hover { filter: none; background: var(--bd); transform: translateY(-1px); }
.btn:active { transform: none; box-shadow: none; }
.btn.sun { --c: var(--ink); }
.btn.ghost { --b: transparent; --bd: var(--cream); --c: var(--ink); border: 1px solid var(--sun); }
.btn.big { font-size: .78rem; min-height: 54px; }
.btn.small { font-size: .66rem; min-height: 36px; padding: 6px 16px; box-shadow: none; }
.icon-btn { border: 1px solid var(--line); background: var(--paper); }

/* ---------- Forms ---------- */
label.field { font-weight: 400; font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
input, textarea, select { background: #fff; border: 1px solid #E3D9C9; border-radius: var(--radius-s); text-transform: none; letter-spacing: normal; color: var(--ink); }
input:focus, textarea:focus, select:focus { border-color: var(--berry); box-shadow: 0 0 0 3px rgba(160, 120, 74, .12); }
input::placeholder, textarea::placeholder { color: #B5A992; }
.hint { font-weight: 300; text-transform: none; letter-spacing: normal; }
.form-error, .form-ok { font-weight: 400; border-radius: var(--radius-s); }
.check { font-weight: 400; text-transform: none; letter-spacing: normal; color: var(--ink-2); }

/* ---------- Auth ---------- */
.auth-hero { margin: 26px 0 22px; }
.auth-hero img { content: url('/icons/mark.svg'); width: 100px; height: 122px; object-fit: contain; border-radius: 0; box-shadow: none; animation: none; }
.auth-hero h1 { font-size: 2.6rem; font-weight: 300; margin-top: 14px; }
.auth-hero p { font-weight: 300; color: var(--ink-2); }
.auth-foot { font-weight: 300; }
.tabs { border-radius: var(--radius-s); background: var(--cream); }
.tabs a, .tabs button { border-radius: var(--radius-s); font-weight: 400; font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; }
.tabs .active { box-shadow: 0 1px 2px rgba(44, 36, 22, .08); }

/* ---------- Chips / badges ---------- */
.chip { border-radius: 2px; font-weight: 500; font-size: .62rem; text-transform: uppercase; letter-spacing: .12em; padding: 4px 9px; }
.st-open { background: var(--sun-l); color: #82623A; }
.st-acknowledged { background: var(--sky-l); color: var(--sky-d); }
.st-in_progress { background: var(--grape-l); color: var(--grape); }
.st-closed { background: var(--grass-l); color: var(--grass-d); }
.role-admin { background: var(--berry-l); color: var(--berry-d); }
.type-badge { border-radius: 50%; box-shadow: none !important; width: 48px; height: 48px; font-size: 1.45rem; }
.ty-livery { background: var(--grass-l); } .ty-medical { background: var(--berry-l); } .ty-school { background: var(--sky-l); }
.filter { border: 1px solid #E3D9C9; border-radius: 999px; padding: 7px 15px; background: transparent; font-weight: 400; font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-2); }
.filter.active { background: var(--grape); border-color: var(--grape); color: var(--cream); }

/* ---------- Hello / stats ---------- */
.hello h1 { font-size: 2.2rem; }
.hello p { font-weight: 300; }
.hello .emoji-big { display: none; }
.stat { border-radius: var(--radius); box-shadow: none; border: 1px solid var(--hair); }
.stat b { font-weight: 300; font-size: 2.6rem; }
.stat span { font-weight: 400; font-size: .64rem; text-transform: uppercase; letter-spacing: .13em; }
.stat.selected { outline: 1px solid var(--berry); outline-offset: 2px; }

/* ---------- Ticket list ---------- */
.titem { border: 1px solid var(--hair); box-shadow: none; padding: 16px; transition: box-shadow .3s, transform .3s; }
.titem:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.titem:active { transform: none; }
.titem .tref { font-weight: 500; font-size: 1.22rem; }
.titem .tdesc { font-weight: 300; }
.titem .tmeta { font-weight: 400; }
.empty .big { animation: none; filter: sepia(.3); }

/* ---------- New ticket ---------- */
.step i { background: none; color: var(--berry); border: 1px solid var(--sun); font-family: var(--head); font-weight: 500; font-size: 1.05rem; width: 32px; height: 32px; }
.step h2 { font-size: 1.6rem; font-weight: 400; }
.type-opt .box { border: 1px solid #E3D9C9; border-radius: var(--radius); }
.type-opt .box b { font-weight: 500; font-size: 1.35rem; }
.type-opt .box small { font-weight: 300; }
.type-opt input:checked + .box { transform: none; }
.type-opt.livery input:checked + .box { box-shadow: 0 0 0 1px var(--grass); }
.type-opt.medical input:checked + .box { box-shadow: 0 0 0 1px var(--berry); }
.type-opt.school input:checked + .box { box-shadow: 0 0 0 1px var(--sky); }
.photo-add { border: 1px dashed #CDBFA8; border-radius: var(--radius); background: var(--paper); color: var(--ink-2); font-weight: 400; text-transform: uppercase; letter-spacing: .1em; font-size: .64rem; }
.thumb, .photos button { border-radius: var(--radius-s); box-shadow: none; }

/* ---------- Ticket detail ---------- */
.back { font-weight: 400; font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.thead h1 { font-size: 2.1rem; font-weight: 400; }
.thead .meta { font-weight: 300; }
.kv dt { font-weight: 400; font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; padding-top: 3px; }
.kv dd { font-weight: 400; }
.progress::before { height: 1px; top: 16px; background: #E3D9C9; }
.progress .bar { height: 1px; top: 16px; background: var(--berry); }
.progress .p { font-weight: 400; font-size: .6rem; text-transform: uppercase; letter-spacing: .1em; }
.progress .p i { border-width: 1px; border-color: #E3D9C9; filter: sepia(.25); }
.progress .p.done i { border-color: var(--grass); background: var(--grass-l); }
.progress .p.now i { border-color: var(--berry); background: var(--berry-l); transform: none; box-shadow: 0 0 0 4px rgba(160, 120, 74, .12); }
.timeline::before { width: 1px; left: 23px; background: #E3D9C9; }
.tl .dot { border: 4px solid var(--paper); font-size: 1.05rem; filter: sepia(.2); }
.tl .bubble { border: 1px solid var(--hair); border-radius: var(--radius); box-shadow: none; }
.tl.mine .bubble { background: var(--cream); }
.tl .who { font-weight: 500; color: var(--ink); } .tl .when { font-weight: 300; }
.tl .msg { font-weight: 300; color: var(--ink); }
.closed-note { border-radius: var(--radius); font-weight: 400; }

/* ---------- Users ---------- */
.swipe, .swipe .under, .urow { border-radius: var(--radius); }
.urow { border: 1px solid var(--hair); }
.swipe .under { font-family: var(--body); font-weight: 500; text-transform: uppercase; letter-spacing: .14em; font-size: .74rem; }
.avatar { font-family: var(--head); font-weight: 500; box-shadow: none; filter: saturate(.3) sepia(.35) brightness(.95); }
.urow .uname { font-weight: 500; color: var(--ink); }
.urow .usub, .swipe-hint { font-weight: 300; }
.urow .ucount { font-weight: 400; }
.urow .ucount b { font-weight: 400; font-size: 1.5rem; }

/* ---------- Toasts / banners / modal / misc ---------- */
.toast { border-radius: var(--radius); font-weight: 400; background: var(--ink); }
.toast.ok { background: var(--grass-d); } .toast.err { background: var(--tomato-d); }
.banner { font-weight: 400; }
.banner.update { background: var(--grape); color: var(--cream); }
.banner.install { background: var(--cream); color: var(--ink-2); border-bottom: 1px solid var(--hair); }
.banner.offline { background: var(--ink); }
.modal { border-radius: 8px 8px 0 0; }
@media (min-width: 620px) { .modal { border-radius: 6px; } }
.modal-bg { background: rgba(44, 36, 22, .4); }
.lightbox { background: rgba(28, 22, 14, .92); }
.lightbox img { border-radius: 2px; }
.splash { font-weight: 400; text-transform: uppercase; letter-spacing: .25em; font-size: .68rem; color: var(--muted); }
.splash img { content: url('/icons/mark.svg'); width: 80px; height: 96px; object-fit: contain; border-radius: 0; animation: none; }
.loading::after { content: ''; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); border-top-color: var(--berry); animation: spin 1s linear infinite; }
.searchbar input { border-radius: var(--radius-s); }
.searchbar::before { filter: grayscale(1); opacity: .5; }
.version { font-weight: 300; }
.progress-text { color: var(--berry-d); font-weight: 500; }
/* empty "All quiet in the paddock!" card: the winged horse instead of the rainbow emoji */
.empty .big.quiet { font-size: 0; width: 66px; height: 80px; margin: 0 auto 6px; background: url('/icons/mark.svg') center / contain no-repeat; filter: none; }
/* progress tracker: make the current stage obvious with a slow, breathing green outline (not on closed tickets) */
.progress .bar { background: var(--grass); height: 2px; }
.progress .p.now { color: var(--ink); font-weight: 600; }
.progress .p.now i { border: 2px solid var(--grass); background: var(--grass-l); filter: none; transform: scale(1.08); animation: stage-pulse 2.4s ease-in-out infinite; }
.progress .p.now:last-child i { animation: none; box-shadow: none; transform: none; }
@keyframes stage-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(122, 140, 110, .85), 0 0 0 7px rgba(122, 140, 110, .22); }
  50% { box-shadow: 0 0 0 2px rgba(122, 140, 110, .15), 0 0 0 7px rgba(122, 140, 110, 0); }
}
