/* Ramonik platform — base styles. Mobile first; light + dark; animations kept subtle but present. */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --text: #0f1b24;
  --muted: #5b6b78;
  --line: #dde3e8;
  --accent: #0f766e;
  --accent-2: #14b8a6;
  --accent-ink: #ffffff;
  --accent-soft: #ccfbf1;
  --danger: #c2410c;
  --danger-soft: #ffedd5;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #a16207;
  --warn-soft: #fef9c3;
  --info: #1d4ed8;
  --info-soft: #dbeafe;
  --shadow: 0 1px 2px rgba(15, 27, 36, .06), 0 4px 14px rgba(15, 27, 36, .06);
  --radius: 14px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1218; --surface: #121c24; --surface-2: #1a2630; --text: #e6edf2; --muted: #93a4b1;
    --line: #24323d; --accent: #2dd4bf; --accent-2: #5eead4; --accent-ink: #042f2e; --accent-soft: #123b38;
    --danger: #fb923c; --danger-soft: #3a2113; --ok: #4ade80; --ok-soft: #12301d; --warn: #facc15;
    --warn-soft: #33290b; --info: #93c5fd; --info-soft: #172a4a;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1218; --surface: #121c24; --surface-2: #1a2630; --text: #e6edf2; --muted: #93a4b1;
  --line: #24323d; --accent: #2dd4bf; --accent-2: #5eead4; --accent-ink: #042f2e; --accent-soft: #123b38;
  --danger: #fb923c; --danger-soft: #3a2113; --ok: #4ade80; --ok-soft: #12301d; --warn: #facc15;
  --warn-soft: #33290b; --info: #93c5fd; --info-soft: #172a4a;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
[dir="rtl"] body { font-family: "Vazirmatn", "Inter", system-ui, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.45rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; text-align: end; white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem 16px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { min-width: 0; display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .logo { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); font-weight: 800; }
.brand .logo img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; background: #fff; }
.brand > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: .72rem; line-height: 1; }
.topbar .spacer { flex: 1; }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--text); width: 36px; height: 36px;
  border-radius: 10px; display: inline-grid; place-items: center; cursor: pointer; transition: transform .15s var(--ease), background .2s; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg, .btn svg { width: 18px; height: 18px; flex: none; }
.sidebar svg { width: 20px; height: 20px; flex: none; }

.shell { display: flex; flex: 1; }
.sidebar { display: none; }
main { flex: 1; min-width: 0; padding: 16px 16px 96px; max-width: 1100px; width: 100%; margin: 0 auto; }

/* bottom nav on phones */
.bottomnav {
  position: fixed; inset: auto 0 0 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: .7rem; color: var(--muted); padding: 4px 0; border-radius: 10px; transition: color .2s, background .2s; }
.bottomnav a svg { width: 22px; height: 22px; transition: transform .25s var(--ease); }
.bottomnav a.active { color: var(--accent); }
.bottomnav a.active svg { transform: translateY(-2px) scale(1.08); }
.bottomnav a:hover { text-decoration: none; }

@media (min-width: 900px) {
  .bottomnav { display: none; }
  .sidebar { display: flex; flex-direction: column; gap: 2px; width: 220px; padding: 16px 10px;
    border-inline-end: 1px solid var(--line); background: var(--surface); position: sticky; top: 57px; height: calc(100vh - 57px); }
  .sidebar a { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; border-radius: 10px;
    color: var(--muted); font-weight: 500; transition: background .2s, color .2s, transform .2s var(--ease); }
  .sidebar a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; transform: translateX(2px); }
  [dir="rtl"] .sidebar a:hover { transform: translateX(-2px); }
  .sidebar a.active { background: var(--accent-soft); color: var(--accent); }
  main { padding: 24px 28px 48px; }
}

/* ---------- page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; flex: 1 1 100%; min-width: 0; overflow-wrap: anywhere; }
@media (min-width: 700px) { .page-head h1 { flex-basis: 0; } }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 14px; }
.grid > .card + .card { margin-top: 0; }
.card h2 { display: flex; align-items: center; gap: .5rem; }
.grid { display: grid; gap: 14px; }
.grid > * { min-width: 0; } /* long emails/names must not push a card wider than the phone */
@media (min-width: 700px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .v { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: .8rem; }

/* list rows (phone friendly "table") */
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: .75rem; padding: 12px 4px; border-bottom: 1px solid var(--line);
  color: var(--text); transition: background .2s, transform .2s var(--ease); border-radius: 8px; }
