/* =====================================================================
   KGN Car Accessories — black & gold theme (matches the logo)
   ===================================================================== */
:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f1eee6;
  --text: #17150f;
  --muted: #6c675b;
  --line: #e5e0d4;
  --brand: #c9a13b;          /* gold fill (buttons, highlights) */
  --brand-2: #b38a25;
  --brand-ink: #86630f;      /* gold text on light surfaces */
  --brand-soft: #f7eed5;
  --on-brand: #1a1306;
  --ink: #0e0e10;            /* black panels */
  --good: #15803d; --good-soft: #dcfce7;
  --warn: #b45309; --warn-soft: #fef3c7;
  --bad: #b91c1c;  --bad-soft: #fee2e2;
  --info: #1d4ed8; --info-soft: #dbeafe;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(23, 21, 15, .05), 0 6px 20px rgba(23, 21, 15, .06);
  --tabbar-h: 64px;
  --gold-grad: linear-gradient(135deg, #e9cf7a 0%, #c9a13b 45%, #a77d1c 100%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0c; --surface: #151517; --surface-2: #1e1e21; --text: #f2eee4; --muted: #a39e91; --line: #2a2926;
    --brand: #d4af37; --brand-2: #e6c463; --brand-ink: #e6c463; --brand-soft: #2c240f; --on-brand: #1a1306; --ink: #060607;
    --good: #4ade80; --good-soft: #10301c; --warn: #fbbf24; --warn-soft: #382a0a; --bad: #f87171; --bad-soft: #3a1414;
    --info: #93c5fd; --info-soft: #172554;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .03);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h3 { font-size: 16px; }
h4 { font-size: 12px; margin: 20px 0 8px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
a { color: var(--brand-ink); text-decoration: none; font-weight: 500; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 11.5px; } .center { text-align: center; }
.good-t { color: var(--good); } .bad-t { color: var(--bad); } .warn-t { color: var(--warn); }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
::selection { background: var(--brand-soft); }
svg { flex: none; }

/* ---------- Splash ---------- */
.splash {
  position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  background: radial-gradient(circle at 50% 42%, #1c1708 0%, #050505 60%); transition: opacity .45s ease, visibility .45s;
}
.splash img { width: min(62vw, 260px); height: auto; border-radius: 28px; position: relative; animation: splashIn .9s cubic-bezier(.2, .8, .2, 1) both; }
.splash-glow { position: absolute; width: 340px; height: 340px; border-radius: 50%; background: radial-gradient(circle, rgba(212, 175, 55, .28), transparent 65%); animation: glow 2.4s ease-in-out infinite; }
.splash-bar { width: 120px; height: 3px; border-radius: 99px; background: rgba(212, 175, 55, .18); overflow: hidden; position: relative; }
.splash-bar span { position: absolute; inset: 0; width: 40%; border-radius: 99px; background: var(--gold-grad); animation: bar 1.1s ease-in-out infinite; }
.splash.hide { opacity: 0; visibility: hidden; }
@keyframes splashIn { from { opacity: 0; transform: scale(.88); } }
@keyframes glow { 50% { transform: scale(1.12); opacity: .7; } }
@keyframes bar { from { left: -40%; } to { left: 100%; } }

/* ---------- Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; max-width: 780px; margin: 0 auto;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
}
.tb-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tb-logo { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; flex: none; box-shadow: 0 0 0 1px rgba(201, 161, 59, .45); }
.tb-right { display: flex; align-items: center; gap: 6px; flex: none; }
.topbar .shop { font-size: 11.5px; color: var(--brand-ink); font-weight: 600; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar h1 { font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.bell { position: relative; width: 42px; height: 42px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); color: var(--text); }
.bell svg { width: 21px; height: 21px; }
.bell.ring svg { animation: ring 2.8s ease-in-out infinite; transform-origin: 50% 10%; color: var(--bad); }
.bell .dot {
  position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px;
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg);
}
@keyframes ring { 0%, 86%, 100% { transform: rotate(0); } 89% { transform: rotate(14deg); } 92% { transform: rotate(-12deg); } 95% { transform: rotate(8deg); } }
.view { max-width: 780px; margin: 0 auto; padding: 4px 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); }
.view > * { animation: rise .3s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center;
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, .04);
}
.tabbar a {
  flex: 1; max-width: 152px; height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); font-size: 11px; font-weight: 500; transition: color .15s;
}
.tabbar a svg { width: 22px; height: 22px; padding: 4px 16px; box-sizing: content-box; border-radius: 99px; transition: background .2s, transform .15s; }
.tabbar a:active svg { transform: scale(.92); }
.tabbar a.active { color: var(--brand-ink); font-weight: 700; }
.tabbar a.active svg { stroke-width: 2.2; background: var(--brand-soft); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; color: var(--text);
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s, filter .15s; position: relative; white-space: nowrap; text-decoration: none;
}
.btn svg { width: 18px; height: 18px; }
.btn:not(:disabled):active { transform: scale(.97); }
.btn.primary { background: var(--gold-grad); border-color: transparent; color: var(--on-brand); box-shadow: 0 3px 12px rgba(201, 161, 59, .35); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-t { color: var(--bad); border-color: transparent; background: transparent; }
.btn.danger-outline { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: var(--surface); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.lg { min-height: 50px; font-size: 15px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.busy { color: transparent !important; pointer-events: none; }
.btn.busy > * { visibility: hidden; }
.btn.busy::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid var(--muted); border-top-color: transparent; animation: spin .7s linear infinite;
}
.btn.primary.busy::after { border-color: var(--on-brand); border-top-color: transparent; }
.btn.danger.busy::after { border-color: #fff; border-top-color: transparent; }
.icon-btn {
  width: 36px; height: 36px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); transition: background .15s, color .15s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active { background: var(--surface-2); }
.icon-btn.del:active { background: var(--bad-soft); color: var(--bad); }
.link-btn { border: 0; background: none; color: var(--brand-ink); font-weight: 600; padding: 12px 0 0; width: 100%; }
.link-btn.sm { width: auto; padding: 4px 6px; font-size: 12.5px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; }
.btn-row .btn { flex: 1; min-width: 130px; }
.btn-row.tight { margin-top: 8px; }
.btn-row.tight .btn { min-width: 100px; font-size: 13px; padding: 0 10px; }
.btn-row:empty { display: none; }

@media (hover: hover) {
  .btn:not(:disabled):hover { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); }
  .btn.primary:not(:disabled):hover { filter: brightness(1.06); box-shadow: 0 4px 16px rgba(201, 161, 59, .45); }
  .btn.danger:not(:disabled):hover { filter: brightness(1.08); }
  .btn.danger-t:not(:disabled):hover, .btn.danger-outline:not(:disabled):hover { background: var(--bad-soft); }
  .icon-btn:hover { background: var(--surface-2); color: var(--text); }
  .icon-btn.del:hover { background: var(--bad-soft); color: var(--bad); }
  .row:not(.static):hover, .item-card:hover, .result:not(:disabled):hover, .stat:hover { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--brand) 55%, transparent), var(--shadow); }
  .item-card:hover img { transform: scale(1.04); }
  .tabbar a:hover { color: var(--text); }
  .chips button:not(.on):hover, .chip:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); }
  input:hover:not(:focus):not(:disabled), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: color-mix(in srgb, var(--muted) 45%, var(--line)); }
}

/* ---------- Cards / dashboard ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.hello { margin: 2px 0 14px; }
.hello p { margin: 0 0 2px; }
.hello h2 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(3, 1fr); } }
.stat {
  display: block; width: 100%; text-align: left; border: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 13px 14px 14px; min-width: 0; transition: box-shadow .15s, transform .1s; color: var(--text);
}
.stat:active { transform: scale(.98); }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.stat-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); }
.stat-ic svg { width: 18px; height: 18px; }
.stat-go svg { width: 16px; height: 16px; color: var(--muted); opacity: .6; }
.stat .label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 22px; font-weight: 800; margin-top: 2px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.good .stat-ic { background: var(--good-soft); color: var(--good); } .stat.good .value { color: var(--good); }
.stat.warn .stat-ic { background: var(--warn-soft); color: var(--warn); } .stat.warn .value { color: var(--warn); }
.stat.bad .stat-ic { background: var(--bad-soft); color: var(--bad); } .stat.bad .value { color: var(--bad); }
.stat.hero {
  margin-bottom: 10px; padding: 16px 18px 18px; color: #f5ecd0;
  background: radial-gradient(circle at 100% 0%, rgba(212, 175, 55, .35), transparent 55%), linear-gradient(160deg, #1b1a17, #0a0a0b);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25), inset 0 0 0 1px rgba(212, 175, 55, .35);
}
.stat.hero .stat-ic { background: rgba(212, 175, 55, .18); color: #e6c463; }
.stat.hero .label, .stat.hero .sub { color: #cbbf9d; }
.stat.hero .value { font-size: 30px; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat.hero .stat-go svg { color: #e6c463; }
.quick { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.quick .btn { padding: 0 8px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.mini-stats > div { background: var(--surface-2); border-radius: 12px; padding: 10px; min-width: 0; }
.mini-stats > div.hl-bad { background: var(--bad-soft); } .mini-stats > div.hl-good { background: var(--good-soft); }
.mini-stats span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.mini-stats b { font-size: 15px; overflow-wrap: anywhere; }
.summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
@media (min-width: 640px) { .summary { grid-template-columns: repeat(4, 1fr); } }
.summary > div { background: var(--surface); box-shadow: var(--shadow); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.sheet .summary > div { background: var(--surface-2); box-shadow: none; }
.summary span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.summary b { font-size: 16px; overflow-wrap: anywhere; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; gap: 6px; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 11px 12px;
  background: var(--surface); border: 0; border-radius: 13px; box-shadow: var(--shadow); color: var(--text);
  transition: box-shadow .15s, transform .1s;
}
.sheet .row { box-shadow: none; background: var(--surface-2); }
.row:not(.static) { cursor: pointer; }
.row:not(.static):active { transform: scale(.99); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-end { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.row-end .row-sub { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.amt { font-weight: 700; white-space: nowrap; }
.chev { color: var(--muted); display: flex; } .chev svg { width: 16px; height: 16px; }
.ord-no { flex: none; min-width: 46px; height: 40px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: 13px; }
.avatar {
  width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: 14px;
}
.avatar.lg { width: 56px; height: 56px; font-size: 19px; background: var(--gold-grad); color: var(--on-brand); }
.avatar.sm { width: 34px; height: 34px; font-size: 12.5px; }
.avatar.muted-av { background: var(--surface-2); color: var(--muted); }
.badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge svg { width: 13px; height: 13px; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad  { background: var(--bad-soft);  color: var(--bad); }
.badge.info { background: var(--brand-soft); color: var(--brand-ink); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--muted); padding: 26px 10px; font-size: 14px; }
.empty svg { width: 34px; height: 34px; opacity: .55; stroke-width: 1.5; }
.profile { display: flex; align-items: center; gap: 14px; }
.profile h3 { font-size: 18px; }

/* ---------- Skeleton loaders ---------- */
.sk-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); }
.sheet .sk-row { background: var(--surface-2); box-shadow: none; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.sk { display: block; height: 11px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.sheet .sk { background: linear-gradient(90deg, var(--line) 25%, var(--surface) 50%, var(--line) 75%); background-size: 200% 100%; }
.sk.short { width: 55%; }
.sk-av { width: 40px; height: 40px; border-radius: 50%; flex: none; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar .search-in { flex: 1 1 200px; }
.toolbar select { flex: 0 1 170px; }
.search-in { position: relative; display: block; }
.search-in > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search-in input { padding-left: 38px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; min-height: 44px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; font-weight: 500; white-space: nowrap;
}
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 500; transition: background .15s, border-color .15s, color .15s; }
.chips button.on { background: var(--ink); border-color: var(--ink); color: #f0d78c; }
.filters { display: flex; flex-direction: column; gap: 10px; }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; margin-bottom: 12px; gap: 2px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 6px; border-radius: 9px; font-weight: 600; color: var(--muted); transition: background .2s, color .2s, box-shadow .2s; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg.pick { margin: 5px 0 0; }
.seg.pick button.on { background: var(--ink); color: #f0d78c; }
.seg button:disabled { cursor: default; opacity: .7; }
details.card summary { font-weight: 600; cursor: pointer; }
table.lines { width: 100%; border-collapse: collapse; font-size: 14px; }
table.lines td, table.lines th { padding: 9px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.lines th { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
table.lines .r { text-align: right; white-space: nowrap; }
.totals { margin-top: 12px; display: flex; flex-direction: column; gap: 5px; padding: 12px; background: var(--surface-2); border-radius: 13px; }
.totals div { display: flex; justify-content: space-between; }
.totals .big { font-size: 18px; font-weight: 800; padding: 4px 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); margin: 3px 0; }
.totals .saved { justify-content: center; color: var(--brand-ink); font-weight: 700; font-size: 13px; margin-top: 4px; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 13px; }
.form label, .filters label, .field-label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.hint { font-weight: 400; font-size: 12px; color: var(--muted); opacity: .9; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:disabled { opacity: .65; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }
.sheet input, .sheet select, .sheet textarea { background: var(--surface-2); border-color: transparent; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); padding: 0; }
.form label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; color: var(--text); }
.form label.switch { padding: 12px; background: var(--surface-2); border-radius: 12px; }
.prefix-in { display: flex; align-items: stretch; }
.prefix-in > span { display: grid; place-items: center; padding: 0 11px; border-radius: 12px 0 0 12px; background: var(--surface-2); border: 1px solid var(--line); border-right: 0; color: var(--muted); font-weight: 600; font-size: 14px; }
.sheet .prefix-in > span { background: var(--line); border-color: transparent; }
.prefix-in input { border-radius: 0 12px 12px 0; min-width: 0; }
.card-inset { background: var(--surface-2); border-radius: 14px; padding: 14px; margin-top: 4px; }
.card-inset h3 { display: flex; align-items: center; gap: 8px; }
.card-inset h3 svg { width: 18px; height: 18px; color: var(--brand-ink); }
.card-inset input { background: var(--surface) !important; }
.msg { font-size: 13.5px; min-height: 0; }
.msg:empty { display: none; }
.msg.bad { color: var(--bad); } .msg.warn { color: var(--warn); } .msg.good { color: var(--good); }

/* ---------- Prices / MRP ---------- */
.price { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 4px; }
.price b { color: var(--text); }
.price small { color: var(--muted); font-size: 11px; }
.price s { color: var(--muted); font-size: 12px; }
.off { color: var(--good); font-size: 11.5px; font-weight: 700; }
.big-price { margin: 8px 0 2px; font-size: 18px; }
.big-price .price b { font-size: 22px; }

/* ---------- Stock ---------- */
.grid-items { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .grid-items { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 720px) { .grid-items { grid-template-columns: repeat(4, 1fr); } }
.item-card { border: 0; padding: 0; text-align: left; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s, transform .1s; color: var(--text); }
.item-card:active { transform: scale(.98); }
.ic-img { position: relative; overflow: hidden; }
.item-card img, .item-card .ph { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; transition: transform .3s ease; }
.off-tag { position: absolute; top: 8px; left: 8px; background: var(--ink); color: #f0d78c; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 99px; }
.item-info { padding: 9px 10px 11px; display: flex; flex-direction: column; gap: 4px; }
.item-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-price { font-size: 13px; }
.ph { display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); font-weight: 800; font-size: 26px; }
.ph.sm, img.sm { width: 44px; height: 44px; border-radius: 10px; font-size: 14px; flex: none; object-fit: cover; }
.item-hero { margin: -16px -16px 14px; }
.item-hero img, .item-hero .ph { width: 100%; max-height: 300px; aspect-ratio: 4/3; object-fit: cover; display: block; font-size: 48px; }
.item-title { font-size: 20px; }
.img-pick { cursor: pointer; }
.img-preview {
  height: 170px; border-radius: 14px; border: 2px dashed var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; color: var(--muted); overflow: hidden; background: var(--surface-2); font-weight: 500;
}
.img-preview svg { width: 30px; height: 30px; }
.img-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- New order / returns ---------- */
.picker { position: relative; display: flex; flex-direction: column; gap: 5px; }
.results { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-height: 340px; overflow-y: auto; }
.result { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; text-align: left; color: var(--text); }
.result:disabled { opacity: .5; }
.result.add { color: var(--brand-ink); font-weight: 600; justify-content: center; border-style: dashed; }
.result.add svg { width: 18px; height: 18px; }
.picked-cust { margin-top: 5px; border: 1px solid var(--line); }
.cart { display: flex; flex-direction: column; gap: 8px; }
.cart-line { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 13px; background: var(--surface-2); transition: box-shadow .15s; }
.cart-line.over { box-shadow: inset 0 0 0 2px var(--bad); }
.cart-line.picked { box-shadow: inset 0 0 0 2px var(--brand); }
.cl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cl-ctrls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cl-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; white-space: nowrap; }
.stepper { display: flex; align-items: center; background: var(--surface); border-radius: 11px; border: 1px solid var(--line); }
.stepper button { width: 36px; height: 38px; border: 0; background: transparent; font-size: 19px; font-weight: 600; color: var(--brand-ink); }
.stepper input { width: 56px; min-height: 38px; text-align: center; padding: 4px; border: 0 !important; background: transparent !important; box-shadow: none !important; }
.price-in { width: 100px !important; min-height: 40px !important; background: var(--surface) !important; }
.deliver-note { display: flex; align-items: center; gap: 6px; margin: 0; }
.deliver-note svg { width: 16px; height: 16px; color: var(--good); }
.total-bar {
  position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom)); margin: 4px -16px calc(-16px - env(safe-area-inset-bottom));
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--ink); color: #f2eee4;
  display: flex; align-items: center; gap: 16px; border-radius: 18px 18px 0 0;
}
.total-bar > div { display: flex; flex-direction: column; min-width: 0; }
.total-bar .muted { color: #a39e91; }
.total-bar b { font-size: 18px; }
.total-bar b.bad-t { color: #f87171; }
.total-bar .btn { margin-left: auto; }
.saved-sm { font-size: 11px; color: #e6c463; font-weight: 600; }
.ret-preview { display: flex; flex-direction: column; gap: 5px; padding: 12px; border-radius: 13px; background: var(--brand-soft); }
.ret-preview > div { display: flex; justify-content: space-between; gap: 10px; }

/* ---------- Sheets ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); opacity: 0; transition: opacity .2s; }
.sheet {
  position: relative; width: 100%; max-width: 640px; max-height: 92vh; max-height: 92dvh; background: var(--surface);
  border-radius: 22px 22px 0 0; display: flex; flex-direction: column; transform: translateY(100%);
  transition: transform .28s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 -8px 30px rgba(0, 0, 0, .18);
}
.sheet-grip { width: 38px; height: 4px; border-radius: 99px; background: var(--line); margin: 8px auto 0; flex: none; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 12px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 17px; font-weight: 700; }
.sheet-body { overflow: auto; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
@media (min-width: 700px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 22px; max-height: 88vh; transform: translateY(24px) scale(.98); opacity: 0; transition: transform .24s ease, opacity .2s; }
  .sheet-wrap.open .sheet { opacity: 1; }
  .sheet-grip { display: none; }
  .total-bar { border-radius: 0 0 22px 22px; }
}

/* ---------- Confirm dialog ---------- */
.dialog-wrap { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; }
.dialog-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); opacity: 0; transition: opacity .18s; }
.dialog {
  position: relative; width: 100%; max-width: 360px; background: var(--surface); border-radius: 22px; padding: 22px 20px 18px;
  text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
  opacity: 0; transform: scale(.94); transition: opacity .18s, transform .18s cubic-bezier(.2, .8, .2, 1);
}
.dialog-wrap.open .dialog-backdrop, .dialog-wrap.open .dialog { opacity: 1; }
.dialog-wrap.open .dialog { transform: none; }
.dialog-icon { width: 50px; height: 50px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); }
.dialog-icon.bad { background: var(--bad-soft); color: var(--bad); }
.dialog-icon svg { width: 24px; height: 24px; }
.dialog h2 { font-size: 17px; overflow-wrap: anywhere; }
.dialog p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }

/* ---------- Auth ---------- */
.auth {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(circle at 50% 0%, rgba(212, 175, 55, .22), transparent 55%), var(--bg);
}
.auth-card { width: 100%; max-width: 390px; background: var(--surface); border-radius: 24px; box-shadow: 0 10px 40px rgba(0, 0, 0, .12); padding: 22px 22px 26px; }
.auth-card .logo { width: 54px; height: 54px; border-radius: 16px; background: var(--gold-grad); color: var(--on-brand); display: grid; place-items: center; margin-bottom: 14px; }
.auth-card .logo svg { width: 30px; height: 30px; }
.auth-card .brand-logo { display: block; width: 150px; height: 150px; object-fit: cover; border-radius: 26px; margin: 0 auto 18px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3), 0 0 0 1px rgba(212, 175, 55, .4); }
.auth-card h1 { font-size: 23px; margin-bottom: 4px; text-align: center; font-weight: 800; }
.auth-card > p { margin: 0 0 20px; text-align: center; }
input.pin { letter-spacing: .6em; font-size: 20px; text-align: center; font-weight: 600; }

/* ---------- Misc ---------- */
.loading { display: grid; place-items: center; padding: 40px; }
.loading.full { min-height: 100vh; }
.spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { background: var(--bad-soft); color: var(--bad); padding: 14px; border-radius: 12px; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  z-index: 100; background: #17150f; color: #fff; padding: 11px 16px 11px 12px; border-radius: 13px; font-size: 14px; font-weight: 500;
  opacity: 0; transition: .2s; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.3);
  display: flex; align-items: center; gap: 9px; width: max-content; border: 1px solid rgba(212, 175, 55, .3);
}
.toast svg { width: 19px; height: 19px; flex: none; color: #4ade80; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); border-color: transparent; }
.toast.bad svg { color: #fff; }
.cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }

@media (max-width: 380px) {
  .topbar h1 { font-size: 19px; }
  .top-actions .btn span, #top-actions .btn span { display: none; }
  #top-actions .btn { padding: 0 10px; }
  .stat .value { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
