/* Visual language follows the MD Pay panel (C:\crypto\frontend\src\theme.css), recoloured light blue. */
:root {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-2: #f8fbfe;
  --border: #e5ebf2;
  --border-strong: #d4dde8;
  --text: #0f1722;
  --muted: #637184;
  --accent: #1a94db;
  --accent-2: #7cc8f5;
  --accent-soft: #e7f4fd;
  --accent-ink: #0b6aa8;
  --ink: #0d1520;
  --green: #0f8a5f; --green-bg: #e6f7ef;
  --red: #c4291c; --red-bg: #fdeeec;
  --amber: #c2570c; --amber-bg: #fff3e6;
  --radius: 20px; --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(15, 30, 50, .04), 0 10px 30px -18px rgba(15, 30, 50, .16);
  --shadow-pop: 0 18px 48px -12px rgba(15, 30, 50, .24), 0 2px 6px rgba(15, 30, 50, .06);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv11', 'ss01';
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
::selection { background: var(--accent-soft); color: var(--accent-ink); }
a { color: inherit; text-decoration: none; }
svg { flex-shrink: 0; }
.mono { font-family: var(--mono); }
.hint, .mute { color: var(--muted); }
.mute { font-size: 13.5px; }
.err { color: var(--red); }
b, strong { font-weight: 600; }

/* ================= shell ================= */
.shell { max-width: 1440px; margin: 0 auto; padding: 0 28px 48px; }
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; height: 76px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-size: 21px; font-weight: 650; letter-spacing: -0.03em; }
.brand-name b { font-weight: 650; color: var(--accent); }
.brand-tag { font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-ink); background: var(--accent-soft); padding: 3px 8px; border-radius: 999px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; padding: 0;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow); cursor: pointer; }
.icon-btn:hover { border-color: var(--border-strong); background: var(--surface); }
.bell-dot { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; border: 2px solid var(--bg);
  background: #ef3a4b; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.menu-toggle { display: none; }
.acct { display: flex; align-items: center; gap: 12px; height: auto; padding: 4px; border: 0; border-radius: 16px; background: none; color: inherit; font: inherit; text-align: right; cursor: pointer; }
.acct:hover { background: var(--surface); }
.acct-text { display: flex; flex-direction: column; gap: 3px; }
.acct-name { font-weight: 650; font-size: 14.5px; letter-spacing: -0.01em; }
.acct-chips { font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 14px;
  background: linear-gradient(140deg, var(--accent-2), var(--accent)); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
.menu-wrap { position: relative; }
.pop { position: absolute; top: calc(100% + 10px); right: 0; z-index: 60; min-width: 230px; padding: 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-pop); animation: pop-in .14s ease-out; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.pop-head { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--border); text-align: left; }
.pop-head small { color: var(--muted); }
.pop-item { display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; height: auto; padding: 10px 12px; border: 0; border-radius: 11px; background: none;
  color: var(--text); font: inherit; font-weight: 500; text-align: left; cursor: pointer; }
.pop-item:hover { background: var(--accent-soft); }
.pop-item.danger, .pop-item.danger svg { color: var(--red); }

.crumbs { display: flex; align-items: center; gap: 8px; padding: 20px 0 16px; color: var(--muted); font-size: 14px; }
.crumbs a:hover { color: var(--text); }
.crumbs svg { opacity: .5; }
.crumbs span { color: var(--text); font-weight: 600; }
.body { display: flex; gap: 28px; align-items: flex-start; }
.page { flex: 1; min-width: 0; }

.rail { position: sticky; top: 96px; flex-shrink: 0; width: 248px; max-height: calc(100vh - 120px); overflow-y: auto; scrollbar-width: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow); padding: 12px; }
.rail::-webkit-scrollbar { display: none; }
.rail-group + .rail-group { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
.rail-title { padding: 6px 12px 4px; font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #95a1b2; }
.rail-item { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; margin-bottom: 2px; border-radius: 14px;
  color: #4f5b6b; font-weight: 550; white-space: nowrap; transition: background .12s, color .12s; }
.rail-item:hover { background: var(--surface-2); color: var(--text); }
.rail-item.active { background: var(--accent-soft); color: var(--accent-ink); }
.rail-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.rail-count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #ef3a4b; color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.backdrop { position: fixed; inset: 0; z-index: 45; background: rgba(13, 21, 32, .35); }

/* admin viewing a business */
.viewing { position: sticky; top: 0; z-index: 31; display: flex; align-items: center; gap: 12px; margin: 0 -28px; padding: 9px 28px;
  background: var(--ink); color: #fff; font-size: 13.5px; }
.viewing b { color: var(--accent-2); }
.viewing button { margin-left: auto; height: 32px; padding: 0 14px; border-radius: 10px; background: rgba(255, 255, 255, .12); font-size: 13px; }
.viewing button:hover { background: rgba(255, 255, 255, .2); }
.viewing + .top { top: 50px; }

/* ================= page furniture ================= */
.page-head { margin-bottom: 22px; }
.page-head h1 { margin: 0 0 6px; font-size: 32px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.1; }
.page-head p { margin: 0; font-size: 15px; }
.eyebrow { margin-bottom: 10px; font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-ink); }
.head-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 26px; margin-bottom: 20px; }
.card > h3, .card-head h3 { margin: 0 0 6px; font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-head h3 { margin: 0; }
.view-all { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); }

/* dashboard tiles */
.hero-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.tile { position: relative; display: flex; flex-direction: column; min-height: 200px; padding: 24px 26px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow); transition: border-color .12s; }
a.tile:hover { border-color: var(--accent-2); }
.tile-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.tile-k { font-size: 15px; font-weight: 550; color: #3e4a5a; }
.tile-v { margin-top: 16px; font-size: 42px; font-weight: 700; letter-spacing: -0.045em; line-height: 1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile-v small { margin-left: 6px; font-size: 15px; font-weight: 500; letter-spacing: -0.01em; color: var(--muted); }
.tile-foot { margin-top: auto; padding-top: 18px; display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13.5px; }
.tile-foot.ok { color: var(--green); } .tile-foot.warn { color: var(--amber); }
.tile.dark { background: radial-gradient(130% 120% at 100% 0%, #1d3a57 0%, var(--ink) 58%); border-color: transparent; color: #fff; }
.tile.dark .tile-k { color: #aebfd2; }
.tile.dark .tile-v small { color: #93a6bb; }
.tile.dark .tile-foot { color: #aebfd2; font-weight: 500; }
.tile-arrow { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .2); color: #fff; transition: background .12s, border-color .12s; }
a.tile:hover .tile-arrow { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .4); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 20px; align-items: start; }

.qa { display: flex; align-items: center; gap: 12px; padding: 13px 16px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 14px;
  font-weight: 600; transition: border-color .12s, background .12s; }
.qa:last-child { margin-bottom: 0; }
.qa:hover { border-color: var(--accent-2); background: var(--surface-2); }
.qa svg { color: var(--muted); } .qa:hover svg { color: var(--accent); }
.qa .go { margin-left: auto; opacity: .45; }

/* list rows (entries, stock, logins) */
.list { padding: 6px 10px; }
.item { display: flex; gap: 14px; align-items: flex-start; padding: 14px 10px; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: 0; }
a.item { border-radius: 14px; transition: background .1s; } a.item:hover { background: var(--surface-2); }
.item-main { flex: 1; min-width: 0; }
.item-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; }
.item-sub { margin-top: 3px; color: var(--muted); font-size: 13.5px; }
.item-qty { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.item-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chipicon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); }
.chipicon.inward { background: var(--green-bg); color: var(--green); }
.chipicon.outward { background: var(--amber-bg); color: var(--amber); }
.chipicon.adjust { background: #eef1f5; color: var(--muted); }
.empty { padding: 22px 10px; color: var(--muted); text-align: center; }

/* pills */
.chip { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; background: #eef1f5; color: var(--muted); }
.chip.active { background: var(--green-bg); color: var(--green); }
.chip.pending, .chip.assigned, .chip.invoice { background: var(--amber-bg); color: var(--amber); }
.chip.rejected, .chip.reversed { background: var(--red-bg); color: var(--red); }

/* segmented pill control */
.tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 5px; margin-bottom: 18px; background: #e7edf4; border-radius: 14px; }
.tabs button { height: 36px; padding: 0 16px; border-radius: 10px; background: transparent; color: var(--muted); }
.tabs button:hover { background: transparent; color: var(--text); }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(15, 30, 50, .1); }

/* ---- forms ---- */
label { display: block; margin: 14px 0 6px; font-size: 13.5px; font-weight: 600; color: var(--text); }
label .mute { font-weight: 500; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 13px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent-2); box-shadow: 0 0 0 4px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: #98a3b3; }
input[type=checkbox] { width: auto; min-height: 0; accent-color: var(--accent); }
input[type=file] { padding: 8px; }
input[type=file]::file-selector-button { margin-right: 12px; padding: 7px 14px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }

button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border: 0; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .12s, box-shadow .12s, transform .06s; }
button:hover, .btn:hover { background: var(--accent-ink); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: default; }
button.ghost, .btn.ghost { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); }
button.ghost:hover, .btn.ghost:hover { background: var(--surface-2); border-color: #c3cedb; }
button.ok { background: var(--green); } button.ok:hover { background: #0b6f4c; }
button.bad { background: var(--red); } button.bad:hover { background: #a3200f; }
button.small, .btn.small { height: 34px; padding: 0 13px; font-size: 13px; border-radius: 10px; }
button.small.bad { background: var(--red-bg); color: var(--red); } button.small.bad:hover { background: #f9dcd8; }
button.small.ok { background: var(--green-bg); color: var(--green); } button.small.ok:hover { background: #d3f0e2; }
.cta { box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 0; }
.full { width: 100%; margin-top: 18px; height: 46px; font-size: 15px; }
.row { display: flex; gap: 12px; align-items: flex-end; } .row > * { flex: 1; min-width: 0; } .row > .auto { flex: 0 0 auto; }
.split { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 0 20px; align-items: start; }

.notice { padding: 13px 16px; margin-bottom: 18px; border-radius: 14px; background: var(--amber-bg); color: var(--amber); font-weight: 500; }
.notice.info { background: var(--accent-soft); color: var(--accent-ink); }
.notice a { text-decoration: underline; }
.line { padding: 14px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-2); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 10px; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { padding: 11px 12px; font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #8794a6; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td, tr:last-child th { border-bottom: 0; }
table.kv th { width: 36%; padding-left: 0; } table.kv td { padding-right: 0; }
.days { display: flex; flex-wrap: wrap; gap: 8px; }
.days label { display: flex; gap: 8px; align-items: center; margin: 0; padding: 9px 13px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); font-weight: 550; cursor: pointer; }
.days label:has(input:checked) { border-color: var(--accent-2); background: var(--accent-soft); color: var(--accent-ink); }

/* modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: start center; overflow-y: auto; padding: 48px 16px;
  background: rgba(13, 21, 32, .45); backdrop-filter: blur(3px); animation: fade .15s ease-out; }
.modal { width: 100%; max-width: 580px; padding: 26px; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-pop); animation: pop-in .16s ease-out; }
@keyframes fade { from { opacity: 0; } }

/* auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(60% 50% at 15% 0%, color-mix(in srgb, var(--accent-2) 26%, transparent), transparent 70%),
              radial-gradient(50% 40% at 100% 100%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; padding: 34px; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow-pop); }
.auth-card .brand { margin-bottom: 26px; }
.auth-card h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.03em; }
.auth-card a { color: var(--accent-ink); font-weight: 600; }
.auth-card .brand { color: var(--text); }

#toast { position: fixed; left: 50%; bottom: 24px; z-index: 80; max-width: min(92vw, 440px); padding: 13px 18px; border-radius: 14px;
  background: var(--ink); color: #fff; font-weight: 550; box-shadow: var(--shadow-pop);
  opacity: 0; transform: translate(-50%, 8px); pointer-events: none; transition: opacity .18s, transform .18s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--red); }

/* ================= responsive ================= */
@media (max-width: 1180px) {
  .hero-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .acct-text { display: none; }
}
@media (max-width: 860px) {
  .shell { padding: 0 16px 32px; }
  .viewing { margin: 0 -16px; padding: 9px 16px; }
  .top { height: 64px; gap: 10px; }
  .menu-toggle { display: inline-grid; width: 42px; height: 42px; }
  .brand-name { font-size: 18px; }
  .brand-tag { display: none; }
  .icon-btn, .avatar { width: 42px; height: 42px; }
  .crumbs { padding: 14px 0 12px; }
  .rail { position: fixed; top: 0; left: 0; bottom: 0; z-index: 50; max-height: none; width: 272px; border-radius: 0 24px 24px 0;
    transform: translateX(-105%); transition: transform .22s ease; }
  .rail.open { transform: none; }
  .hero-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .hero-grid .tile.dark, .hero-grid > :nth-child(4) { grid-column: 1 / -1; }
  .tile { min-height: 0; padding: 18px; border-radius: 20px; }
  .tile-v { font-size: 32px; margin-top: 12px; }
  .page-head h1 { font-size: 26px; }
  .card { padding: 18px; border-radius: 18px; }
  .list { padding: 4px 6px; }
  .item { padding: 12px 6px; gap: 12px; }
  .modal-backdrop { padding: 12px 8px; }
  .modal { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ================= motion =================
   One easing family: quick start, soft landing. Everything is transform/opacity only. */
:root { --out: cubic-bezier(.22, 1, .36, 1); --spring: cubic-bezier(.34, 1.4, .64, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(14deg); } 40% { transform: rotate(-12deg); } 60% { transform: rotate(8deg); } 80% { transform: rotate(-4deg); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }

/* page builds in, block by block */
.page-head, .page > .notice, .page > .tabs, .page > .card, .page > form.card, .hero-grid > *, .dash-grid > * { animation: rise .5s var(--out) both; }
.page-head { animation-duration: .4s; }
.hero-grid > :nth-child(1), .dash-grid > :nth-child(1) { animation-delay: 60ms; }
.hero-grid > :nth-child(2), .dash-grid > :nth-child(2) { animation-delay: 110ms; }
.hero-grid > :nth-child(3) { animation-delay: 160ms; }
.hero-grid > :nth-child(4) { animation-delay: 210ms; }
.page > .card:nth-of-type(2) { animation-delay: 80ms; }
.list > .item { animation: rise .45s var(--out) both; }
.list > .item:nth-child(2) { animation-delay: 30ms; } .list > .item:nth-child(3) { animation-delay: 60ms; }
.list > .item:nth-child(4) { animation-delay: 90ms; } .list > .item:nth-child(5) { animation-delay: 120ms; }
.list > .item:nth-child(6) { animation-delay: 150ms; } .list > .item:nth-child(n+7) { animation-delay: 180ms; }

/* hover lift + press */
.tile, .qa, .btn, button { will-change: transform; }
a.tile { transition: transform .25s var(--out), box-shadow .25s var(--out), border-color .15s; }
a.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); }
a.tile:active { transform: translateY(-1px) scale(.99); transition-duration: .08s; }
.tile.dark .tile-arrow { transition: transform .3s var(--spring), background .12s, border-color .12s; }
a.tile:hover .tile-arrow { transform: rotate(45deg); }
.qa { transition: border-color .15s, background .15s, transform .2s var(--out); }
.qa:hover { transform: translateX(2px); }
.qa .go { transition: transform .25s var(--spring), opacity .15s; }
.qa:hover .go { transform: translateX(4px); opacity: .9; }
button:not(.pop-item):not(.acct):hover, .btn:hover { transform: translateY(-1px); }
button:active, .btn:active { transform: translateY(0) scale(.97); transition-duration: .06s; }
.tabs button:hover { transform: none; }
.tabs button { transition: background .2s var(--out), color .2s, box-shadow .2s; }
.rail-item svg { transition: transform .25s var(--spring); }
.rail-item:hover svg { transform: scale(1.12); }
.chipicon { transition: transform .25s var(--spring); }
a.item:hover .chipicon, .item:hover .chipicon { transform: scale(1.06) rotate(-3deg); }
.icon-btn.ring svg { animation: wiggle .8s ease-in-out .3s 2; transform-origin: 50% 10%; }
.bell-dot { animation: modal-in .35s var(--spring) both; }
.avatar { transition: transform .25s var(--spring); } .acct:hover .avatar { transform: scale(1.05); }
input, select, textarea { transition: border-color .15s, box-shadow .2s var(--out), background .15s; }

/* overlays */
.modal { animation: modal-in .32s var(--out); }
.pop { transform-origin: top right; animation: modal-in .18s var(--out); }
.rail { transition: transform .3s var(--out); }
.backdrop { animation: fade .2s ease-out; }
#toast { display: flex; align-items: center; gap: 10px; transition: opacity .2s, transform .35s var(--spring); }
#toast svg { flex-shrink: 0; }

/* friendly empty states */
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 30px 16px; }
.empty .em-ico { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-ink); animation: modal-in .45s var(--spring) both; }
.greet-wave { display: inline-block; transform-origin: 70% 70%; animation: wiggle 1.2s ease-in-out .4s 1; }

/* attachments */
.drop { display: flex; align-items: center; gap: 14px; margin: 0; padding: 14px 16px; border: 1.5px dashed var(--border-strong); border-radius: 16px;
  background: var(--surface-2); color: var(--text); font-weight: 500; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop:focus-within { border-color: var(--accent-2); background: var(--accent-soft); }
.drop > svg { color: var(--accent); transition: transform .3s var(--spring); }
.drop:hover > svg { transform: rotate(-12deg) scale(1.1); }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 10px; margin-top: 10px; }
.files:empty { display: none; }
.file { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 8px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  animation: modal-in .3s var(--out) both; transition: border-color .15s; }
a.file:hover { border-color: var(--accent-2); }
.file img, .file-ico { flex-shrink: 0; width: 44px; height: 44px; border-radius: 10px; object-fit: cover; }
.file-ico { display: grid; place-items: center; background: var(--red-bg); color: var(--red); }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; font-size: 13.5px; }
.file button { width: 30px; height: 30px; padding: 0; }

/* reports */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.card.report { display: flex; flex-direction: column; gap: 14px; margin: 0; transition: transform .25s var(--out), box-shadow .25s var(--out), border-color .15s; }
.card.report:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); border-color: var(--accent-2); }
.card.report h3 { margin: 0 0 4px; font-size: 17px; letter-spacing: -0.015em; }
.card.report p { margin: 0; font-size: 13.5px; }
.card.report .btn { margin-top: auto; align-self: flex-start; }
.card-head h3 svg { vertical-align: -3px; color: var(--muted); }
.report-grid > .card { animation: rise .45s var(--out) both; }
.report-grid > :nth-child(2) { animation-delay: 40ms; } .report-grid > :nth-child(3) { animation-delay: 80ms; }
.report-grid > :nth-child(4) { animation-delay: 120ms; } .report-grid > :nth-child(n+5) { animation-delay: 160ms; }
.page > #list > .card { animation: rise .45s var(--out) both; }
.item-title a:hover { color: var(--accent-ink); text-decoration: underline; }

/* quick actions: one horizontal row under the top bar */
.qa-bar { display: flex; gap: 10px; margin: 0 0 22px; padding: 2px 2px 6px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.qa-bar::-webkit-scrollbar { display: none; }
.qa-btn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 9px; height: 46px; padding: 0 18px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow); font-weight: 600; white-space: nowrap; scroll-snap-align: start;
  transition: transform .2s var(--out), border-color .15s, background .15s, box-shadow .2s; animation: rise .4s var(--out) both; }
.qa-btn svg { color: var(--accent); transition: transform .25s var(--spring); }
.qa-btn:hover { border-color: var(--accent-2); background: var(--surface-2); transform: translateY(-2px); box-shadow: var(--shadow-pop); }
.qa-btn:hover svg { transform: scale(1.15); }
.qa-btn:active { transform: scale(.97); }
.qa-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.qa-btn.primary svg { color: #fff; }
.qa-btn.primary:hover { background: var(--accent-ink); }
.qa-btn:nth-child(2) { animation-delay: 25ms; } .qa-btn:nth-child(3) { animation-delay: 50ms; } .qa-btn:nth-child(4) { animation-delay: 75ms; }
.qa-btn:nth-child(5) { animation-delay: 100ms; } .qa-btn:nth-child(n+6) { animation-delay: 125ms; }

/* stock availability on item rows */
.line-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.line-meta .avail { color: var(--green); font-weight: 600; }
.line-meta .err { font-weight: 600; }
.line.over { border-color: color-mix(in srgb, var(--red) 45%, var(--border)); background: var(--red-bg); }
/* quick actions: wrap on wide screens, swipe sideways on phones */
.qa-bar { flex-wrap: wrap; overflow: visible; }
@media (max-width: 860px) {
  .qa-bar { flex-wrap: nowrap; overflow-x: auto; margin-right: -16px; padding-right: 16px; }
  .qa-btn { height: 44px; padding: 0 15px; }
}

/* password form */
label.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-weight: 500; cursor: pointer; }

/* item picker dropdown */
.combo { position: relative; display: block; }
.combo > input { width: 100%; }
.combo-list { position: absolute; left: 0; right: 0; min-width: min(440px, calc(100vw - 56px)); top: calc(100% + 6px); z-index: 40; max-height: min(320px, 50vh); overflow-y: auto; padding: 6px;
  background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-pop); animation: pop-in .14s ease-out; overscroll-behavior: contain; }
.combo-opt { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.combo-opt + .combo-opt { margin-top: 2px; }
.combo-opt span { font-weight: 550; line-height: 1.35; }
.combo-opt small { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.combo-opt small.good { color: var(--green); font-weight: 600; }
.combo-opt.on, .combo-opt:hover { background: var(--accent-soft); }
.combo-opt mark { background: none; color: var(--accent-ink); font-weight: 750; }
.combo-empty { padding: 14px 12px; color: var(--muted); font-size: 14px; }

/* own units rows */
.unit-row { margin-top: 8px; align-items: center; }
.unit-row .unit-eq { color: var(--muted); font-weight: 600; min-width: 10px; text-align: center; }
.unit-row .un { flex: 1.3; } .unit-row .uq { flex: 1; } .unit-row select { flex: 1; }
.uadd { margin-top: 10px; }

/* stock rows: in stock / assigned / available, and quick actions */
.qty3 { display: flex; gap: 14px; justify-content: flex-end; text-align: right; }
.qty3 span { display: flex; flex-direction: column; }
.qty3 small { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.qty3 b { font-weight: 650; white-space: nowrap; }
.held { color: var(--amber); } .free { color: var(--green); }
.split-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; padding: 6px 0; border-top: 1px dashed var(--border); }
.split-line:first-child { border-top: 0; }
.row-acts { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.item-main > .row-acts { margin-top: 8px; }
.row-acts .small { height: 30px; padding: 0 10px; font-size: 12.5px; }
a.tel { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-ink); font-weight: 600; }
a.tel:hover { text-decoration: underline; }
@media (max-width: 600px) {
  .qty3 { gap: 10px; } .qty3 b { font-size: 13px; }
  .item:has(.qty3) { flex-wrap: wrap; } .item:has(.qty3) .item-qty { width: 100%; padding-left: 52px; } .item:has(.qty3) .qty3 { justify-content: flex-start; text-align: left; }
}

/* timeline */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { position: relative; display: flex; gap: 14px; padding: 0 0 18px; }
.tl li:last-child { padding-bottom: 0; }
.tl li::before { content: ""; position: absolute; left: 8px; top: 20px; bottom: 0; width: 2px; background: var(--border); }
.tl li:last-child::before { display: none; }
.tl li.done::before { background: var(--green); }
.tl .dot { flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%; margin-top: 2px; border: 2px solid var(--border-strong); background: var(--surface); position: relative; z-index: 1; }
.tl .done .dot { background: var(--green); border-color: var(--green); box-shadow: inset 0 0 0 3px #fff; }
.tl .now .dot { border-color: var(--amber); background: var(--amber-bg); animation: ping-amber 1.8s infinite; }
.tl .bad .dot { background: var(--red); border-color: var(--red); box-shadow: inset 0 0 0 3px #fff; }
.tl .todo b { color: var(--muted); font-weight: 550; }
.tl .now b { color: var(--amber); }
.tl .bad b { color: var(--red); }
@keyframes ping-amber { 0% { box-shadow: 0 0 0 0 rgba(194, 87, 12, .35); } 70% { box-shadow: 0 0 0 8px rgba(194, 87, 12, 0); } 100% { box-shadow: 0 0 0 0 rgba(194, 87, 12, 0); } }

/* item ledger */
.item-link { display: inline-flex; align-items: center; gap: 4px; }
.item-link svg { opacity: .35; transition: transform .2s var(--spring), opacity .15s; }
.item-link:hover { color: var(--accent-ink); } .item-link:hover svg { opacity: .9; transform: translateX(2px); }
.tabs .tab-link { display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border-radius: 10px; color: var(--muted); font-weight: 600; }
.tabs .tab-link.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(15, 30, 50, .1); }
.tabs .tab-link:hover { color: var(--text); }
.table-wrap { overflow-x: auto; padding: 4px 8px 12px; }
table.ledger td, table.ledger th { padding: 11px 14px; }
table.ledger .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.ledger .nowrap { white-space: nowrap; color: var(--muted); font-size: 13.5px; }
table.ledger tr:hover td { background: var(--surface-2); }
a.split-line:hover { background: var(--surface-2); }
@media (max-width: 860px) { .hero-grid[style*="repeat(3"] { grid-template-columns: 1fr 1fr 1fr !important; } .hero-grid[style*="repeat(3"] .tile-v { font-size: 20px !important; } }

/* the hidden attribute always wins over component display rules (e.g. .empty is display:flex) */
[hidden] { display: none !important; }
.tl .edit .dot { background: var(--accent-soft); border-color: var(--accent); }
.tl .edit b { color: var(--accent-ink); }

/* reverse outward */
.danger-card { border-color: color-mix(in srgb, var(--red) 25%, var(--border)); }
button.ghost.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--border-strong)); }
button.ghost.danger:hover { background: var(--red-bg); }

.history-btn { height: 38px; }