.row:last-child { border-bottom: 0; }
a.row:hover { background: var(--surface-2); text-decoration: none; transform: translateX(2px); }
[dir="rtl"] a.row:hover { transform: translateX(-2px); }
.row .main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row > svg { width: 20px; height: 20px; flex: none; color: var(--muted); }
.row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 700; color: var(--accent); background: var(--accent-soft); font-size: .85rem; }

/* tables (wide screens) */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 600;
  padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.draft { background: var(--surface-2); color: var(--muted); }
.badge.sent { background: var(--info-soft); color: var(--info); }
.badge.approved { background: var(--ok-soft); color: var(--ok); }
.badge.declined { background: var(--danger-soft); color: var(--danger); }
.badge.lead { background: var(--warn-soft); color: var(--warn); }
.badge.active { background: var(--ok-soft); color: var(--ok); }
.badge.inactive { background: var(--danger-soft); color: var(--danger); }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px;
  transition: border-color .2s, box-shadow .2s;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.form-grid { display: grid; gap: 0 14px; }
@media (min-width: 700px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .full { grid-column: 1 / -1; } }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 42px;
  padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: transform .15s var(--ease), background .2s, box-shadow .2s, border-color .2s; }
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 34px; padding: 0 10px; font-size: .85rem; }
.btn.ghost { border-color: transparent; background: transparent; }
.fab { position: fixed; inset-inline-end: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 25;
  width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 40%, transparent);
  animation: pop .4s var(--ease) both .15s; }
.fab svg { width: 26px; height: 26px; }
.fab:hover { text-decoration: none; transform: scale(1.05); }
@media (min-width: 900px) { .fab { display: none; } }
.hide-phone { display: none; }
@media (min-width: 900px) { .hide-phone { display: inline-flex; } }

.search { position: relative; margin-bottom: 12px; }
.search input { padding-inline-start: 38px; }
.search svg { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; scrollbar-width: none; }
.tabs a { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  color: var(--muted); font-size: .85rem; font-weight: 600; white-space: nowrap; transition: all .2s; }
.tabs a.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.tabs a:hover { text-decoration: none; }

/* ---------- flash ---------- */
.flash { position: fixed; z-index: 50; left: 50%; top: 70px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow);
  font-weight: 600; animation: toast 3.2s var(--ease) both; max-width: calc(100vw - 32px); }
.flash.error { background: var(--danger); color: #fff; }

.empty { text-align: center; padding: 36px 12px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; opacity: .5; margin-bottom: 8px; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent), var(--bg); }
.auth .card { width: 100%; max-width: 400px; padding: 28px 22px; animation: rise .5s var(--ease) both; }
.auth .brand { justify-content: center; margin-bottom: 1rem; font-size: 1.15rem; }
.auth .brand .logo { width: 40px; height: 40px; border-radius: 12px; font-size: 1.2rem; }
.error-box { background: var(--danger-soft); color: var(--danger); border-radius: 10px; padding: 8px 12px;
  margin-bottom: 12px; font-weight: 600; animation: shake .4s; }
.demo-box { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: .85rem; }

/* ---------- quote editor ---------- */
.section-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px;
  background: var(--surface); animation: rise .35s var(--ease) both; }
.section-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.section-head input { font-weight: 700; }
.item { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; padding: 10px 0; border-top: 1px dashed var(--line);
  animation: rise .3s var(--ease) both; }
