/* DurgaHub web: customer site + admin dashboard.
   Contrast rules (same as the app): text on saffron is always ink; saffron is
   never small text on white; vermilion marks active states and badges. */

@font-face { font-family: "Sora"; font-weight: 600; font-display: swap; src: url("fonts/Sora-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Sora"; font-weight: 700; font-display: swap; src: url("fonts/Sora-Bold.ttf") format("truetype"); }
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("fonts/Inter-Regular.ttf") format("truetype"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("fonts/Inter-Medium.ttf") format("truetype"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("fonts/Inter-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("fonts/Inter-Bold.ttf") format("truetype"); }

:root {
  --saffron: #F5A524; --ink: #1A1423; --vermilion: #E5482B; --white: #FFFFFF;
  --bg: #F2F2F4; --surface: #FFFFFF; --surface-2: #F2F2F4; --border: #E2E0E6;
  --text: #1A1423; --muted: #5E5A66; --accent-text: #1A1423;
  --success: #15803D; --warning: #A15C07; --info: #1D4ED8; --error: #B3261E;
  --saffron-tint: #FDE9C4; --vermilion-tint: #FBDAD3;
  --radius: 16px; --radius-sm: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1A1423; --surface: #241D2F; --surface-2: #2E2639; --border: #3A3446;
    --text: #FFFFFF; --muted: #B9B5C2; --accent-text: #F5A524;
    --success: #4ADE80; --warning: #FBBF24; --info: #93C5FD; --error: #F2B8B5;
    --saffron-tint: #4A3818; --vermilion-tint: #4D2219;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.5 Inter, system-ui, sans-serif; }
h1, h2, h3, .h { font-family: Sora, Inter, sans-serif; font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
a { color: var(--accent-text); text-underline-offset: 3px; }
a:hover { color: var(--vermilion); }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card-pad { padding: 16px 20px; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 0; }

/* Buttons: primary = saffron with ink text (8.8:1). */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border-radius: 14px; border: 1px solid transparent; font: 600 15px/1 Inter, sans-serif; cursor: pointer;
  background: var(--saffron); color: var(--ink); text-decoration: none; }
.btn:hover { filter: brightness(0.96); color: var(--ink); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, button:focus-visible {
  outline: 3px solid var(--vermilion); outline-offset: 2px; }
.btn.outline { background: transparent; color: var(--text); border-color: var(--text); }
.btn.outline:hover { background: var(--surface-2); }
.btn.danger { background: transparent; color: var(--error); border-color: var(--error); }
.btn.ghost { background: transparent; color: var(--accent-text); min-height: 40px; padding: 0 12px; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon { width: 18px; height: 18px; flex: none; }

/* Forms */
label { display: block; font-weight: 600; font-size: 13px; margin: 0 0 6px; }
.field { display: flex; flex-direction: column; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=password], input[type=date], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: 400 15px/1.4 Inter, sans-serif; }
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--saffron); outline: 2px solid var(--saffron); outline-offset: -1px; }
.code-input { font: 700 28px/1 Inter, sans-serif; letter-spacing: 12px; text-align: center; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--saffron); }
.prefix { display: flex; align-items: stretch; }
.prefix span { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--border); border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--surface); color: var(--muted); font-weight: 600; }
.prefix input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* Messages */
.flash { padding: 12px 16px; border-radius: 12px; font-weight: 500; border: 1px solid; }
.flash.ok { background: color-mix(in srgb, var(--success) 12%, transparent); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.flash.error { background: color-mix(in srgb, var(--error) 12%, transparent); border-color: color-mix(in srgb, var(--error) 45%, transparent); }

/* Pills (status) */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font: 700 11px/1.4 Inter, sans-serif;
  letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.s-PLACED { color: var(--info); background: color-mix(in srgb, var(--info) 12%, transparent); }
.s-CONFIRMED { color: var(--accent-text); background: var(--saffron-tint); }
.s-DISPATCHED, .s-late { color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent); }
.s-DELIVERED, .s-SENT, .s-sent, .s-ok, .s-live { color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); }
.s-CANCELLED, .s-FAILED, .s-failed, .s-bad { color: var(--error); background: color-mix(in srgb, var(--error) 12%, transparent); }
.s-PENDING, .s-pending, .s-neutral, .s-offline { color: var(--muted); background: var(--surface-2); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font: 600 12px/1.3 Inter, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
  padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.right, th.right { text-align: right; }
tbody tr:hover { background: var(--surface-2); }

/* Tabs / chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); text-decoration: none; font-weight: 500; font-size: 14px; }
.chip.on { background: var(--saffron); border-color: var(--saffron); color: var(--ink); font-weight: 600; }
.chip .count { font-size: 12px; opacity: .75; }

/* ---------------------------------------------------------------- site -- */
.site-header { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .inner { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo img { height: 30px; display: block; }
.logo .dark { display: none; }
@media (prefers-color-scheme: dark) { .logo .light { display: none; } .logo .dark { display: block; } }
.site-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.site-nav a, .site-nav button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-weight: 500; background: none; border: 0; font-size: 15px; cursor: pointer; }
.site-nav a.on { color: var(--text); font-weight: 700; box-shadow: inset 0 -3px 0 var(--vermilion); border-radius: 0; }
.site-nav a:hover, .site-nav button:hover { background: var(--surface-2); color: var(--text); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--vermilion); color: var(--white);
  font: 700 12px/20px Inter, sans-serif; text-align: center; }
.page { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }
.narrow { max-width: 460px; margin: 0 auto; }

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 440px; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 8px; }
.auth-logo img { height: 52px; }

