/* ExpenseFlow — Cosmic Nutracos expense portal
   Primary #2563eb · Surface #fff · Page #f4f7fd · Text #0f172a · Muted #64748b · Border #e2e8f0 */
:root {
  --primary: #2563eb; --primary-dark: #1d4ed8; --primary-soft: #eff6ff;
  --page: #f4f7fd; --surface: #ffffff; --surface-2: #f8fafc;
  --text: #0f172a; --text-2: #334155; --muted: #64748b; --faint: #94a3b8;
  --border: #e2e8f0; --border-2: #f1f5f9;
  --ok: #16a34a; --ok-bg: #dcfce7; --ok-fg: #166534;
  --err: #dc2626; --err-bg: #fee2e2; --err-fg: #991b1b;
  --warn: #f59e0b; --warn-bg: #fffbeb; --warn-fg: #92400e;
  --info-bg: #eff6ff; --info-fg: #1e40af;
  --radius: 12px; --shadow: 0 1px 2px rgba(15,23,42,.05), 0 4px 16px rgba(15,23,42,.04);
  --sidebar: 264px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--text);
  font: 14px/1.5 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.msr {
  font-family: 'Material Symbols Rounded'; font-weight: normal; font-style: normal;
  font-size: 18px; line-height: 1; letter-spacing: normal; text-transform: none;
  display: inline-block; white-space: nowrap; direction: ltr; vertical-align: -4px;
  -webkit-font-smoothing: antialiased; font-feature-settings: 'liga';
}
.dim { color: var(--faint); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }

