/* Vanam — order follow-up. Mobile-first; the same CSS drives the Android WebView.
   Visual/responsive design pass only — every class name below is generated by
   web/js/*.js (including var(--token) references inline in several screens),
   so no selector or custom-property name was renamed or removed here. */

:root {
  --teal-800: #0b5c55;
  --teal-700: #0f766e;
  --teal-600: #0d9488;
  --teal-500: #14b8a6;
  --teal-50:  #f0fdfa;
  --ink:      #0f172a;
  --ink-2:    #334155;
  --muted:    #64748b;
  --line:     #e2e8f0;
  --bg:       #f4f6f8;
  --card:     #ffffff;
  --red:      #dc2626;
  --red-bg:   #fef2f2;
  --green:    #16a34a;
  --green-bg: #f0fdf4;
  --amber:    #d97706;
  --amber-bg: #fffbeb;
  --radius:   12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow:   0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .18);
  --shadow-lg: 0 4px 10px rgba(15, 23, 42, .07), 0 20px 44px -18px rgba(15, 23, 42, .28);
  --focus-ring: 0 0 0 3px rgba(13, 148, 136, .16);
  --nav-h:    60px;
  --sidebar-w: 232px;
  --sidebar-w-compact: 188px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

::selection { background: var(--teal-500); color: #fff; }

a { color: var(--teal-700); }

:focus-visible {
  outline: 2px solid var(--teal-600);
  outline-offset: 2px;
}

.app-loading {
  padding: 48px;
  text-align: center;
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* Shell                                                               */
/* ------------------------------------------------------------------ */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(184deg, #111c33 0%, var(--ink) 55%, var(--teal-800) 180%);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 2px 0 18px -10px rgba(0, 0, 0, .35);
}
.brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand b { display: block; color: #fff; font-size: 17px; letter-spacing: .2px; }
.brand span { font-size: 12px; color: #94a3b8; }

.nav { padding: 10px; flex: 1; overflow-y: auto; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 2px;
  border-radius: 9px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 14px;
  position: relative;
  transition: background-color .12s ease, color .12s ease;
}
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.active {
  background: linear-gradient(90deg, var(--teal-600), var(--teal-500) 160%);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 16px -6px rgba(13, 148, 136, .6);
}
.nav .nav-group {
  padding: 14px 12px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #64748b;
}

.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 13px; }
.sidebar-foot .who { color: #fff; font-weight: 600; }
.sidebar-foot .role { color: #94a3b8; font-size: 12px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 0 rgba(15, 23, 42, .03), 0 6px 16px -14px rgba(15, 23, 42, .3);
}
.topbar h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -.1px; }
.topbar .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.content { padding: 22px; flex: 1; max-width: 1180px; width: 100%; }

.bottom-nav { display: none; }

/* Tablet: a narrower, tighter sidebar instead of jumping straight from the
   full 232px desktop rail to the phone bottom-nav — landscape tablets and
   small laptop windows get their own step. */
@media (max-width: 1100px) and (min-width: 861px) {
  .sidebar { width: var(--sidebar-w-compact); flex-basis: var(--sidebar-w-compact); }
  .brand { padding: 16px 14px 12px; }
  .brand b { font-size: 15.5px; }
  .brand span { font-size: 11px; }
  .nav a { padding: 9px 10px; font-size: 13.3px; gap: 8px; }
  .content { padding: 18px; }
}

@media (max-width: 860px) {
  .sidebar { display: none; }
  .content { padding: 14px; padding-bottom: calc(var(--nav-h) + 24px); }
  .topbar { padding: 12px 14px; }
  .topbar h1 { font-size: 17px; }
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--card);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 20px -16px rgba(15, 23, 42, .4);
    z-index: 30;
  }
  .bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--muted);
    font-size: 11px;
    position: relative;
    transition: color .12s ease;
  }
  .bottom-nav a.active { color: var(--teal-700); font-weight: 600; }
  .bottom-nav a.active::before {
    content: "";
    position: absolute;
    top: 0; left: 50%;
    width: 26px; height: 3px;
    transform: translateX(-50%);
    border-radius: 0 0 4px 4px;
    background: var(--teal-600);
  }
  .bottom-nav .ico { font-size: 19px; line-height: 1; }
}

/* ------------------------------------------------------------------ */
/* Cards, tables, forms                                                */
/* ------------------------------------------------------------------ */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.card-head h2 { margin: 0; font-size: 15.5px; font-weight: 650; }
.card-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) {
  .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 460px) {
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .grid.keep2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.field { display: block; margin-bottom: 12px; }
.field > label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 5px;
}
.field .req { color: var(--red); }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

