:root {
  /* Brand: blue (matches the client's own ERP admin panel) + gold (jewelry accent) */
  --brand-blue: #1c6ea4;
  --brand-blue-dark: #114a72;
  --gold: #b8902e;
  --gold-soft: #f4e6c2;
  --gold-dark: #8f6d1f;

  --bg: #f7f8fa;
  --surface: #ffffff;
  --ink: #1c2733;
  --muted: #63707d;
  --line: #e1e6ec;
  --accent: var(--gold);
  --accent-soft: var(--gold-soft);
  --user: #1c6ea4;
  --user-soft: #e2eef6;
  --employee: #8f6d1f;
  --employee-soft: #f4e6c2;
  --danger: #a13f3f;
  --danger-soft: #f5e3e3;
  --ok: #3f7a4f;
  --ok-soft: #e3f0e6;

  /* Neumorphic blue surface (logged-in app shell) — all shades of blue */
  --cream: #dbe7f2;
  --neu-light: rgba(255,255,255,0.7);
  --neu-dark: rgba(90,130,170,0.22);
  --neu-border: rgba(28,110,164,0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: linear-gradient(180deg, #f0f5f9 0%, #f7f8fa 240px);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.has-sidebar { background: var(--cream); }

/* ---- App shell (sidebar layout, logged-in pages) ---- */

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

.sidebar {
  width: 240px;
  flex: none;
  background: var(--cream);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 3px solid rgba(28,110,164,0.6);
  transition: width 0.2s ease, padding 0.2s ease;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-toggle {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--cream);
  border: 1.5px solid var(--neu-border);
  box-shadow: 2px 2px 4px var(--neu-dark), -2px -2px 4px var(--neu-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-blue);
  cursor: pointer;
  z-index: 5;
}
.sidebar-toggle:hover { box-shadow: 1px 1px 3px var(--neu-dark), -1px -1px 3px var(--neu-light); }
.sidebar-toggle svg { transition: transform 0.2s ease; }
.sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }
.toggle-icon-mobile { display: none; width: 18px; height: 18px; object-fit: contain; }

.sidebar-collapsible {
  display: flex;
  flex-direction: column;
  gap: 22px;
  flex: 1;
  min-height: 0;
}

/* ---- Collapsed state (desktop): ~2cm icon-only rail ---- */
.sidebar.collapsed { width: 168px; padding-left: 14px; padding-right: 14px; }
.sidebar.collapsed .sidebar-toggle {
  color: var(--gold-dark);
  border-color: var(--gold);
  box-shadow: inset 2px 2px 5px var(--neu-dark), inset -2px -2px 5px var(--neu-light);
}
.sidebar.collapsed .sidebar-top { flex-direction: column; gap: 14px; }
.sidebar.collapsed .sidebar-brand { justify-content: center; }

/* Nav keeps icon + name — only the brand subtitle, role chip label, and
   footer button label shrink away since those aren't needed to navigate. */
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .whoami .label,
.sidebar.collapsed .sidebar-footer form button .label,
.sidebar.collapsed .role-chip .label {
  display: none;
}
.sidebar.collapsed .role-chip { padding: 6px; width: 10px; height: 10px; align-self: center; }
.sidebar.collapsed .sidebar-footer .whoami,
.sidebar.collapsed .sidebar-footer form button.link { justify-content: center; }

.sidebar-brand { display: flex; align-items: center; gap: 10px; }
.brand-mark-box {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #ffffff;
  border: 1.5px solid #bcd6e8;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.12);
}
.sidebar-brand .mark-img { height: 32px; width: auto; object-fit: contain; flex: none; }
.sidebar-brand-name {
  font-family: Georgia, "Times New Roman", ui-serif, serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--brand-blue-dark);
  white-space: nowrap;
}
.sidebar-brand-sub { font-size: 11px; color: var(--muted); white-space: nowrap; }

.sidebar .role-chip {
  align-self: flex-start;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 100px;
  white-space: nowrap;
}
.role-chip.user { background: var(--user-soft); color: var(--user); }
.role-chip.employee { background: var(--employee-soft); color: var(--employee); }

.sidebar-nav { display: flex; flex-direction: column; gap: 10px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--brand-blue-dark);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--cream);
  border: 1.5px solid var(--neu-border);
  box-shadow: 3px 3px 6px var(--neu-dark), -3px -3px 6px var(--neu-light);
  transition: box-shadow 0.15s ease;
}
.sidebar-nav a svg { flex: none; }
.sidebar-nav a:hover {
  box-shadow: 2px 2px 4px var(--neu-dark), -2px -2px 4px var(--neu-light);
}
.sidebar-nav a.active {
  color: var(--gold-dark);
  border-color: var(--gold);
  box-shadow: inset 2px 2px 5px var(--neu-dark), inset -2px -2px 5px var(--neu-light);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(90,130,170,0.3);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-footer .whoami {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}
.sidebar-footer form button.link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  color: var(--muted);
  text-decoration: none;
  font-size: 12.5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-align: left;
  white-space: nowrap;
}
.sidebar-footer form button.link:hover { color: var(--danger); }

.main-area {
  flex: 1;
  min-width: 0;
}

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100% !important;
    height: auto;
    position: static;
    flex-direction: column;
    padding: 12px 16px !important;
    gap: 0;
    overflow: visible;
    border-right: none;
    border-bottom: 3px solid rgba(28,110,164,0.6);
  }

  /* Hamburger toggles a dropdown panel — hidden by default, no separate
     desktop/mobile JS needed, the same .collapsed class just means
     "menu open" here instead of "icon rail". */
  .sidebar-collapsible {
    display: none;
    gap: 16px;
    padding-top: 16px;
  }
  .sidebar.collapsed .sidebar-collapsible { display: flex; }

  .toggle-icon-desktop { display: none; }
  .toggle-icon-mobile { display: block; }

  /* Desktop's "collapsed = icon rail" styling must not leak into mobile,
     where the same class means "menu open" — header stays a fixed row. */
  .sidebar-top,
  .sidebar.collapsed .sidebar-top { flex-direction: row; gap: 10px; }
  .sidebar-brand,
  .sidebar.collapsed .sidebar-brand { justify-content: flex-start; }
  .sidebar-brand-text,
  .sidebar.collapsed .sidebar-brand-text { display: block; }
  .whoami .label,
  .sidebar.collapsed .whoami .label,
  .sidebar-footer form button .label,
  .sidebar.collapsed .sidebar-footer form button .label { display: inline; }
  .sidebar-footer .whoami,
  .sidebar.collapsed .sidebar-footer .whoami,
  .sidebar-footer form button.link,
  .sidebar.collapsed .sidebar-footer form button.link { justify-content: flex-start; }

  .sidebar .role-chip { align-self: flex-start; }
  .sidebar-nav { flex-direction: column; }
  .sidebar-footer {
    margin-top: 0;
    padding-top: 14px;
    border-top: 1px solid rgba(90,130,170,0.3);
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.page {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 40px 64px;
}

@media (max-width: 600px) {
  .page { padding: 20px 16px 40px; }
  .has-sidebar .card { padding: 18px; border-radius: 16px; }
  h1 { font-size: 20px; }
  h2 { font-size: 11px; }
  p.lede { font-size: 13px; margin-bottom: 20px; }
  table { font-size: 12.5px; }
  th, td { padding: 9px 10px; }
  .actions { flex-direction: column; align-items: stretch; }
  .actions button, .actions .btn { text-align: center; }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar a.btn-primary { margin-left: 0 !important; width: 100%; text-align: center; }
}

.page.narrow { max-width: 420px; padding-top: 80px; }

h1 {
  font-family: Georgia, "Times New Roman", ui-serif, serif;
  font-size: 25px;
  font-weight: 600;
  color: var(--brand-blue-dark);
  margin: 0 0 4px;
}
h2 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-blue);
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gold-soft);
}
p.lede { color: var(--muted); margin: 0 0 28px; font-size: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px;
  box-shadow: 0 1px 2px rgba(28,52,74,0.03), 0 8px 24px -14px rgba(28,52,74,0.15);
}

.has-sidebar .card {
  background: var(--cream);
  border: 1.5px solid var(--neu-border);
  border-radius: 20px;
  box-shadow: 5px 5px 12px var(--neu-dark), -5px -5px 12px var(--neu-light);
}

