@font-face {
  font-family: 'Vazirmatn';
  src: url('./fonts/Vazirmatn.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --violet: #7b5cff;
  --violet-2: #9d82ff;
  --violet-d: #5a3fd6;
  --bg: #eef0fb;
  --card: #ffffff;
  --ink: #2b2350;
  --muted: #8f8dab;
  --line: #edecf7;
  --pink: #ff5fa2;
  --danger: #ff566b;
  --ok: #2bc48a;

  --g-violet: linear-gradient(135deg, #8b6bff, #6b46ff);
  --g-pink: linear-gradient(135deg, #ff7eb3, #ff5f8f);
  --g-orange: linear-gradient(135deg, #ffb057, #ff8a3c);
  --g-blue: linear-gradient(135deg, #66c6ff, #3d8bff);
  --g-green: linear-gradient(135deg, #4be0a8, #22b981);
  --g-gray: linear-gradient(135deg, #b9bcd6, #8f92b8);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Vazirmatn', Tahoma, 'Segoe UI', sans-serif;
  direction: rtl;
  background:
    radial-gradient(120% 60% at 100% 0%, #efe9ff 0%, rgba(239,233,255,0) 55%),
    radial-gradient(120% 60% at 0% 5%, #e7f0ff 0%, rgba(231,240,255,0) 50%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
#app { max-width: 520px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

/* Header */
.appbar {
  background: var(--g-violet);
  color: #fff;
  padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 8px 22px rgba(107, 70, 255, .28);
  position: sticky; top: 0; z-index: 10;
  border-radius: 0 0 22px 22px;
}
.appbar .title { font-size: 15.5px; font-weight: 700; }
.appbar .left { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.appbar .clock { font-size: 13px; opacity: .92; }
.appbar .back { background: rgba(255,255,255,.18); border: 0; color: #fff; width: 30px; height: 30px; border-radius: 10px; font-size: 20px; cursor: pointer; line-height: 1; }

.net-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.net-dot.on { background: #7bffb0; box-shadow: 0 0 0 3px rgba(123,255,176,.3); }
.net-dot.off { background: #ffd24d; box-shadow: 0 0 0 3px rgba(255,210,77,.3); }

main { flex: 1; padding: 16px; }

/* Hero card */
.hero {
  background: var(--g-violet);
  color: #fff; border-radius: 24px; padding: 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  box-shadow: 0 16px 34px rgba(107,70,255,.32);
  margin-bottom: 18px; position: relative; overflow: hidden;
}
.hero::after { content: ''; position: absolute; width: 160px; height: 160px; border-radius: 50%; background: rgba(255,255,255,.12); top: -70px; left: -40px; }
.hero .hi { font-size: 12.5px; opacity: .9; }
.hero h2 { margin: 4px 0 8px; font-size: 20px; font-weight: 800; }
.hero .hero-sub { font-size: 12px; opacity: .92; line-height: 1.7; }
.hero .hero-art { width: 96px; height: 96px; flex: 0 0 auto; filter: drop-shadow(0 12px 16px rgba(0,0,0,.22)); }
.hero .hero-art svg { width: 100%; height: 100%; }
.hero-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.hero-badge { background: rgba(255,255,255,.22); border-radius: 999px; padding: 4px 11px; font-size: 11.5px; font-weight: 700; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; background: #fff; color: var(--violet-d); border-radius: 999px; padding: 5px 13px; font-size: 12px; font-weight: 800; margin-top: 6px; box-shadow: 0 6px 14px rgba(0,0,0,.12); }
.status-pill .st-dot { width: 8px; height: 8px; border-radius: 50%; background: #22b981; }

/* Bale-login welcome */
.welcome { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 60% at 50% 35%, #9d82ff 0%, #6b46ff 60%, #5a3fd6 100%); color: #fff; }
.welcome-inner { text-align: center; }
.welcome .avatar { width: 122px; height: 122px; border-radius: 50%; margin: 0 auto 18px; overflow: hidden;
  background: rgba(255,255,255,.2); border: 4px solid rgba(255,255,255,.55); display: flex; align-items: center; justify-content: center;
  font-size: 44px; font-weight: 800; box-shadow: 0 18px 42px rgba(0,0,0,.32); animation: avatarPop .7s cubic-bezier(.2,.8,.3,1.5) both; }
.welcome .avatar img { width: 100%; height: 100%; object-fit: cover; }
.welcome .w-hi { font-size: 15px; opacity: 0; animation: fadeUp .5s ease .5s forwards; }
.welcome .w-name { font-size: 24px; font-weight: 800; margin-top: 6px; opacity: 0; animation: fadeUp .5s ease .78s forwards; }
.welcome .w-ring { width: 44px; height: 44px; border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; margin: 0 auto; animation: spin .8s linear infinite; }
@keyframes avatarPop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* splash */
#splash {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(120% 60% at 50% 38%, #ffffff 0%, #eef0fb 100%);
  transition: opacity .5s ease;
}
#splash.hide { opacity: 0; pointer-events: none; }
#splash .logo { width: 96px; height: 96px; filter: drop-shadow(0 14px 22px rgba(107,70,255,.4));
  animation: splashPop .7s cubic-bezier(.2,.8,.3,1.4) both, floaty 2.2s ease-in-out .7s infinite; }
#splash .brand { font-weight: 800; font-size: 18px; color: var(--violet-d); opacity: 0; animation: fadeUp .5s ease .45s forwards; }
#splash .ring { width: 40px; height: 40px; border: 3px solid #e6e1ff; border-top-color: var(--violet); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes splashPop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Tile grid (driver home) */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.tile {
  background: var(--card); border-radius: 20px; padding: 16px 8px 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 10px 24px rgba(80,60,160,.09); cursor: pointer; min-height: 116px;
  text-align: center; position: relative; transition: transform .08s ease;
}
.tile:active { transform: scale(.96); }
.chip {
  width: 54px; height: 54px; border-radius: 17px; display: flex; align-items: center; justify-content: center;
  background: var(--g-gray); box-shadow: 0 8px 16px rgba(120,110,180,.28);
}
.chip svg { width: 28px; height: 28px; stroke: #fff; fill: none; }
.chip .chip-num { color: #fff; font-size: 24px; font-weight: 800; }
.chip.c0 { background: var(--g-pink); box-shadow: 0 8px 16px rgba(255,95,143,.34); }
.chip.c1 { background: var(--g-orange); box-shadow: 0 8px 16px rgba(255,138,60,.34); }
.chip.c2 { background: var(--g-blue); box-shadow: 0 8px 16px rgba(61,139,255,.34); }
.chip.c3 { background: var(--g-violet); box-shadow: 0 8px 16px rgba(107,70,255,.34); }
.chip.c4 { background: var(--g-green); box-shadow: 0 8px 16px rgba(34,185,129,.34); }
.chip.c5 { background: var(--g-gray); }
.tile .label { font-size: 12.5px; color: #4a4470; font-weight: 600; }
.tile .badge {
  position: absolute; top: 10px; left: 10px; background: var(--danger); color: #fff;
  min-width: 20px; height: 20px; border-radius: 10px; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 6px;
  box-shadow: 0 4px 10px rgba(255,86,107,.4);
}

/* Cards / forms */
.card { background: var(--card); border-radius: 20px; padding: 18px; box-shadow: 0 10px 26px rgba(80,60,160,.08); margin-bottom: 14px; }
.card h2 { margin: 0 0 12px; font-size: 15.5px; font-weight: 800; }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input, .field select {
  width: 100%; padding: 13px 14px; border-radius: 13px; border: 1.5px solid #eceaf6;
  background: #f7f6fc; font-size: 15px; font-family: inherit; color: var(--ink);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--violet); background: #fff; box-shadow: 0 0 0 4px rgba(123,92,255,.12); }

.seg { display: flex; background: #f0eefa; border-radius: 14px; padding: 5px; gap: 4px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 11px; border-radius: 10px; font-family: inherit; font-size: 13px; color: #6b6790; cursor: pointer; font-weight: 600; }
.seg button.active { background: var(--g-violet); color: #fff; box-shadow: 0 6px 14px rgba(107,70,255,.32); }

.btn {
  width: 100%; padding: 15px; border: 0; border-radius: 15px; background: var(--g-violet);
  color: #fff; font-size: 15px; font-weight: 700; font-family: inherit; cursor: pointer;
  box-shadow: 0 12px 24px rgba(107,70,255,.3);
}
.btn:active { transform: translateY(1px); }
.btn.btn-lg { padding: 17px; font-size: 16px; }
.btn.secondary { background: #f0eefa; color: #5a4fb0; box-shadow: none; }
.btn.ghost { background: transparent; color: var(--violet); border: 1.5px solid #e0d9ff; box-shadow: none; }
.btn:disabled { opacity: .6; }
.btn + .btn { margin-top: 10px; }

.hint { font-size: 12px; color: var(--muted); margin: 8px 2px 0; line-height: 1.8; }
.pill { display: inline-block; background: #efeaff; color: var(--violet); border-radius: 999px; padding: 3px 11px; font-size: 12px; font-weight: 700; }

/* key-value */
.kv { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #f1f0f8; font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 700; }

/* queue */
/* transaction card (sent = green ✓, waiting = orange !) */
.q-card { background: var(--card); border-radius: 16px; padding: 12px 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 12px; box-shadow: 0 8px 20px rgba(80,60,160,.09); }
.q-icon { width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; background: var(--g-blue); box-shadow: 0 6px 14px rgba(61,139,255,.3); }
.q-icon svg { width: 22px; height: 22px; stroke: #fff; fill: none; }
.q-body { flex: 1; min-width: 0; }
.q-title { font-weight: 800; font-size: 14px; }
.q-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.q-badge { width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.q-badge svg { width: 15px; height: 15px; stroke: #fff; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.q-badge.q-sent { background: #2bc48a; box-shadow: 0 4px 10px rgba(43,196,138,.45); }
.q-badge.q-pending { background: #ffab2e; box-shadow: 0 4px 10px rgba(255,171,46,.45); }
.q-badge.q-failed { background: #ee4d4d; box-shadow: 0 4px 10px rgba(238,77,77,.45); }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; font-size: 14px; }

/* live search results */
.search-results { margin-top: 6px; }
.result-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 4px; border-bottom: 1px solid #f1f0f8; cursor: pointer; }
.result-row:active { background: #f7f5ff; border-radius: 12px; }
.result-row .rr-name { font-weight: 700; font-size: 14px; }
.result-row .meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.result-row .chev { color: #c4bfe4; font-size: 22px; }
.rr-left { display: flex; align-items: center; gap: 10px; }

/* avatar (photo or initials) */
.av { border-radius: 50%; overflow: hidden; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; background: #ece9fb; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av-i { background: linear-gradient(135deg, #9d82ff, #6b46ff); color: #fff; font-weight: 800; }

/* selected household header */
.sel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sel-head-txt { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.sel-head-txt h2 { font-size: 16px; }

/* delivery amount: centered + bold */
.amount-input { text-align: center; font-weight: 800; font-size: 18px; }

/* GPS status chip */
.gps-chip { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 7px 13px; font-size: 12px; font-weight: 700; margin: 2px 0 12px; }
.gps-chip .gps-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.gps-idle { background: #eef0f5; color: #6b7280; }
.gps-idle .gps-dot { background: #b6bcc9; }
.gps-getting { background: #fff3d9; color: #a4700a; }
.gps-getting .gps-dot { background: #ffab2e; animation: gpsPulse 1s ease-in-out infinite; }
.gps-ok { background: #dff5e9; color: #1c8a53; }
.gps-ok .gps-dot { background: #2bc48a; }
.gps-err { background: #fde3e3; color: #c0362e; }
.gps-err .gps-dot { background: #ee4d4d; }
@keyframes gpsPulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* harmonize dropdowns: smaller, centered, bold, custom arrow */
.field select { padding: 11px 14px; font-weight: 700; text-align: center; text-align-last: center; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238f8dab' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: left 14px center; }
.field select:disabled { color: #a9adbb; }

/* login */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(120% 50% at 50% 0%, #9d82ff 0%, #6b46ff 55%, #5a3fd6 100%); }
.login-card { background: #fff; border-radius: 26px; padding: 28px 24px; width: 100%; max-width: 360px; box-shadow: 0 24px 60px rgba(40,20,90,.35); }
.login-logo { width: 76px; height: 76px; margin: 0 auto 14px; display: block; filter: drop-shadow(0 10px 16px rgba(107,70,255,.35)); }
.login-card h1 { font-size: 18px; text-align: center; margin: 0 0 4px; font-weight: 800; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 12.5px; margin-bottom: 20px; }
.login-card .field input { text-align: center; }

.toast-host { position: fixed; bottom: 18px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 50; pointer-events: none; }
.toast { background: #2b2350; color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 13px; box-shadow: 0 10px 24px rgba(20,10,50,.3); max-width: 90%; }
.toast.ok { background: linear-gradient(135deg, #4be0a8, #22b981); }
.toast.err { background: linear-gradient(135deg, #ff7a8a, #f0455a); }

.spinner { width: 18px; height: 18px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* request workflow stepper */
.stepper { display: flex; align-items: flex-start; justify-content: space-between; margin-top: 8px; }
.stepper .step { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 0 0 auto; width: 62px; text-align: center; }
.stepper .step-line { flex: 1; height: 3px; background: #edecf7; margin-top: 8px; border-radius: 2px; }
.stepper .dot { width: 19px; height: 19px; border-radius: 50%; background: #fff; border: 2px solid #d9d5ee; }
.stepper .st-label { font-size: 10.5px; color: var(--muted); line-height: 1.4; }
.stepper .step.done .dot { background: var(--ok); border-color: var(--ok); }
.stepper .step.done .st-label { color: var(--ok); }
.stepper .step.active .dot { background: var(--violet); border-color: var(--violet); box-shadow: 0 0 0 5px rgba(123,92,255,.18); }
.stepper .step.active .st-label { color: var(--violet); font-weight: 700; }
.stepper .step.rejected .dot { background: var(--danger); border-color: var(--danger); }
.stepper .step.rejected .st-label { color: var(--danger); font-weight: 700; }

/* charts */
.chart-card h2 { font-size: 14px; }
.barchart { display: flex; align-items: flex-end; gap: 8px; height: 152px; padding-top: 18px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.bar-track { width: 100%; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar { width: 66%; max-width: 34px; border-radius: 9px 9px 5px 5px; min-height: 6px; transition: height .5s cubic-bezier(.2,.8,.3,1); }
.bar.b-blue { background: var(--g-blue); box-shadow: 0 6px 12px rgba(61,139,255,.3); }
.bar.b-orange { background: var(--g-orange); box-shadow: 0 6px 12px rgba(255,138,60,.3); }
.bar.b-violet { background: var(--g-violet); box-shadow: 0 6px 12px rgba(107,70,255,.3); }
.bar-val { font-size: 10.5px; color: #5a4fb0; font-weight: 800; }
.bar-lbl { font-size: 10px; color: var(--muted); white-space: nowrap; }
.chart-total { text-align: center; margin-top: 12px; font-size: 12.5px; font-weight: 700; color: var(--violet-d); }

/* animated water tanker */
.truck-scene { border-radius: 20px; overflow: hidden; margin-bottom: 14px; box-shadow: 0 12px 28px rgba(2,136,209,.28); background: linear-gradient(180deg, #29b6f6, #039be5); }
.truck-scene svg { width: 100%; display: block; }
.tk-truck { transform-box: fill-box; transform-origin: center; animation: tkBob 1.1s ease-in-out infinite; }
.tk-wheel { transform-box: fill-box; transform-origin: center; animation: tkSpin .8s linear infinite; }
.tk-drop { transform-box: fill-box; transform-origin: center; animation: tkDropPulse 1.5s ease-in-out infinite; }
.tk-dash { animation: tkDash .8s linear infinite; }
@keyframes tkBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes tkSpin { to { transform: rotate(-360deg); } }
@keyframes tkDropPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes tkDash { from { transform: translateX(0); } to { transform: translateX(-70px); } }
@media (prefers-reduced-motion: reduce) { .tk-truck, .tk-wheel, .tk-drop, .tk-dash { animation: none; } }

/* info banner slider */
.banner-slider { margin-bottom: 18px; }
.banner-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; direction: ltr; gap: 12px; scrollbar-width: none; -ms-overflow-style: none; }
.banner-track::-webkit-scrollbar { display: none; }
.banner-slide { flex: 0 0 100%; scroll-snap-align: center; height: 132px; border-radius: 20px; overflow: hidden; display: flex; align-items: flex-end; text-decoration: none; background-size: cover; background-position: center; box-shadow: 0 12px 28px rgba(80,60,160,.2); position: relative; }
.banner-slide[data-link] { cursor: pointer; }
.banner-slide.grad { background: linear-gradient(135deg, #8b6bff, #6b46ff); }
.banner-slide.grad::after { content: ''; position: absolute; width: 150px; height: 150px; border-radius: 50%; background: rgba(255,255,255,.1); top: -60px; left: -34px; }
.banner-slide:nth-child(3n+2).grad { background: linear-gradient(135deg, #4fc3f7, #0288d1); }
.banner-slide:nth-child(3n).grad { background: linear-gradient(135deg, #4be0a8, #22b981); }
.banner-body { direction: rtl; text-align: right; padding: 14px 16px; color: #fff; width: 100%; position: relative; z-index: 1; }
.banner-title { font-size: 15px; font-weight: 800; }
.banner-desc { font-size: 12px; opacity: .95; margin-top: 4px; line-height: 1.7; }
.banner-att { display: inline-block; margin-top: 8px; font-size: 11px; font-weight: 700; background: rgba(255,255,255,.92); color: var(--violet-d); border-radius: 999px; padding: 4px 11px; text-decoration: none; }
.banner-dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.banner-dots .bd { width: 7px; height: 7px; border-radius: 50%; background: #cfc9ee; cursor: pointer; transition: all .25s; }
.banner-dots .bd.active { width: 20px; border-radius: 4px; background: var(--violet); }

/* header bell */
.bell { position: relative; background: rgba(255,255,255,.18); border: 0; width: 34px; height: 34px; border-radius: 11px; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.bell svg { width: 19px; height: 19px; stroke: #fff; fill: none; }
.bell-badge { position: absolute; top: -4px; left: -4px; background: var(--danger); color: #fff; min-width: 17px; height: 17px; border-radius: 9px; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 4px; box-shadow: 0 3px 8px rgba(255,86,107,.5); }

/* messages / inbox */
.msg .msg-top { display: flex; align-items: center; justify-content: space-between; }
.msg .msg-cat { font-size: 11px; font-weight: 700; color: var(--violet); background: #efeaff; border-radius: 999px; padding: 3px 10px; }
.msg .msg-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); }
.msg.unread { border-inline-start: 3px solid var(--violet); }