input, select, textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal-600);
  box-shadow: var(--focus-ring);
}
input[readonly] { background: #f8fafc; color: var(--muted); }
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
textarea.mono {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
}
.field.error input, .field.error select, .field.error textarea { border-color: var(--red); }
.field .err { color: var(--red); font-size: 11.5px; margin-top: 4px; }

@media (max-width: 460px) {
  input, select, textarea { padding: 11px 12px; font-size: 16px; } /* 16px stops iOS auto-zoom on focus */
  .field { margin-bottom: 14px; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--teal-700);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .12s ease, box-shadow .12s ease, transform .06s ease;
}
.btn:hover { background: var(--teal-600); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #b91c1c; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row.end { justify-content: flex-end; }
.btn-row.between { justify-content: space-between; }

@media (max-width: 460px) {
  .btn { padding: 11px 16px; min-height: 44px; }
  .btn.sm { min-height: 38px; }
}

.table-wrap { overflow-x: auto; overflow-y: auto; max-height: 70vh; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left;
  padding: 10px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
td { padding: 11px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tbody tr:nth-child(even) { background: #fafbfc; }
tbody tr:hover { background: var(--teal-50); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-link { cursor: pointer; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
}
.pill.ok   { background: var(--green-bg); color: var(--green); }
.pill.warn { background: var(--amber-bg); color: var(--amber); }
.pill.bad  { background: var(--red-bg);   color: var(--red); }

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  transition: box-shadow .15s ease, transform .15s ease;
}
.stat:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.stat .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .foot { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); animation: fade-in .2s ease-out; }
.empty .big { font-size: 30px; margin-bottom: 8px; }

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.filters .field { margin-bottom: 0; min-width: 140px; flex: 1 1 140px; }
.filters .field.grow { flex: 2 1 220px; }

.note {
  padding: 11px 13px;
  border-radius: 9px;
  font-size: 13px;
  border: 1px solid;
  margin-bottom: 14px;
}
.note.info { background: var(--teal-50); border-color: #99f6e4; color: #115e59; }
.note.warn { background: var(--amber-bg); border-color: #fde68a; color: #92400e; }
.note.bad  { background: var(--red-bg);   border-color: #fecaca; color: #991b1b; }
.note.ok   { background: var(--green-bg); border-color: #bbf7d0; color: #166534; }

/* ------------------------------------------------------------------ */
/* Login                                                               */
/* ------------------------------------------------------------------ */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 15% 15%, rgba(20, 184, 166, .25), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(15, 118, 110, .3), transparent 50%),
    linear-gradient(160deg, #134e4a 0%, #0f172a 100%);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .5);
  animation: rise .28s ease-out;
}
.login-card .logo { font-size: 32px; text-align: center; }
.login-card h1 { margin: 6px 0 2px; font-size: 22px; text-align: center; }
.login-card .tag { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-hint {
  margin-top: 18px;
  padding: 11px;
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 9px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
.login-hint code { color: var(--ink-2); font-weight: 700; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade-in { from { opacity: 0; } }

/* ------------------------------------------------------------------ */
/* Create-order wizard                                                 */
/* ------------------------------------------------------------------ */

.steps { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.steps .step {
  flex: 1 1 120px;
  padding: 9px 10px;
  border-radius: 9px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: border-color .15s ease, color .15s ease;
}
.steps .step b {
  width: 21px; height: 21px;
  border-radius: 50%;
  background: #e2e8f0;
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 11.5px;
  flex: 0 0 auto;
  transition: background-color .15s ease, color .15s ease;
}
.steps .step.active { border-color: var(--teal-600); color: var(--teal-700); font-weight: 650; }
.steps .step.active b { background: var(--teal-700); color: #fff; }
.steps .step.done b { background: var(--green); color: #fff; }

.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 6px; }
.choice button {
  padding: 16px 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color .12s ease, background-color .12s ease, box-shadow .12s ease;
}
.choice button b { display: block; font-size: 15px; margin-bottom: 3px; }
.choice button span { font-size: 12.5px; color: var(--muted); }
.choice button.on { border-color: var(--teal-600); background: var(--teal-50); box-shadow: var(--focus-ring); }
.choice button.on b { color: var(--teal-700); }
@media (max-width: 460px) { .choice { grid-template-columns: 1fr; } }

.review dl { margin: 0; display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: 13.5px; }
.review dt { color: var(--muted); font-weight: 600; }
.review dd { margin: 0; }
@media (max-width: 520px) { .review dl { grid-template-columns: 110px 1fr; } }

/* WhatsApp message preview bubble */
.wa-preview {
  background: #dcf8c6;
  border: 1px solid #b9e39a;
  border-radius: 10px;
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13.5px;
  line-height: 1.6;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  max-height: 460px;
  overflow-y: auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5);
}
.wa-preview strong { font-weight: 700; }

/* ------------------------------------------------------------------ */
/* Tabs, modal, toasts                                                 */
/* ------------------------------------------------------------------ */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  overflow-x: auto;
}
.tabs button {
  padding: 9px 14px;
  border: none;
  background: none;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color .12s ease, border-color .12s ease;
}
.tabs button:hover { color: var(--ink-2); }
.tabs button.on { color: var(--teal-700); border-bottom-color: var(--teal-700); }

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(1.5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  animation: fade-in .15s ease-out;
}
.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .45);
  animation: rise .18s ease-out;
}
.modal .card-head { position: sticky; top: 0; background: #fff; border-radius: 14px 14px 0 0; }
.modal.wide { max-width: 720px; }

.toasts {
  position: fixed;
  top: 14px;
  right: 14px;
  left: 14px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .5);
  max-width: 460px;
  animation: pop .18s ease-out;
}
.toast.ok  { background: #166534; }
.toast.bad { background: #991b1b; }
@keyframes pop { from { opacity: 0; transform: translateY(-8px); } }

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

.switch { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; }
.switch input { width: auto; margin: 0; accent-color: var(--teal-700); width: 17px; height: 17px; }

@media print {
  .sidebar, .topbar, .bottom-nav, .btn, .filters { display: none !important; }
  .content { padding: 0; }
  .card { box-shadow: none; border: none; }
}