.stuck-sessions-card { margin-bottom: 20px; border-color: #e0a838; }
.stuck-sessions-card h2 { margin-top: 0; }
.stuck-session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(90,130,170,0.2);
}
.stuck-session-row:first-of-type { border-top: none; }
.stuck-session-row .hint { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) { .field-grid { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field label .req { color: var(--danger); }
.field input, .field select, .field textarea {
  padding: 9px 12px;
  border: 1.5px solid #d6e2ea;
  border-radius: 8px;
  font-size: 14px;
  background: #fbfcfd;
  color: var(--ink);
  font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(28,110,164,0.12);
}
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

.order-mode-tabs { display: flex; gap: 10px; margin-bottom: 16px; }
.order-mode-tab {
  padding: 10px 18px;
  border-radius: 100px;
  border: 1.5px solid var(--neu-border);
  background: var(--cream);
  color: var(--brand-blue-dark);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 2px 2px 5px var(--neu-dark), -2px -2px 5px var(--neu-light);
}
.order-mode-tab.active {
  background: linear-gradient(135deg, #2f8fd1 0%, #1c6ea4 100%);
  color: #fff;
  border-color: var(--brand-blue-dark);
  box-shadow: inset 2px 2px 5px rgba(0,0,0,0.25), inset -1px -1px 3px rgba(255,255,255,0.2);
}

.image-uploader { margin-bottom: 24px; }
.image-uploader .hint { font-size: 11px; font-weight: 400; color: var(--muted); }
.image-uploader-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.image-uploader-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.image-uploader-actions .btn:disabled { opacity: 0.5; cursor: not-allowed; }
.image-count { font-size: 12px; font-weight: 600; color: var(--muted); }
#voice-note-btn.recording { background: #dc2626; color: #fff; border-color: #dc2626; animation: voice-pulse 1.2s ease-in-out infinite; }
@keyframes voice-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

.image-previews { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.image-previews:empty { margin-top: 0; }
.image-thumb {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid #d6e2ea;
  background: #fbfcfd;
}
.image-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-thumb-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(20,20,20,0.65);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-thumb-remove:hover { background: rgba(0,0,0,0.85); }
.image-previews-existing .image-thumb { border-color: var(--neu-border); }

.has-sidebar .image-thumb { background: var(--cream); border-color: var(--neu-border); }

.has-sidebar .field label { color: #000; }
.has-sidebar .field input,
.has-sidebar .field select,
.has-sidebar .field textarea {
  background: var(--cream);
  border: 1.5px solid var(--neu-border);
  border-radius: 12px;
  box-shadow: inset 2px 2px 5px var(--neu-dark), inset -2px -2px 5px var(--neu-light);
  color: #000;
}
.has-sidebar .field input:focus,
.has-sidebar .field select:focus,
.has-sidebar .field textarea:focus {
  border-color: var(--brand-blue);
  box-shadow: inset 2px 2px 5px var(--neu-dark), inset -2px -2px 5px var(--neu-light), 0 0 0 2px rgba(28,110,164,0.2);
}

.actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

button, .btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 100px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: #fff;
  box-shadow: 0 3px 12px rgba(184,144,46,0.3);
}
.btn-primary:hover { box-shadow: 0 5px 16px rgba(184,144,46,0.4); transform: translateY(-1px); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { border-color: var(--brand-blue); color: var(--brand-blue); }
/* Looks locked, but stays clickable — a truly disabled button never fires
   a click event, so there'd be no way to warn the user what's missing. */
button[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
button[aria-disabled="true"]:hover { transform: none !important; box-shadow: none !important; }
.btn-ok {
  background: linear-gradient(135deg, #4a9159 0%, var(--ok) 100%);
  color: #fff;
  box-shadow: 0 3px 12px rgba(63,122,79,0.3);
}
.btn-ok:hover { box-shadow: 0 5px 16px rgba(63,122,79,0.4); transform: translateY(-1px); }
.btn-danger { background: var(--danger); color: #fff; }

.has-sidebar .btn-secondary {
  background: var(--cream);
  border: 1.5px solid var(--neu-border);
  box-shadow: 3px 3px 6px var(--neu-dark), -3px -3px 6px var(--neu-light);
}
.has-sidebar .btn-secondary:hover {
  box-shadow: 2px 2px 4px var(--neu-dark), -2px -2px 4px var(--neu-light);
  color: var(--brand-blue);
}
.has-sidebar button:active {
  box-shadow: inset 2px 2px 5px var(--neu-dark), inset -2px -2px 5px var(--neu-light) !important;
  transform: none !important;
}

.msg {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 20px;
  border: 1px solid transparent;
}
.msg.ok { background: var(--ok-soft); color: var(--ok); border-color: #c7e0cc; }
.msg.error { background: var(--danger-soft); color: var(--danger); border-color: #ecc; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); }
th {
  color: var(--brand-blue-dark);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f2f7fb;
  border-bottom: 1.5px solid #d6e2ea;
}
th:first-child { border-top-left-radius: 8px; }
th:last-child { border-top-right-radius: 8px; }
tr:hover td { background: var(--gold-soft); }
tr.clickable { cursor: pointer; }

.status-pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.status-draft { background: #eceff2; color: #667; }
.status-submitted { background: var(--user-soft); color: var(--user); }
.status-under_review { background: var(--accent-soft); color: var(--gold-dark); }
.status-ready_for_erp { background: #fff3cd; color: #8a6d1a; }
.status-synced { background: var(--ok-soft); color: var(--ok); }

.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.filter-bar input[type=date] {
  padding: 8px 12px;
  border: 1.5px solid #d6e2ea;
  border-radius: 8px;
  background: #fbfcfd;
  font-family: inherit;
}
.has-sidebar .filter-bar input[type=date] {
  background: var(--cream);
  border: 1.5px solid var(--neu-border);
  border-radius: 10px;
  box-shadow: inset 2px 2px 5px var(--neu-dark), inset -2px -2px 5px var(--neu-light);
}

.empty-state {
  color: var(--muted);
  font-size: 14px;
  padding: 48px 0;
  text-align: center;
  border: 1.5px dashed var(--line);
  border-radius: 10px;
}

/* ---- Order detail modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,30,40,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: var(--surface);
  border-radius: 14px;
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 26px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  position: relative;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover { color: var(--ink); }
.modal-box h2 { margin: 0 0 18px; padding-right: 28px; font-size: 18px; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
  margin-bottom: 18px;
}
.detail-grid dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 3px;
}
.detail-grid dd { margin: 0; font-size: 14px; }
.detail-grid .span-2 { grid-column: 1 / -1; }
.detail-images { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.detail-images img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.detail-note {
  font-size: 12.5px;
  color: var(--gold-dark);
  background: var(--gold-soft);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
}

/* ---- Login page ----
   Same visual language as the AI Cure login (glass card, animated blobs,
   pill inputs, 3D tilt, gradient button) but in the AI Driven blue+gold brand,
   and deliberately WITHOUT any Google Fonts / external CDN — this runs on
   shop tablets where we can't depend on the wifi reaching outside their LAN.
   System serif/sans stacks stand in for Noto Serif / DM Sans. */

.login-header {
  background: linear-gradient(to right, var(--brand-blue-dark) 0%, var(--brand-blue) 45%, #4a94c4 75%, #a9cfe6 100%);
  border-bottom: 3px solid var(--gold);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.login-header .mark-chip {
  height: 38px;
  width: 38px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.login-header .mark-img {
  height: 30px;
  width: auto;
  object-fit: contain;
}
.login-header .logo-text {
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  font-family: Georgia, "Times New Roman", ui-serif, serif;
}
.login-header .logo-text small {
  display: block;
  font-size: 11px;
  color: var(--gold-soft);
  font-weight: 400;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.page-center {
  min-height: calc(100vh - 63px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #eaf3fa 0%, #dcebf5 40%, #cfe4f2 100%);
  background-attachment: fixed;
}

.page-center::before, .page-center::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}
.page-center::before {
  width: 480px; height: 480px;
  background: radial-gradient(circle, #5c9bc4, #1c6ea4);
  top: -120px; left: -100px;
  animation: blob1 9s ease-in-out infinite alternate;
}
.page-center::after {
  width: 420px; height: 420px;
  background: radial-gradient(circle, #e8c874, #b8902e);
  bottom: -110px; right: -90px;
  animation: blob2 11s ease-in-out infinite alternate;
}
@media (prefers-reduced-motion: reduce) {
  .page-center::before, .page-center::after { animation: none; }
}
@keyframes blob1 { to { transform: translate(50px, 70px) scale(1.1); } }
@keyframes blob2 { to { transform: translate(-40px, -50px) scale(1.08); } }

.login-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
}

.login-card {
  background: #a0cbe9;
  border-radius: 20px;
  border: 2px solid #62b0e3;
  box-shadow:
    0 10px 44px rgba(17,74,114,0.28),
    0 2px 10px rgba(98,176,227,0.25);
  padding: 34px 32px;
}

@media (max-width: 400px) {
  .page-center { padding: 24px 12px; }
  .login-card { padding: 24px 18px; }
  .login-header { padding: 12px 16px; }
}

.login-card .logo-panel {
  background: #ffffff;
  border: 1px solid #bcd6e8;
  border-radius: 14px;
  padding: 18px 16px 14px;
  margin: -4px -4px 20px;
}

.card-logo-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.card-logo-img { height: 64px; width: 64px; object-fit: contain; flex: none; }
.card-logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.card-logo-name {
  font-family: Georgia, "Times New Roman", ui-serif, serif;
  font-weight: 700;
  font-size: 24px;
  color: var(--brand-blue-dark);
}
.card-logo-sub { font-size: 12px; color: var(--brand-blue); letter-spacing: 0.02em; }

.login-card .card-logo {
  display: block;
  width: 190px;
  max-width: 80%;
  height: auto;
  margin: 0 auto;
}

.card-heading { text-align: center; margin-bottom: 26px; }
.card-heading p { font-size: 13px; color: #000; margin: 0; }
.card-divider {
  width: 44px;
  height: 3px;
  background: linear-gradient(to right, var(--brand-blue), var(--gold));
  border-radius: 4px;
  margin: 10px auto 0;
}

.login-card .field label {
  color: #000;
  letter-spacing: 0.02em;
}
.login-card .field input {
  border-radius: 50px;
  padding: 12px 20px;
  border: 1.5px solid var(--brand-blue);
  background: #f2f7fb;
}
.login-card .field input:focus {
  border-color: var(--brand-blue);
  background: #f2f7fb;
  box-shadow: none;
  outline: none;
}

.password-field { position: relative; display: flex; }
.password-field input { width: 100%; padding-right: 46px !important; }
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--brand-blue);
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
}
.password-toggle:hover { background: rgba(28,110,164,0.08); }

.login-card button[type="submit"] {
  width: 100%;
  background: linear-gradient(135deg, #2f8fd1 0%, #1c6ea4 100%);
  color: #fff;
  border-radius: 50px;
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 16px rgba(28,110,164,0.35);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.login-card button[type="submit"]:hover {
  box-shadow: 0 6px 20px rgba(28,110,164,0.45);
  transform: translateY(-1px);
}
.login-card button[type="submit"]:focus,
.login-card button[type="submit"]:active {
  outline: none;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(28,110,164,0.35);
  transform: none;
}

.login-card .role-hint {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: #000;
  text-align: center;
  font-family: Georgia, "Times New Roman", ui-serif, serif;
}

/* Inline "send another code" action that has to sit inside its own form */
.link-button {
  background: none; border: none; padding: 0;
  color: var(--brand-blue); font: inherit; text-decoration: underline; cursor: pointer;
}

/* Search row on the customers list */
.filter-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filter-row .field { margin-bottom: 0; }

/* ---- Dynamic UI layer ---- */
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
.page, .main-area > .card { animation: page-in .35s ease both; }
.card { transition: box-shadow .2s ease, transform .2s ease; }
tr.clickable { transition: background .15s ease, transform .15s ease; }
tr.clickable:hover { background: var(--user-soft); }
.btn { transition: transform .12s ease, box-shadow .2s ease, filter .2s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.05); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.98); }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite;
}
.live-search {
  flex: 1; min-width: 180px; max-width: 320px; padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.live-search:focus { outline: none; border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(28,110,164,.15); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: var(--brand-blue); }
.chip.active { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff; }
.result-count { color: var(--muted); font-size: 13px; }
#new-orders-bar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 10px 14px;
  background: var(--ok-soft); border-radius: 10px; animation: page-in .3s ease both;
}
#new-orders-bar[hidden] { display: none; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { padding: 10px 16px; border-radius: 10px; background: var(--ink); color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.2); animation: page-in .25s ease both; transition: opacity .3s; }
.toast.error { background: var(--danger); }
.toast.out { opacity: 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.profile-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--neu-border); }
.profile-card .avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-blue); color: #fff; display: grid; place-items: center; font-weight: 600; }
.profile-text { min-width: 0; }
.profile-name, .profile-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-name { font-weight: 600; font-size: 14px; }
.profile-sub { font-size: 12px; color: var(--muted); }
.sidebar.collapsed .profile-text { display: none; }

/* ---- Deeper-blue, curved sidebar ---- */
@media (min-width: 761px) {
  body.has-sidebar .app-shell { padding: 12px 0 12px 12px; gap: 0; }
  body.has-sidebar .sidebar {
    height: calc(100vh - 24px);
    top: 12px;
    border: none;
    border-radius: 28px;
    background: linear-gradient(170deg, #2f86bf 0%, #1c6ea4 45%, #114a72 100%);
    box-shadow: 8px 10px 28px rgba(17,74,114,.35), inset 0 1px 0 rgba(255,255,255,.25);
  }
}
.sidebar .sidebar-brand-name { color: #fff; }
.sidebar .sidebar-brand-sub { color: rgba(255,255,255,.75); }
.sidebar .sidebar-toggle { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.35); color: #fff; box-shadow: none; }
.sidebar .sidebar-toggle img { filter: brightness(0) invert(1); }
.sidebar .sidebar-nav a {
  background: rgba(255,255,255,.10); color: #fff; border: 1px solid rgba(255,255,255,.18);
  border-radius: 16px; box-shadow: none; transition: background .2s, transform .2s;
}
.sidebar .sidebar-nav a:hover { background: rgba(255,255,255,.22); transform: translateX(3px); box-shadow: none; }
.sidebar .sidebar-nav a.active { background: #fff; color: var(--brand-blue-dark); border-color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.18); }
.sidebar .profile-card { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); border-radius: 18px; color: #fff; }
.sidebar .profile-card .avatar { background: #fff; color: var(--brand-blue-dark); }
.sidebar .profile-sub { color: rgba(255,255,255,.75); }
.sidebar .sidebar-footer { border-top-color: rgba(255,255,255,.25); }
.sidebar .sidebar-footer form button.link { color: rgba(255,255,255,.85); }
.sidebar .sidebar-footer form button.link:hover { color: #ffd0d0; }

/* Sidebar: flush to the left edge, curves only on the right */
@media (min-width: 761px) {
  body.has-sidebar .app-shell { padding-left: 0; }
  body.has-sidebar .sidebar { border-radius: 0 28px 28px 0; }
}

/* Collapse button: clearly visible on the blue sidebar */
.sidebar .sidebar-toggle { width: 38px; height: 38px; border-radius: 12px; background: rgba(255,255,255,.22); border: 1.5px solid rgba(255,255,255,.6); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.sidebar .sidebar-toggle:hover { background: rgba(255,255,255,.35); }
.sidebar .sidebar-toggle svg { display: block; }
.sidebar.collapsed .sidebar-toggle svg { transform: none; }
.sidebar .sidebar-toggle .toggle-icon-mobile { width: 22px; height: 22px; }

/* Collapse button uses the supplied arrows icon on a white tile */
.sidebar .sidebar-toggle { background: #fff; border-color: #fff; }
.sidebar .sidebar-toggle:hover { background: #eaf3fa; }
.sidebar .sidebar-toggle .toggle-img { display: block; width: 26px; height: 26px; object-fit: contain; filter: none; transition: transform .2s ease; }
.sidebar.collapsed .sidebar-toggle .toggle-img { transform: rotate(180deg); }

/* Grey divider between the brand row and the profile card */
.sidebar .sidebar-top { padding-bottom: 18px; border-bottom: 1px solid #b8c0c8; }

/* Collapsed: show the "AI Driven" name under the logo */
@media (min-width: 761px) {
  .sidebar.collapsed .sidebar-brand { flex-direction: column; gap: 8px; text-align: center; }
  .sidebar.collapsed .sidebar-brand-text { display: block; }
  .sidebar.collapsed .sidebar-brand-sub { display: none; }
  .sidebar.collapsed .sidebar-brand-name { font-size: 14px; }
}

/* Collapsed rail: show both brand lines; small touches */
@media (min-width: 761px) {
  .sidebar.collapsed .sidebar-brand-sub { display: block; font-size: 10px; }
}
.profile-greet { font-size: 11px; color: rgba(255,255,255,.75); }
.profile-card .avatar { position: relative; }
.online-dot { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: #3ecf72; border: 2px solid #fff; }
.sidebar.collapsed .profile-card { justify-content: center; }

/* ---- Theme toggle button ---- */
#theme-toggle { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: none; cursor: pointer; padding: 0 0 12px; color: rgba(255,255,255,.85); font: inherit; font-size: 12.5px; white-space: nowrap; }
#theme-toggle:hover { color: #fff; }
.sidebar.collapsed #theme-toggle { justify-content: center; }
.sidebar.collapsed #theme-toggle .label { display: none; }

/* ---- Dashboard ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin: 18px 0; }
.stat-card { display: block; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--neu-border); border-radius: 18px; padding: 18px; box-shadow: 4px 4px 10px var(--neu-dark), -4px -4px 10px var(--neu-light); transition: transform .2s, box-shadow .2s; animation: page-in .4s ease both; }
.stat-card:hover { transform: translateY(-3px); }
.stat-num { font-size: 34px; font-weight: 700; color: var(--brand-blue); line-height: 1.1; }
.stat-card.warn .stat-num { color: var(--gold-dark); }
.stat-card.ok .stat-num { color: var(--ok); }
.stat-card.danger .stat-num { color: var(--danger); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .dash-cols { grid-template-columns: 1fr; } }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar { width: 100%; max-width: 38px; height: var(--h); min-height: 4px; border-radius: 10px 10px 4px 4px; background: linear-gradient(180deg, #2f86bf, #114a72); transform-origin: bottom; animation: grow .7s ease both; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.bar-val { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.bar-label { font-size: 12px; color: var(--muted); margin-top: 6px; }
.pending-list { list-style: none; margin: 0 0 12px; padding: 0; }
.pending-list a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 10px; text-decoration: none; color: inherit; transition: background .15s; }
.pending-list a:hover { background: var(--user-soft); }

/* ---- Order status timeline ---- */
.timeline { display: flex; justify-content: space-between; margin: 14px 0 22px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6%; right: 6%; top: 14px; height: 3px; background: var(--line); }
.tl-step { position: relative; flex: 1; text-align: center; font-size: 12px; color: var(--muted); }
.tl-dot { width: 30px; height: 30px; border-radius: 50%; margin: 0 auto 6px; background: var(--surface); border: 3px solid var(--line); display: grid; place-items: center; font-size: 13px; position: relative; z-index: 1; transition: all .3s; }
.tl-step.done { color: var(--ink); }
.tl-step.done .tl-dot { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff; }
.tl-step.current .tl-dot { box-shadow: 0 0 0 5px rgba(28,110,164,.2); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(28,110,164,.06); } }

/* ---- Drag & drop ---- */
.image-uploader { position: relative; border: 2px dashed transparent; border-radius: 16px; padding: 10px; transition: all .2s; }
.image-uploader.drag-over { border-color: var(--brand-blue); background: rgba(28,110,164,.08); }
.dropzone-hint { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 10px 0; padding: 22px; border: 2px dashed var(--neu-border); border-radius: 14px; color: var(--muted); font-size: 14px; cursor: pointer; transition: all .2s; }
.dropzone-hint:hover, .image-uploader.drag-over .dropzone-hint { border-color: var(--brand-blue); color: var(--brand-blue); background: rgba(28,110,164,.06); }
.image-thumb { animation: page-in .25s ease both; }
.image-thumb .thumb-name { display: block; font-size: 10px; color: var(--muted); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Dark mode (logged-in app shell) ---- */
:root[data-theme="dark"] {
  --bg: #0f1720; --surface: #17222e; --ink: #e6edf3; --muted: #93a4b5; --line: #2a3947;
  --cream: #0f1a25; --user-soft: #1c3247; --gold-soft: #3a3016; --danger-soft: #3d2222; --ok-soft: #1d3626;
  --neu-light: rgba(255,255,255,0.03); --neu-dark: rgba(0,0,0,0.45); --neu-border: rgba(98,176,227,0.25);
  --brand-blue: #4aa3dc; --brand-blue-dark: #cfe6f6; --gold-dark: #e0b955;
  color-scheme: dark;
}
:root[data-theme="dark"] body.has-sidebar { background: var(--cream); color: var(--ink); }
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .modal-box { background: var(--surface); color: var(--ink); border-color: var(--neu-border); }
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .live-search,
:root[data-theme="dark"] .chip { background: #101b26; color: var(--ink); border-color: var(--line); }
:root[data-theme="dark"] .btn-secondary { background: #1c2a38; color: var(--ink); border-color: var(--line); }
:root[data-theme="dark"] th { color: var(--muted); }
:root[data-theme="dark"] td, :root[data-theme="dark"] th { border-color: var(--line); }
:root[data-theme="dark"] h1, :root[data-theme="dark"] h2, :root[data-theme="dark"] .page h1 { color: #9fd0f0; }
:root[data-theme="dark"] .lede, :root[data-theme="dark"] .hint { color: var(--muted); }
:root[data-theme="dark"] .field label, :root[data-theme="dark"] label { color: var(--ink); }
:root[data-theme="dark"] .stat-card { background: var(--surface); color: var(--ink); }
:root[data-theme="dark"] .sidebar { background: linear-gradient(170deg, #1a4f74 0%, #0f3450 50%, #081f31 100%); }

/* ---- New order page ---- */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding: 26px 30px; margin-bottom: 18px; border-radius: 24px; color: #fff; background: linear-gradient(120deg, #1c6ea4 0%, #2f86bf 55%, #62b0e3 100%); box-shadow: 0 10px 28px rgba(28,110,164,.3); position: relative; overflow: hidden; animation: page-in .4s ease both; }
.hero::after { content: ""; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.12); }
.hero h1 { color: #fff !important; margin: 4px 0 6px; }
.hero .lede { color: rgba(255,255,255,.88); margin: 0; max-width: 520px; }
.hero-eyebrow { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
.hero-stats { display: flex; gap: 12px; position: relative; z-index: 1; }
.hero-stat { min-width: 96px; padding: 12px 16px; border-radius: 16px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); text-align: center; backdrop-filter: blur(4px); }
.hero-stat b { display: block; font-size: 26px; line-height: 1.1; }
.hero-stat span { font-size: 12px; opacity: .9; }
.steps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 0; margin: 0 0 18px; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--neu-border); animation: page-in .45s ease both; }
.steps li:nth-child(2) { animation-delay: .07s; } .steps li:nth-child(3) { animation-delay: .14s; }
.steps li > span { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--brand-blue); }
.steps b { display: block; font-size: 14px; } .steps small { color: var(--muted); font-size: 12px; }
.order-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.order-side { display: flex; flex-direction: column; gap: 16px; }
.side-card h2 { font-size: 16px; margin: 0 0 10px; }
.recent-list { list-style: none; margin: 0 0 8px; padding: 0; }
.recent-list a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 6px; border-radius: 10px; text-decoration: none; color: inherit; transition: background .15s; }
.recent-list a:hover { background: var(--user-soft); }
.recent-main b { display: block; font-size: 14px; } .recent-main small { color: var(--muted); font-size: 12px; }
.side-link { font-size: 13px; color: var(--brand-blue); text-decoration: none; font-weight: 600; }
.tips { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.tips-card { background: linear-gradient(160deg, var(--surface), var(--user-soft)); }
.sending { margin-top: 10px; font-size: 13px; color: var(--brand-blue); animation: pulse-text 1.4s infinite; }
@keyframes pulse-text { 50% { opacity: .45; } }
.dropzone-hint { padding: 42px 22px; font-size: 15px; background: rgba(28,110,164,.04); }
.dropzone-hint::before { content: "🖼️"; font-size: 30px; }
@media (max-width: 980px) { .order-layout { grid-template-columns: 1fr; } .steps { grid-template-columns: 1fr; } }
:root[data-theme="dark"] .steps li { background: var(--surface); }

/* Tips dropdown under the steps */
.tips-drop { margin: -6px 0 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--neu-border); overflow: hidden; }
.tips-drop summary { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; cursor: pointer; list-style: none; font-weight: 600; font-size: 14px; color: var(--brand-blue-dark); border-top: 2px solid var(--brand-blue); }
.tips-drop summary::-webkit-details-marker { display: none; }
.tips-drop summary:hover { background: var(--user-soft); }
.tips-drop .chev { width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .25s; }
.tips-drop[open] .chev { transform: rotate(-135deg); }
.tips-drop .tips { padding: 4px 18px 16px 38px; animation: page-in .25s ease both; }
.tips-drop .steps { margin: 10px 18px 6px; animation: page-in .25s ease both; }
.tips-drop .steps li { background: var(--user-soft); }
.tips-drop { margin-top: 0; }

/* Logged-in pages use the full width beside the sidebar (no empty gutter) */
@media (min-width: 761px) {
  body.has-sidebar .page:not(.narrow) { max-width: none; margin: 0; padding: 28px 28px 56px 24px; }
}
@media (min-width: 761px) {
  body.has-sidebar .page:not(.narrow) { padding-left: 1cm; padding-right: 1cm; }
}

/* Compact welcome banner (most users are on phones) */
.hero { padding: 14px 22px; margin-bottom: 12px; border-radius: 20px; gap: 12px; flex-wrap: nowrap; }
.hero h1 { font-size: 20px; margin: 2px 0 2px; }
.hero .lede { font-size: 13px; line-height: 1.35; }
.hero-stats { gap: 8px; flex: none; }
.hero-stat { min-width: 70px; padding: 6px 10px; border-radius: 12px; }
.hero-stat b { font-size: 18px; }
.hero-stat span { font-size: 11px; }
@media (max-width: 600px) {
  .hero { padding: 12px 14px; border-radius: 16px; }
  .hero .lede { display: none; }
  .hero h1 { font-size: 18px; }
  .hero-eyebrow { font-size: 10px; }
  .hero-stat { min-width: 58px; padding: 5px 8px; }
  .hero-stat b { font-size: 16px; }
  .hero-stat span { font-size: 10px; }
}

/* Simple, clear mode tabs */
.order-mode-tabs { gap: 8px; padding: 4px; width: fit-content; max-width: 100%; border-radius: 100px; background: rgba(28,110,164,.12); }
.order-mode-tab { box-shadow: none; background: transparent; border: none; color: var(--brand-blue-dark); padding: 9px 18px; font-size: 14px; transition: background .15s, color .15s; }
.order-mode-tab:hover { background: rgba(255,255,255,.55); }
.order-mode-tab.active { background: var(--brand-blue); color: #fff; border: none; box-shadow: none; }
:root[data-theme="dark"] .order-mode-tab { color: var(--ink); }
:root[data-theme="dark"] .order-mode-tab.active { color: #fff; }
@media (max-width: 420px) { .order-mode-tab { padding: 9px 12px; font-size: 13px; } }

#order-mode-hint { color: #000; font-weight: 500; }
:root[data-theme="dark"] #order-mode-hint { color: var(--ink); }

/* "+" tile shown after the first photo is added */
.image-thumb.image-add { display: grid; place-items: center; border: 2px dashed var(--brand-blue); background: rgba(28,110,164,.06); color: var(--brand-blue); cursor: pointer; transition: background .15s, transform .15s; }
.image-thumb.image-add span { font-size: 34px; line-height: 1; font-weight: 300; }
.image-thumb.image-add:hover { background: rgba(28,110,164,.15); transform: translateY(-2px); }

/* Upload status: its own row under the buttons, with a soft slide-in and progress bar */
.actions { flex-wrap: wrap; }
.sending { flex: 0 0 100%; order: 10; display: flex; flex-direction: column; gap: 8px; margin-top: 14px; padding: 12px 16px; border-radius: 14px; background: rgba(28,110,164,.1); border: 1px solid var(--neu-border); color: var(--brand-blue-dark); font-size: 14px; font-weight: 500; user-select: none; animation: sending-in .35s ease both; }
.sending::after { content: ""; display: block; height: 4px; border-radius: 4px; background: linear-gradient(90deg, transparent, var(--brand-blue), transparent) 0 0 / 50% 100% no-repeat, rgba(28,110,164,.15); animation: sending-bar 1.3s ease-in-out infinite; }
@keyframes sending-in { from { opacity: 0; transform: translateY(-8px); max-height: 0; } to { opacity: 1; transform: none; max-height: 90px; } }
@keyframes sending-bar { from { background-position: -50% 0, 0 0; } to { background-position: 150% 0, 0 0; } }
.sending { order: -1; margin: 0 0 8px; }

/* Live microphone panel */
.mic-panel { display: flex; align-items: center; gap: 14px; margin: 12px 0; padding: 12px 16px; border-radius: 16px; background: #fdecec; border: 1px solid #f3b5b5; animation: sending-in .3s ease both; }
.mic-panel[hidden] { display: none; }
.mic-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: #dc2626; box-shadow: 0 0 0 0 rgba(220,38,38,.5); animation: mic-ring 1.2s infinite; }
@keyframes mic-ring { 70% { box-shadow: 0 0 0 12px rgba(220,38,38,0); } 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); } }
.mic-text b { display: block; font-size: 14px; color: #7f1d1d; }
.mic-text small { font-size: 12px; color: #a15555; }
.mic-bars { flex: 1; display: flex; align-items: center; justify-content: center; gap: 3px; height: 34px; min-width: 60px; }
.mic-bars i { display: block; flex: 1; max-width: 6px; height: 100%; border-radius: 3px; background: #dc2626; transform: scaleY(.12); transition: transform .08s linear; }
.mic-time { font-variant-numeric: tabular-nums; font-weight: 700; color: #7f1d1d; }
@media (max-width: 480px) { .mic-bars { display: none; } }
:root[data-theme="dark"] .mic-panel { background: #3a1f1f; border-color: #6b2b2b; }
:root[data-theme="dark"] .mic-text b, :root[data-theme="dark"] .mic-time { color: #ffc9c9; }
:root[data-theme="dark"] .mic-text small { color: #e0a0a0; }

/* Order source badges */
.src-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--user-soft); color: var(--brand-blue-dark); }
.src-badge.src-whatsapp { background: #dcf8e6; color: #167a3e; }
.src-badge.src-staff { background: var(--gold-soft); color: var(--gold-dark); }
:root[data-theme="dark"] .src-badge.src-whatsapp { background: #16351f; color: #6fdc98; }

/* AI impact card */
.impact-card { margin-bottom: 16px; background: linear-gradient(135deg, var(--surface), var(--user-soft)); }
.impact-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 6px 0 16px; }
.impact-big b { display: block; font-size: 36px; line-height: 1.1; color: var(--brand-blue); }
.impact-big span { font-size: 13px; color: var(--muted); }
.source-split { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--line); }
.seg { display: block; min-width: 0; transition: flex .6s ease; }
.seg-web { background: #2f86bf; } .seg-wa { background: #25d366; } .seg-staff { background: var(--gold); }
.source-legend { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0; font-size: 13px; color: var(--muted); }
.source-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }

/* Customer order actions, cancelled state, change requests */
.status-cancelled { background: #eceff2; color: #6b7280; text-decoration: line-through; }
.order-actions { display: flex; flex-direction: column; gap: 12px; margin: 14px 0 18px; padding: 14px; border-radius: 14px; background: var(--user-soft); }
.change-form { display: flex; flex-direction: column; gap: 8px; }
.change-form label { font-weight: 600; font-size: 13px; }
.change-form textarea { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); font: inherit; resize: vertical; }
.btn-danger-outline { color: var(--danger) !important; border-color: var(--danger) !important; }
.cancelled-note { flex: 1; text-align: center; padding: 10px; border-radius: 10px; background: #eceff2; color: #6b7280; font-weight: 600; }
.change-badge { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--gold-soft); color: var(--gold-dark); white-space: nowrap; }
.change-requests { margin-bottom: 16px; }
.change-item { padding: 10px 12px; margin: 8px 0; border-radius: 10px; border-left: 4px solid var(--line); background: var(--user-soft); }
.change-item.unseen { border-left-color: var(--gold); background: var(--gold-soft); }
.change-item p { margin: 4px 0 0; white-space: pre-wrap; }

/* Live tracker inside the My Orders table */
.track { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.track-dots { display: inline-flex; align-items: center; gap: 4px; }
.track-dots i { display: block; width: 14px; height: 6px; border-radius: 3px; background: var(--line); transition: background .4s; }
.track-dots i.done { background: var(--brand-blue); }
.track-dots i.now { background: var(--brand-blue); animation: pulse-text 1.4s infinite; }
.track-label { font-size: 13px; color: var(--brand-blue-dark); }

/* Photo viewer */
img[data-zoom] { cursor: zoom-in; transition: transform .15s; }
img[data-zoom]:hover { transform: scale(1.04); }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(8,16,24,.92); display: flex; align-items: center; justify-content: center; animation: page-in .2s ease both; }
.lightbox[hidden] { display: none; }
body.lb-active { overflow: hidden; }
.lb-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; color: #fff; z-index: 2; }
.lb-actions { display: flex; gap: 10px; align-items: center; }
.lb-btn { color: #fff; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3); border-radius: 999px; padding: 8px 16px; font: inherit; font-size: 14px; text-decoration: none; cursor: pointer; }
.lb-btn:hover { background: rgba(255,255,255,.3); }
.lb-close { font-size: 22px; line-height: 1; padding: 4px 14px; }
.lb-stage { max-width: 92vw; max-height: 82vh; overflow: auto; display: flex; }
.lb-stage img { margin: auto; max-width: 92vw; max-height: 82vh; object-fit: contain; border-radius: 8px; cursor: zoom-in; transition: none; transform: none !important; }
.lightbox.zoomed .lb-stage img { max-width: none; max-height: none; cursor: zoom-out; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.16); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; z-index: 2; }
.lb-nav:hover { background: rgba(255,255,255,.3); }
.lb-prev { left: 16px; } .lb-next { right: 16px; }
.lightbox.single .lb-nav { display: none; }
@media (max-width: 600px) { .lb-newtab { display: none; } .lb-btn { padding: 7px 12px; font-size: 13px; } .lb-nav { width: 40px; height: 40px; } }

/* Daily report */
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.report-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.day-list { display: flex; flex-direction: column; gap: 10px; }
.day-card { background: var(--surface); border: 1px solid var(--neu-border); border-radius: 16px; overflow: hidden; animation: page-in .3s ease both; }
.day-card summary { display: flex; align-items: center; gap: 16px; padding: 14px 18px; cursor: pointer; list-style: none; flex-wrap: wrap; }
.day-card summary::-webkit-details-marker { display: none; }
.day-card summary:hover { background: var(--user-soft); }
.day-date { font-weight: 700; min-width: 170px; color: var(--brand-blue-dark); }
.today-tag { font-style: normal; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--brand-blue); color: #fff; margin-left: 6px; }
.day-count { min-width: 90px; }
.day-count b { font-size: 20px; color: var(--brand-blue); }
.day-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.day-card .chev { width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .25s; margin-left: auto; }
.day-card[open] .chev { transform: rotate(-135deg); }
.day-body { padding: 4px 18px 16px; border-top: 1px solid var(--line); animation: page-in .25s ease both; }
.day-actions { margin: 12px 0 0; }
:root[data-theme="dark"] .day-card { background: var(--surface); }
@media (max-width: 600px) { .day-date { min-width: 0; width: 100%; } }

/* Customer detail */
.customer-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.customer-head h1 { margin: 0; }
.customer-head .lede { margin: 2px 0 0; }
.customer-avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--brand-blue); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 700; flex: none; }
.customer-stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.customer-more { margin: -6px 0 14px; }

/* Customer cards */
.customer-search { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; align-items: center; }
.customer-search .live-search { max-width: 380px; }
.customer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.customer-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--neu-border); border-radius: 20px; box-shadow: 4px 4px 12px var(--neu-dark), -4px -4px 12px var(--neu-light); transition: transform .2s, box-shadow .2s; animation: page-in .35s ease both; }
.customer-card:hover { transform: translateY(-3px); }
.customer-card header { display: flex; gap: 12px; align-items: center; }
.customer-id { min-width: 0; }
.customer-id h3 { margin: 0; font-size: 17px; }
.customer-id h3 a { color: var(--brand-blue-dark); text-decoration: none; }
.customer-id h3 a:hover { text-decoration: underline; }
.customer-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-phone { font-size: 13px; font-variant-numeric: tabular-nums; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-stats > div { text-align: center; padding: 8px 4px; border-radius: 12px; background: var(--user-soft); }
.mini-stats b { display: block; font-size: 20px; color: var(--brand-blue); }
.mini-stats .ok b { color: var(--ok); } .mini-stats .warn b { color: var(--gold-dark); }
.mini-stats span { font-size: 11px; color: var(--muted); }
.order-ids-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.order-id-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.id-chip { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; text-decoration: none; transition: transform .12s, box-shadow .12s; }
.id-chip:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.id-chip.id-more { background: var(--line); color: var(--muted); font-weight: 600; }
.customer-card footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }

/* Order cards (staff Orders page) */
.order-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.order-card { position: relative; background: var(--surface); border: 1px solid var(--neu-border); border-left: 6px solid var(--line); border-radius: 18px; padding: 14px 16px 16px; cursor: pointer; box-shadow: 3px 3px 10px var(--neu-dark), -3px -3px 10px var(--neu-light); transition: transform .18s, box-shadow .18s; animation: page-in .3s ease both; }
.order-card:hover, .order-card:focus-visible { transform: translateY(-3px); outline: none; box-shadow: 0 8px 22px rgba(17,74,114,.2); }
.order-card[hidden] { display: none; }
.order-card header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.order-no { font-size: 20px; font-weight: 800; color: var(--brand-blue-dark); }
.order-when { font-size: 13px; color: var(--muted); flex: 1; }
.order-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 0; }
.order-fields dt { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.order-fields dd { margin: 2px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.status-edge-submitted { border-left-color: #2f86bf; }
.status-edge-under_review { border-left-color: var(--gold); }
.status-edge-ready_for_erp { border-left-color: #e0a800; }
.status-edge-synced { border-left-color: var(--ok); }
.status-edge-cancelled { border-left-color: #9ca3af; opacity: .8; }
@media (max-width: 600px) { .order-cards { grid-template-columns: 1fr; } }

/* Orders table: every row is its own clearly outlined box */
#orders-table { border-collapse: separate; border-spacing: 0 10px; }
#orders-table tbody td { border-top: 1.5px solid #3a86b8; border-bottom: 1.5px solid #3a86b8; background: rgba(255,255,255,.55); padding-top: 14px; padding-bottom: 14px; }
#orders-table tbody td:first-child { border-left: 1.5px solid #3a86b8; border-radius: 12px 0 0 12px; }
#orders-table tbody td:last-child { border-right: 1.5px solid #3a86b8; border-radius: 0 12px 12px 0; }
#orders-table tbody tr:hover td { background: var(--user-soft); border-color: var(--brand-blue-dark); }
#orders-table tbody tr[hidden] { display: none; }
:root[data-theme="dark"] #orders-table tbody td { border-color: #4aa3dc; background: rgba(255,255,255,.04); }

/* Search box with a magnifier icon */
.search-wrap { position: relative; display: block; flex: 1; min-width: 220px; max-width: 360px; margin: 0; }
.search-wrap .search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--brand-blue); pointer-events: none; }
.search-wrap .live-search { width: 100%; max-width: none; padding-left: 42px; }

/* Daily report: dates read clearly as openable sections */
.report-hint { margin: 4px 0 14px; padding: 10px 14px; border-radius: 12px; background: var(--user-soft); color: var(--brand-blue-dark); font-size: 14px; border: 1px dashed var(--brand-blue); }
.day-card { border: 1.5px solid #3a86b8; border-left: 6px solid var(--brand-blue); box-shadow: 3px 3px 10px var(--neu-dark), -3px -3px 10px var(--neu-light); transition: box-shadow .2s, transform .2s; }
.day-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(17,74,114,.18); }
.day-card[open] { border-left-color: var(--gold); }
.day-card summary { background: linear-gradient(90deg, var(--user-soft), transparent 70%); }
.view-btn { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--brand-blue); color: var(--brand-blue); font-weight: 600; font-size: 13px; white-space: nowrap; transition: background .2s, color .2s; }
.day-card summary:hover .view-btn { background: var(--brand-blue); color: #fff; }
.view-btn .lbl-hide, .day-card[open] .view-btn .lbl-show { display: none; }
.day-card[open] .view-btn .lbl-hide { display: inline; }
.day-card[open] .view-btn { background: var(--gold); border-color: var(--gold); color: #fff; }
.view-btn .chev { margin-left: 0; width: 8px; height: 8px; border-color: currentColor; }

/* Alerts, assignment, staff pages */
.alert-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0 0 12px; padding: 12px 16px; border-radius: 14px; background: #fdecec; border: 1.5px solid #e26b6b; color: #7f1d1d; animation: page-in .3s ease both; }
.alert-link { border: none; background: rgba(220,38,38,.12); color: #7f1d1d; font: inherit; font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.alert-link:hover { background: rgba(220,38,38,.25); }
.filter-note { margin: 0 0 10px; padding: 8px 14px; border-radius: 10px; background: var(--user-soft); font-size: 14px; }
.chip-alert { border-color: #e26b6b; color: #7f1d1d; }
.chip-alert.active { background: #dc2626; border-color: #dc2626; color: #fff; }
.flag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; margin-right: 4px; }
.flag-urgent { background: #dc2626; color: #fff; }
.flag-late { background: #fde7c3; color: #8a4b00; border: 1px solid #f0b866; }
.assignee { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--user-soft); font-size: 13px; font-weight: 600; }
.assignee.mine { background: var(--brand-blue); color: #fff; }
.assign-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 14px; padding: 12px 16px; border-radius: 14px; background: var(--user-soft); border: 1.5px solid var(--neu-border); }
.assign-bar.locked { background: #fff3cd; border-color: #e0a800; }
.assign-bar form { display: flex; gap: 8px; align-items: center; margin: 0; }
.assign-bar select { padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); font: inherit; background: var(--surface); }
.assign-who { font-weight: 600; }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.activity-list li:last-child { border-bottom: none; }
.activity-list time { color: var(--muted); min-width: 130px; font-size: 13px; }
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-top: 14px; }
.staff-card { padding: 16px; background: var(--surface); border: 1.5px solid var(--neu-border); border-radius: 18px; display: flex; flex-direction: column; gap: 12px; }
.staff-card.disabled { opacity: .6; }
.staff-card h3 { margin: 0; font-size: 17px; }
.staff-card .actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.staff-card form { margin: 0; }
.role-tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--gold-soft); color: var(--gold-dark); margin-left: 6px; }
.role-tag.off { background: #eceff2; color: #6b7280; }
.new-password { padding: 16px; border-radius: 14px; background: #e3f0e6; border: 1.5px solid #3f7a4f; margin-bottom: 16px; }
.new-password code { display: inline-block; padding: 6px 12px; border-radius: 8px; background: #fff; font-size: 18px; letter-spacing: .04em; user-select: all; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.form-grid .field { margin: 0; }
a.profile-card { text-decoration: none; color: inherit; transition: background .2s; }
a.profile-card:hover { background: rgba(255,255,255,.26); }
.plain-fieldset { border: none; margin: 0; padding: 0; min-width: 0; }
.plain-fieldset:disabled { opacity: .75; }

/* Collapsed sidebar (desktop): same width, icons only */
@media (min-width: 761px) {
  .sidebar.collapsed .sidebar-nav a .label { display: none; }
  .sidebar.collapsed .sidebar-nav a { justify-content: center; padding-left: 0; padding-right: 0; }
  .sidebar.collapsed .sidebar-nav a:hover { transform: none; }
  .sidebar.collapsed .sidebar-nav a svg { width: 22px; height: 22px; }
}

/* ---- Collapsed sidebar: rounded icon tiles, name pop-up, live badges ---- */
.nav-badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; box-shadow: 0 0 0 2px rgba(255,255,255,.35); animation: badge-pop .4s ease both; }
@keyframes badge-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.sidebar-nav a { position: relative; }

.nav-tip { position: fixed; z-index: 90; transform: translateY(-50%); padding: 7px 12px; border-radius: 10px; background: #0f2233; color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.3); animation: tip-in .15s ease both; }
.nav-tip::before { content: ""; position: absolute; left: -5px; top: 50%; width: 10px; height: 10px; background: inherit; transform: translateY(-50%) rotate(45deg); border-radius: 2px; }
.nav-tip[hidden] { display: none; }
@keyframes tip-in { from { opacity: 0; margin-left: -6px; } to { opacity: 1; margin-left: 0; } }

@media (min-width: 761px) {
  .sidebar.collapsed .sidebar-nav { align-items: center; gap: 14px; }
  .sidebar.collapsed .sidebar-nav a {
    width: 58px; height: 58px; padding: 0; border-radius: 18px; justify-content: center;
    background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22);
    transition: background .2s, transform .2s, box-shadow .2s;
  }
  .sidebar.collapsed .sidebar-nav a svg { width: 24px; height: 24px; }
  .sidebar.collapsed .sidebar-nav a:hover { background: rgba(255,255,255,.26); transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0,0,0,.22); }
  .sidebar.collapsed .sidebar-nav a.active { background: #fff; color: var(--brand-blue-dark); box-shadow: 0 0 0 4px rgba(255,255,255,.28), 0 8px 20px rgba(0,0,0,.25); }
  .sidebar.collapsed .nav-badge { position: absolute; top: -6px; right: -6px; margin: 0; min-width: 20px; height: 20px; font-size: 11px; }
  .sidebar.collapsed #theme-toggle, .sidebar.collapsed .sidebar-footer form button.link { justify-content: center; }
}

/* Smaller collapsed icon tiles */
@media (min-width: 761px) {
  .sidebar.collapsed .sidebar-nav { gap: 10px; }
  .sidebar.collapsed .sidebar-nav a { width: 42px; height: 42px; border-radius: 13px; }
  .sidebar.collapsed .sidebar-nav a svg { width: 20px; height: 20px; }
  .sidebar.collapsed .sidebar-nav a.active { box-shadow: 0 0 0 3px rgba(255,255,255,.28), 0 6px 14px rgba(0,0,0,.22); }
  .sidebar.collapsed .nav-badge { top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; font-size: 10px; }
}

/* Requests (staff) */
.request-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; margin-bottom: 8px; }
.request-card { background: var(--surface); border: 1.5px solid var(--neu-border); border-left: 6px solid var(--gold); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; animation: page-in .3s ease both; }
.request-card.kind-cancel { border-left-color: #dc2626; }
.request-card header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.req-kind { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--gold-soft); color: var(--gold-dark); }
.req-kind.req-cancel { background: #fdecec; color: #b91c1c; }
.req-order { font-weight: 800; color: var(--brand-blue-dark); text-decoration: none; }
.req-meta { font-size: 12px; color: var(--muted); margin-left: auto; }
.req-who { margin: 0; font-size: 14px; }
.change-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.change-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 4px 8px; }
.change-table td { padding: 8px; border-top: 1px solid var(--line); }
.change-table .was { color: var(--muted); text-decoration: line-through; }
.change-table .arrow { color: var(--muted); width: 24px; text-align: center; }
.change-table .now { font-weight: 700; color: var(--ok); }
.req-note { margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--user-soft); font-style: italic; }
.req-warn { margin: 0; padding: 8px 12px; border-radius: 10px; background: #fff3cd; color: #7a5a00; font-size: 13px; }
.req-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.req-actions form { margin: 0; }
.reject-form { display: flex; gap: 6px; flex: 1; min-width: 220px; }
.reject-form input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); font: inherit; background: var(--surface); }
.cancel-badge { background: #fdecec; color: #b91c1c; }
@media (max-width: 600px) { .request-grid { grid-template-columns: 1fr; } }

/* Customer: requests on My Orders */
.my-requests { margin: 12px 0; padding: 12px 14px; border-radius: 14px; background: var(--user-soft); }
.my-requests-title { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.my-request { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.my-request:first-of-type { border-top: none; }
.my-request-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.my-request-row { margin-top: 3px; }
.req-state { font-size: 13px; font-weight: 600; }
.req-state-pending { color: var(--gold-dark); } .req-state-approved { color: var(--ok); } .req-state-rejected { color: #b91c1c; }
.change-rows { display: flex; flex-direction: column; gap: 8px; }
.change-row { display: flex; gap: 8px; align-items: center; }
.change-row select, .change-row input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); font: inherit; background: var(--surface); }
.change-row-x { border: none; background: none; font-size: 20px; color: var(--muted); cursor: pointer; }

/* ---- Phones ---- */
@media (hover: none) { .dz-desktop { display: none; } }
@media (hover: hover) { .dz-touch { display: none; } }

@media (max-width: 760px) {
  /* The header block keeps the same deep-blue look as desktop, so its white text is readable. */
  body.has-sidebar .sidebar {
    background: linear-gradient(170deg, #2f86bf 0%, #1c6ea4 50%, #114a72 100%);
    border: none; border-radius: 0 0 22px 22px;
    box-shadow: 0 8px 22px rgba(17,74,114,.3);
  }
  .sidebar .sidebar-top { border-bottom-color: rgba(255,255,255,.3); }
  /* Here "collapsed" means "menu open": show names, not the desktop icon rail. */
  .sidebar.collapsed .profile-text { display: block; }
  .sidebar.collapsed #theme-toggle .label { display: inline; }
  .sidebar.collapsed #theme-toggle { justify-content: flex-start; width: auto; }
  .sidebar.collapsed .profile-card { justify-content: flex-start; }
  .sidebar-footer { border-top-color: rgba(255,255,255,.25) !important; }
  .sidebar-nav a .label { display: inline !important; }

  .search-wrap { flex: 1 1 100%; max-width: none; }
  .filter-bar { gap: 10px; }

  /* Tables become one card per row, so nothing needs sideways scrolling. */
  table.stack-mobile, .stack-mobile thead, .stack-mobile tbody, .stack-mobile tr, .stack-mobile td { display: block; width: 100%; }
  .stack-mobile thead { display: none; }
  .stack-mobile { border-spacing: 0 !important; }
  .stack-mobile tbody tr {
    border: 1.5px solid #3a86b8; border-radius: 14px; margin: 0 0 12px; padding: 6px 14px;
    background: rgba(255,255,255,.6);
  }
  .stack-mobile tbody td {
    display: flex; justify-content: space-between; align-items: center; gap: 14px; text-align: right;
    border: none !important; border-radius: 0 !important; background: transparent !important;
    padding: 7px 0 !important; min-width: 0;
  }
  .stack-mobile tbody td + td { border-top: 1px dashed var(--line) !important; }
  .stack-mobile tbody td::before {
    content: attr(data-label); flex: none; text-align: left; font-size: 11px; font-weight: 700;
    letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
  }
  .stack-mobile tbody td:not([data-label])::before { content: none; }
  .stack-mobile .track { justify-content: flex-end; }
  .stack-mobile .change-badge { margin-left: 0; }
  .table-scroll { overflow: visible; }
  .card:has(> .table-scroll > .stack-mobile), .card:has(> .stack-mobile) { background: transparent; box-shadow: none; border: none; padding: 0; }
}
.cell-val { display: inline; }
@media (max-width: 760px) {
  .stack-mobile .cell-val { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; text-align: right; min-width: 0; }
}

/* ---- Responsive hardening (most people use phones) ---- */
.filter-bar { flex-wrap: wrap; }
.request-grid { grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); }
.customer-grid, .staff-grid { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.order-cards { grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); }
.impact-row, .stat-grid { grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); }
img, video, svg { max-width: 100%; }
.card, .page, .request-card, .customer-card, .staff-card { min-width: 0; }
.msg, .req-note, .change-item p { overflow-wrap: anywhere; }

/* Easy-to-tap targets on phones and tablets */
@media (max-width: 900px), (pointer: coarse) {
  .role-hint a, .side-link, .customer-id h3 a, .req-order, .link-inline { display: inline-block; padding: 12px 6px; }
  .chip { min-height: 40px; padding: 9px 16px; }
  .id-chip { min-height: 34px; padding: 7px 12px; display: inline-flex; align-items: center; }
  .order-mode-tab { min-height: 42px; }
  .alert-link { min-height: 38px; }
  .btn, button.btn-primary, button.btn-secondary, .btn-sm { min-height: 42px; }
  .filter-bar input[type=date], .live-search, .search-wrap input { min-height: 42px; }
  .sidebar-nav a { min-height: 46px; }
  input[type=text], input[type=search], input[type=number], input[type=password], input[type=tel], select, textarea { font-size: 16px; } /* stops iOS zooming in on focus */
}
@media (max-width: 400px) {
  .page { padding-left: 14px !important; padding-right: 14px !important; }
  .hero { padding: 12px !important; }
  .req-meta { margin-left: 0; width: 100%; }
}

/* Order form: columns may shrink, so nothing pokes out of a narrow screen */
.form-grid-2, .grid-2, form .row { min-width: 0; }
select, input, textarea { max-width: 100%; min-width: 0; }
.password-toggle { width: 40px; height: 40px; right: 4px; }
.id-chip { min-height: 36px; }
@media (min-width: 601px) { .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Login: the small print uses the app's font, not the browser default */
.login-card p, .login-card a, .role-hint, .role-hint a { font-family: inherit; }
.role-hint a { color: var(--brand-blue); font-weight: 600; }

/* Change rows: dropdown and value each get a full line on a phone */
@media (max-width: 600px) {
  .change-row { display: grid; grid-template-columns: 1fr 40px; gap: 8px; align-items: stretch; padding: 8px 0; border-top: 1px dashed var(--line); }
  .change-row:first-child { border-top: none; }
  .change-row select[name=field], .change-row [name=value] { grid-column: 1; width: 100%; min-height: 44px; }
  .change-row-x { grid-column: 2; grid-row: 1 / 3; align-self: center; min-height: 44px; }
}

/* Dark mode: the phone "one card per row" tables need dark cards too */
:root[data-theme="dark"] .stack-mobile tbody tr { background: #17222e; border-color: #4aa3dc; }
:root[data-theme="dark"] .stack-mobile tbody td + td { border-top-color: #2a3947 !important; }

/* Dark mode: brighter status colors so every label stays readable on dark cards */
:root[data-theme="dark"] {
  --user: #8fd0ff; --danger: #ff9a9a; --ok: #7be3a4; --employee: #e0b955;
  --danger-soft: #472525; --ok-soft: #1d3a2a; --gold-soft: #3f3413;
}
:root[data-theme="dark"] .status-draft { background: #2b333c; color: #b9c4d0; }
:root[data-theme="dark"] .status-submitted { background: #1c3a55; color: #9bd6ff; }
:root[data-theme="dark"] .status-under_review { background: #4a3d12; color: #ffd866; }
:root[data-theme="dark"] .status-ready_for_erp { background: #5a4a12; color: #ffe08a; }
:root[data-theme="dark"] .status-synced { background: #1d3a2a; color: #86e8ad; }
:root[data-theme="dark"] .status-cancelled { background: #2b333c; color: #b9c4d0; }
:root[data-theme="dark"] .change-badge { background: #4a3d12; color: #ffd866; }
:root[data-theme="dark"] .change-badge.cancel-badge, :root[data-theme="dark"] .req-kind.req-cancel { background: #4a2626; color: #ffb3b3; }
:root[data-theme="dark"] .req-kind { background: #4a3d12; color: #ffd866; }
:root[data-theme="dark"] .assignee { background: #1c3a55; color: #cfe9ff; }
:root[data-theme="dark"] .src-badge { background: #1c3a55; color: #bfe3ff; }
:root[data-theme="dark"] .src-badge.src-staff { background: #4a3d12; color: #ffd866; }
:root[data-theme="dark"] .flag-late { background: #4a3a12; color: #ffd28a; border-color: #8a6a1a; }
:root[data-theme="dark"] .btn-danger-outline, :root[data-theme="dark"] .reject-form .btn { color: #ff9a9a !important; border-color: #ff9a9a !important; }
:root[data-theme="dark"] .req-warn { background: #4a3d12; color: #ffe08a; }
:root[data-theme="dark"] .alert-bar { background: #3a1f1f; border-color: #c25a5a; color: #ffc9c9; }
:root[data-theme="dark"] .alert-link { background: rgba(255,120,120,.16); color: #ffc9c9; }
:root[data-theme="dark"] .chip-alert { color: #ffb3b3; border-color: #c25a5a; }
:root[data-theme="dark"] .change-table th, :root[data-theme="dark"] th { color: #a9bccd; }
:root[data-theme="dark"] .req span.req, :root[data-theme="dark"] .req { color: #ff9a9a; }
:root[data-theme="dark"] .today-tag { background: #4aa3dc; color: #08202f; }
:root[data-theme="dark"] .day-card[open] .view-btn { color: #1a1300; }
:root[data-theme="dark"] .customer-avatar, :root[data-theme="dark"] .avatar { color: #06263a; }
:root[data-theme="dark"] .customer-avatar { background: #8fd0ff; }
:root[data-theme="dark"] .order-mode-tab.active { background: #4aa3dc; color: #06263a; }
:root[data-theme="dark"] .id-chip { filter: none; }
:root[data-theme="dark"] .stat-card .stat-num { color: #8fd0ff; }
:root[data-theme="dark"] .stat-card.warn .stat-num { color: #ffd866; }
:root[data-theme="dark"] .stat-card.ok .stat-num { color: #86e8ad; }
:root[data-theme="dark"] .stat-card.danger .stat-num { color: #ff9a9a; }
:root[data-theme="dark"] .mini-stats b { color: #8fd0ff; }
:root[data-theme="dark"] .mini-stats .ok b { color: #86e8ad; }
:root[data-theme="dark"] .mini-stats .warn b { color: #ffd866; }
:root[data-theme="dark"] .impact-big b, :root[data-theme="dark"] .day-count b { color: #8fd0ff; }
:root[data-theme="dark"] th { background: #1c2c3b; color: #a9bccd; }
:root[data-theme="dark"] .steps li > span { color: #06263a; }

/* The menu button's icon must keep its size (a blanket "images can't exceed their box" rule squeezed it to nothing) */
.sidebar-toggle { padding: 0; }
.sidebar-toggle img, .sidebar-toggle svg { max-width: none; flex: none; }
.sidebar-toggle .toggle-img { width: 26px; height: 26px; }

/* Voice notes: what the customer sees, and what staff hear */
.voice-heard { margin: 10px 0; padding: 10px 14px; border-radius: 12px; background: var(--user-soft); font-size: 14px; overflow-wrap: anywhere; }
.voice-heard[hidden] { display: none; }
.voice-heard-warn { margin-top: 6px; color: var(--gold-dark); font-size: 13px; }
.voice-card .voice-note { padding: 12px 0; border-top: 1px solid var(--line); }
.voice-card .voice-note:first-of-type { border-top: none; }
.voice-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.voice-meta b { color: var(--ink); }
.voice-note audio { width: 100%; max-width: 520px; display: block; margin: 6px 0; }
.voice-transcript { margin: 6px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--user-soft); border-left: 4px solid var(--brand-blue); white-space: pre-wrap; overflow-wrap: anywhere; }
.voice-transcript small { display: block; margin-bottom: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.voice-badge { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #e6f0ff; color: #1c4f9c; white-space: nowrap; }
:root[data-theme="dark"] .voice-badge { background: #1c3a55; color: #bfe3ff; }

/* My orders: status tabs are links, with a count; the filter row holds search, period and source */
a.chip { text-decoration: none; color: inherit; display: inline-flex; align-items: center; gap: 6px; }
a.chip b { font-weight: 700; font-size: 12px; opacity: .75; }
a.chip.active b { opacity: 1; }
.filter-bar select {
  padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface);
  font: inherit; color: inherit; min-height: 38px;
}
.filter-bar .live-search { flex: 1 1 220px; min-width: 0; }
@media (max-width: 720px) {
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .chips .chip { flex: 0 0 auto; }
  .filter-bar select, .filter-bar .btn { flex: 1 1 140px; }
}

/* My profile (customer, read-only) */
.profile-card-box { max-width: 520px; margin-bottom: 16px; }
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.prof-avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--brand-blue); color: #fff;
  display: grid; place-items: center; font-size: 22px; font-weight: 700; }
.prof-name { font-size: 18px; font-weight: 700; }
.profile-note { margin-top: 14px; }
.profile-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 10px 0; }
.profile-stat { display: block; text-decoration: none; color: inherit; padding: 12px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface); }
.profile-stat:hover { border-color: var(--brand-blue); }
.profile-stat b { display: block; font-size: 22px; }
.profile-stat span { font-size: 12px; color: var(--muted); }
.profile-ways { margin: 8px 0 0; padding-left: 18px; line-height: 1.7; }

/* My profile: the ways to order */
.ways { display: grid; gap: 12px; margin: 14px 0; }
.way { display: flex; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.way-no { flex: 0 0 34px; height: 34px; border-radius: 50%; background: var(--brand-blue); color: #fff; font-weight: 700;
  display: grid; place-items: center; }
.way-body h3 { margin: 0 0 4px; font-size: 16px; }
.way-body p { margin: 0 0 6px; line-height: 1.55; }
.way-for { color: var(--muted); font-size: 13px; }
.way-sub { margin: 18px 0 4px; font-size: 15px; }

/* ways to order as dropdowns, and a narrower profile page */
.way { display: block; padding: 0; }
.way > summary { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; list-style: none; }
.way > summary::-webkit-details-marker { display: none; }
.way > summary::after { content: "\25BE"; margin-left: auto; color: var(--muted); transition: transform .15s; }
.way[open] > summary::after { transform: rotate(180deg); }
.way-no { flex: 0 0 28px; height: 28px; font-size: 14px; }
.way-title { font-weight: 600; font-size: 15px; }
.way-body { padding: 0 14px 12px 54px; }
.way-body h3 { display: none; }
.way-body p { font-size: 14px; }
.profile-stats { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); }

/* Customer "My orders" on a phone: one compact card per order, empty fields hidden */
@media (max-width: 760px) {
  .cust-orders tbody tr { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; padding: 12px 14px; }
  .cust-orders tbody td { grid-column: 1 / -1; padding: 5px 0 !important; font-size: 15px; }
  .cust-orders tbody td.is-empty { display: none; }
  .cust-orders tbody td[data-label="Order"], .cust-orders tbody td[data-label="Status"] { grid-row: 1; grid-column: auto; border-top: none !important; padding-top: 0 !important; }
  .cust-orders tbody td[data-label="Order"] { grid-column: 1; justify-content: flex-start; font-size: 18px; }
  .cust-orders tbody td[data-label="Status"] { grid-column: 2; }
  .cust-orders tbody td[data-label="Order"]::before, .cust-orders tbody td[data-label="Status"]::before,
  .cust-orders tbody td[data-label="Date"]::before { content: none; }
  .cust-orders tbody td[data-label="Date"] { grid-row: 2; justify-content: flex-start; color: var(--muted); font-size: 13px; padding-top: 0 !important; }
  .cust-orders tbody td[data-label="Date"] .cell-val { justify-content: flex-start; text-align: left; }
  .cust-orders .track { gap: 8px; }
  /* the tabs scroll sideways: fade the right edge so it is clear there are more */
  .chips { -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); mask-image: linear-gradient(to right, #000 88%, transparent); }
}

/* Order pop-up: wider on large screens so the details sit in three columns; unchanged on phones */
@media (min-width: 900px) {
  .modal-box { max-width: 880px; max-height: 90vh; padding: 30px 34px; }
  .modal-box .detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 28px; }
  .modal-box .detail-grid dd { font-size: 15px; }
  .modal-box .detail-images img { width: 110px; }
}
@media (min-width: 1300px) { .modal-box { max-width: 980px; } }
@media (max-width: 600px) { .modal-box { padding: 20px 16px; max-height: 92vh; } }

/* Staff: notes on an order, search from any page, one-tap actions on the list */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.note-form { display: grid; gap: 8px; margin: 10px 0 14px; }
.note-form textarea { width: 100%; min-height: 76px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; resize: vertical; background: var(--surface); color: var(--ink); }
.note-form .btn { justify-self: start; }
.note-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.note-list li { padding: 10px 12px; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 10px; background: var(--surface); }
.note-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.note-meta time { margin-left: 6px; }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.note-badge { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--gold-soft); color: var(--gold-dark); }
.note-hit { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }
.search-customers { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.side-search { margin: 0 0 12px; }
.side-search input { width: 100%; padding: 10px 12px; border-radius: 12px; border: none; background: rgba(255,255,255,.92); color: #16324a; font: inherit; font-size: 14px; min-height: 40px; }
.sidebar.collapsed .side-search { display: none; }
@media (max-width: 760px) { .sidebar.collapsed .side-search { display: block; } }
.row-action form { margin: 0; }
.row-action .btn { white-space: nowrap; }

#notes { margin-top: 16px; }
#notes + .card { margin-top: 16px; }

/* Order page: the "push as separate entries" tick box next to the Sync button */
.split-box { display: flex; align-items: center; gap: 8px; flex-basis: 100%; padding: 8px 12px; border-radius: 10px; background: var(--gold-soft); color: var(--gold-dark); font-size: 14px; }
.split-box input { width: 18px; height: 18px; flex: none; }

/* Design files */
.file-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.file-list li { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.file-main { min-width: 0; display: grid; gap: 2px; }
.file-name { font-weight: 600; overflow-wrap: anywhere; }
.file-stats { margin-top: 4px; font-size: 13px; }
.file-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.file-form input[type=file] { max-width: 100%; flex: 1 1 220px; min-width: 0; }
.file-form form, .file-list form { margin: 0; }
.design-files-field { margin: 12px 0; }
.file-list li { flex-wrap: wrap; }
.file-name { color: var(--brand-blue-dark, #114a72); text-decoration: none; }
.file-name:hover { text-decoration: underline; }
.file-main { flex: 1 1 220px; }
.file-main .hint, .file-stats .hint { font-size: 12px; }
.file-stats { font-size: 13px; color: var(--ink); }

/* 3D preview of an STL */
.file-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stl-panel { flex-basis: 100%; margin-top: 8px; font-size: 14px; }
.stl-canvas { display: block; width: 100%; height: 340px; border-radius: 12px; background: #edf2f7; touch-action: none; cursor: grab; }
.stl-canvas:active { cursor: grabbing; }
.stl-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--muted); }
@media (max-width: 600px) { .stl-canvas { height: 280px; } }

/* File view page, link input */
.file-title { overflow-wrap: anywhere; }
.file-view-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; }
.sheet-table { border-collapse: collapse; font-size: 14px; }
.sheet-table td { border: 1px solid var(--line); padding: 6px 10px; vertical-align: top; max-width: 320px; overflow-wrap: anywhere; }
.sheet-table tr:nth-child(odd) td { background: rgba(0,0,0,.025); }
.doc-view p { margin: 0 0 10px; line-height: 1.6; overflow-wrap: anywhere; }
.text-view { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.5; margin: 0; }
.image-view { max-width: 100%; height: auto; border-radius: 10px; }
.design-link-label { display: block; margin-top: 10px; }
.file-form input[type=url] { flex: 1 1 220px; min-width: 0; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; background: var(--surface); color: var(--ink); }
.design-files-field input[type=url] { width: 100%; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; background: var(--surface); color: var(--ink); }
/* spreadsheet preview: keep each column readable and scroll sideways on a phone */
.sheet-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.sheet-table td { white-space: nowrap; min-width: 64px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
.doc-view .sheet-table td { white-space: normal; overflow-wrap: anywhere; min-width: 80px; }

/* Order sheets */
.sheet-card { max-width: 760px; margin-bottom: 16px; }
.sheet-add { display: grid; gap: 8px; }
.sheet-add input[type=url], .sheet-add input[type=file] { width: 100%; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; background: var(--surface); color: var(--ink); }
.sheet-or { text-align: center; color: var(--muted); font-size: 13px; }
.sheet-add .btn { justify-self: start; margin-top: 4px; }
.sheet-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.sheet-list li { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.sheet-main { display: grid; gap: 2px; min-width: 0; flex: 1 1 220px; }
.sheet-title { overflow-wrap: anywhere; }
.sheet-choose { display: grid; gap: 12px; }
.choice { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.n-input { width: 76px; padding: 6px 8px; border: 1.5px solid var(--line); border-radius: 8px; font: inherit; }

/* ERP push messages: which fields are missing, and the small retry buttons inside a message */
.problem-list { margin: 8px 0 0; padding-left: 20px; }
.problem-list a { font-weight: 600; text-decoration: underline; }
.msg .inline-form { display: block; margin-top: 10px; }
.field-missing { outline: 3px solid #d97706; outline-offset: 2px; }

/* Needs attention board */
.attn-side { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.attn-chip { display: inline-block; padding: 8px 14px; border-radius: 12px; font-size: 14px; text-decoration: none; border: 1px solid var(--border, #d8dde6); color: inherit; }
.attn-chip.bad { background: #fde8e8; border-color: #f2b3b3; color: #8f1d1d; }
.attn-chip.warn { background: #fde7c3; border-color: #f0b866; color: #8a4b00; }
.attn-list { display: grid; gap: 12px; }
.attn-card { padding: 16px; }
.attn-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.attn-title { font-weight: 700; font-size: 16px; text-decoration: none; }
.attn-reasons { list-style: none; margin: 10px 0 12px; padding: 0; display: grid; gap: 6px; }
.attn-reasons li { padding: 7px 10px 7px 12px; border-radius: 8px; font-size: 14px; border-left: 4px solid #f0b866; background: #fdf3e0; color: #5c3b00; }
.attn-reasons li.bad { border-left-color: #dc2626; background: #fde8e8; color: #7a1616; }
.attn-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.attn-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.attn-actions form { margin: 0; }
:root[data-theme="dark"] .attn-chip.bad { background: #4a1d1d; border-color: #8f3a3a; color: #ffc9c9; }
:root[data-theme="dark"] .attn-chip.warn { background: #4a3a12; border-color: #8a6a1a; color: #ffd28a; }
:root[data-theme="dark"] .attn-reasons li { background: #3a2e12; color: #ffd28a; }
:root[data-theme="dark"] .attn-reasons li.bad { background: #4a1d1d; color: #ffc9c9; }
@media (max-width: 520px) { .attn-actions { width: 100%; } .attn-actions .btn, .attn-actions form { flex: 1; } .attn-actions .btn { width: 100%; text-align: center; } }

/* Customer home */
.home-order-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 18px 20px; border-radius: 16px;
  background: var(--primary, #1f4fd8); color: #fff; font-size: 18px; font-weight: 700; text-decoration: none; box-shadow: 0 6px 18px rgba(31, 79, 216, .25); }
.home-order-btn:active { transform: translateY(1px); }
.home-wa { margin: 10px 2px 18px; }
.home h2 { margin: 22px 0 10px; font-size: 17px; }
.home-list { display: grid; gap: 12px; }
.home-card { display: block; padding: 16px; text-decoration: none; color: inherit; }
.home-card.compact { padding: 12px 16px; }
.home-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.home-steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 12px; padding: 0; gap: 4px; }
.home-steps li { position: relative; text-align: center; font-size: 11px; color: #7b8494; padding-top: 18px; }
.home-steps li::before { content: ""; position: absolute; top: 6px; left: -50%; right: 50%; height: 3px; background: #d8dde6; }
.home-steps li:first-child::before { display: none; }
.home-steps .dot { position: absolute; top: 0; left: 50%; width: 15px; height: 15px; margin-left: -7px; border-radius: 50%; background: #d8dde6; }
.home-steps li.done { color: #1d7a3c; font-weight: 600; }
.home-steps li.done::before, .home-steps li.done .dot { background: #2fa24f; }
.home-steps li.now .dot { box-shadow: 0 0 0 4px rgba(47, 162, 79, .25); }
.home-status { font-weight: 600; margin-bottom: 2px; }
.home-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
:root[data-theme="dark"] .home-steps li { color: #9aa3b2; }
:root[data-theme="dark"] .home-steps li.done { color: #7fdc9a; }
:root[data-theme="dark"] .home-steps li::before, :root[data-theme="dark"] .home-steps .dot { background: #3a4252; }
:root[data-theme="dark"] .home-steps li.done::before, :root[data-theme="dark"] .home-steps li.done .dot { background: #2fa24f; }
