/* Lucky Travels tracker – mobile first. No web fonts or frameworks, to stay fast on 4G. */

:root {
  --brand: #0f4c5c;
  --brand-strong: #0a3742;
  --brand-soft: #e3f0f2;
  --gold: #f2a900;
  --bg: #f3f5f7;
  --card: #ffffff;
  --text: #17202b;
  --muted: #5d6876;
  --line: #e1e6eb;
  --gain: #12784a;
  --loss: #c4281c;
  --loss-soft: #fdecea;
  --pending: #8a5300;
  --pending-soft: #fff3d9;
  --ok-soft: #e4f5ec;
  --svc-ticketing: #1f6fd1;
  --svc-medical: #0b8f6a;
  --svc-police: #5b45c9;
  --svc-agreement: #c0510f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; scroll-padding-bottom: calc(var(--nav-h) + 110px); }
body {
  margin: 0;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand); }
h1, h2 { line-height: 1.2; }
h2 { font-size: 1.05rem; margin: 0; }
p { margin: 0 0 .75rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
[hidden] { display: none !important; }

.icon { width: 22px; height: 22px; flex: none; vertical-align: middle; }

/* ---------- layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  background: var(--brand); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.brand img { border-radius: 8px; }
.who {
  margin-left: auto; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: .9rem;
  background: rgba(255, 255, 255, .16);
}
.topnav { display: none; }

.container { max-width: 1040px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + var(--safe-b) + 28px); }
.page-login .container { padding-bottom: 32px; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: #fff; border-top: 1px solid var(--line);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--nav-h); color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600;
}
.bottomnav a[aria-current="page"] { color: var(--brand); }
.bottomnav .fab { position: relative; color: var(--brand); }
.bottomnav .fab .icon {
  width: 54px; height: 54px; padding: 14px; margin-top: -26px; border-radius: 50%;
  background: var(--brand); color: #fff; stroke-width: 2.6;
  box-shadow: 0 6px 16px rgba(15, 76, 92, .35); border: 4px solid #fff;
}

/* ---------- headings ---------- */
.page-title { font-size: 1.4rem; margin: 4px 0 12px; }
.page-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.page-head .page-title { margin: 0; }
.page-head .push { margin-left: auto; }
.back {
  display: grid; place-items: center; width: 40px; height: 40px; margin-left: -8px;
  border-radius: 50%; color: var(--text);
}
.back:active { background: var(--line); }
.block { margin-top: 22px; }
.block > h2 { margin-bottom: 10px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.link { font-weight: 600; text-decoration: none; }

/* ---------- cards and messages ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.messages { display: grid; gap: 8px; margin-bottom: 12px; }
.msg { padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-strong); }
.msg a { font-weight: 700; color: inherit; }
.msg-success { background: var(--ok-soft); color: #0d5434; }
.msg-error { background: var(--loss-soft); color: #8e1b12; }
.msg-warning { background: var(--pending-soft); color: #6a3f00; }
.msg ul { margin: 6px 0 10px; padding-left: 18px; }
.msg p:last-child { margin-bottom: 0; }

.notice {
  display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 12px 14px;
  border-radius: 12px; background: var(--card); box-shadow: var(--shadow); color: var(--text); text-decoration: none; font-size: .92rem;
}
.notice-pending { background: var(--pending-soft); color: #5c3700; box-shadow: none; }
.notice-deleted { background: var(--loss-soft); color: #7c1810; box-shadow: none; margin: 0 0 12px; }
.notice > span { flex: 1; }

.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty .btn { margin-top: 6px; }

/* ---------- money ---------- */
.amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.amt.gain { color: var(--gain); }
.amt.loss { color: var(--loss); }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .74rem; font-weight: 700;
  line-height: 1.5; white-space: nowrap; vertical-align: middle;
}
.badge.pending { background: var(--pending-soft); color: var(--pending); }
.badge.open { background: var(--brand-soft); color: var(--brand); }
.badge.done { background: var(--ok-soft); color: var(--gain); }
.badge.muted-badge { background: #eceff2; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap;
  background: #fff; color: var(--text);
}
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
.btn-sm .icon { width: 18px; height: 18px; }
.btn-lg { min-height: 52px; font-size: 1.05rem; padding: 12px 20px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); }
.btn-danger { background: var(--loss); color: #fff; }
.btn-warning { background: #b87300; color: #fff; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--text); }
.btn-ghost-danger { background: #fff; border-color: #f3c7c2; color: var(--loss); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.actions .btn-lg { flex: 1; }
.actions form { flex: 1; display: flex; }
.actions form .btn { flex: 1; }

/* ---------- dashboard ---------- */
.period { margin-bottom: 12px; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; font-weight: 600; font-size: .92rem;
  text-decoration: none; white-space: nowrap; cursor: pointer;
}
.chip .icon { width: 18px; height: 18px; }
.chip[aria-current="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.range-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-top: 10px; }
.range-form label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); flex: 1 1 130px; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; display: grid; gap: 2px; }
.stat-label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 1.15rem; }
.stat-sub { font-size: .85rem; color: rgba(255, 255, 255, .8); }
.stat-profit { grid-column: 1 / -1; background: var(--brand); color: #fff; padding: 16px; }
.stat-profit .stat-label { color: rgba(255, 255, 255, .85); }
.stat-profit .stat-value { font-size: 2rem; letter-spacing: -.01em; }
.stat-profit .amt.gain { color: #fff; }
.stat-profit .amt.loss { color: #ffd2cc; }

.svc-list, .rec-list, .menu, .user-list, .history { list-style: none; margin: 0; padding: 0; }
.svc-list { display: grid; gap: 8px; }
.svc-row, .rec-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--text); text-decoration: none; min-height: 64px;
}
.svc-row:active, .rec-row:active { background: #f7f9fa; }
.svc-main, .rec-main { flex: 1; min-width: 0; display: grid; }
.svc-main small, .rec-main small { color: var(--muted); font-size: .82rem; }
.rec-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-profit { font-weight: 700; }
.chev { width: 18px; height: 18px; color: #a4adb8; }

.svc-dot { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex: none; color: #fff; }
.svc-dot .icon { width: 22px; height: 22px; }
.svc-ticketing { --svc: var(--svc-ticketing); }
.svc-medical { --svc: var(--svc-medical); }
.svc-police { --svc: var(--svc-police); }
.svc-agreement { --svc: var(--svc-agreement); }
.svc-dot { background: var(--svc, var(--brand)); }
.svc-dot.svc-ticketing .icon { fill: currentColor; stroke: none; }
.svc-pill { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--svc); margin-right: 8px; }

.rec-list { display: grid; gap: 8px; }
.rec-amt { display: grid; justify-items: end; gap: 2px; font-weight: 700; text-align: right; }
.rec-amt small { font-weight: 400; }
.rec-row.is-cancelled { opacity: .65; }
.rec-row.is-cancelled .amt { text-decoration: line-through; }

/* ---------- new record ---------- */
.svc-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.svc-tile {
  display: grid; justify-items: center; align-content: center; gap: 12px; min-height: 140px; padding: 16px;
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow); border: 2px solid transparent;
  color: var(--text); text-decoration: none; text-align: center; font-size: 1.05rem;
}
.svc-tile:active { border-color: var(--svc); }
.svc-tile .svc-dot { width: 56px; height: 56px; border-radius: 16px; }
.svc-tile .svc-dot .icon { width: 30px; height: 30px; }

.svc-chosen { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.svc-chosen strong { font-size: 1.1rem; }
.svc-chosen .link { margin-left: auto; }

/* ---------- forms ---------- */
.form { display: grid; gap: 12px; }
.form-section { margin: 0; padding: 14px; border: 0; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); display: grid; gap: 12px; min-width: 0; }
.form-section legend { float: left; width: 100%; padding: 0; margin-bottom: 2px; font-weight: 700; font-size: .95rem; color: var(--brand); }
.form-section legend + * { clear: both; }
.row-2 { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label { font-size: .86rem; font-weight: 600; color: #3b4652; }
.req { color: var(--loss); }
.help { font-size: .8rem; color: var(--muted); margin: 0; }
.error { font-size: .85rem; color: var(--loss); margin: 0; font-weight: 600; }
input[type=text], input[type=search], input[type=tel], input[type=password], input[type=date], input[type=month], input[type=number], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #cfd6de; border-radius: 12px;
  background: #fff; color: var(--text); font: inherit; font-size: 16px; /* 16px stops iOS zooming in */
  -webkit-appearance: none; appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235d6876' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
input[type=date], input[type=month] { min-width: 0; display: block; }
input::-webkit-date-and-time-value { text-align: left; }
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, .chip:focus-visible {
  outline: 3px solid rgba(15, 76, 92, .35); outline-offset: 1px; border-color: var(--brand);
}
.has-error input, .has-error select { border-color: var(--loss); }
.money-wrap { position: relative; }
.money-prefix { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.money-input { padding-left: 40px !important; font-size: 1.2rem !important; font-weight: 700; font-variant-numeric: tabular-nums; }

.seg { display: flex; gap: 6px; background: #eef1f4; padding: 4px; border-radius: 12px; }
.seg-opt { flex: 1; position: relative; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-opt span { display: flex; align-items: center; justify-content: center; min-height: 42px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.seg-opt input:checked + span { background: #fff; color: var(--brand); box-shadow: var(--shadow); }
.seg-opt input:focus-visible + span { outline: 3px solid rgba(15, 76, 92, .35); }

.save-bar {
  position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); z-index: 10;
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px;
  background: #fff; border-radius: 16px; box-shadow: 0 8px 24px rgba(16, 24, 40, .18);
}
.save-bar .btn { margin-left: auto; min-width: 128px; }
.live-profit { display: grid; }
.live-profit strong { font-size: 1.35rem; }
.live-profit .label { font-size: .78rem; }

.dup-warning .btn { margin-top: 4px; }

/* ---------- records list ---------- */
.search-form { display: grid; gap: 10px; margin-bottom: 12px; }
.search-box { position: relative; display: flex; gap: 8px; }
.search-box > .icon { position: absolute; left: 12px; top: 13px; color: var(--muted); }
.search-box input { padding-left: 42px; }
.filters { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0 14px; }
.filters summary { display: flex; align-items: center; gap: 8px; min-height: 48px; font-weight: 700; cursor: pointer; list-style: none; }
.filters summary::-webkit-details-marker { display: none; }
.filters[open] { padding-bottom: 14px; }
.filters-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.filters-grid label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); font-weight: 600; min-width: 0; }
.filters-grid label.check { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; color: var(--text); min-height: 40px; }
.filters-grid .actions { grid-column: 1 / -1; margin-top: 4px; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--brand); }

.totals-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 12px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.totals-bar > div { display: grid; min-width: 0; }
.totals-bar .label { font-size: .72rem; color: var(--muted); }
.totals-bar strong { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 8px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; }

/* ---------- record detail ---------- */
.record-card { display: grid; gap: 14px; }
.record-svc { display: flex; align-items: center; gap: 12px; }
.record-svc strong { font-size: 1.1rem; flex: 1; }
.money-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.money-grid > div { display: grid; gap: 2px; padding: 10px 12px; background: #f6f8fa; border-radius: 12px; min-width: 0; }
.money-grid .label { font-size: .78rem; }
.money-grid strong { font-size: 1.1rem; }
.money-profit { grid-column: 1 / -1; }
.money-profit strong { font-size: 1.5rem; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 0; }
.facts div { min-width: 0; }
.facts .wide { grid-column: 1 / -1; }
.facts dt { font-size: .78rem; color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.stamp { font-size: .85rem; color: var(--muted); margin: 0; padding-top: 12px; border-top: 1px solid var(--line); }

.history { display: grid; gap: 10px; }
.history > li { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 14px; }
.history p { margin: 0; }
.changes { list-style: none; margin: 6px 0 0; padding: 0; font-size: .9rem; display: grid; gap: 2px; }
del { color: var(--loss); text-decoration: line-through; }
ins { color: var(--gain); text-decoration: none; font-weight: 600; }
.log > li.log-day { background: none; box-shadow: none; padding: 8px 2px 0; font-weight: 700; color: var(--muted); font-size: .85rem; }
.log-time { font-variant-numeric: tabular-nums; color: var(--muted); margin-right: 6px; }
.log-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 4px 1px 2px; background: var(--brand); }
.log-dot.log-record_created { background: var(--gain); }
.log-dot.log-record_deleted, .log-dot.log-user_deactivated { background: var(--loss); }
.log-dot.log-record_edited { background: var(--gold); }
.inline-form { margin-bottom: 12px; max-width: 320px; }

/* ---------- reports ---------- */
.month-form { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.month-form label { width: 100%; font-weight: 600; font-size: .86rem; }
.month-form input { flex: 1 1 160px; width: auto; }
.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table thead th { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.table tfoot th { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.current td { background: var(--brand-soft); }
.table a { text-decoration: none; font-weight: 600; }
.table small.narrow-only { display: block; font-size: .78rem; color: var(--muted); font-weight: 400; margin-top: 2px; }
.table .wide-only { display: none; }

/* ---------- users and more ---------- */
.user-list { display: grid; gap: 10px; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.user-row.is-inactive { opacity: .7; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 700; flex: none; }
.user-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.user-main small { color: var(--muted); font-size: .82rem; }
.menu { padding: 4px 0; margin-bottom: 16px; }
.menu li + li { border-top: 1px solid var(--line); }
.menu a { display: flex; align-items: center; gap: 14px; padding: 14px 16px; color: var(--text); text-decoration: none; min-height: 56px; }
.menu a > .icon:first-child { color: var(--brand); }
.menu span { flex: 1; display: grid; font-weight: 600; }
.menu small { font-weight: 400; color: var(--muted); font-size: .82rem; }
.install-hint { margin-top: 20px; }

/* ---------- login ---------- */
.login { max-width: 380px; margin: 6vh auto 0; text-align: center; }
.login h1 { margin: 12px 0 2px; font-size: 1.6rem; }
.login-logo { border-radius: 18px; box-shadow: var(--shadow); }
.login .card { text-align: left; margin: 20px 0 12px; }

/* ---------- wider screens ---------- */
@media (min-width: 560px) {
  .table .wide-only { display: table-cell; }
  .table .narrow-only { display: none !important; }
  .row-2 { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 2fr 1fr 1fr; }
  .stat-profit { grid-column: auto; }
  .svc-picker { grid-template-columns: repeat(4, 1fr); }
  .filters-grid { grid-template-columns: repeat(3, 1fr); }
  .money-grid { grid-template-columns: repeat(3, 1fr); }
  .money-profit { grid-column: auto; }
  .facts { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 900px) {
  :root { --nav-h: 0px; }
  .bottomnav { display: none; }
  .topbar { padding: 10px 24px; }
  .topnav { display: flex; align-items: center; gap: 4px; margin-left: 24px; flex: 1; }
  .topnav a { color: rgba(255, 255, 255, .85); text-decoration: none; font-weight: 600; padding: 8px 12px; border-radius: 10px; }
  .topnav a[aria-current="page"], .topnav a:hover { background: rgba(255, 255, 255, .14); color: #fff; }
  .topnav .btn-primary { margin-left: auto; background: #fff; color: var(--brand); }
  .topnav .btn-primary:hover { background: var(--brand-soft); }
  .who { margin-left: 8px; }
  .container { padding: 24px 24px 48px; }
  .save-bar { bottom: 16px; }
  .dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
  .svc-row, .rec-row { transition: background .15s; }
  .svc-row:hover, .rec-row:hover { background: #fafbfc; }
  .form.record-form { max-width: 760px; }
}

/* ================================================================
   New look: glass bars, light and dark themes, gentle motion.
   It sits after the rules above and overrides them.
   ================================================================ */
@font-face {
  font-family: "IBM Plex Sans"; font-style: normal; font-weight: 100 700; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin.b2c9031d9fd6.woff2") format("woff2");
}
:root {
  --brand: #1D4ED8; --brand-strong: #1E3A8A; --brand-soft: #E8EEFC; --link: #1D4ED8; --accent: #E11D48;
  --bg: #F4F6FA; --card: rgba(255, 255, 255, .84); --solid: #fff; --text: #0F172A; --muted: #5B6779;
  --line: rgba(15, 23, 42, .09); --label: #334155; --field: #fff; --field-line: #CBD5E1; --sunk: #EEF2F7;
  --hover: rgba(29, 78, 216, .05); --ring: rgba(29, 78, 216, .35);
  --gain: #047857; --loss: #B91C1C; --loss-soft: #FDECEC; --pending: #B45309; --pending-soft: #FEF3C7; --ok-soft: #DCFCE7;
  --svc-ticketing: #2563EB; --svc-medical: #059669; --svc-police: #7C3AED; --svc-agreement: #EA580C;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 28px -14px rgba(15, 23, 42, .2);
  --glass: rgba(255, 255, 255, .72); --glass-line: rgba(255, 255, 255, .8);
  --hero: linear-gradient(135deg, #1E3A8A 0%, #1D4ED8 55%, #3B82F6 100%);
  --blobs: radial-gradient(38rem 26rem at 105% -8%, rgba(59, 130, 246, .16), transparent 60%),
           radial-gradient(30rem 22rem at -12% 34%, rgba(16, 185, 129, .1), transparent 60%);
  color-scheme: light;
}
html.dark {
  --brand: #2563EB; --brand-strong: #93C5FD; --brand-soft: rgba(59, 130, 246, .16); --link: #93C5FD;
  --bg: #0B1120; --card: rgba(30, 41, 59, .62); --solid: #131C31; --text: #E2E8F0; --muted: #94A3B8;
  --line: rgba(148, 163, 184, .15); --label: #CBD5E1; --field: rgba(15, 23, 42, .75); --field-line: rgba(148, 163, 184, .3);
  --sunk: rgba(148, 163, 184, .1); --hover: rgba(148, 163, 184, .08); --ring: rgba(96, 165, 250, .5);
  --gain: #34D399; --loss: #F87171; --loss-soft: rgba(248, 113, 113, .14); --pending: #FBBF24;
  --pending-soft: rgba(251, 191, 36, .14); --ok-soft: rgba(52, 211, 153, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -16px rgba(0, 0, 0, .7);
  --glass: rgba(15, 23, 42, .68); --glass-line: rgba(148, 163, 184, .16);
  --hero: linear-gradient(135deg, #172554 0%, #1E40AF 55%, #2563EB 100%);
  --blobs: radial-gradient(38rem 26rem at 105% -8%, rgba(37, 99, 235, .24), transparent 60%),
           radial-gradient(30rem 22rem at -12% 34%, rgba(5, 150, 105, .12), transparent 60%);
  color-scheme: dark;
}
html { background: var(--bg); }
body { font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: transparent; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: var(--blobs); pointer-events: none; }
h1, h2, .page-title { letter-spacing: -.015em; }
.amt, .stat-value, .rec-amt, .svc-profit { font-variant-numeric: tabular-nums; }
html.theming, html.theming * { transition: background-color .35s, color .35s, border-color .35s !important; }

/* glass bars: the only places that blur, to keep scrolling fast */
.topbar, .bottomnav, .save-bar {
  background: var(--glass); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(18px) saturate(1.6); backdrop-filter: blur(18px) saturate(1.6);
}
.topbar { color: var(--text); border-width: 0 0 1px; border-bottom-color: var(--line); }
.brand { color: var(--text); letter-spacing: -.01em; }
.brand img { border-radius: 9px; box-shadow: var(--shadow); }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.who { margin-left: 0; width: 36px; height: 36px; background: var(--hero); color: #fff; box-shadow: var(--shadow); }
.who-name { display: none; }
.themebtn {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
}
.themebtn .icon { width: 20px; height: 20px; }
.themebtn .i-sun, html.dark .themebtn .i-moon { display: none; }
html.dark .themebtn .i-sun { display: block; }

.bottomnav {
  left: 12px; right: 12px; bottom: calc(10px + var(--safe-b)); height: var(--nav-h); padding-bottom: 0;
  border-radius: 24px; box-shadow: 0 14px 34px -14px rgba(15, 23, 42, .45);
}
.bottomnav a { border-radius: 18px; }
.bottomnav a[aria-current="page"] { color: var(--link); }
.bottomnav .fab { color: var(--text); }
.bottomnav .fab .icon { background: var(--accent); border: 3px solid var(--solid); box-shadow: 0 10px 22px -6px rgba(225, 29, 72, .6); }
.save-bar { bottom: calc(var(--nav-h) + var(--safe-b) + 20px); border-radius: 20px; box-shadow: var(--shadow); }

/* cards */
.card, .stat, .svc-row, .rec-row, .notice { border: 1px solid var(--line); }
.notice-pending, .notice-deleted { border-color: transparent; }
.stat-profit {
  position: relative; overflow: hidden; background: var(--hero); border: 0; border-radius: 22px; padding: 20px;
  box-shadow: 0 18px 40px -18px rgba(29, 78, 216, .75);
}
.stat-profit::after {
  content: ""; position: absolute; right: -60px; top: -70px; width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 70%); pointer-events: none;
}
.stat-profit .stat-value { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; }
.stat-profit .amt.loss { color: #FECDD3; }
.svc-dot { border-radius: 14px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); }
.chev { color: var(--muted); }
.badge.muted-badge { background: var(--sunk); }
.link, .back { color: var(--link); }
.back { color: var(--text); }

/* buttons, chips and fields */
.btn { background: var(--solid); border-radius: 14px; transition: transform .15s, box-shadow .2s, background-color .2s; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 18px -10px rgba(29, 78, 216, .8); }
.btn-primary:hover { background: #1E40AF; }
.btn-danger { background: var(--loss); color: #fff; }
html.dark .btn-danger { background: #DC2626; }
.btn-ghost, .btn-ghost-danger { background: var(--solid); }
.btn-ghost-danger { border-color: var(--loss-soft); }
.chip { background: var(--card); border-color: var(--line); transition: transform .15s, background-color .2s; }
.chip[aria-current="true"] { background: var(--brand); border-color: var(--brand); }
.field > label, .label { color: var(--label); }
input[type=text], input[type=search], input[type=tel], input[type=password], input[type=date], input[type=month],
input[type=number], select, textarea { background: var(--field); border-color: var(--field-line); border-radius: 14px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, .chip:focus-visible, .themebtn:focus-visible {
  outline: 3px solid var(--ring); outline-offset: 1px;
}
.seg { background: var(--sunk); }
.seg-opt input:checked + span { background: var(--solid); color: var(--link); }
.seg-opt input:focus-visible + span { outline-color: var(--ring); }
.money-grid > div { background: var(--sunk); }
.svc-row:active, .rec-row:active { background: var(--hover); }
html.dark .msg-success { color: #6EE7B7; }
html.dark .msg-error, html.dark .notice-deleted { color: #FCA5A5; }
html.dark .msg-warning, html.dark .notice-pending { color: #FCD34D; }

/* motion: things fade up, rows press in. All of it stops when the device asks for less motion. */
@keyframes lt-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.container > *, .stats > *, .svc-list > *, .rec-list > * { animation: lt-rise .45s cubic-bezier(.2, .7, .2, 1) both; }
.container > :nth-child(2), .stats > :nth-child(2), .svc-list > :nth-child(2), .rec-list > :nth-child(2) { animation-delay: .05s; }
.container > :nth-child(3), .stats > :nth-child(3), .svc-list > :nth-child(3), .rec-list > :nth-child(3) { animation-delay: .1s; }
.container > :nth-child(4), .svc-list > :nth-child(4), .rec-list > :nth-child(4) { animation-delay: .15s; }
.container > :nth-child(n+5), .rec-list > :nth-child(n+5) { animation-delay: .2s; }
.svc-row, .rec-row { transition: transform .15s, box-shadow .2s, background-color .2s; }
.btn:active, .chip:active, .svc-row:active, .rec-row:active, .bottomnav a:active, .themebtn:active { transform: scale(.97); }
.topbar { view-transition-name: lt-topbar; }
.bottomnav { view-transition-name: lt-bottomnav; }
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .btn:active, .chip:active, .svc-row:active, .rec-row:active, .bottomnav a:active, .themebtn:active { transform: none; }
}

/* computer screens: the top bar becomes a glass side menu */
@media (min-width: 900px) {
  body { padding-left: 260px; }
  .topbar {
    position: fixed; left: 12px; top: 12px; bottom: 12px; width: 236px; z-index: 30;
    flex-direction: column; align-items: stretch; gap: 4px; padding: 20px 14px 14px;
    border: 1px solid var(--glass-line); border-radius: 24px; box-shadow: var(--shadow);
  }
  .brand { padding: 0 8px 16px; }
  .topnav { flex-direction: column; align-items: stretch; gap: 2px; margin: 0; flex: 1; }
  .topnav a {
    display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 12px; border-radius: 12px;
    color: var(--muted); transition: background-color .2s, color .2s;
  }
  .topnav a .icon { width: 20px; height: 20px; }
  .topnav a[aria-current="page"], .topnav a:hover { background: var(--brand-soft); color: var(--link); }
  .topnav .btn-primary {
    order: -1; margin: 0 0 12px; justify-content: center; color: #fff; background: var(--accent);
    box-shadow: 0 10px 22px -10px rgba(225, 29, 72, .8);
  }
  .topnav .btn-primary:hover { background: #BE123C; color: #fff; }
  .topbar-end { margin: 0; padding: 12px 8px 0; border-top: 1px solid var(--line); }
  .who-name { display: block; flex: 1; min-width: 0; font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .container { padding: 28px 32px 48px; }
  .svc-row:hover, .rec-row:hover { background: var(--card); transform: translateY(-1px); box-shadow: 0 16px 34px -18px rgba(15, 23, 42, .35); }
}