.item .desc { grid-column: 1 / -1; }
.item .tot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; }
@media (min-width: 760px) {
  .item { grid-template-columns: minmax(0,1fr) 80px 200px 110px auto; align-items: center; }
  .item .desc { grid-column: auto; }
  .item .tot { grid-column: auto; justify-content: flex-end; gap: 8px; }
  .item .lbl { display: none; }
}
.item .lbl { font-size: .72rem; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.item.optional { background: linear-gradient(90deg, var(--warn-soft), transparent 60%); border-radius: 8px; padding-inline: 6px; }
.totals { margin-inline-start: auto; max-width: 340px; }
.totals .line { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { border-top: 2px solid var(--text); margin-top: 6px; padding-top: 8px; font-size: 1.15rem; font-weight: 800; }
.sticky-save { position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 15; margin-top: 12px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: flex; gap: 8px; align-items: center;
  box-shadow: var(--shadow); }
@media (min-width: 900px) { .sticky-save { bottom: 12px; } }

@media (max-width: 599px) {
  .quote-table th:nth-child(3), .quote-table td:nth-child(3) { display: none; }
  .quote-table { font-size: .9rem; }
}
/* printable quote */
.doc { background: #fff; color: #111; max-width: 820px; margin: 0 auto; padding: 32px; border-radius: 12px; box-shadow: var(--shadow); }
.doc table th { color: #555; }
.doc .muted { color: #666; }
.doc-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
@media print {
  .topbar, .sidebar, .bottomnav, .fab, .no-print { display: none !important; }
  main { padding: 0; }
  body { background: #fff; }
  .doc { box-shadow: none; padding: 0; }
}

/* ---------- animations ---------- */
.fade-in { animation: rise .4s var(--ease) both; }
.stagger > * { animation: rise .4s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; } .stagger > *:nth-child(2) { animation-delay: .05s; }
.stagger > *:nth-child(3) { animation-delay: .08s; } .stagger > *:nth-child(4) { animation-delay: .11s; }
.stagger > *:nth-child(5) { animation-delay: .14s; } .stagger > *:nth-child(6) { animation-delay: .17s; }
.stagger > *:nth-child(7) { animation-delay: .2s; }  .stagger > *:nth-child(n+8) { animation-delay: .23s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -12px); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -12px); visibility: hidden; } }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
.quote-table { table-layout: fixed; }
.quote-table th:nth-child(2), .quote-table td:nth-child(2) { width: 22%; }
.quote-table th:nth-child(3), .quote-table td:nth-child(3) { width: 16%; }
.quote-table th:nth-child(4), .quote-table td:nth-child(4) { width: 18%; }
@media (max-width: 599px) { .quote-table th:nth-child(2), .quote-table td:nth-child(2) { width: 30%; } .quote-table th:nth-child(4), .quote-table td:nth-child(4) { width: 32%; } }
[dir="rtl"] .row .title, [dir="rtl"] .row .sub, [dir="rtl"] .brand span { unicode-bidi: plaintext; }

/* ===== Round 2: chips, checklist, photos, signature, schedule, crew screen ===== */
.d-block { display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; margin: 0; font-weight: 500; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); transition: all .2s var(--ease); }
.chip input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: transparent; transform: scale(1.03); }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
details > summary { list-style: none; } details > summary::-webkit-details-marker { display: none; }
.card h2 svg, .decision h2 svg { width: 20px; height: 20px; color: var(--accent); flex: none; }
.decision h2 { display: flex; align-items: center; gap: .5rem; }
.avatar svg { width: 18px; height: 18px; }

.checklist { display: flex; flex-direction: column; gap: 6px; }
.check-item { width: 100%; display: flex; gap: 12px; align-items: flex-start; text-align: start; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid transparent; border-radius: 12px; padding: 12px; cursor: pointer; min-height: 52px;
  transition: background .2s, border-color .2s, transform .15s var(--ease); }
.check-item:active { transform: scale(.98); }
.check-item .box { flex: none; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--muted); display: grid; place-items: center; transition: all .25s var(--ease); }
.check-item .box svg { width: 16px; height: 16px; stroke-width: 3; animation: pop .3s var(--ease); }
.check-item.done { background: var(--ok-soft); }
.check-item.done .box { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.check-item.done .lbl { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text) 40%, transparent); }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.photo-grid a { display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); animation: pop .35s var(--ease) both; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s var(--ease); }
.photo-grid a:hover img { transform: scale(1.06); }
.upload { cursor: pointer; }
.btn.busy { opacity: .6; pointer-events: none; }
.btn.busy::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.sigpad { width: 100%; height: 180px; border: 2px dashed var(--line); border-radius: 12px; background: #fff; touch-action: none; display: block; }
.sig-show { background: #fff; border-radius: 12px; padding: 8px; display: inline-block; margin: 4px 8px 4px 0; border: 1px solid var(--line); }
.sig-show img { max-width: 260px; height: 90px; object-fit: contain; display: block; }
.sig-show .small { color: #555; }

/* visit status colours */
.vdot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--info); }
.vdot.on_the_way, .vs-on_the_way { --c: var(--warn); --cs: var(--warn-soft); }
.vdot.in_progress, .vs-in_progress { --c: var(--accent); --cs: var(--accent-soft); }
.vdot.done, .vs-done { --c: var(--ok); --cs: var(--ok-soft); }
.vdot.scheduled, .vs-scheduled { --c: var(--info); --cs: var(--info-soft); }
.vdot { background: var(--c); }
.badge[class*="vs-"] { background: var(--cs); color: var(--c); }
.vdot.in_progress { animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }

/* schedule week */
.week { display: grid; gap: 10px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); }
.day header { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.day .dname { font-weight: 700; } .day .dnum { font-weight: 800; font-size: 1.1rem; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }
.day.today .dnum { color: var(--accent); }
.day.empty-day { padding-block: 6px; } .day.empty-day header { margin: 0; } .day.empty-day .nothing { display: none; }
.vcard { display: block; border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; color: var(--text); background: var(--surface-2);
  border-inline-start: 4px solid var(--info); transition: transform .2s var(--ease), box-shadow .2s; }
.vcard:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }
.vcard.on_the_way { border-color: var(--warn); } .vcard.in_progress { border-color: var(--accent); } .vcard.done { border-color: var(--ok); opacity: .75; }
.vtime { font-weight: 700; font-size: .8rem; font-variant-numeric: tabular-nums; }
.vtitle { font-weight: 600; font-size: .9rem; line-height: 1.3; }
.vsub { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vsub svg { width: 12px; height: 12px; vertical-align: -1px; }
@media (min-width: 1000px) {
  .week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
  .day { min-height: 340px; padding: 8px; }
  .day header { flex-direction: column; gap: 0; align-items: flex-start; }
  .day.empty-day { padding: 8px; } .day.empty-day header { margin-bottom: 8px; } .day.empty-day .nothing { display: block; }
}

/* crew: today list + visit screen */
.tlist { display: flex; flex-direction: column; gap: 10px; }
.tcard { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; color: var(--text); box-shadow: var(--shadow); border-inline-start: 5px solid var(--info); transition: transform .2s var(--ease); }
.tcard:hover { text-decoration: none; transform: translateY(-2px); }
.tcard.on_the_way { border-inline-start-color: var(--warn); } .tcard.in_progress { border-inline-start-color: var(--accent); } .tcard.done { border-inline-start-color: var(--ok); opacity: .8; }
.tcard .main { flex: 1; min-width: 0; } .tcard .title { font-weight: 700; } .tcard .sub { color: var(--muted); font-size: .85rem; }
.tcard .sub svg { width: 13px; height: 13px; vertical-align: -2px; }
.tleft { text-align: center; min-width: 52px; } .ttime { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stepbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.btn.big { width: 100%; min-height: 58px; font-size: 1.05rem; border-radius: 14px; }
.btn.big svg { width: 22px; height: 22px; }
.btn.big.on_my_way { background: var(--warn); color: #fff; }
.btn.big.check_out { background: var(--ok); color: #fff; }
:root[data-theme="dark"] .btn.big.on_my_way, :root[data-theme="dark"] .btn.big.check_out { color: #111; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.big.on_my_way, :root:not([data-theme="light"]) .btn.big.check_out { color: #111; } }
.stepbar form:not([style*="flex:1"]) { flex: 0 0 auto; } .stepbar form:not([style*="flex:1"]) .btn.big { width: auto; }
.done-banner { flex: 1; display: flex; align-items: center; gap: 8px; padding: 14px; border-radius: 14px; background: var(--ok-soft); color: var(--ok); font-weight: 700; animation: pop .4s var(--ease); }
.done-banner svg { width: 22px; height: 22px; }
.timeline { display: flex; gap: 14px; margin-bottom: 12px; } .timeline svg { width: 14px; height: 14px; vertical-align: -2px; }
.instructions { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); white-space: pre-wrap; }
.row a.title { display: block; }
.check-item .lbl .d-block { display: inline-block; width: 100%; text-decoration: none; }
.small svg, .sub svg { width: 14px; height: 14px; vertical-align: -2px; flex: none; }

/* ===== Round 3: money, documents, customer pages ===== */
.phone-only { display: inline-grid; }
@media (min-width: 900px) { .phone-only { display: none !important; } }
.icon-btn.active { background: var(--accent-soft); color: var(--accent); }
.badge.paid { background: var(--ok-soft); color: var(--ok); }
.badge.overdue { background: var(--danger-soft); color: var(--danger); }
.badge.partial { background: var(--warn-soft); color: var(--warn); }
.badge.void { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.money-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.money-grid .m { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.money-grid .m .v { font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.money-grid .m .l { font-size: .75rem; color: var(--muted); }
.money-grid .m.hl { background: var(--accent-soft); } .money-grid .m.hl .v { color: var(--accent); }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 10px 0 4px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: inherit;
  transform-origin: left; animation: grow 1s var(--ease) both .2s; }
[dir="rtl"] .progress > span { transform-origin: right; }
@keyframes grow { from { transform: scaleX(0); } }
.bill-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; }
.bill-actions form { display: flex; gap: 6px; align-items: center; margin: 0; }
.bill-actions input[type=number] { width: 78px; min-height: 34px; padding: 4px 8px; }
.share { border: 2px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; animation: rise .4s var(--ease) both; }
.share .linkbox { display: flex; gap: 6px; margin: 8px 0; }
.share .linkbox input { font-family: ui-monospace, monospace; font-size: .8rem; }
.lines .line-row { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; padding: 10px 0; border-top: 1px dashed var(--line); animation: rise .3s var(--ease) both; }
.lines .line-row .desc { grid-column: 1 / -1; }
.lines .line-row .tot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; }
@media (min-width: 760px) {
  .lines .line-row { grid-template-columns: minmax(0,1fr) 80px 200px 90px 110px auto; align-items: center; }
  .lines .line-row .desc, .lines .line-row .tot { grid-column: auto; }
  .lines .line-row .tot { justify-content: flex-end; gap: 8px; } .lines .lbl { display: none; }
}
.lines .lbl { font-size: .72rem; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.neg { color: var(--danger); }
.pay-list .row .sub { white-space: normal; }
/* customer pages */
.public-top { background: var(--surface); border-bottom: 1px solid var(--line); padding: 14px 16px; }
.public-top .inner, .public-main { max-width: 860px; margin: 0 auto; }
.public-main { padding: 16px 16px 60px; }
.public-top strong { font-size: 1.1rem; }
.decision { border: 2px solid var(--accent); border-radius: var(--radius); padding: 16px; background: var(--surface); box-shadow: var(--shadow); }
.opt-toggle { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); margin: 6px 0; cursor: pointer; font-weight: 500; }
.opt-toggle input { width: 22px; height: 22px; min-height: 0; flex: none; }
.opt-toggle .num { margin-inline-start: auto; font-weight: 700; }
.result-banner { padding: 16px; border-radius: var(--radius); font-weight: 700; display: flex; gap: 10px; align-items: center; margin-bottom: 14px; animation: pop .45s var(--ease); }
.result-banner.ok { background: var(--ok-soft); color: var(--ok); } .result-banner.no { background: var(--danger-soft); color: var(--danger); }
.result-banner svg { width: 24px; height: 24px; }
.paybox { background: var(--info-soft); border-radius: 12px; padding: 12px 14px; white-space: pre-wrap; }
.big-due { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.doc-amt { text-align: end; }
@media (max-width: 560px) { .doc-amt { text-align: start; } }

/* Company colour from the owner console (base.html sets --brand / --brand-ink and data-brand on <html>). */
:root[data-brand] { --accent: var(--brand); --accent-ink: var(--brand-ink);
  --accent-2: color-mix(in oklab, var(--brand) 70%, white); --accent-soft: color-mix(in oklab, var(--brand) 16%, white); }
@media (prefers-color-scheme: dark) {
  :root[data-brand]:not([data-theme="light"]) { --accent: color-mix(in oklab, var(--brand) 72%, white); --accent-ink: #0b1218;
    --accent-2: color-mix(in oklab, var(--brand) 50%, white); --accent-soft: color-mix(in oklab, var(--brand) 26%, #0b1218); }
}
:root[data-brand][data-theme="dark"] { --accent: color-mix(in oklab, var(--brand) 72%, white); --accent-ink: #0b1218;
  --accent-2: color-mix(in oklab, var(--brand) 50%, white); --accent-soft: color-mix(in oklab, var(--brand) 26%, #0b1218); }
.passkey-btn svg { width: 18px; height: 18px; }

/* Workflow: route like parcel tracking, bell, editors */
.journey { list-style: none; margin: 0; padding: 0; position: relative; }
.journey li { display: flex; gap: 12px; padding: 0 0 14px; position: relative; }
.journey li:not(:last-child)::before { content: ""; position: absolute; inset-inline-start: 13px; top: 28px; bottom: 0;
  width: 2px; background: var(--line); }
.journey li.j-done:not(:last-child)::before { background: var(--ok); }
.journey .dot { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  font-size: .8rem; background: var(--surface-2); color: var(--muted); border: 2px solid var(--line); }
.journey .j-done .dot { background: var(--ok); color: #fff; border-color: transparent; }
.journey .j-now .dot { background: var(--accent); color: var(--accent-ink); border-color: transparent; animation: pulse 2s infinite; }
.journey .j-returned .dot { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.journey .j-title { font-weight: 600; } .journey .j-sub { color: var(--muted); font-size: .85rem; }
.journey .j-note { font-size: .85rem; font-style: italic; margin-top: 2px; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); } 50% { box-shadow: 0 0 0 6px var(--accent-soft); } }
@media (prefers-reduced-motion: reduce) { .journey .j-now .dot { animation: none; } }
.icon-btn.bell { position: relative; }
.bell-n { position: absolute; top: -5px; inset-inline-end: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center; animation: rise .3s var(--ease); }
.bell-n[hidden] { display: none; }
.facts-list { margin: 0; display: grid; gap: 6px; } .facts-list div { display: flex; gap: 10px; justify-content: space-between;
  border-bottom: 1px dashed var(--line); padding-bottom: 4px; } .facts-list dt { color: var(--muted); } .facts-list dd { margin: 0;
  font-weight: 600; text-align: end; overflow-wrap: anywhere; min-width: 0; }
.step-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.step-row .grow { flex: 1 1 200px; min-width: 0; } .step-row .w-xs { width: 56px; } .step-row select { width: auto; max-width: 100%; }
.person-row { display: grid; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.person-row .who { display: flex; gap: 10px; align-items: center; min-width: 0; }
@media (min-width: 900px) { .person-row { grid-template-columns: 220px 1fr 1fr 1fr; align-items: end; } .person-row .chips { grid-column: 1 / -1; } }

/* Shared list/filter/document helpers (sales product and others) */
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-row > * { margin: 0; } .filter-row .grow { flex: 1 1 180px; min-width: 0; } .filter-row select { width: auto; max-width: 100%; }
.w-date { width: 150px; max-width: 100%; } .w-xs { width: 64px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 12px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.tile:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow); }
.tile::after { content: ""; position: absolute; top: 0; inset-inline-end: 0; width: 18px; height: 18px;
  background: linear-gradient(225deg, var(--bg) 50%, var(--line) 50%); border-start-end-radius: 12px; }
.tile-code { font-size: .72rem; font-weight: 800; letter-spacing: .06em; color: var(--accent); }
.tile-title { font-weight: 700; }
.totals > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 4px 0; }
table.items input { min-height: 36px; padding: 4px 8px; min-width: 70px; } table.items td { padding: 4px; } table.items .n { color: var(--muted); }
table.items .amt { white-space: nowrap; text-align: end; }
.next-box { border-inline-start: 4px solid var(--accent); }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) 2fr auto; gap: 8px; align-items: center; padding: 4px 0; }
.bar-row .bar-k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 6px;
  animation: grow .8s var(--ease) both; transform-origin: left; }
[dir="rtl"] .bar span { transform-origin: right; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.sig-pad canvas { width: 100%; height: 160px; border: 1px dashed var(--line); border-radius: 12px; background: #fff; touch-action: none; }
@media (prefers-reduced-motion: reduce) { .bar span { animation: none; } }