.product { display: flex; flex-direction: column; }
.product .photo { aspect-ratio: 16 / 10; background: var(--surface-2); display: flex; overflow-x: auto; scroll-snap-type: x mandatory; }
.product .photo img { width: 100%; height: 100%; object-fit: cover; flex: none; scroll-snap-align: start; }
.product .photo .none { margin: auto; color: var(--muted); }
.size-row { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.size-row .label { font-weight: 600; flex: 1 1 auto; }
.size-row .price { font-weight: 700; }
.size-row form { display: flex; gap: 6px; align-items: center; }
.size-row input[type=number] { width: 76px; min-height: 40px; text-align: center; padding: 6px; }
.in-cart { color: var(--success); font-size: 13px; font-weight: 600; }

.vcard { border-radius: 16px; padding: 20px; color: #fff; background: linear-gradient(135deg, #0F172A, #1E3A8A, #0284C7); }
.vcard.t1 { background: linear-gradient(135deg, #064E3B, #047857, #10B981); }
.vcard.t2 { background: linear-gradient(135deg, #18181B, #27272A, #52525B); }
.vcard.t3 { background: linear-gradient(135deg, #3B0764, #581C87, #9333EA); }
.vcard .gold { color: #FBBF24; }
.vcard .soft { color: rgba(255, 255, 255, .8); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }

/* --------------------------------------------------------------- admin -- */
.admin { display: flex; flex-wrap: wrap; min-height: 100vh; }
.sidebar { flex: 1 1 220px; max-width: 260px; background: var(--surface); border-right: 1px solid var(--border); padding: 20px 14px;
  display: flex; flex-direction: column; gap: 4px; }
.sidebar .logo { padding: 4px 8px 16px; }
.sidebar a.nav { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--text);
  text-decoration: none; font-weight: 500; }
.sidebar a.nav:hover { background: var(--surface-2); }
.sidebar a.nav.on { background: var(--vermilion-tint); font-weight: 700; }
.sidebar a.nav.on .icon { color: var(--vermilion); }
.sidebar .who { margin-top: auto; padding: 12px; border-top: 1px solid var(--border); font-size: 13px; }
.main { flex: 999 1 560px; min-width: 0; padding: 24px clamp(16px, 3vw, 40px) 64px; }
@media (max-width: 860px) {
  .sidebar { max-width: none; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border); padding: 10px; }
  .sidebar .logo { flex-basis: 100%; padding-bottom: 8px; }
  .sidebar a.nav { min-height: 40px; }
  .sidebar .who { flex-basis: 100%; margin-top: 4px; }
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.kpi .v { font: 700 26px/1.2 Sora, Inter, sans-serif; margin-top: 4px; }
.kpi .l { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { position: relative; width: 120px; height: 120px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb form { position: absolute; top: 6px; right: 6px; }
.size-edit { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.qr { background: #fff; border-radius: 16px; padding: 12px; display: inline-block; border: 1px solid var(--border); }
.qr svg { display: block; width: 264px; height: 264px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
details.edit summary { cursor: pointer; color: var(--accent-text); font-weight: 600; }
details.edit[open] { background: var(--surface-2); border-radius: 12px; padding: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Location tracking maps */
.map { height: min(62vh, 560px); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; background: var(--surface-2); z-index: 0; }
.map-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 8px; }
.map-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.replay { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.replay input[type=range] { flex: 1; accent-color: var(--vermilion); }
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; align-items: end; height: 140px; }
.bars .bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; font-size: 11px; color: var(--muted); }
.bars .bar span.fill { width: 100%; max-width: 34px; background: var(--saffron); border-radius: 6px 6px 0 0; min-height: 2px; }
.timeline-list { list-style: none; margin: 0; padding: 0; }
.timeline-list li { display: grid; grid-template-columns: 76px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.timeline-list li:last-child { border-bottom: 0; }
.timeline-list .t { font-variant-numeric: tabular-nums; color: var(--muted); }
.leaflet-tooltip.stay-tip { background: #DC2626; color: #fff; border: 0; font: 700 11px/1.2 Inter, sans-serif; padding: 3px 7px; border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.leaflet-tooltip.stay-tip::before { display: none; }
.leaflet-tooltip.stay-tip.big { font-size: 13px; padding: 5px 10px; }
tr.pick { cursor: pointer; }
tr.pick:hover td { background: var(--surface-2); }
tr.pick.on td { background: var(--saffron-tint); }
