:root {
  /* light theme: soft grey page, white rounded cards, deep green actions (SwiftGames green as accent) */
  --bg: #eef1ee;
  --side: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f6f4;
  --surface-3: #e8ece8;
  --border: #e2e6e2;
  --border-soft: #edf0ed;
  --text: #121712;
  --muted: #6a736b;
  --green: #15803d;
  --green-hover: #116932;
  --green-deep: #0e4f2c;
  --green-dim: rgba(21, 128, 61, .10);
  --brand: #05fc4c;
  --on-green: #ffffff;
  --red: #c4320a;
  --red-dim: rgba(217, 45, 32, .09);
  --amber: #a35b00;
  --amber-dim: rgba(245, 158, 11, .14);
  --violet: #6d4fd8;
  --violet-dim: rgba(109, 79, 216, .12);
  --blue: #1d6fd6;
  --blue-dim: rgba(29, 111, 214, .11);
  --shadow: 0 1px 2px rgba(18, 23, 18, .04), 0 4px 16px rgba(18, 23, 18, .04);
  --radius: 20px;
  --text-2: #3f4840;
  --row-hover: #f8faf8;
  --placeholder: #9aa29b;
  --glass: rgba(255, 255, 255, .93);
  --dash: #cfd6cf;
  --alert-ok-bg: #effaf2; --alert-info-bg: #eef4fd; --alert-warn-bg: #fffaeb; --alert-err-bg: #fdf1f0;
  color-scheme: light;
}
/* dark theme (toggle in the sidebar / page header; remembered per device) */
:root[data-theme="dark"] {
  --bg: #0b0d0b;
  --side: #131613;
  --surface: #161a16;
  --surface-2: #1d221d;
  --surface-3: #283028;
  --border: #283028;
  --border-soft: rgba(255, 255, 255, .06);
  --text: #eef2ee;
  --text-2: #c6cec6;
  --muted: #8f998f;
  --green: #22c55e;
  --green-hover: #4ade80;
  --green-deep: #0e4f2c;
  --green-dim: rgba(34, 197, 94, .14);
  --on-green: #06210f;
  --red: #ff7a6e;
  --red-dim: rgba(255, 122, 110, .14);
  --amber: #ffb547;
  --amber-dim: rgba(255, 181, 71, .14);
  --violet: #a78bfa;
  --violet-dim: rgba(167, 139, 250, .15);
  --blue: #6cb8ff;
  --blue-dim: rgba(108, 184, 255, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --row-hover: rgba(255, 255, 255, .03);
  --placeholder: #667066;
  --glass: rgba(11, 13, 11, .92);
  --dash: #343c34;
  --alert-ok-bg: rgba(34, 197, 94, .08); --alert-info-bg: rgba(47, 127, 227, .1);
  --alert-warn-bg: rgba(245, 181, 10, .08); --alert-err-bg: rgba(239, 68, 68, .09);
  color-scheme: dark;
}
:root[data-theme="dark"] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238f998f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] select:focus { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] .stat-ico, :root[data-theme="dark"] .ico-amber, :root[data-theme="dark"] .ico-red,
:root[data-theme="dark"] .ico-violet, :root[data-theme="dark"] .ico-blue { color: #0b0d0b; }
:root[data-theme="dark"] .stat.accent .stat-ico { color: var(--green-deep); }
:root[data-theme="dark"] .nav-scrim:not([hidden]) { background: rgba(0, 0, 0, .6); }

/* logos: dark-text logo on light, white-text logo on dark */
.for-dark { display: none !important; }
:root[data-theme="dark"] .for-light { display: none !important; }
:root[data-theme="dark"] .for-dark { display: block !important; }
:root[data-theme="dark"] .mobile-logo .for-dark, :root[data-theme="dark"] .c-head .for-dark { display: inline-block !important; }

/* theme switch */
.theme-toggle { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; flex: none; padding: 0; }
.theme-toggle:hover { border-color: var(--green); color: var(--green); }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.side .theme-toggle-wide { margin-top: auto; }
.theme-toggle-wide { display: flex; align-items: center; gap: 12px; width: 100%; height: auto; padding: 11px 14px; margin: 16px 0 10px;
  border-radius: 12px; border: 0; background: var(--surface-2); color: var(--muted); font: 500 .95rem var(--font-display); text-align: left; }
.theme-toggle-wide:hover { color: var(--text); }
.tt-label { flex: 1; }
.tt-switch { width: 36px; height: 20px; border-radius: 99px; background: var(--surface-3); position: relative; transition: background .15s; }
.tt-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
:root[data-theme="dark"] .tt-switch { background: var(--green); }
:root[data-theme="dark"] .tt-switch::after { transform: translateX(16px); }
.c-head-right { display: inline-flex; align-items: center; gap: 10px; }
.corner-toggle { position: fixed; top: 14px; right: 14px; z-index: 10; }
@media (prefers-reduced-motion: reduce) { .tt-switch, .tt-switch::after { transition: none; } }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
/* type: Plus Jakarta Sans for headings, numbers and actions; Inter for body text and small UI labels */
:root {
  --font-display: "Plus Jakarta Sans", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-ui: Inter, "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
body { font: 15px/1.55 var(--font-ui); -webkit-font-smoothing: antialiased; }  /* no stylistic-set overrides: they swapped in squared-off n/m alternates */
h1, h2, h3, .btn, .seg-btn, .nav a, .stat .v, .amount, .summary-strip strong, .me-name, .item-tab .t, .seg-opt span,
.topbar h1, .side-logo, .mobile-title, .item-editor-head h3 { font-family: var(--font-display); }
.stat .v, .amount, .summary-strip strong { font-variant-numeric: tabular-nums; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; font-weight: 700; letter-spacing: -.02em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.num { font-variant-numeric: tabular-nums; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--green); background: var(--green); color: var(--on-green); font-weight: 700;
  font-size: .95rem; cursor: pointer; text-decoration: none; transition: background .15s, transform .05s; }
.btn:hover { background: var(--green-hover); border-color: var(--green-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.btn-ghost { background: var(--surface); color: var(--green); border-color: var(--green); }
.btn-ghost:hover { background: var(--green-dim); }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red-dim); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: .85rem; }
.btn-block { width: 100%; }

/* forms */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.hint { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.err-text { color: var(--red); font-size: .82rem; margin-top: 4px; }
input[type=text], input[type=search], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  padding: 11px 12px; font: inherit; }
textarea { min-height: 90px; resize: vertical; }
input[type=text], input[type=search], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], select { height: 47px; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
select { -webkit-appearance: none; appearance: none; padding-right: 44px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236a736b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; background-size: 14px; }
select:focus { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2315803d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
select::-ms-expand { display: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--green); margin-top: 2px; flex: none; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

/* cards & layout */
.card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 24px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card h2 { margin-bottom: 16px; font-size: 1.05rem; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); }
.grid > *, .main { min-width: 0; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); }
.card .stat { background: var(--surface-2); box-shadow: none; }
.stat .v { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; order: 2; }
.stat .l { color: var(--muted); font-size: .88rem; font-weight: 500; order: 1; }
.stat.accent { background: linear-gradient(140deg, #1c8f4e 0%, var(--green-deep) 100%); border-color: transparent; color: #fff; }
.stat.accent .v { color: #fff; }
.stat.accent .l { color: rgba(255, 255, 255, .82); }
.stat.accent .stat-ico { background: #fff; color: var(--green); }
.stat-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; order: 0; margin-bottom: 4px;
  background: var(--green); color: #fff; }
.stat-ico svg { width: 18px; height: 18px; }
.stat:has(.stat-ico) { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 12px; row-gap: 10px; }
.stat:has(.stat-ico) .stat-ico { margin: 0; grid-row: 1; }
.stat:has(.stat-ico) .l { grid-row: 1; grid-column: 2; line-height: 1.3; }
.stat:has(.stat-ico) .v { grid-column: 1 / -1; }
.ico-amber { background: var(--amber); } .ico-red { background: var(--red); } .ico-violet { background: var(--violet); } .ico-blue { background: var(--blue); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em;
  background: var(--surface-2); border-bottom: 0; }
th:first-child { border-radius: 10px 0 0 10px; } th:last-child { border-radius: 0 10px 10px 0; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: var(--row-hover); }
td.r, th.r { text-align: right; }

/* badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 8px; font-size: .74rem; font-weight: 700; border: 1px solid transparent; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.b-ok { color: var(--green-hover); background: var(--green-dim); }
.b-warn { color: var(--amber); background: var(--amber-dim); }
.b-bad { color: var(--red); background: var(--red-dim); }
.b-info { color: var(--text-2); }

/* alerts: coloured outline, round icon, optional bold title, optional close button */
.alert { position: relative; border-radius: 16px; padding: 15px 18px 15px 66px; margin-bottom: 14px; border: 1.5px solid;
  font-size: .93rem; line-height: 1.5; color: var(--text-2); min-height: 66px; display: flow-root; }
.alert::before { content: ""; position: absolute; left: 16px; top: 14px; width: 36px; height: 36px; border-radius: 50%;
  background: center / 36px 36px no-repeat; }
.alert-title { display: block; font-family: var(--font-display); font-weight: 700; font-size: 1rem; color: var(--text); margin-bottom: 2px; }
.alert strong { color: var(--text); }
.alert a { color: inherit; text-decoration: underline; }
.alert-ok { border-color: #6fd394; background: var(--alert-ok-bg); }
.alert-ok::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='20' fill='%2322c55e'/%3E%3Cpath d='M12.5 20.5l5 5 10-11' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.alert-info { border-color: #6ea6ec; background: var(--alert-info-bg); }
.alert-info::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='20' fill='%232f7fe3'/%3E%3Cpath d='M16.5 25.5h7M17.5 29h5M20 11a6.5 6.5 0 0 0-3.6 11.9c.6.4 1.1 1.1 1.1 1.9h5c0-.8.5-1.5 1.1-1.9A6.5 6.5 0 0 0 20 11z' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.alert-warn { border-color: #f2c94c; background: var(--alert-warn-bg); }
.alert-warn::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='20' fill='%23f5b50a'/%3E%3Cpath d='M20 11.5v11' stroke='%23fff' stroke-width='3.6' stroke-linecap='round'/%3E%3Ccircle cx='20' cy='28.5' r='2.2' fill='%23fff'/%3E%3C/svg%3E"); }
.alert-err { border-color: #ef8a82; background: var(--alert-err-bg); }
.alert-err::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='20' fill='%23ef4444'/%3E%3Cpath d='M14 14l12 12M26 14L14 26' stroke='%23fff' stroke-width='3.4' stroke-linecap='round'/%3E%3C/svg%3E"); }
.alert.has-close { padding-right: 54px; }
.alert-close { position: absolute; right: 10px; top: 12px; width: 34px; height: 34px; border-radius: 10px; border: 0; background: transparent;
  color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.alert-close:hover { background: var(--surface); color: var(--text); }
.alert .btn { vertical-align: middle; }

/* admin shell */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; gap: 0; }
.shell-bare { grid-template-columns: 1fr; }
.side { background: var(--side); border: 1px solid var(--border-soft); border-radius: 24px; margin: 14px 0 14px 14px; box-shadow: var(--shadow); padding: 24px 14px 16px; position: sticky; top: 14px; height: calc(100vh - 28px);
  display: flex; flex-direction: column; overflow-y: auto; }
.side-head { display: flex; align-items: center; justify-content: space-between; margin: 0 6px 26px; }
.side-logo img { width: 168px; display: block; }
.side-close { display: none; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a { position: relative; display: flex; align-items: center; gap: 12px; color: var(--muted); padding: 11px 14px; border-radius: 12px; font-weight: 500; font-size: .95rem; }
.nav a svg { flex: none; opacity: .85; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--green-dim); color: var(--text); font-weight: 700; }
.nav a.on svg { color: var(--green); }
.nav a.on::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--green); }
.nav a.on svg { opacity: 1; }
.me { display: flex; align-items: center; gap: 10px; padding: 12px 10px; border-radius: 16px; background: linear-gradient(140deg, #1c8f4e, var(--green-deep)); color: #fff; }
.me-avatar { width: 34px; height: 34px; border-radius: 50%; background: #fff; color: var(--green); display: grid; place-items: center; font-weight: 800; flex: none; }
.me-text { min-width: 0; flex: 1; }
.me-name { font-weight: 600; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { color: rgba(255,255,255,.78); font-size: .76rem; }
.me-out { background: none; border: 0; color: rgba(255,255,255,.85); width: 34px; height: 34px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.me-out:hover { color: #fff; background: rgba(255,255,255,.16); }
.main { padding: 30px 34px 60px; max-width: 1340px; width: 100%; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.topbar h1 { margin: 0; font-size: 1.9rem; letter-spacing: -.02em; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: .85rem; }
.tabs a:hover { text-decoration: none; background: var(--surface-2); }
.tabs a.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.thumb { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.thumb img { width: 100%; height: 130px; object-fit: cover; display: block; background: #fff; }
.thumb .cap { padding: 8px 10px; font-size: .8rem; }
.bar { height: 10px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, #22a35a, var(--green)); border-radius: 99px; }
.flags li { color: var(--amber); margin-bottom: 4px; }
details summary { cursor: pointer; color: var(--muted); }
.mobile-nav, .nav-scrim { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .mobile-nav { display: flex; gap: 12px; align-items: center; position: sticky; top: 0; z-index: 25; height: 60px; padding: 0 12px;
    background: var(--glass); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
  .hamburger { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
    display: grid; place-items: center; cursor: pointer; flex: none; }
  .hamburger:hover { border-color: var(--green); color: var(--green); }
  .mobile-logo img { width: 120px; display: block; }
  .mobile-nav .theme-toggle { order: 3; }
  .mobile-title { margin-left: auto; color: var(--muted); font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 40; width: min(290px, 84vw); height: 100%;
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: 10px 0 40px rgba(18, 23, 18, .18); visibility: hidden;
    margin: 0; border-radius: 0 24px 24px 0; }
  body.nav-open .side { transform: none; visibility: visible; }
  body.nav-open { overflow: hidden; }
  .nav-scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(18, 23, 18, .35); }
  .side-close { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0; background: var(--surface-2); color: var(--text); cursor: pointer; }
  .side-logo img { width: 140px; }
  .nav a { padding: 12px; }
  .main { padding: 18px 16px 60px; }
  .topbar h1 { font-size: 1.3rem; }
  .topbar .btn { width: 100%; }
  .card { padding: 16px; border-radius: 14px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dt { margin-top: 8px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 14px; }
  .stat .v { font-size: 1.35rem; }
  .row { grid-template-columns: 1fr; }
  /* any table not already in a scroll box scrolls sideways inside its card instead of pushing the page */
  .main table:not(.table-wrap table) { display: block; overflow-x: auto; max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

/* customer form */
.c-wrap { max-width: 640px; margin: 0 auto; padding: 18px 16px 120px; }
.c-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 18px; }
.c-head img { width: 160px; }
.steps { display: flex; gap: 6px; margin-bottom: 18px; }
.steps span { flex: 1; height: 4px; border-radius: 99px; background: var(--border); }
.steps span.done { background: var(--green); }
.offline-bar { position: fixed; left: 0; right: 0; top: 0; z-index: 20; background: #ffb547; color: #000; font-weight: 700; font-size: .88rem; text-align: center; padding: 10px 16px; }
.offline-bar[hidden] { display: none; }
.savebar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--glass); border-top: 1px solid var(--border); padding: 10px 16px; backdrop-filter: blur(6px); }
.savebar .in { max-width: 640px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .85rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; margin-right: 6px; }
.dot.saving { background: var(--amber); }
.dot.err { background: var(--red); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg-opt { margin: 0; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { display: block; text-align: center; padding: 12px 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-weight: 700; }
.seg-opt input:checked + span { border-color: var(--green); background: var(--green-dim); color: var(--green); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }
.seg-5 { grid-template-columns: repeat(5, 1fr); }
.seg-2 { grid-template-columns: repeat(2, 1fr); max-width: 320px; }
.seg-4 { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.seg-4 .seg-opt span { padding: 11px 2px; font-size: .9rem; }
.seg-6 { grid-template-columns: repeat(6, 1fr); gap: 6px; }
.seg-opt small { display: block; font-size: .68rem; font-weight: 500; color: var(--muted); margin-top: 2px; }
.seg-opt input:checked + span small { color: var(--green); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 8px 14px; }
.checks .check { margin: 0; padding: 10px 10px; font-size: .88rem; overflow-wrap: break-word; hyphens: auto; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.checks .check:has(input:checked) { border-color: var(--green); background: var(--green-dim); }
.ctrl-card { border: 1px solid var(--border); border-radius: 16px; padding: 14px; margin-top: 12px; background: var(--surface); }
.ctrl-card h3 { margin-bottom: 10px; }
.ctrl-box { border: 1px solid var(--border); background: var(--surface-2); border-radius: 16px; padding: 14px; margin-bottom: 16px; }
.ctrl-box[hidden] { display: none; }
.upl { border: 1.5px dashed var(--dash); background: var(--surface-2); border-radius: 16px; padding: 14px; margin-bottom: 12px; }
.upl-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.upl-head > div:first-child { flex: 1 1 150px; min-width: 0; } /* two buttons drop below the text on a phone */
.upl input[type=file] { display: none; }
.upl-btns { display: flex; gap: 6px; flex: none; }
.upl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.upl-item { position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.upl-item img { width: 100%; height: 90px; object-fit: cover; display: block; }
.upl-item .st { position: absolute; left: 4px; bottom: 4px; max-width: calc(100% - 8px); overflow: hidden; text-overflow: ellipsis; font-size: .68rem; padding: 1px 6px; }
.upl-item button { position: absolute; right: 4px; top: 4px; background: rgba(0,0,0,.75); color: #fff; border: 0; border-radius: 6px; width: 26px; height: 26px; cursor: pointer; }
.upl-sending img { opacity: .6; }
.upl-msg { color: var(--red); font-size: .85rem; margin-top: 6px; }
.terms { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 14px; max-height: 300px; overflow-y: auto; white-space: pre-wrap; font-size: .85rem; color: var(--text-2); margin-bottom: 12px; }
.sigpad { background: #fff; border: 1.5px solid var(--border); border-radius: 14px; width: 100%; height: 170px; touch-action: none; display: block; }
.center { text-align: center; }
.big-ok { font-size: 3rem; color: var(--green); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.rv { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.eye { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 6px; width: 28px; height: 24px; display: inline-grid; place-items: center; cursor: pointer; padding: 0; }
.eye:hover { color: var(--green); border-color: var(--green); }
.eye.on { color: var(--green); border-color: var(--green); background: var(--green-dim); }
.logo-print { display: none; }
.amount { font-size: 1.2rem; font-weight: 800; color: var(--green); }
@media print {
  html, body { background: #fff; color: #000; }
  .theme-toggle, .corner-toggle { display: none !important; }
  .for-dark { display: none !important; }
  .no-print { display: none !important; }
  .logo-screen { display: none !important; }
  .logo-print { display: block !important; }
  .card { border-color: #ccc; background: #fff; }
  .muted, .kv dt { color: #555; }
  .amount { color: #000; }
}

/* address suggestions (Google Maps) */
.ac-wrap { position: relative; }
.ac-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 30px rgba(18,23,18,.12); }
.ac-list li { padding: 10px 12px; border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.ac-list li strong { font-weight: 600; }
.ac-list li span { color: var(--muted); font-size: .85rem; }
.ac-list li:hover, .ac-list li[aria-selected=true] { background: var(--green-dim); }
.ac-list::after { content: "powered by Google"; display: block; text-align: right; font-size: .7rem; color: var(--muted); padding: 4px 8px 2px; }

/* audit trail filters */
.audit-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; align-items: end; }
.audit-filters .field { margin-bottom: 12px; }
.audit-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; grid-column: 1 / -1; }

/* multi-item transactions */
.item-declined { opacity: .6; }
.photo-group { font-size: .95rem; margin: 18px 0 8px; color: var(--muted); }
.photo-group:first-of-type { margin-top: 4px; }
.review-items td { vertical-align: top; }
.review-items select, .review-items input[type=text] { min-width: 120px; }
.review-items tr.row-off td:not(:last-child) { opacity: .45; }

/* customer form: several items in one buy-back */
.item-tabs { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 12px; }
.item-tab { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; text-align: left; width: 100%;
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: inherit;
  font: inherit; cursor: pointer; min-height: 48px; }
.item-tab .n { color: var(--muted); font-weight: 600; }
.item-tab .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-tab .s { font-size: .8rem; color: var(--amber); white-space: nowrap; }
.item-tab.ready .s { color: var(--green); }
.item-tab.on { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.add-item { margin-bottom: 14px; }
.add-item-pick { margin-top: 10px; }
.add-item-pick .seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.seg-btn { min-height: 47px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: inherit;
  font: inherit; font-weight: 600; cursor: pointer; }
.seg-btn:hover, .seg-btn:focus-visible { border-color: var(--green); color: var(--green); outline: none; }
.item-editor-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 4px 0 12px;
  padding-top: 12px; border-top: 1px solid var(--border); }
.item-editor-head h3 { margin: 0; font-size: 1.05rem; }
/* anything the page hides stays hidden, even when a class gives it display:flex/grid */
[hidden] { display: none !important; }

/* transaction page: at-a-glance strip, item cards */
.summary-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 22px; }
.summary-strip > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.summary-strip .lbl { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.summary-strip strong { font-size: 1.05rem; overflow-wrap: anywhere; }
.summary-strip .sub { font-size: .8rem; color: var(--muted); }
.item-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.item-card-head h2 { margin: 0; }
.item-card-head .badge { vertical-align: middle; }
.item-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 36px; }
.item-cols > * { min-width: 0; }
.sub-head { font-size: .95rem; margin: 18px 0 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.items-table td { vertical-align: middle; }
.items-table tr.row-off td { opacity: .55; }
.nowrap { white-space: nowrap; }
.sig-img { display: block; margin-top: 12px; max-width: 360px; width: 100%; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
@media (max-width: 860px) { .item-cols { grid-template-columns: 1fr; } .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* transactions list: one line per item */
.li-items { display: grid; grid-template-columns: auto minmax(140px, 1fr) auto; gap: 4px 10px; align-items: center; min-width: 380px; }
.li-item { display: contents; }
.li-item .t { font-size: .88rem; }
.li-item .id { white-space: nowrap; color: var(--green); }
.li-item.off .t { text-decoration: line-through; color: var(--muted); }
.li-item.off .id { color: var(--muted); }

/* discard draft */
.discard-card summary { color: var(--text); list-style-position: outside; }
.discard-card[open] summary { margin-bottom: 4px; }

/* delivery riders */
.rider-row { padding: 14px 0; border-bottom: 1px solid var(--border); }
.rider-row:first-of-type { padding-top: 0; }
.rider-row:last-of-type { border-bottom: 0; padding-bottom: 0; }
.rider-foot { display: flex; align-items: center; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.rider-foot .btn { margin-left: auto; }
.rider-set { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; }
.rider-set select { width: auto; min-width: 240px; flex: 1; max-width: 380px; }
/* money and other numbers never break across lines */
.num, td.r { white-space: nowrap; }
/* transactions list: one line per item, transaction details span the item lines */
.tx-row.tx-cont td.it { border-bottom: 1px dashed var(--border-soft); }
.tx-row.tx-more td.it { padding-top: 6px; }
.tx-row td.it-id { color: var(--green); }
.tx-row td.it-off { text-decoration: line-through; color: var(--muted); }
.tx-row td[rowspan] { background: inherit; }
.audit-say { font-family: var(--font-ui); font-size: .85rem; color: var(--text); margin-bottom: 4px; }
/* per-photo check by the sales rep */
.ph-state { margin-top: 6px; font-size: .78rem; font-weight: 600; }
.ph-ok { color: var(--green); } .ph-bad { color: var(--red); }
.ph-actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; margin-top: 8px; }
.ph-actions form { margin: 0; }
.ph-actions .btn:disabled { opacity: 1; cursor: default; }
.ph-retake summary { list-style: none; }
.ph-retake summary::-webkit-details-marker { display: none; }
.ph-retake[open] { flex-basis: 100%; }
.ph-retake[open] summary { display: none; }
.ph-retake form { display: grid; gap: 6px; }
.ph-retake input { height: 38px; font-size: .85rem; padding: 6px 10px; }
.thumb .cap { display: flex; flex-direction: column; gap: 2px; }
/* receipt: item details in aligned rows, amounts in one column */
.rcpt { margin: 18px 0 20px; table-layout: fixed; }
.rcpt th:last-child, .rcpt td:last-child { width: 150px; }
.rcpt td { vertical-align: top; padding: 16px 12px; }
.rcpt-title { font-family: var(--font-display); font-weight: 600; font-size: 1rem; margin-bottom: 8px; }
.rcpt-title .badge { margin-left: 6px; vertical-align: 2px; }
.rcpt-meta { display: grid; grid-template-columns: 112px 1fr; gap: 4px 12px; margin: 0; font-size: .86rem; }
.rcpt-meta dt { color: var(--muted); }
.rcpt-meta dd { margin: 0; overflow-wrap: anywhere; }
.rcpt-ctl { display: block; }
.rcpt-amt { font-weight: 600; }
.rcpt tfoot td { border-top: 1.5px solid var(--border); border-bottom: 0; padding-top: 16px; font-size: 1.05rem; vertical-align: middle; }
@media (max-width: 520px) { .rcpt th:last-child, .rcpt td:last-child { width: 118px; } .rcpt-meta { grid-template-columns: 1fr; gap: 0; } .rcpt-meta dd { margin-bottom: 6px; } }
@media print { .rcpt th { background: #f2f2f2; } }
.fees-set { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; padding: 16px 18px; }
.fees-set .fees-lbl { align-self: center; font-family: var(--font-display); }
.fees-set input { width: 160px; }
.fees-set .hint { flex-basis: 100%; margin: 0; }
/* reviewer warnings: each one resolved by a person */
.warn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.warn-list li { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.warn-list li.is-open { border-color: #f2c94c; }
.warn-list li.is-open .warn-text { color: var(--amber); font-weight: 600; }
.warn-list li.is-done .warn-text { color: var(--muted); text-decoration: line-through; }
.warn-by { font-size: .8rem; color: var(--green); margin-top: 4px; }
.warn-form { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.warn-form input { flex: 1; min-width: 220px; height: 38px; font-size: .88rem; padding: 6px 10px; }
.hold-list { margin: 6px 0 6px 18px; padding: 0; }
/* photo cards: smooth decisions, numbers, "you are here" counter */
.thumb.ph { position: relative; transition: border-color .25s ease, box-shadow .25s ease, transform .2s ease; }
.thumb.ph .cap { gap: 4px; }
.ph-num { position: absolute; top: 8px; left: 8px; background: rgba(0, 0, 0, .62); color: #fff; font: 600 .72rem/1 var(--font-ui);
  padding: 5px 8px; border-radius: 999px; pointer-events: none; }
.ph-state { font-size: .78rem; font-weight: 600; min-height: 0; }
.ph-state:empty { display: none; }
.thumb.ph[data-state="approved"] { border-color: rgba(34, 160, 80, .55); }
.thumb.ph[data-state="retake"] { border-color: rgba(217, 45, 32, .5); }
.thumb.ph.ph-current { box-shadow: 0 0 0 3px var(--green-dim), var(--shadow); }
.thumb.ph.ph-busy { opacity: .7; }
.ph-actions .btn { transition: background .2s ease, color .2s ease, opacity .2s ease; }
/* approved: hide Approve, keep a quiet "Change to retake"; retake: offer Approve again */
.thumb.ph[data-state="approved"] .ph-approve { display: none; }
.ph-retake .when-done { display: none; }
.thumb.ph[data-state="approved"] .ph-retake summary { background: transparent; border-color: transparent; color: var(--muted); padding: 0; min-height: 0; font-weight: 500; text-decoration: underline; }
.thumb.ph[data-state="approved"] .ph-retake .when-open { display: none; }
.thumb.ph[data-state="approved"] .ph-retake .when-done { display: inline; }
.thumb.ph[data-state="retake"] .ph-approve .btn::after { content: " instead"; }
.ph-retake form { animation: ph-drop .2s ease; }
@keyframes ph-drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.ph-flash-ok { animation: ph-ok .7s ease; }
.ph-flash-bad { animation: ph-bad .7s ease; }
@keyframes ph-ok { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); transform: scale(1); } 35% { transform: scale(1.015); }
  100% { box-shadow: 0 0 0 14px rgba(34, 197, 94, 0); transform: scale(1); } }
@keyframes ph-bad { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .5); } 100% { box-shadow: 0 0 0 14px rgba(239, 68, 68, 0); } }
.ph-badge .badge { transition: background .25s ease, color .25s ease; }
.ph-progress { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 30; background: var(--text); color: var(--bg);
  font: 500 .9rem var(--font-ui); padding: 10px 18px; border-radius: 999px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); white-space: nowrap; }
.ph-progress strong { font-family: var(--font-display); }
.ph-progress.bump strong { display: inline-block; animation: ph-bump .3s ease; }
@keyframes ph-bump { 0% { transform: translateY(4px); opacity: .3; } 100% { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .thumb.ph, .ph-actions .btn, .ph-badge .badge { transition: none; }
  .ph-flash-ok, .ph-flash-bad, .ph-retake form, .ph-progress.bump strong { animation: none; }
}
.dash-row { font-size: .95rem; margin: 18px 0 10px; }
.dash-row:first-of-type { margin-top: 18px; }
.stat.accent .stat-ico.ico-red { background: #fff; color: var(--green); }
.sold-form { display: flex; gap: 6px; align-items: center; min-width: 300px; }
.sold-form input { height: 36px; padding: 6px 8px; font-size: .85rem; }
.sold-form input[name="sold_price"] { width: 100px; }
.sold-form input[type="date"] { width: 140px; }
/* dashboard money rows: compact tiles, one row each */
.stat-row { display: grid; gap: 10px; }
.stat-row-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stat-row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-row .stat { padding: 12px 14px; border-radius: 14px; row-gap: 8px !important; column-gap: 8px !important; }
.stat-row .stat-ico { width: 26px; height: 26px; border-radius: 8px; }
.stat-row .stat-ico svg { width: 14px; height: 14px; }
.stat-row .stat .l { font-size: .76rem; line-height: 1.25; }
.stat-row .stat .v { font-size: 1.05rem !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1180px) { .stat-row-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .stat-row-6, .stat-row-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* dashboard breakdown panels */
.panels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.panels .panel { margin: 0; padding: 18px 20px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { margin: 0; font-size: 1rem; }
.panel-row { margin-bottom: 10px; }
.panel-row:last-child { margin-bottom: 0; }
.panel-line { display: flex; justify-content: space-between; gap: 10px; font-size: .86rem; margin-bottom: 4px; }
.panel-row.is-zero { opacity: .45; }
@media (max-width: 1180px) { .panels { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .panels { grid-template-columns: 1fr; } }
/* ID document choice: three equal buttons; a long name like "Driving Licence" wraps neatly inside its button */
.seg-id { align-items: stretch; }
.seg-id .seg-opt { display: flex; }
.seg-id .seg-opt span { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 50px;
  padding: 8px 6px; line-height: 1.2; font-size: .92rem; overflow-wrap: anywhere; }
@media (max-width: 380px) { .seg-id .seg-opt span { font-size: .84rem; padding: 8px 4px; } }
@media (max-width: 480px) { .c-head img { width: 128px; } .c-head-right .mono { font-size: .7rem; white-space: nowrap; } }

/* =====================================================================
   Motion: one set of curves for the whole app.
   ease-out = quick start, gentle stop (the "smooth glide"); spring = a light, physical settle.
   Only colours, opacity and transform animate on interaction, so phones stay smooth.
   ===================================================================== */
:root {
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --ease-spring: cubic-bezier(.34, 1.36, .64, 1);  /* fallback: small overshoot */
  --dur-fast: 140ms;
  --dur: 220ms;
  --dur-slow: 340ms;
}
@supports (transition-timing-function: linear(0, 1)) {
  :root {  /* spring (tension ~180, friction ~16), sampled: settles with a ~2% overshoot */
    --ease-spring: linear(0, 0.006, 0.025 2.8%, 0.101 6.1%, 0.539 18.9%, 0.721 25.3%, 0.849 31.5%, 0.937 38.1%,
      0.968 41.8%, 0.991 45.7%, 1.006 50.1%, 1.015 55%, 1.017 63.9%, 1.001 85.9%, 1);
  }
}

/* smooth scrolling to anchors (#photos, #warnings, item links), clear of the sticky phone header */
html { scroll-behavior: smooth; }
[id] { scroll-margin-top: 84px; }

/* buttons: colours glide, press springs back */
.btn { transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
  color var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-spring); }
.btn:hover:not(:disabled) { box-shadow: 0 4px 14px rgba(21, 128, 61, .18); }
.btn-ghost:hover:not(:disabled), .btn-danger:hover:not(:disabled) { box-shadow: none; }
.btn:active:not(:disabled) { transform: scale(.97); transition-duration: 60ms; }
.theme-toggle, .hamburger, .me-out, .side-close, .eye, .alert-close {
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out), transform var(--dur) var(--ease-spring); }
.theme-toggle:active, .hamburger:active, .eye:active, .alert-close:active { transform: scale(.92); }

/* fields: border and focus ring fade in */
input, select, textarea { transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease-out),
  background-color var(--dur-fast) var(--ease-out); }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-dim); outline: none; }

/* choices: selection glides; the picked option settles with a small spring */
.nav a, .tabs a, .checks .check, .item-tab, .seg-btn, .upl, .warn-list li, .thumb {
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease-out); }
.seg-opt span { transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
  color var(--dur-fast) var(--ease-out), transform var(--dur) var(--ease-spring); }
.seg-opt input:checked + span { animation: pick var(--dur-slow) var(--ease-spring); }
@keyframes pick { 0% { transform: scale(.96); } 100% { transform: scale(1); } }
.tt-switch, .tt-switch::after { transition: background-color var(--dur) var(--ease-out), transform var(--dur-slow) var(--ease-spring); }

/* phone menu: drawer glides in on ease-out, the dimmer fades with it */
@media (max-width: 860px) {
  .side { transition: transform var(--dur-slow) var(--ease-out), visibility 0s linear var(--dur-slow); }
  body.nav-open .side { transition: transform var(--dur-slow) var(--ease-out), visibility 0s; }
  .nav-scrim { display: block !important; position: fixed; inset: 0; z-index: 35; background: rgba(18, 23, 18, .35);
    opacity: 0; pointer-events: none; transition: opacity var(--dur-slow) var(--ease-out); }
  :root[data-theme="dark"] .nav-scrim { background: rgba(0, 0, 0, .6); }
  body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
}

/* pages and messages: arrive with a short fade-and-rise; dismissed messages fold away */
.main > *:not(.ph-progress):not(script) { animation: rise var(--dur-slow) var(--ease-out) both; }  /* the floating photo counter keeps its own centring transform */
.main > *:nth-child(2) { animation-delay: 30ms; } .main > *:nth-child(3) { animation-delay: 60ms; }
.main > *:nth-child(n+4) { animation-delay: 90ms; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.alert { animation: rise var(--dur-slow) var(--ease-out) both; }
.alert.is-leaving { overflow: hidden; opacity: 0; transform: translateY(-4px); margin-bottom: 0; padding-top: 0; padding-bottom: 0;
  min-height: 0; border-width: 0; transition: height var(--dur) var(--ease-in-out), opacity var(--dur-fast) var(--ease-out),
  transform var(--dur) var(--ease-out), margin var(--dur) var(--ease-in-out), padding var(--dur) var(--ease-in-out); }

/* things that open (details, retake box, add-item picker) slide down gently */
details[open] > *:not(summary) { animation: drop var(--dur) var(--ease-out); }
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* new photos pop into their tile with a spring */
.upl-item { animation: pop var(--dur-slow) var(--ease-spring) both; }
@keyframes pop { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }

/* bars grow on ease-out (tweened in by motion.js on the dashboard) */
.bar > span { transition: width 700ms var(--ease-out); }

/* photo review: reuse the shared curves */
.thumb.ph { transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-spring); }
.ph-flash-ok { animation: ph-ok 700ms var(--ease-out); }
.ph-flash-bad { animation: ph-bad 700ms var(--ease-out); }
.ph-progress { transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-spring); }

/* anyone who asked their phone/computer for less motion gets none */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important;
    animation-delay: 0ms !important; transition-duration: 1ms !important; transition-delay: 0ms !important; }
}

/* wide tables: glide sideways one column at a time */
.hs { position: relative; }
.hs-bar { display: none; align-items: center; justify-content: flex-end; gap: 6px; margin: 0 0 8px; min-height: 34px; }
.hs.hs-on .hs-bar { display: flex; }
.hs.hs-static > .hs-bar { display: flex; }  /* lists: space reserved from the first paint, buttons appear when needed */
.hs.hs-static:not(.hs-on) > .hs-bar > * { visibility: hidden; }
.hs-hint { margin-right: auto; font-size: .78rem; color: var(--muted); }
.hs-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 1.25rem; line-height: 1; display: grid; place-items: center; cursor: pointer; padding: 0 0 2px;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
    opacity var(--dur-fast) var(--ease-out), transform var(--dur) var(--ease-spring); }
.hs-btn:hover:not(:disabled) { border-color: var(--green); color: var(--green); }
.hs-btn:active:not(:disabled) { transform: scale(.9); }
.hs-btn:disabled { opacity: .35; cursor: default; }
.hs [data-hscroll] { scroll-snap-type: x proximity; scroll-padding-left: var(--pin-w, 0px); overscroll-behavior-x: contain; }
.hs [data-hscroll] th { scroll-snap-align: start; }
.hs [data-hscroll].dragging { scroll-snap-type: none; cursor: grabbing; user-select: none; }
.hs [data-hscroll]:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
/* pinned first column stays put while the rest glides under it */
.hs th.pin, .hs td.pin { position: sticky; left: 0; z-index: 2; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
.hs th.pin { background: var(--surface-2); z-index: 3; }
.card.table-wrap > table th.pin { border-radius: 10px 0 0 10px; }
/* soft shading on whichever side has more columns */
.hs::before, .hs::after { content: ""; position: absolute; top: 42px; bottom: 0; width: 36px; pointer-events: none; z-index: 4;
  opacity: 0; transition: opacity var(--dur) var(--ease-out); }
.hs::before { left: var(--pin-w, 0px); background: linear-gradient(90deg, rgba(18, 23, 18, .10), transparent); }
.hs::after { right: 0; background: linear-gradient(-90deg, rgba(18, 23, 18, .10), transparent); border-radius: 0 var(--radius) var(--radius) 0; }
:root[data-theme="dark"] .hs::before { background: linear-gradient(90deg, rgba(0, 0, 0, .45), transparent); }
:root[data-theme="dark"] .hs::after { background: linear-gradient(-90deg, rgba(0, 0, 0, .45), transparent); }
.hs.more-left::before, .hs.more-right::after { opacity: 1; }

/* filter tabs: the list slides sideways and the green pill glides to the chosen tab (View Transitions) */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
.vt-list { view-transition-name: tx-list; }
[data-vt="cat"] a.on { view-transition-name: tab-cat; }
[data-vt="status"] a.on { view-transition-name: tab-status; }
/* same-page reload (filter tab, search): nothing hops into place. Must beat the entrance rule's specificity. */
html.vt-nav .main > *, html.vt-nav .main > *:not(.ph-progress):not(script), html.vt-nav .alert { animation: none !important; }
::view-transition-group(*) { animation-duration: 340ms; animation-timing-function: cubic-bezier(.22, 1, .36, 1); }
::view-transition-old(root) { display: none; }   /* the rest of the page swaps in place: no flicker */
::view-transition-new(root) { animation: none; }
::view-transition-old(tx-list), ::view-transition-new(tx-list) { height: auto; object-fit: none; object-position: top left; }
/* calmer slide: the old list just fades out where it is; only the new list glides in (no two moving copies) */
html:active-view-transition-type(forward)::view-transition-old(tx-list),
html:active-view-transition-type(back)::view-transition-old(tx-list) { animation: vt-fade-out 140ms cubic-bezier(.4, 0, 1, 1) both; }
html:active-view-transition-type(forward)::view-transition-new(tx-list) { animation: vt-in-right 280ms cubic-bezier(.22, 1, .36, 1) both; }
html:active-view-transition-type(back)::view-transition-new(tx-list) { animation: vt-in-left 280ms cubic-bezier(.22, 1, .36, 1) both; }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-in-right { from { transform: translateX(20px); opacity: 0; } }
@keyframes vt-in-left { from { transform: translateX(-20px); opacity: 0; } }
::view-transition-group(tx-list) { animation-duration: 0s; }
::view-transition-image-pair(tx-list) { overflow: hidden; }
.dash-tabs { display: flex; gap: 6px 18px; flex-wrap: wrap; }
.dash-tabs .tabs { margin-bottom: 12px; }

/* nothing on the page moves sideways when a list is short enough to lose its scrollbar (Windows / "always show scrollbars") */
html { scrollbar-gutter: stable; }
/* "Your costs" and "Delivery rider" rows: label, box and button share one line, centred on the box */
.fees-set { align-items: flex-end; }
.fees-set .fees-lbl { align-self: flex-end; height: 47px; display: flex; align-items: center; min-width: 96px; }
.fees-set .btn, .rider-set .btn { min-height: 47px; }
.fees-set .field label { margin-bottom: 6px; }
.fees-set .hint { flex-basis: 100%; margin: 2px 0 0; }
.rider-set { align-items: center; }
.rider-set > label { min-width: 96px; }
/* correction requests */
input.locked { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.req-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.req-row:last-of-type { border-bottom: 0; }
.req-body { flex: 1; min-width: 0; }
.req-new { margin-top: 10px; }
.req-new summary { font-weight: 600; color: var(--green); }
.req-new[open] summary { margin-bottom: 10px; }
.req-card { margin-bottom: 12px; }
.req-decide { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.req-decide input { flex: 1; min-width: 220px; height: 40px; }

/* Record a sale: chosen rows stand out */
.sale-pick tr.on td { background: var(--green-dim); }
.sale-pick td:first-child { width: 36px; }
.sale-pick input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--green); }

/* small inline edit (e.g. customer email on the buy-back page) */
.inline-edit { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.inline-edit input { flex: 1; min-width: 180px; height: 38px; }

/* Branded "link can't be used" page (expired / used / revoked): the logo on the brand's dark green */
body.brand-page { background: #001b0b; color: #f4fff6; margin: 0; }
.brand-stage { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 32px 24px calc(32px + env(safe-area-inset-bottom)); box-sizing: border-box; }
.brand-logo { width: min(78vw, 520px); height: auto; }
.brand-msg { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.35rem, 4.6vw, 2rem);
  letter-spacing: -.01em; line-height: 1.25; margin: clamp(28px, 6vh, 48px) 0 10px; color: #f4fff6; max-width: 22ch; }
.brand-sub { font-family: var(--font-display); font-weight: 500; font-size: clamp(1rem, 3.4vw, 1.15rem); line-height: 1.5;
  color: #c9e9d0; margin: 0; max-width: 34ch; }
.brand-help { margin-top: 36px; font-size: .9rem; color: #8fbf99; }
.brand-help a { color: #2bff6a; text-decoration: none; border-bottom: 1px solid rgba(43, 255, 106, .4); }

/* super admin: add a photo to a buy-back (2 Dec 2026) */
.add-photo { margin-top: 16px; }
.add-photo > summary { list-style: none; display: inline-flex; cursor: pointer; }
.add-photo > summary::-webkit-details-marker { display: none; }
.add-photo form { margin-top: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; }
.add-photo .row { display: flex; gap: 12px; flex-wrap: wrap; }
.add-photo .row .field { flex: 1; min-width: 200px; }

/* Items table: customer location column (2 Dec 2026) */
.items-table .cust-loc { min-width: 180px; max-width: 260px; vertical-align: middle; }
.items-table .cust-loc .rv-val { white-space: normal; }

/* dashboard rows that open the items behind them (2 Dec 2026) */
a.panel-row { display: block; color: inherit; text-decoration: none; border-radius: 8px; margin-left: -6px; margin-right: -6px; padding: 4px 6px; }
a.panel-row:hover, a.panel-row:focus-visible { background: var(--border-soft); }
.panel-go { color: var(--green); font-weight: 600; }

/* Mac specs on the customer form (3 Dec 2026) */
.mac-specs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 12px; margin-top: 10px; align-items: end; }
.mac-specs > .field > label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mac-specs .field { margin-bottom: 10px; }
.mac-lock { grid-column: 1 / -1; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }

/* Products page (super administrator, 3 Dec 2026) */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 20px; }
.prod-brand h3 { margin: 6px 0 4px; }
.prod-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border-soft); }
.prod-row.is-off > span, .prod-row.is-off > strong, .prod-mac.is-off > .prod-row > strong { opacity: .55; }
.prod-year { padding-left: 14px; font-size: .9rem; }
.prod-mac { margin-bottom: 12px; }
.prod-add { margin-top: 14px; }
.prod-mac-add .row { display: flex; gap: 12px; flex-wrap: wrap; }
.prod-mac-add .row .field { flex: 1; min-width: 180px; }
.prod-row .btn { white-space: nowrap; }
.prod-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.prod-top .tabs { margin: 0; flex: 1; }
#new-category .row, #add-product .row { display: flex; gap: 12px; flex-wrap: wrap; }
#new-category .row .field { flex: 1; min-width: 200px; }
