@import url('https://fonts.googleapis.com/css2?family=Archivo:ital,wdth,wght@0,62..125,400..900;1,62..125,400..900&display=swap');

:root {
  --red: #e5112b;
  --red-deep: #b70b20;
  --red-soft: #fde8ea;
  --ink: #16171b;
  --ink-2: #4b4e57;
  --ink-3: #80838c;
  --line: #e7e3dd;
  --line-2: #f0ede8;
  --bg: #f6f4f0;
  --card: #ffffff;

  --st-pool: #c77700;      --st-pool-bg: #fff3dc;
  --st-assigned: #1d5fd6;  --st-assigned-bg: #e6efff;
  --st-picked: #6b3fd4;    --st-picked-bg: #efe8ff;
  --st-delivered: #0b8a5c; --st-delivered-bg: #e0f5ec;
  --st-failed: #c2410c;    --st-failed-bg: #ffeadf;
  --st-cancelled: #6b6f78; --st-cancelled-bg: #eeeeef;

  --r: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(22, 23, 27, .05), 0 6px 20px -12px rgba(22, 23, 27, .18);
  --font: 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg);
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--ink-3); }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.nowrap { white-space: nowrap; }

.logo-mark { height: 30px; width: auto; color: var(--red); display: block; }

/* Buttons */
.btn {
  --bc: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1.5px solid transparent;
  background: var(--card); color: var(--ink); font-weight: 650; font-size: 14px; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .15s, transform .08s, box-shadow .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--red); color: #fff; box-shadow: 0 6px 16px -8px rgba(229, 17, 43, .7); }
.btn.primary:hover { background: var(--red-deep); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.dark:hover { background: #000; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--card); border-color: #d8d3cb; }
.btn.danger { background: var(--st-failed); color: #fff; }
.btn.ok { background: var(--st-delivered); color: #fff; }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.lg { min-height: 52px; padding: 0 22px; font-size: 16px; }
.btn.block { width: 100%; }
.btn.icon { width: 40px; padding: 0; }
.btn svg { width: 18px; height: 18px; flex: none; }

/* Pills */
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 650; white-space: nowrap; letter-spacing: .01em;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-pool { color: var(--st-pool); background: var(--st-pool-bg); }
.st-assigned { color: var(--st-assigned); background: var(--st-assigned-bg); }
.st-picked { color: var(--st-picked); background: var(--st-picked-bg); }
.st-delivered { color: var(--st-delivered); background: var(--st-delivered-bg); }
.st-failed { color: var(--st-failed); background: var(--st-failed-bg); }
.st-cancelled { color: var(--st-cancelled); background: var(--st-cancelled-bg); }
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
}
.tag.urgent { background: var(--red); color: #fff; }
.tag.cod { background: var(--ink); color: #fff; }
.tag.soft { background: var(--line-2); color: var(--ink-2); }

/* Forms */
.field { display: grid; gap: 6px; }
.field > span, .label { font-size: 12.5px; font-weight: 650; color: var(--ink-2); letter-spacing: .01em; }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--r-sm); border: 1.5px solid var(--line);
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; font-size: 15px;
}
.field textarea { min-height: 76px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22, 23, 27, .08);
}
.check { display: flex; align-items: center; gap: 10px; font-weight: 550; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--red); }
.seg { display: inline-flex; background: var(--line-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: block; padding: 7px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 650; color: var(--ink-2); cursor: pointer; }
.seg input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.seg input:focus-visible + span { outline: 2px solid var(--ink); }

/* Dialog */
.dlg {
  border: 0; padding: 0; border-radius: 20px; width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  background: var(--card); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .4);
}
.dlg.wide { width: min(760px, calc(100vw - 24px)); }
.dlg::backdrop { background: rgba(18, 18, 22, .45); backdrop-filter: blur(3px); }
.dlg[open] { animation: dlg-in .22s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.dlg-body { padding: 22px; display: grid; gap: 16px; }
.dlg-body h3 { font-size: 20px; font-weight: 800; }
.dlg-body p { margin: 0; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding-top: 4px; }
@media (max-width: 560px) {
  .dlg { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 22px 22px 0 0; max-height: 92dvh; }
  .dlg[open] { animation: sheet-in .26s cubic-bezier(.2, .9, .3, 1); }
  .dlg-body { padding-bottom: calc(22px + var(--safe-b)); }
  .dlg-actions .btn { flex: 1; }
}
@keyframes sheet-in { from { transform: translateY(40%); opacity: .4; } }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px;
  z-index: 1000; pointer-events: none; transition: .22s; max-width: calc(100vw - 32px); box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .5);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--st-failed); }
.toast.ok { background: var(--st-delivered); }

.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty strong { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }

.spinner { width: 22px; height: 22px; border: 2.5px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Login screen (shared) */
.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 500px at 110% -10%, rgba(229, 17, 43, .16), transparent 60%),
    repeating-linear-gradient(-18deg, transparent 0 22px, rgba(229, 17, 43, .035) 22px 24px),
    var(--bg);
}
.login-card { width: min(400px, 100%); background: var(--card); border-radius: 22px; padding: 30px 26px; box-shadow: var(--shadow); display: grid; gap: 18px; }
.login-card .logo-mark { height: 42px; }
.login-card h1 { font-size: 22px; font-weight: 800; }
.login-card .err { color: var(--st-failed); font-weight: 600; font-size: 14px; min-height: 1em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Job types and order sources */
.st-pending { color: #a21caf; background: #fae8ff; }
.jt {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 7px; border-radius: 7px; font-size: 12px; font-weight: 800;
  letter-spacing: .02em; white-space: nowrap; vertical-align: middle;
}
.jt svg { width: 14px; height: 14px; flex: none; }
.jt-b2c { background: #e6efff; color: #1d4fb8; }
.jt-post { background: #fff1d6; color: #9a4a07; }
.jt-c2c { background: #dcf5e9; color: #0a7a51; }
.src { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; border: 1.5px solid; white-space: nowrap; }
.src-office { color: var(--ink-2); border-color: var(--line); }
.src-seller { color: #1d4fb8; border-color: #c7d9fb; }
.src-customer { color: #a21caf; border-color: #f0c6f6; }
