/* Bhima Jewellery — "jewellery house" look: theme colours come from scripts/set-theme.py,
   Cormorant Garamond for display, Manrope for everything you read and tap. */
/* THEME:emerald (generated by scripts/set-theme.py) */
:root {
  --bg: #f3f1ea;
  --surface: #ffffff;
  --surface-2: #e9e6da;
  --text: #13201b;
  --muted: #62716a;
  --line: #dcddd2;
  --brand: #0f5a43;
  --brand-deep: #06291f;
  --brand-ink: #ffffff;
  --on-brand: #ffffff;
  --gold: #b88a35;
  --gold-soft: #ece0bd;
  --gold-text: #866220;
  --hero-a: #0f5641;
  --hero-b: #04211a;
  --login-a: #0c4d3a;
  --login-b: #03160f;
  --shade: 6, 41, 31;
  --numeral: #f1d9a0;
  --accent-on-dark: #e3bf73;
  --ok: #1d7146; --ok-bg: #e2f2e8;
  --info: #24548f; --info-bg: #e4ecf8;
  --warn: #8e5a00; --warn-bg: #fbefd5;
  --bad: #a3242c; --bad-bg: #fbe4e4;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(var(--shade), .05), 0 8px 24px -12px rgba(var(--shade), .18);
  --display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --ui: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1210;
    --surface: #111c18;
    --surface-2: #182622;
    --text: #e7eee9;
    --muted: #9aaea5;
    --line: #24352f;
    --brand: #43b98f;
    --brand-deep: #03130e;
    --on-brand: #03130e;
    --gold: #d6ad5c;
    --gold-soft: #4a3a1c;
    --gold-text: #e3bf73;
    --ok: #6fd39c; --ok-bg: #16301f;
    --info: #92b9f0; --info-bg: #18283f;
    --warn: #f0bd64; --warn-bg: #36280f;
    --bad: #f39696; --bad-bg: #3d1719;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
/* /THEME */

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 500 15.5px/1.5 var(--ui);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}
body.has-bottomnav { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
@media (min-width: 820px) { body.has-bottomnav { padding-bottom: 0; } }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 12px; text-wrap: balance; }
h1 { font: 700 2rem/1.1 var(--display); letter-spacing: .005em; }
h2 { font: 700 1.45rem/1.15 var(--display); }
h3 { font-size: 1rem; font-weight: 700; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; flex: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--brand-deep); color: var(--brand-ink);
  border-bottom: 1px solid color-mix(in srgb, var(--gold) 55%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand img { width: 36px; height: 36px; border-radius: 9px; box-shadow: 0 0 0 1px rgba(232, 214, 171, .35); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text b { font: 700 1.3rem var(--display); letter-spacing: .01em; }
.brand-text small { font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-soft); opacity: .85; }
@media (prefers-color-scheme: dark) { .brand-text small { color: var(--gold); } }
.topnav { display: none; margin-left: auto; gap: 2px; align-items: center; }
.topnav a, .topnav button { color: rgba(255,255,255,.82); text-decoration: none; background: none; border: 0; font: 600 .92rem var(--ui); padding: 8px 12px; border-radius: 999px; cursor: pointer; }
.topnav a:hover, .topnav button:hover { background: rgba(255,255,255,.1); color: #fff; }
.topnav a.on { background: rgba(232, 214, 171, .16); color: #fff; box-shadow: inset 0 0 0 1px rgba(232, 214, 171, .35); }
.topnav .who { color: var(--gold-soft); font-size: .85rem; padding: 0 6px 0 14px; border-left: 1px solid rgba(255,255,255,.18); margin-left: 6px; }
.menu-btn { display: none; }
@media (min-width: 820px) { .topnav { display: flex; } }

/* ---------- bottom navigation (phones) ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 6px max(8px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.bottomnav a, .bottomnav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; background: none; border: 0; font: 700 .7rem var(--ui); letter-spacing: .02em;
  border-radius: 12px; cursor: pointer; position: relative;
}
.bottomnav .ic { width: 23px; height: 23px; }
.bottomnav a.on { color: var(--brand); }
.bottomnav a.on::before { content: ""; position: absolute; top: 0; width: 22px; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); }
@media (min-width: 820px) { .bottomnav { display: none !important; } }

.menu-sheet {
  position: fixed; z-index: 40; right: max(8px, env(safe-area-inset-right)); left: max(8px, env(safe-area-inset-left));
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 50px -10px rgba(var(--shade), .35);
  display: flex; flex-direction: column; padding: 8px;
}
@media (min-width: 820px) { .menu-sheet { left: auto; width: 300px; top: 70px; bottom: auto; } }
.menu-sheet a, .menu-sheet button { display: flex; align-items: center; gap: 12px; padding: 13px 14px; text-align: left; color: var(--text); text-decoration: none; border: 0; background: none; font: 600 .98rem var(--ui); border-radius: 12px; cursor: pointer; }
.menu-sheet a:hover, .menu-sheet button:hover { background: var(--surface-2); }
.menu-sheet .ic { color: var(--gold-text); }
.menu-sheet .who { display: flex; gap: 12px; align-items: center; padding: 10px 14px 14px; color: var(--muted); font-size: .85rem; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-sheet .who b { color: var(--text); font-size: 1rem; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font: 700 1rem var(--ui); text-transform: uppercase; box-shadow: 0 0 0 2px var(--gold-soft); }

/* ---------- layout ---------- */
.app { max-width: 1120px; margin: 0 auto; padding-block: 16px 28px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.loading { padding: 48px; text-align: center; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card > h2:first-child { margin-bottom: 14px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack > * { min-width: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > h1 { font-size: 1.7rem; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.narrow { max-width: 440px; margin: 8px auto; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: 700 .95rem var(--ui); text-decoration: none; cursor: pointer; transition: transform .08s ease, filter .15s ease, background .15s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 16px -8px var(--brand); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.gold { background: linear-gradient(180deg, #d8b468, #b88a35); border-color: #b88a35; color: #2b1606; }
.btn.gold:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: rgba(232, 214, 171, .5); color: #fff; }
.btn.ghost:hover { background: rgba(255,255,255,.08); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: transparent; }
.btn.small { min-height: 38px; padding: 7px 14px; font-size: .88rem; border-radius: 10px; }
.btn.small .ic { width: 18px; height: 18px; }
.btn.lg { min-height: 52px; font-size: 1.02rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
@media (prefers-color-scheme: dark) { .btn.primary, .btn.ok { color: var(--on-brand); } }

/* ---------- forms ---------- */
label { display: block; font-weight: 700; font-size: .86rem; margin-bottom: 6px; color: var(--text); }
.field { margin-bottom: 16px; min-width: 0; }
.hint { font-weight: 500; color: var(--muted); font-size: .8rem; }
input, select, textarea {
  width: 100%; min-height: 48px; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text);
  font: 500 1rem var(--ui);
  transition: border-color .15s ease, box-shadow .15s ease;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 25%, transparent); }
input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; min-height: 0; accent-color: var(--brand); flex: none; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 600; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.check:has(input:checked) { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 8%, var(--surface)); }
.grid2 { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100dvh; display: grid; place-content: center; gap: 22px; justify-items: center;
  margin: -16px calc(-1 * max(16px, env(safe-area-inset-right))) -28px calc(-1 * max(16px, env(safe-area-inset-left)));
  padding: 32px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 0%, rgba(214, 173, 92, .28), transparent 55%),
    radial-gradient(circle at 15% 85%, rgba(214, 173, 92, .12), transparent 40%),
    repeating-radial-gradient(circle at 50% -20%, transparent 0 22px, rgba(232, 214, 171, .05) 22px 23px),
    linear-gradient(170deg, var(--login-a), var(--login-b) 70%);
}
.login-brand { text-align: center; color: #fff; max-width: 360px; }
.login-brand img { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 0 0 1px rgba(232, 214, 171, .5), 0 14px 30px -10px rgba(0,0,0,.6); margin-bottom: 14px; }
.login-brand h1 { font-size: 2.7rem; margin: 6px 0 8px; color: #fff; }
.login-brand p { margin: 0; color: rgba(255,255,255,.72); font-size: .95rem; }
.login-brand .eyebrow { color: var(--accent-on-dark); }
.login-card {
  width: min(400px, 100%); background: var(--surface); border-radius: 22px; padding: 26px 22px 20px;
  box-shadow: 0 30px 60px -20px rgba(var(--shade), .55); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
}
.narrow .login-card { box-shadow: var(--shadow); margin: 0 auto; }
.login-card h2 { margin-bottom: 18px; }
.login-card .fine { margin: 14px 0 0; text-align: center; font-size: .8rem; color: var(--muted); }

/* ---------- home hero ---------- */
.hero {
  border-radius: 22px; padding: 20px; color: #fff; position: relative; overflow: hidden;
  background:
    radial-gradient(circle at 100% 0%, rgba(214, 173, 92, .35), transparent 45%),
    repeating-radial-gradient(circle at 110% -10%, transparent 0 18px, rgba(232, 214, 171, .06) 18px 19px),
    linear-gradient(150deg, var(--hero-a), var(--hero-b));
  box-shadow: 0 18px 40px -22px rgba(var(--shade), .8);
}
.hero-top { display: flex; gap: 14px; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; margin-bottom: 18px; }
.hero h1 { color: #fff; margin: 2px 0 0; font-size: 2.1rem; }
.hero .eyebrow { color: var(--accent-on-dark); }
.hero-actions { display: flex; gap: 8px; }
.hero-actions .btn { min-height: 42px; padding: 8px 16px; }
.stats { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: rgba(255,255,255,.07); border: 1px solid rgba(232, 214, 171, .22); border-radius: 14px; padding: 10px 13px; min-width: 0; }
.stat .n { font: 800 1.75rem/1.05 var(--ui); color: var(--numeral); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .l { font-size: .8rem; font-weight: 600; color: rgba(255,255,255,.85); margin-top: 4px; }
.stat .w { font-size: .76rem; color: rgba(241, 217, 160, .8); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- filters ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { white-space: nowrap; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 8px 15px; font: 600 .86rem var(--ui); cursor: pointer; }
.tab:hover { border-color: var(--gold); }
.tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .tab.on { color: var(--on-brand); } }
.filters { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.filters .search { grid-column: 1 / -1; }
.filters > * { min-width: 0; }
@media (min-width: 720px) { .filters { grid-template-columns: 2fr 1fr 1fr 1fr; } .filters .search { grid-column: auto; } }
.search { position: relative; margin: 0; }
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 44px; }

/* ---------- item list (photo tiles) ---------- */
.list { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 600px) { .list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .list { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .list { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.item {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  color: inherit; text-decoration: none; position: relative; min-width: 0;
  transition: transform .12s ease, border-color .12s ease, opacity .12s ease;
}
.item:hover { border-color: color-mix(in srgb, var(--gold) 60%, var(--line)); transform: translateY(-1px); }
.item .thumb { position: relative; aspect-ratio: 1; background: var(--surface-2); display: grid; place-items: center; color: var(--gold); overflow: hidden; }
.item .thumb .ic { width: 40px; height: 40px; stroke-width: 1.3; }
.item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.item .thumb .badge { position: absolute; left: 8px; bottom: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.item .body { min-width: 0; padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 1px; }
.item .ref { font-size: .66rem; color: var(--gold-text); font-weight: 800; letter-spacing: .07em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .title { font: 700 1.12rem/1.15 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.item .tick {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255,255,255,.85); border: 2px solid rgba(0,0,0,.25); color: transparent;
}
.item .tick .ic { width: 18px; height: 18px; stroke-width: 3; }
.item.selected { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand); }
.item.selected .tick { background: var(--brand); border-color: #fff; color: #fff; }
.item.selected .thumb img { opacity: .85; }
.item.unavailable { opacity: .45; }
.hint-line { font-size: .86rem; color: var(--muted); margin-top: -4px; }
.wt { display: inline-block; font-size: .74rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-text); font-variant-numeric: tabular-nums; }
@media (prefers-color-scheme: dark) { .wt { color: var(--gold); } }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.custody, .badge.returned { background: var(--ok-bg); color: var(--ok); }
.badge.given { background: var(--info-bg); color: var(--info); }
.badge.discrepancy { background: var(--bad-bg); color: var(--bad); }
.badge.gift { background: var(--warn-bg); color: var(--warn); }

.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 44px 20px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty .ic { width: 40px; height: 40px; color: var(--gold); stroke-width: 1.3; margin-bottom: 4px; }
.empty b { color: var(--text); font: 700 1.3rem var(--display); }

.selectbar {
  position: sticky; bottom: 0; z-index: 10; margin: 0 calc(-1 * max(16px, env(safe-area-inset-right))) 0 calc(-1 * max(16px, env(safe-area-inset-left)));
  padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  background: var(--surface); border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; font-weight: 700;
  box-shadow: 0 -10px 24px -16px rgba(var(--shade), .4);
}
body.has-bottomnav .selectbar { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
@media (min-width: 820px) { body.has-bottomnav .selectbar { bottom: 0; } }

/* ---------- photos ---------- */
.gallery { display: grid; gap: 8px; grid-template-columns: repeat(3, 1fr); }
@media (min-width: 720px) { .gallery { grid-template-columns: repeat(5, 1fr); } }
.gallery.big { grid-template-columns: repeat(2, 1fr); }
.gallery.big > .ph:first-child:not(:only-child) { grid-column: 1 / -1; aspect-ratio: 4 / 3; }
@media (min-width: 720px) { .gallery.big { grid-template-columns: repeat(4, 1fr); } .gallery.big > .ph:first-child:not(:only-child) { grid-column: span 2; grid-row: span 2; aspect-ratio: 1; } }
.ph { position: relative; aspect-ratio: 1; max-width: 100%; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); cursor: zoom-in; padding: 0; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.ph:hover img { transform: scale(1.03); }
.ph .del { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(var(--shade), .62); color: #fff; font-size: .95rem; cursor: pointer; }
.ph .tag { position: absolute; left: 6px; bottom: 6px; font-size: .68rem; font-weight: 700; background: rgba(var(--shade), .62); color: #fff; padding: 3px 8px; border-radius: 999px; }
.ph.pending { cursor: default; box-shadow: inset 0 0 0 2px var(--gold); }
.photo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.photo-actions .btn { margin: 0; }

/* ---------- item page ---------- */
.ref { letter-spacing: .06em; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 0; margin: 0; }
.details dt, .details dd { padding: 10px 0; border-bottom: 1px solid var(--line); }
.details dt { color: var(--muted); font-size: .86rem; padding-right: 18px; }
.details dd { margin: 0; font-weight: 700; word-break: break-word; }
.details dt:last-of-type, .details dd:last-of-type { border-bottom: 0; }

.status-box { border-radius: var(--radius); padding: 16px; border: 1px solid transparent; }
.status-box.custody, .status-box.returned { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.status-box.given { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.status-box.discrepancy { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 4px 0 16px 22px; border-left: 2px solid var(--line); position: relative; margin-left: 6px; }
.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 7px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--gold); }
.timeline li:first-child::before { background: var(--gold); }
.timeline .when { font-size: .78rem; color: var(--muted); margin-top: 2px; }

.weight-diff { font-weight: 800; }
.weight-diff.ok { color: var(--ok); }
.weight-diff.bad { color: var(--bad); }

.users { display: grid; gap: 14px; }
@media (min-width: 820px) { .users { grid-template-columns: 1fr 1fr; } }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--brand-deep); color: #fff; padding: 13px 18px; border-radius: 14px; z-index: 100; font-weight: 600;
  max-width: calc(100% - 32px); box-shadow: 0 12px 30px -8px rgba(0,0,0,.4); border: 1px solid rgba(232, 214, 171, .3);
}
body.has-bottomnav .toast { bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom)); }
@media (min-width: 820px) { body.has-bottomnav .toast { bottom: 24px; } }
.toast.err { background: var(--bad); border-color: transparent; }

/* ---------- full-screen zoomable photo viewer ---------- */
.viewer { position: fixed; inset: 0; z-index: 60; background: #070707; display: flex; flex-direction: column; color: #fff; }
.viewer .vbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); background: rgba(0,0,0,.5); }
.viewer .vbar button { background: rgba(255,255,255,.12); border: 0; color: #fff; min-width: 44px; height: 44px; border-radius: 12px; font-size: 1.2rem; cursor: pointer; }
.viewer .count { flex: 1; text-align: center; font-size: .9rem; font-weight: 600; }
.viewer .stage { position: relative; flex: 1; overflow: hidden; touch-action: none; }
.viewer .stage img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: contain; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; }
.viewer .nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.14); border: 0; color: #fff; width: 44px; height: 64px; font-size: 1.6rem; cursor: pointer; border-radius: 12px; }
.viewer .nav.prev { left: 8px; } .viewer .nav.next { right: 8px; }
.viewer .vhint { text-align: center; font-size: .78rem; opacity: .65; padding: 6px 0 calc(8px + env(safe-area-inset-bottom)); }

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

/* ---------- audit trail ---------- */
.audit-filters { align-items: end; }
.audit-filters .btn { min-height: 48px; }
@media (min-width: 820px) { .audit-filters { grid-template-columns: 2fr 1fr 1fr 1.4fr auto; } .audit-filters .search { grid-column: auto; } }
.date-f { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; font-weight: 700; color: var(--muted); margin: 0; }
.audit-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.audit-list .empty { border: 0; box-shadow: none; }
.audit-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 14px; border-top: 1px solid var(--line); font-size: .9rem; }
.audit-row:first-child { border-top: 0; }
.audit-row .a-when { grid-column: 1 / -1; font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.audit-row .a-main { min-width: 0; overflow-wrap: anywhere; }
.audit-row .a-who { text-align: right; font-weight: 700; display: flex; flex-direction: column; }
.audit-row.warn { box-shadow: inset 3px 0 0 var(--bad); }
@media (min-width: 820px) {
  .audit-row { grid-template-columns: 150px 1fr 140px; align-items: start; }
  .audit-row .a-when { grid-column: auto; font-size: .82rem; padding-top: 1px; }
}

.totalbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); color: var(--text); }
.totalbar span { display: flex; flex-direction: column; font-weight: 700; font-size: .92rem; }
.totalbar small { font-weight: 500; color: var(--muted); font-size: .78rem; }
.totalbar b { font: 800 1.45rem/1 var(--ui, inherit); color: var(--gold-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .totalbar b { color: var(--gold); } }
#selCount small { display: block; font-weight: 600; font-size: .78rem; color: var(--gold-text); }

.steps { margin: 0; padding-left: 22px; display: grid; gap: 10px; }
.steps li { padding-left: 4px; }