/* ── Shell ─────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); padding: 18px 14px 24px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { text-align: center; padding: 4px 0 10px; }
.brand img { width: 132px; height: auto; display: block; margin: 0 auto 6px; }
.brand .tag { font-size: 10px; color: var(--faint); letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.demo-flag { background: #fef3c7; border: 1px solid #f59e0b; color: #92400e; border-radius: 10px; padding: 7px 10px;
  font-size: 11.5px; font-weight: 700; margin-top: 8px; text-align: center; }
.me {
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe); border: 1px solid #bae6fd;
  border-radius: 12px; padding: 12px 14px; margin: 12px 0 16px;
}
.me .name { font-weight: 700; font-size: 14px; line-height: 1.3; }
.me .role { font-size: 12px; color: var(--primary); font-weight: 500; margin-top: 3px; word-break: break-all; }
.me .desig { font-size: 11px; color: var(--muted); margin-top: 2px; }
.nav-sec { font-size: 10.5px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; margin: 14px 6px 6px; }
.nav a, .nav button.navlink {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 9px; color: var(--text-2); font: inherit; font-weight: 500;
  background: none; border: 0; cursor: pointer; text-align: left;
}
.nav a:hover, .nav button.navlink:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav a .msr { font-size: 20px; color: var(--muted); }
.nav a.active .msr { color: var(--primary); }
.nav .badge { margin-left: auto; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; border-radius: 20px; padding: 1px 8px; }
.nav .soon { margin-left: auto; font-size: 10px; color: var(--faint); border: 1px solid var(--border); border-radius: 20px; padding: 0 6px; }
.nav-div { height: 1px; background: var(--border); margin: 12px 0; }
.sidebar details summary { list-style: none; }
.sidebar details summary::-webkit-details-marker { display: none; }
.sidebar details[open] > summary { color: var(--primary); }
.pw-form { padding: 6px 4px 2px; display: grid; gap: 8px; }

.main { flex: 1; min-width: 0; padding: 22px 28px 48px; }
.topbar { display: none; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.page-head .ic {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); flex-shrink: 0;
}
.page-head .ic .msr { font-size: 24px; vertical-align: 0; }
.page-head h1 { font-size: 22px; font-weight: 800; }
.page-head .sub { font-size: 12px; color: var(--muted); }

@media (max-width: 860px) {
  .sidebar {
    position: fixed; z-index: 40; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: 0 0 40px rgba(15,23,42,.18);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 30; }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px;
  }
  .topbar img { height: 26px; }
  .main { padding: 0 16px 40px; }
  .main > .topbar { margin: 0 -16px 14px; }
  .page-head { display: none; }
}

/* ── Surfaces ──────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card h2 { font-size: 15px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.section-title { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 18px 0 8px; }
.note { border-radius: 9px; padding: 10px 14px; font-size: 13px; margin-bottom: 12px; border: 1px solid; }
.note-info { background: var(--info-bg); border-color: #bfdbfe; color: var(--info-fg); }
.note-ok { background: #f0fdf4; border-color: #86efac; color: var(--ok-fg); }
.note-err { background: #fef2f2; border-color: #fecaca; color: var(--err-fg); }
.note-warn { background: var(--warn-bg); border-color: #fcd34d; color: var(--warn-fg); }
.note ul { margin: 6px 0 0; padding-left: 18px; }
.note .msr { font-size: 17px; }
.flashes { margin-bottom: 14px; }

/* ── KPI cards ─────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border-top: 3px solid var(--kpi); }
.kpi-top { display: flex; align-items: center; gap: 8px; }
.kpi-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--kpi) 12%, white); color: var(--kpi); }
.kpi-ic .msr { font-size: 17px; vertical-align: 0; }
.kpi-lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi-val { font-size: 22px; font-weight: 800; margin-top: 8px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--muted); }

/* ── Forms ─────────────────────────────────────────────── */
label.f { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.field { margin-bottom: 12px; min-width: 0; }
.help { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface-2);
  border: 1.5px solid var(--border); border-radius: 9px; padding: 9px 11px; transition: border-color .15s, box-shadow .15s;
}
::placeholder { color: #a8b3c4; opacity: 1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); background: #fff; }
input:disabled, select:disabled, textarea:disabled { color: var(--faint); background: var(--border-2); }
input[type=file] { font: inherit; font-size: 13px; width: 100%; }
textarea { resize: vertical; min-height: 64px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 14px; }
@media (max-width: 700px) { .grid2, .grid3, .grid4 { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 701px) and (max-width: 1000px) { .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-row label { display: flex; gap: 6px; align-items: center; font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 13.5px; padding: 9px 16px; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer;
  text-decoration: none; transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { color: var(--err); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn.disabled { opacity: .45; pointer-events: none; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn .msr { font-size: 18px; vertical-align: 0; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > * { flex: 1; }
form.inline { display: inline; }

/* ── Expanders ─────────────────────────────────────────── */
details.exp { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; box-shadow: var(--shadow); }
details.exp > summary {
  cursor: pointer; padding: 12px 16px; list-style: none; display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 13.5px; flex-wrap: wrap;
}
details.exp > summary::-webkit-details-marker { display: none; }
details.exp > summary::before { content: 'chevron_right'; font-family: 'Material Symbols Rounded'; font-size: 20px; color: var(--muted); transition: transform .15s; font-weight: normal; }
details.exp[open] > summary::before { transform: rotate(90deg); }
details.exp > .body { padding: 2px 16px 16px; border-top: 1px solid var(--border-2); }
details.exp.flat { box-shadow: none; background: var(--surface-2); }
.sum-amt { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ── Badges / pills ────────────────────────────────────── */
.wfb { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 20px; border: 1px solid; white-space: nowrap; }
.wfb .msr { font-size: 14px; vertical-align: -2px; }
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 20px; white-space: nowrap; }
.pill-ok { background: var(--ok-bg); color: var(--ok-fg); }
.pill-no { background: var(--err-bg); color: var(--err-fg); }
.pill-wait { background: #fef9c3; color: #854d0e; }
.pill-info { background: #dbeafe; color: #1e40af; }
.pill-mute { background: var(--border-2); color: #475569; }
.chip { display: inline-block; background: var(--border-2); color: #475569; font-size: 12px; padding: 2px 10px; border-radius: 20px; }

/* ── Tables ────────────────────────────────────────────── */
.tbl-box { position: relative; margin-bottom: 12px; }
.tbl-tools { display: flex; justify-content: flex-end; gap: 4px; margin-bottom: 4px; }
.tbl-tools button { border: 1px solid var(--border); background: var(--surface); border-radius: 7px; padding: 3px 6px; cursor: pointer; color: var(--muted); }
.tbl-tools button:hover { color: var(--primary); border-color: #bfdbfe; }
.tbl-wrap { overflow: auto; max-height: 560px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.tbl-box.full { position: fixed; inset: 12px; z-index: 50; background: var(--surface); padding: 12px; border-radius: 14px; box-shadow: 0 10px 60px rgba(15,23,42,.35); display: flex; flex-direction: column; }
.tbl-box.full .tbl-wrap { max-height: none; flex: 1; }
table.tbl { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; }
table.tbl th { position: sticky; top: 0; background: #f8fafc; color: var(--muted); font-weight: 700; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; z-index: 1; }
table.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--border-2); white-space: nowrap; color: var(--text-2); }
table.tbl tbody tr:hover td { background: #f8fbff; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl tr.tot td { background: #f1f5f9; font-weight: 700; color: var(--text); border-top: 2px solid var(--border); }
table.tbl td.chg { background: #fff7ed !important; box-shadow: inset 0 0 0 1px #fdba74; }
table.tbl tr.blank td { background: #fefce8; color: #a16207; }

/* ── Bar charts ────────────────────────────────────────── */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .charts { grid-template-columns: minmax(0, 1fr); } }
.chart h3 { font-size: 13.5px; font-weight: 700; margin-bottom: 12px; display: flex; gap: 6px; align-items: center; }
.hbar { display: grid; grid-template-columns: minmax(70px, 34%) 1fr; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 12px; }
.hbar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); text-align: right; }
.hbar .track { position: relative; height: 20px; }
.hbar .fill { height: 100%; border-radius: 0 6px 6px 0; background: var(--c); min-width: 2px; }
.hbar .val { position: absolute; top: 2px; font-size: 11px; color: #475569; white-space: nowrap; padding-left: 6px; }
.vbars { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding-top: 18px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.vbar { flex: 1; min-width: 38px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.vbar .fill { width: 70%; max-width: 54px; border-radius: 6px 6px 0 0; background: var(--c); min-height: 2px; }
.vbar .val { font-size: 10.5px; color: #475569; margin-bottom: 3px; white-space: nowrap; }
.vlabels { display: flex; gap: 10px; overflow-x: auto; }
.vlabels span { flex: 1; min-width: 38px; text-align: center; font-size: 11px; color: var(--text-2); padding-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Timeline ──────────────────────────────────────────── */
.timeline { margin: 6px 0; }
.tl { display: flex; gap: 12px; margin-bottom: 9px; font-size: 13px; }
.tl .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: var(--c, #3b82f6); }
.tl .ts { font-size: 11px; color: var(--faint); }

/* ── Bills ─────────────────────────────────────────────── */
.bills { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 8px 0; }
.bill { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; display: flex; flex-direction: column; }
.bill .thumb { height: 120px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.bill .thumb img { width: 100%; height: 100%; object-fit: cover; }
.bill .thumb .msr { font-size: 40px; color: var(--faint); }
.bill .meta { padding: 8px 10px; font-size: 12px; display: grid; gap: 6px; }
.bill .meta .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.bill .acts { display: flex; gap: 6px; }
.bill .acts > * { flex: 1; }

/* ── Expense cards ─────────────────────────────────────── */
.exp-meta { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 12px 14px; margin: 12px 0; font-size: 13px; line-height: 1.8; }
.money-chain { margin-top: 8px; padding: 8px 10px; background: var(--warn-bg); border: 1px solid #fde68a; border-radius: 7px; font-size: 12.5px; color: var(--warn-fg); }
.req { border-left: 4px solid #3b82f6; }
.req-top { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.req-amt { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 9px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--primary); border-color: var(--primary); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.summary-strip { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 10px 14px; font-size: 13px; color: #475569; margin: 4px 0 14px; }
.vert-badge { display: inline-block; font-size: 17px; font-weight: 800; letter-spacing: .04em; color: #4338ca; background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 7px; padding: 0 10px; margin-left: 8px; vertical-align: middle; }
.fare-preview { background: var(--info-bg); border: 1px solid #bfdbfe; color: var(--info-fg); border-radius: 9px; padding: 9px 13px; font-size: 13px; margin-bottom: 12px; }
.dyn-row { border: 1px dashed var(--border); border-radius: 10px; padding: 12px 12px 0; margin-bottom: 10px; background: var(--surface-2); }
.dyn-row .row-title { font-size: 12px; font-weight: 700; color: #475569; margin-bottom: 8px; }

/* ── Login ─────────────────────────────────────────────── */
body.login { background: linear-gradient(135deg, #e0e7ff 0%, #f0f4ff 50%, #ede9fe 100%); min-height: 100vh; }
.login-card { max-width: 420px; margin: 7vh auto 24px; background: #fff; border-radius: 24px; border: 1px solid var(--border); overflow: hidden; box-shadow: 0 24px 64px rgba(37,99,235,.13), 0 4px 20px rgba(0,0,0,.07); }
.login-card .strip { height: 5px; background: linear-gradient(90deg, #2563eb, #7c3aed, #06b6d4); }
.login-card .top { text-align: center; padding: 32px 32px 8px; }
.login-card .top img { width: 150px; }
.login-badge { display: inline-block; margin-top: 10px; background: linear-gradient(135deg, #eff6ff, #ede9fe); border: 1px solid #bfdbfe; border-radius: 20px; padding: 4px 16px; font-size: 11px; font-weight: 700; color: var(--primary); letter-spacing: .07em; text-transform: uppercase; }
.login-card h1 { font-size: 23px; font-weight: 800; margin-top: 18px; }
.login-card form { padding: 18px 28px 30px; }
.login-card .btn-primary { width: 100%; padding: 13px; font-size: 15px; border-radius: 12px; margin-top: 6px; box-shadow: 0 6px 20px rgba(37,99,235,.35); }
.install-strip { text-align: center; font-size: 12px; color: var(--muted); }
@media (max-width: 480px) { .login-card { margin: 16px; } }

/* ── Admin inbox rows (the Streamlit layout: a line per claim, Actions opens it in place) ── */
.arow-list { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.arow-line { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border-2); }
.arow-item:last-child .arow-line { border-bottom: 0; }
.ahead-line { background: #f8fafc; }
.arow { flex: 1; min-width: 0; display: grid; align-items: center; gap: 8px; font-size: 12.5px;
  grid-template-columns: 52px minmax(120px, 1.6fr) 78px 62px minmax(90px, 1.3fr) 70px 80px 70px 84px minmax(90px, 1.3fr) 96px 150px; }
.arow > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arow.ahead > span { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.arow .a-id { color: var(--muted); font-variant-numeric: tabular-nums; }
.arow .a-emp { font-weight: 700; color: var(--text); }
.arow .a-dim { color: var(--muted); }
.arow .a-amt { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.arow-btn { flex-shrink: 0; width: 112px; }
.arow-btn-space { width: 112px; flex-shrink: 0; }
.arow-item.open > .arow-line { background: var(--primary-soft); }
.arow-panel { display: none; padding: 12px 14px 16px; border-bottom: 1px solid var(--border); background: #fbfcfe; }
.arow-item.open > .arow-panel, .arow-panel.open { display: block; }
.arow-panel .loading { color: var(--muted); font-size: 13px; padding: 8px 0; }
@media (max-width: 1100px) {
  .arow { grid-template-columns: 46px minmax(110px, 1.5fr) 84px minmax(90px, 1.2fr) 92px 140px; }
  .arow .a-role, .arow .a-desig, .arow .a-sm { display: none; }
}
@media (max-width: 640px) {
  .arow-line { flex-wrap: wrap; }
  .arow { grid-template-columns: 40px 1fr 84px; }
  .arow .a-date, .arow .a-cat, .arow .a-stage { display: none; }
  .arow-btn, .arow-btn-space { width: 100%; }
}
.ctx { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 13px; color: #374151; line-height: 1.7; margin-bottom: 10px; }
.ctx-final { background: #faf5ff; border-color: #e9d5ff; color: #6b21a8; }
.action-panel { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-top: 10px; }
.ap-note { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 8px 12px; font-size: 13px; color: var(--primary); margin-bottom: 10px; }

/* ── Admin ─────────────────────────────────────────────── */
table.tbl td.ell { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.show-md { display: none; }
@media (max-width: 1200px) { .hide-md { display: none; } .show-md { display: inline; } }
.or-line { text-align: center; font-size: 11.5px; color: var(--faint); margin: 14px 0 10px; }
.checks fieldset { border: 1px solid var(--border); border-radius: 9px; padding: 6px 10px 8px; margin: 0 0 10px; max-height: 150px; overflow: auto; }
.checks legend { font-size: 12px; font-weight: 600; color: var(--text-2); padding: 0 4px; }
.checks label, .checks-flow label { display: flex; gap: 6px; align-items: center; font-size: 12.5px; padding: 2px 0; }
.checks-flow { display: flex; flex-wrap: wrap; gap: 2px 16px; padding: 8px 0; }
.grid-ed { max-height: 70vh; }
.grid-ed td { padding: 3px 4px; }
.grid-ed input, .grid-ed select { padding: 5px 6px; font-size: 12.5px; border-radius: 6px; border-width: 1px; }
.grid-ed select { min-width: 96px; }
.grid-ed td:first-child, .grid-ed th:first-child { position: sticky; left: 0; background: inherit; z-index: 2; }
.grid-ed tbody td:first-child { background: #fff; }
.grid-ed tr.blank td { background: #fefce8; }
.grid-ed tfoot td { position: sticky; bottom: 0; }
.grid-ed tr.inactive td { opacity: .6; }
.grid-ed tr.dirty td { background: #fffbeb; }
.orgtree { font-size: 13px; overflow-x: auto; }
.orgtree ul { list-style: none; margin: 0; padding-left: 26px; position: relative; }
.orgtree ul::before { content: ''; position: absolute; left: 10px; top: -6px; bottom: 14px; border-left: 1.5px solid #cbd5e1; }
.orgtree li { position: relative; padding: 3px 0 3px 20px; }
.orgtree li::before { content: ''; position: absolute; left: -16px; top: 19px; width: 28px; border-top: 1.5px solid #cbd5e1; }
.orgtree > ul { padding-left: 0; }
.orgtree > ul::before, .orgtree > ul > li::before { display: none; }
.orgtree > ul > li { padding-left: 0; }
.orgtree details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.orgtree details > summary::-webkit-details-marker { display: none; }
.orgtree .tw { flex: 0 0 auto; width: 17px; height: 17px; border: 1.5px solid #94a3b8; border-radius: 4px; background: #fff; color: #475569; font-weight: 700; font-size: 12px; line-height: 14px; text-align: center; }
.orgtree details[open] > summary .tw::after { content: '\2212'; }
.orgtree details:not([open]) > summary .tw::after { content: '+'; }
.orgtree .ocard { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #e2e8f0; border-left-width: 4px; border-radius: 9px; padding: 5px 11px; box-shadow: 0 1px 2px rgba(15,23,42,.05); flex-wrap: wrap; }
.orgtree .nm { font-weight: 600; }
.orgtree .rl { font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.orgtree .dg { font-size: 11.5px; color: #64748b; }
.orgtree .ct { font-size: 11px; color: #94a3b8; }
.orgtree .off { opacity: .55; }
.orgtree .off .nm { text-decoration: line-through; }
.orgtree .leafpad { padding-left: 25px; }
/* ── Spreadsheet grids (Jspreadsheet) ─────────────────── */
.sheet-help { margin: 4px 0 6px; }
.sheet-wrap { max-width: 100%; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.sheet-wrap .jss_container, .sheet-wrap .jss_content { max-width: 100%; }
.sheet .jss_worksheet { font: 12.5px 'Inter', system-ui, sans-serif; }
.sheet .jss_worksheet > thead > tr > td { background: #f8fafc; color: #475569; font-weight: 700; font-size: 11.5px; }
.sheet .jss_worksheet td.readonly { color: #64748b; background: #f8fafc; }
.sheet .jss_worksheet td.sheet-missing { background: #fef9c3 !important; }
.sheet-total { margin: 8px 0 0; font-size: 13px; }
.sheet-wrap.view .jss_worksheet > tbody > tr > td.readonly { color: var(--text-2); background: #fff; }
.sheet .jss_worksheet > tbody > tr > td.chg { background: #fff7ed !important; box-shadow: inset 0 0 0 1px #fdba74; }
.sheet .jss_worksheet > tbody > tr > td.tot { background: #f1f5f9 !important; font-weight: 700; color: var(--text) !important; }
.sheet .jss_worksheet > tbody > tr > td.blank { background: #fefce8 !important; color: #a16207 !important; }
.sheet .jss_worksheet td a { font-weight: 600; }
.sheet .jss_worksheet td a.sheet-btn { display: inline-block; padding: 1px 10px; border-radius: 6px; border: 1px solid var(--border); color: var(--text-2); text-decoration: none; }
.sheet .jss_worksheet td a.sheet-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.sheet .jss_worksheet td .pill, .sheet .jss_worksheet td .wfb { font-size: 11px; }
.tbl-tools { align-items: center; }
.sheet-box { margin-bottom: 12px; }
.sheet-bar { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; flex-wrap: wrap; }
.sheet-bar-text { flex: 1; min-width: 200px; }
/* Full view: the sheet fills the window; the page behind stops scrolling. */
.sheet-box.full { position: fixed; inset: 10px; z-index: 60; margin: 0; background: #fff; border-radius: 14px;
  padding: 10px 12px; box-shadow: 0 10px 60px rgba(15,23,42,.35); display: flex; flex-direction: column; }
.sheet-box.full .sheet-wrap { flex: 1; min-height: 0; }
.sheet-box.full .jss_content { max-height: calc(100vh - 110px) !important; height: calc(100vh - 110px) !important; }
body.sheet-full-open { overflow: hidden; }
body.sheet-full-open::before { content: ''; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 55; }
.deduct-warn { color: #d97706 !important; font-weight: 600; }

@media print {
  .sidebar, .topbar, .tbl-tools, .btn, form { display: none !important; }
  .main { padding: 0; }
  .card, details.exp { box-shadow: none; }
}

/* ── Read-only tables: Streamlit's _html_table ("mtbl"), same look ── */
.mtbl-box { position: relative; margin-bottom: 0; }
.mtbl-toolrow { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.mtbl-tools { display: inline-flex; align-items: center; gap: 1px; padding: 3px; background: #fff;
  border: 1px solid #e2e8f0; border-radius: 9px; box-shadow: 0 1px 4px rgba(15,23,42,.08); }
.mtbl-tools:hover { border-color: #c7d2fe; }
.mtbl-tbtn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 26px;
  border-radius: 7px; cursor: pointer; color: #475569; background: none; border: 0; padding: 0;
  text-decoration: none; user-select: none; transition: background .12s ease, color .12s ease; }
.mtbl-tbtn:hover { background: #eef2ff; color: #4f46e5; }
.mtbl-tbtn .msr { font-size: 17px; }
.mtbl-wrap { position: relative; overflow: auto; max-height: 70vh; border: 1px solid #e2e8f0; border-radius: 12px;
  background: #fff; box-shadow: 0 1px 3px rgba(15,23,42,.05); margin-bottom: 10px; outline: none; }
.mtbl-wrap::-webkit-scrollbar { height: 9px; width: 9px; }
.mtbl-wrap::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9px; }
.mtbl-wrap::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.mtbl-wrap::-webkit-scrollbar-track { background: #f8fafc; }
.mtbl { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; }
.mtbl thead th { position: sticky; top: 0; z-index: 3; padding: 10px 13px; text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #64748b;
  background: #f8fafc; border-bottom: 1px solid #e2e8f0; box-shadow: inset 0 -1px 0 #e2e8f0; cursor: s-resize; user-select: none; }
.mtbl thead th.num { text-align: right; }
.mtbl tbody td { padding: 9px 13px; font-size: 13px; color: #0f172a; white-space: nowrap;
  border-bottom: 1px solid #f1f5f9; vertical-align: middle; cursor: cell; }
.mtbl tbody td.num { text-align: right; font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; font-weight: 600; }
.mtbl tbody td.dim, .mtbl tbody td .dim { color: #64748b; }
.mtbl tbody td.chg { background: #fff7ed; box-shadow: inset 2px 0 0 #f97316; font-weight: 700; }
.mtbl tbody tr:hover td.chg { background: #ffedd5; }
.mtbl tbody tr { transition: background .12s ease; }
.mtbl tbody tr:hover td { background: #f5f7ff; }
.mtbl tbody tr:last-child td { border-bottom: none; }
.mtbl tbody tr.tot td { background: #eef2ff; font-weight: 800; color: #312e81; border-top: 2px solid #c7d2fe; border-bottom: none; }
.mtbl tbody tr.tot:hover td { background: #e6ebff; }
/* Excel-style selection */
.mtbl tbody td.sel, .mtbl tbody tr:hover td.sel { background: #dbe4ff; box-shadow: inset 0 0 0 1px #818cf8; }
.mtbl-wrap.copied td.sel { background: #c7d2fe; }
/* full view: cover the viewport */
.mtbl-box.full { position: fixed; inset: 0; z-index: 2147483000; margin: 0; padding: 0; background: #fff; border-radius: 0; }
.mtbl-box.full .mtbl-toolrow { position: fixed; top: 12px; right: 18px; z-index: 2147483001; margin: 0; }
.mtbl-box.full .mtbl-tools { box-shadow: 0 2px 10px rgba(15,23,42,.18); }
.mtbl-box.full .mtbl-wrap { position: absolute; inset: 52px 0 0 0; max-height: none; margin: 0; border: none; border-radius: 0; box-shadow: none; }
/* status pills — Streamlit's colours */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  letter-spacing: .01em; white-space: nowrap; border: 1px solid transparent; }
.pill-ok { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.pill-no { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.pill-wait { background: #fef3c7; color: #a16207; border-color: #fde68a; }
.pill-info { background: #e0e7ff; color: #4338ca; border-color: #c7d2fe; }
.pill-mute { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
@media (max-width: 640px) {
  .mtbl thead th { font-size: 10px; padding: 8px 10px; }
  .mtbl tbody td { font-size: 12px; padding: 8px 10px; }
  .mtbl-wrap { max-height: 60vh; }
}

/* ── Excel-style column filter ── */
.flt-btn { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-left: 4px;
  padding: 0; vertical-align: middle; border: 1px solid #cbd5e1; border-radius: 4px; background: #fff; color: #64748b; cursor: pointer; }
.flt-btn .msr { font-size: 16px; }
.flt-btn:hover { border-color: #818cf8; color: #4f46e5; }
.flt-btn.on { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.flt-pop { position: fixed; z-index: 2147483600; width: 250px; background: #fff; border: 1px solid #cbd5e1; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15,23,42,.2); padding: 6px; font-size: 13px; color: #0f172a; text-transform: none; letter-spacing: 0; font-weight: 400; }
.flt-pop > button { display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 8px; border: 0; background: none;
  border-radius: 6px; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.flt-pop > button:hover:not(:disabled) { background: #eef2ff; }
.flt-pop > button:disabled { color: #94a3b8; cursor: default; }
.flt-pop > button .msr { font-size: 17px; }
.flt-pop hr { border: 0; border-top: 1px solid #e2e8f0; margin: 4px 0; }
.flt-pop input[type=search] { width: 100%; margin: 6px 0; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 6px; font: inherit; box-sizing: border-box; }
.flt-list { max-height: 220px; overflow: auto; border: 1px solid #e2e8f0; border-radius: 6px; padding: 4px 6px; }
.flt-list label { display: flex; align-items: center; gap: 6px; padding: 2px 0; white-space: nowrap; cursor: pointer; font-weight: 400; }
.flt-list label[hidden] { display: none; }
.flt-list .flt-all { border-bottom: 1px solid #f1f5f9; margin-bottom: 2px; padding-bottom: 4px; }
.flt-foot { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.flt-note { margin-right: auto; align-self: center; font-size: 12px; color: #4338ca; display: inline-flex; align-items: center; gap: 4px; }
.flt-note .msr { font-size: 16px; }
.mtbl-toolrow .flt-note { margin-right: auto; }
.mtbl tbody tr[hidden] { display: none; }

/* ── Admin Inbox: Spreadsheet | Rows ── */
.view-switch { display: inline-flex; gap: 2px; padding: 3px; margin: 2px 0 10px; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 10px; }
.view-switch button { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border: 0; border-radius: 7px;
  background: none; color: #475569; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.view-switch button .msr { font-size: 17px; }
.view-switch button.on { background: #fff; color: #4338ca; box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.mtbl td .sheet-btn { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 7px; border: 1px solid #cbd5e1;
  background: #fff; color: #334155; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.mtbl td .sheet-btn .msr { font-size: 15px; }
.mtbl td .sheet-btn:hover { border-color: #818cf8; color: #4338ca; }
.mtbl td .sheet-btn.primary { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.mtbl td .sheet-btn.open { background: #fee2e2; border-color: #fecaca; color: #b91c1c; }
.sheet-panel { border: 2px solid #c7d2fe; border-radius: 12px; padding: 12px 14px; margin: 4px 0 16px; background: #fff; scroll-margin-top: 12px; }
.sheet-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 14px; }

/* ── Searchable dropdowns (public/app.js) ── */
.combo { position: relative; }
.combo .combo-native { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.combo-input { width: 100%; box-sizing: border-box; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.combo-list { position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 3px); max-height: 280px; overflow: auto;
  background: #fff; border: 1px solid #cbd5e1; border-radius: 8px; box-shadow: 0 8px 24px rgba(15,23,42,.14); padding: 4px; }
.combo-item { padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-item.on { background: #eef2ff; color: #3730a3; }
.combo-item.cur { font-weight: 700; }
.combo-none { padding: 8px 10px; color: #64748b; font-size: 13px; }



/* ── Login background: full-screen clip in Cosmic colours (views/login.ejs) ──
   Brand: leaf green #9CC43C, gold #F2C21B (from the logo), portal blue #2563EB.
   Without a clip, the gradient alone; with one (static/login-bg.*), the clip
   under a light brand tint so the card stays readable. */
body.login { position: relative; min-height: 100vh; }
.login-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background: #1f3d1a center / cover no-repeat;
  background-color: #2b4a1f; }
.login-bg::before { content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(1100px 700px at 12% 18%, rgba(156,196,60,.85), transparent 60%),
    radial-gradient(900px 650px at 88% 82%, rgba(242,194,27,.75), transparent 60%),
    radial-gradient(800px 600px at 80% 10%, rgba(37,99,235,.45), transparent 60%),
    linear-gradient(135deg, #2f5a1f 0%, #3f6d25 45%, #7a6a16 100%); }
.login-bg:has(video)::before, .login-bg[style]::before { display: none; }
.login-bg video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.login-tint { position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 45%, rgba(15,23,42,.18), transparent 60%); }
/* Narrow screens: keep the left of the clip (the rep) in view rather than its middle. */
@media (max-aspect-ratio: 1/1) { .login-bg video { object-position: 18% 50%; } .login-bg { background-position: 18% 50%; } }
body.login .login-card, body.login .install-strip { position: relative; z-index: 1; }
body.login .login-card .strip { background: linear-gradient(90deg, #9cc43c, #f2c21b, #2563eb); }
@media (prefers-reduced-motion: reduce) { .login-bg video { display: none; } }


/* ── Login sketch: hand-drawn ink cartoon (views/partials/login_sketch.ejs) ──
   40 s loop, six stops (walk 6 %, stop 9 %; the hotel stop runs to the end):
   bus stand 6 %, Kirana 21 %, dhaba 36 %, auto 51 %, recharge 66 %, hotel 81 %. */
.login-sketch { background: #fbf6e9; }
.login-sketch::before { display: none; }
.login-sketch svg { display: block; width: 100%; height: 100%; }
.sk-sign, .sk-say-t, .sk-ph-h, .sk-ph-t, .sk-ph-tot, .sk-bill-t, .sk-stamp-t, .sk-caption { font-family: 'Patrick Hand', 'Comic Sans MS', cursive; }
.sk-sign { font-size: 27px; fill: #141414; letter-spacing: .04em; }
.sk-say-t { font-size: 38px; fill: #141414; }
.sk-ph-h { font-size: 38px; fill: #141414; }
.sk-ph-t { font-size: 27px; fill: #141414; }
.sk-ph-tot { font-size: 32px; fill: #141414; font-weight: 700; }
.sk-bill-t { font-size: 17px; fill: #141414; }
.sk-stamp-t { font-size: 50px; fill: #3f7d1c; letter-spacing: .05em; }
.sk-caption { font-size: 40px; fill: #141414; }

.sk-drive, .sk-walk, .sk-stand, .sk-box, .sk-say, .sk-keeper-arm, .sk-bill, .sk-row, .sk-stamp { animation: 40s infinite both; }
.sk-drive { animation-name: sk-drive; }
.sk-walk { animation-name: sk-walk; }
.sk-stand { animation-name: sk-stand; }
.sk-box { animation-name: sk-box; }
.sk-say { animation-name: sk-say; transform-box: fill-box; transform-origin: 20% 100%; opacity: 0; }
.sk-keeper-arm { animation-name: sk-arm; transform-box: fill-box; transform-origin: 100% 50%; }
.sk-bill { animation-name: sk-bill; opacity: 0; }
.sk-b1 { --dy: -356px; } .sk-b2 { --dy: -298px; animation-delay: 12s; } .sk-b3 { --dy: -240px; animation-delay: 18s; }
.sk-b4 { --dy: -182px; animation-delay: 24s; } .sk-b5 { --dy: -124px; animation-delay: 30s; }
.sk-row { opacity: 0; }
.sk-r1 { animation-name: sk-r1; } .sk-r2 { animation-name: sk-r2; } .sk-r3 { animation-name: sk-r3; }
.sk-r4 { animation-name: sk-r4; } .sk-r5 { animation-name: sk-r5; } .sk-total { animation-name: sk-total; }
.sk-stamp { animation-name: sk-stamp; transform-box: fill-box; transform-origin: center; opacity: 0; }
.sk-legA, .sk-legB, .sk-armB { transform-box: fill-box; transform-origin: 50% 0%; animation: sk-swing .7s ease-in-out infinite alternate; }
.sk-legB, .sk-armB { animation-direction: alternate-reverse; }
.sk-eye { animation: sk-blink 3.6s infinite; transform-box: fill-box; transform-origin: center; }
.sk-steam { animation: sk-steam 1.4s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 100%; }
.sk-sun { animation: sk-sun 40s linear infinite; transform-box: fill-box; transform-origin: center; }
.sk-clouds { animation: sk-clouds 120s linear infinite; }

@keyframes sk-drive {
  0% { transform: translateX(0); animation-timing-function: ease-in-out; }
  6%, 15% { transform: translateX(calc(var(--w) * -1 / 6)); } 15% { animation-timing-function: ease-in-out; }
  21%, 30% { transform: translateX(calc(var(--w) * -2 / 6)); } 30% { animation-timing-function: ease-in-out; }
  36%, 45% { transform: translateX(calc(var(--w) * -3 / 6)); } 45% { animation-timing-function: ease-in-out; }
  51%, 60% { transform: translateX(calc(var(--w) * -4 / 6)); } 60% { animation-timing-function: ease-in-out; }
  66%, 75% { transform: translateX(calc(var(--w) * -5 / 6)); } 75% { animation-timing-function: ease-in-out; }
  81%, 100% { transform: translateX(calc(var(--w) * -1)); }
}
@keyframes sk-walk {
  0%, 5.9% { opacity: 1; } 6%, 14.9% { opacity: 0; } 15%, 20.9% { opacity: 1; } 21%, 29.9% { opacity: 0; }
  30%, 35.9% { opacity: 1; } 36%, 44.9% { opacity: 0; } 45%, 50.9% { opacity: 1; } 51%, 59.9% { opacity: 0; }
  60%, 65.9% { opacity: 1; } 66%, 74.9% { opacity: 0; } 75%, 80.9% { opacity: 1; } 81%, 100% { opacity: 0; }
}
@keyframes sk-stand {
  0%, 5.9% { opacity: 0; } 6%, 14.9% { opacity: 1; } 15%, 20.9% { opacity: 0; } 21%, 29.9% { opacity: 1; }
  30%, 35.9% { opacity: 0; } 36%, 44.9% { opacity: 1; } 45%, 50.9% { opacity: 0; } 51%, 59.9% { opacity: 1; }
  60%, 65.9% { opacity: 0; } 66%, 74.9% { opacity: 1; } 75%, 80.9% { opacity: 0; } 81%, 100% { opacity: 1; }
}
@keyframes sk-swing { from { transform: rotate(-16deg); } to { transform: rotate(16deg); } }
/* Kirana (stop at 21 %): hand over the box, "Order booked!" */
@keyframes sk-box {
  0%, 22% { transform: translate(0, 0); opacity: 1; }
  23.5% { transform: translate(45px, -50px); }
  25% { transform: translate(90px, 24px); } 25.8% { transform: translate(90px, 18px); }
  26.5%, 29% { transform: translate(90px, 24px); opacity: 1; }
  29.8% { transform: translate(90px, 24px); opacity: 0; }
  98% { transform: translate(0, 0); opacity: 0; } 100% { transform: translate(0, 0); opacity: 1; }
}
@keyframes sk-arm { 0%, 22% { transform: rotate(0deg); } 23.5% { transform: rotate(14deg); } 25%, 27% { transform: rotate(-6deg); } 28.5%, 100% { transform: rotate(0deg); } }
@keyframes sk-say {
  0%, 24% { opacity: 0; transform: scale(.4) rotate(-8deg); }
  25.3% { opacity: 1; transform: scale(1.08) rotate(2deg); } 26% { transform: scale(1) rotate(0deg); }
  29% { opacity: 1; transform: scale(1); } 30%, 100% { opacity: 0; transform: scale(.9); }
}
/* A bill: pops up at the stop, flies behind the card onto its line (delays move it to its stop) */
@keyframes sk-bill {
  0%, 7% { opacity: 0; transform: translate(0, 0) rotate(0deg) scale(.6); }
  7.8% { opacity: 1; transform: translate(0, -46px) rotate(-6deg) scale(1.05); }
  9% { opacity: 1; transform: translate(0, -54px) rotate(6deg) scale(1); }
  10.6% { opacity: 1; transform: translate(430px, -330px) rotate(-22deg) scale(1); }
  12% { opacity: 1; transform: translate(854px, var(--dy)) rotate(-6deg) scale(.6); }
  12.6%, 100% { opacity: 0; transform: translate(854px, var(--dy)) scale(.5); }
}
@keyframes sk-r1 { 0%, 11.8% { opacity: 0; } 12.4%, 98% { opacity: 1; } 99%, 100% { opacity: 0; } }
@keyframes sk-r2 { 0%, 41.8% { opacity: 0; } 42.4%, 98% { opacity: 1; } 99%, 100% { opacity: 0; } }
@keyframes sk-r3 { 0%, 56.8% { opacity: 0; } 57.4%, 98% { opacity: 1; } 99%, 100% { opacity: 0; } }
@keyframes sk-r4 { 0%, 71.8% { opacity: 0; } 72.4%, 98% { opacity: 1; } 99%, 100% { opacity: 0; } }
@keyframes sk-r5 { 0%, 86.8% { opacity: 0; } 87.4%, 98% { opacity: 1; } 99%, 100% { opacity: 0; } }
@keyframes sk-total { 0%, 88% { opacity: 0; } 89%, 98% { opacity: 1; } 99%, 100% { opacity: 0; } }
@keyframes sk-stamp {
  0%, 90% { opacity: 0; transform: scale(2.4) rotate(10deg); }
  91.2% { opacity: 1; transform: scale(.94) rotate(-2deg); } 92% { transform: scale(1.03); }
  92.8%, 98% { opacity: 1; transform: scale(1) rotate(0deg); } 99%, 100% { opacity: 0; transform: scale(1); }
}
@keyframes sk-blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes sk-steam { from { transform: translateY(0) skewX(-6deg); opacity: .5; } to { transform: translateY(-6px) skewX(6deg); opacity: 1; } }
@keyframes sk-sun { to { transform: rotate(360deg); } }
@keyframes sk-clouds { to { transform: translateX(-1600px); } }

@media (prefers-reduced-motion: reduce) {
  .login-sketch *, .login-sketch { animation: none !important; }
  .login-sketch [filter] { filter: none; }
  .sk-row { opacity: 1; }
}

/* ── Login anime: vector illustration with motion (views/partials/login_anime.ejs) ── */
.login-anime { background: #5aa2ff; }
.login-anime::before { display: none; }
.login-anime svg { display: block; width: 100%; height: 100%; }
.login-anime [class^="an-"], .login-anime [class*=" an-"] { transform-box: fill-box; }

.an-body { transform-origin: 50% 100%; animation: an-breathe 4.2s ease-in-out infinite; }
.an-head { transform-origin: 45% 95%; animation: an-head 6s ease-in-out infinite; }
.an-hair { transform-origin: 50% 90%; animation: an-hair 3.4s ease-in-out infinite; }
.an-eye { transform-origin: 50% 55%; animation: an-blink 4.8s infinite; }
.an-meye { animation-duration: 3.7s; animation-delay: -1.2s; }
.an-mascot { transform-origin: 50% 100%; animation: an-bounce 1.6s cubic-bezier(.3,0,.4,1) infinite; }
.an-leaf { transform-origin: 0% 100%; animation: an-leaf 1.6s ease-in-out infinite; }
.an-rays { transform-origin: 0% 0%; transform-box: view-box; animation: an-rays 14s ease-in-out infinite alternate; }
.an-cloud { animation: an-drift 18s ease-in-out infinite alternate; }
.an-c2 { animation-duration: 23s; animation-delay: -6s; } .an-c3 { animation-duration: 15s; animation-delay: -3s; }
.an-spark { transform-origin: center; animation: an-twinkle 2.6s ease-in-out infinite; }
g:nth-of-type(2) > .an-spark { animation-delay: -.7s; } g:nth-of-type(3) > .an-spark { animation-delay: -1.4s; } g:nth-of-type(4) > .an-spark { animation-delay: -2s; }

/* phone timeline (classes set by the script in login.ejs) */
.an-row, .an-total { opacity: 0; transform: translateX(26px); transition: opacity .45s ease, transform .45s cubic-bezier(.2,.8,.3,1.2); }
.an-row.in, .an-total.in { opacity: 1; transform: none; }
.an-stamp { opacity: 0; transform-origin: center; transform: scale(2.4) rotate(12deg); }
.an-stamp.in { animation: an-stamp .5s cubic-bezier(.2,.9,.3,1.3) forwards; }

@keyframes an-breathe { 50% { transform: scaleY(1.012); } }
@keyframes an-head { 0%, 100% { transform: rotate(0deg); } 30% { transform: rotate(-1.6deg); } 60% { transform: rotate(1.1deg); } }
@keyframes an-hair { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(1.6deg) skewX(-1deg); } }
@keyframes an-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.08); } }
@keyframes an-bounce {
  0%, 100% { transform: translateY(0) scale(1.06, .94); }
  15% { transform: translateY(0) scale(1, 1); }
  45% { transform: translateY(-34px) scale(.96, 1.05); }
  75% { transform: translateY(0) scale(1, 1); }
  85% { transform: translateY(0) scale(1.08, .92); }
}
@keyframes an-leaf { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-14deg); } }
@keyframes an-rays { from { transform: rotate(-3deg); } to { transform: rotate(4deg); } }
@keyframes an-drift { from { transform: translateX(-30px); } to { transform: translateX(40px); } }
@keyframes an-twinkle { 0%, 100% { opacity: .25; transform: scale(.55) rotate(0deg); } 50% { opacity: 1; transform: scale(1.15) rotate(45deg); } }
@keyframes an-stamp { 0% { opacity: 0; transform: scale(2.4) rotate(12deg); } 70% { opacity: 1; transform: scale(.94) rotate(-2deg); } 100% { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .login-anime *, .login-anime { animation: none !important; transition: none !important; }
  .an-row, .an-total, .an-stamp { opacity: 1 !important; transform: none !important; }
}

/* Phone-size dropdowns in the grids open full screen under a fixed 40px search bar.
   Jspreadsheet's ".jss_worksheet .jdropdown-container { margin-top: 1px }" (meant for the
   in-cell dropdown) also hit that picker, so its first option (e.g. "Working") sat under
   the search bar. Give the full-screen list its room back. */
.jss_worksheet .jdropdown-searchbar.jdropdown-focus .jdropdown-container { margin-top: 44px; }
.jdropdown-searchbar.jdropdown-focus .jdropdown-item { scroll-margin-top: 56px; }

/* A save's result, floated on screen when the page reopens a claim further down */
.flashes-toast { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 1000; width: min(620px, calc(100vw - 32px));
  margin: 0; box-shadow: 0 12px 32px rgba(15, 23, 42, .22); border-radius: 12px; transition: opacity .4s ease, transform .4s ease; }
.flashes-toast .note { margin: 0; padding-right: 40px; }
.flashes-toast .note + .note { margin-top: 6px; }
.flashes-toast .toast-close { position: absolute; top: 8px; right: 8px; z-index: 1; border: 0; background: transparent; cursor: pointer; color: inherit; padding: 2px; }
.flashes-toast.toast-out { opacity: 0; transform: translate(-50%, -12px); pointer-events: none; }

/* TOTAL row of the travel sheets: always in view at the bottom of the grid */
.jss_worksheet tfoot td { position: sticky; bottom: 0; z-index: 3; background: #eef2f7; font-weight: 800; color: #0f172a;
  border-top: 2px solid #94a3b8 !important; white-space: nowrap; }

/* Read-only tables with frozen leading columns (data-freeze) */
.mtbl .frz { position: sticky; z-index: 2; background: #fff; }
.mtbl thead th.frz { z-index: 5; background: #f8fafc; }
.mtbl .frz-edge { box-shadow: inset -1px 0 0 #e2e8f0, 6px 0 8px -6px rgba(15, 23, 42, .18); }
.mtbl tbody tr:hover td.frz { background: #f5f7ff; }
.mtbl tbody td.chg.frz { background: #fff7ed; }
.mtbl tbody tr.tot td.frz { background: #eef2ff; }
.jss_worksheet tfoot td.jss-foot-frz { position: sticky; z-index: 4; }

/* Date boxes in DD/MM/YYYY (public/app.js): text box + calendar button; the browser's own date box stays hidden and keeps the value */
.dmy-wrap { position: relative; display: flex; align-items: stretch; width: 100%; }
.dmy-wrap > input[type="text"] { flex: 1; min-width: 0; padding-right: 38px; }
.dmy-pick { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; cursor: pointer;
  color: var(--muted, #64748b); padding: 4px; line-height: 0; border-radius: 6px; }
.dmy-pick:hover { color: var(--primary, #2563eb); background: rgba(37, 99, 235, .08); }
.dmy-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }

/* Files picked for upload, before they are sent (public/app.js) */
.picked-files { margin-top: 6px; }
.picked-files .picked { display: flex; gap: 8px; align-items: center; border-bottom: 1px solid var(--border-2, #eef2f7); padding: 4px 0; }
.picked-files .picked .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked-files .picked .msr { color: var(--muted, #64748b); }
