/* ============ THEME TOKENS ============ */
:root[data-theme="light"], :root:not([data-theme]) {
  --bg: #f4f5f7;
  --bg-elev: #ffffff;
  --bg-elev2: #fafbfc;
  --bg-hover: #eef0f3;
  --border: #e1e4e8;
  --border-strong: #c8ccd1;
  --text: #1a1d21;
  --text-muted: #5b6470;
  --text-faint: #8b929b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-text: #ffffff;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --success-text: #14532d;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --warning-text: #78350f;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --danger-text: #7f1d1d;
  --info-bg: #dbeafe;
  --info-text: #1e3a8a;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
}
:root[data-theme="dark"] {
  --bg: #0f1419;
  --bg-elev: #1a1f26;
  --bg-elev2: #232931;
  --bg-hover: #2a323c;
  --border: #2d343d;
  --border-strong: #3d4651;
  --text: #e8ebef;
  --text-muted: #9aa3ae;
  --text-faint: #6b7480;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-text: #ffffff;
  --success: #22c55e;
  --success-bg: #14532d;
  --success-text: #86efac;
  --warning: #f59e0b;
  --warning-bg: #78350f;
  --warning-text: #fcd34d;
  --danger: #ef4444;
  --danger-bg: #7f1d1d;
  --danger-text: #fca5a5;
  --info-bg: #1e3a8a;
  --info-text: #93c5fd;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
}

/* Sepia - warm cream background, easy on the eyes during day */
:root[data-theme="sepia"] {
  --bg: #f5ecd6;
  --bg-elev: #fdf6e3;
  --bg-elev2: #f0e7cc;
  --bg-hover: #ebdfbe;
  --border: #d4c5a0;
  --border-strong: #b8a67e;
  --text: #3a2e1a;
  --text-muted: #7a6a4f;
  --text-faint: #a89878;
  --primary: #b45309;
  --primary-hover: #92400e;
  --primary-text: #fdf6e3;
  --success: #166534;
  --success-bg: #d9e8c8;
  --success-text: #14532d;
  --warning: #92400e;
  --warning-bg: #fde9b8;
  --warning-text: #78350f;
  --danger: #991b1b;
  --danger-bg: #f5d4ce;
  --danger-text: #7f1d1d;
  --info-bg: #e8d8b6;
  --info-text: #5a4520;
  --shadow: 0 1px 3px rgba(120,80,30,0.1), 0 1px 2px rgba(120,80,30,0.06);
  --shadow-lg: 0 4px 12px rgba(120,80,30,0.12);
}

/* Cool Blue Night - softer than full dark, navy-blue tones */
:root[data-theme="night-blue"] {
  --bg: #0c1a2e;
  --bg-elev: #142339;
  --bg-elev2: #1c2c47;
  --bg-hover: #243756;
  --border: #2a3f60;
  --border-strong: #3a527a;
  --text: #d6e3f5;
  --text-muted: #8ea4c2;
  --text-faint: #5c7396;
  --primary: #60a5fa;
  --primary-hover: #93c5fd;
  --primary-text: #0c1a2e;
  --success: #34d399;
  --success-bg: #064e3b;
  --success-text: #6ee7b7;
  --warning: #fbbf24;
  --warning-bg: #78350f;
  --warning-text: #fde68a;
  --danger: #f87171;
  --danger-bg: #7f1d1d;
  --danger-text: #fecaca;
  --info-bg: #1e3a8a;
  --info-text: #bfdbfe;
  --shadow: 0 1px 3px rgba(0,10,30,0.4), 0 1px 2px rgba(0,10,30,0.25);
  --shadow-lg: 0 4px 12px rgba(0,10,30,0.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; overflow-x: hidden; max-width: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Heebo", "Assistant", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   DENSITY COMPACT MODE (v1.5.3)
   Aggressive direct CSS reductions instead of CSS zoom.
   - Reduces font-size from 14px to 12px (-14%)
   - Reduces padding ~30%
   - Sidebar from 220px to 180px
   - UI fills the entire screen, no dead space
   To DISABLE: remove the class from body in head.ejs.
   ============================================================ */
@media (min-width: 769px) {
  body.density-compact {
    font-size: 12px;
  }

  /* Sidebar */
  body.density-compact .sidebar { width: 180px; }
  body.density-compact .sidebar-brand { padding: 10px 12px; }
  body.density-compact .sidebar-brand .brand-name { font-size: 13px; }
  body.density-compact .sidebar-brand .brand-sub { font-size: 9px; }
  body.density-compact .sidebar-nav { padding: 4px; }
  body.density-compact .nav-item {
    padding: 6px 8px;
    gap: 7px;
    font-size: 12px;
    margin-bottom: 1px;
  }
  body.density-compact .nav-icon { font-size: 13px; }
  body.density-compact .sidebar-footer { padding: 8px; font-size: 11px; }

  /* Top bar */
  body.density-compact .topbar { padding: 6px 12px; min-height: 38px; }
  body.density-compact .topbar-title { font-size: 14px; }
  body.density-compact .topbar input[type="search"] { padding: 5px 10px; font-size: 12px; }

  /* Content area */
  body.density-compact .content { padding: 12px 16px; }
  body.density-compact .page-header { margin-bottom: 10px; }
  body.density-compact .page-title { font-size: 16px; }
  body.density-compact .section-title { font-size: 13px; }
  body.density-compact .section-header { margin-bottom: 6px; }

  /* Panels */
  body.density-compact .panel { padding: 10px; border-radius: 8px; margin-bottom: 10px; }
  body.density-compact .panel-title { font-size: 13px; margin-bottom: 6px; }
  body.density-compact .panel-title-sm { font-size: 12px; margin-bottom: 4px; }

  /* Buttons */
  body.density-compact .btn {
    padding: 5px 11px;
    font-size: 12px;
    border-radius: 6px;
  }
  body.density-compact .btn-sm {
    padding: 3px 8px;
    font-size: 11px;
  }
  body.density-compact .btn-accent { font-size: 12px; }

  /* Chips */
  body.density-compact .chip {
    padding: 5px 10px;
    font-size: 11px;
  }
  body.density-compact .chip-count {
    font-size: 10px;
    padding: 1px 5px;
  }

  /* Inputs */
  body.density-compact input[type="text"],
  body.density-compact input[type="search"],
  body.density-compact input[type="email"],
  body.density-compact input[type="tel"],
  body.density-compact input[type="date"],
  body.density-compact input[type="time"],
  body.density-compact input[type="number"],
  body.density-compact textarea,
  body.density-compact select {
    padding: 5px 9px;
    font-size: 12px;
  }
  body.density-compact .form-group label {
    font-size: 11px;
    margin-bottom: 3px;
  }

  /* Order cards */
  body.density-compact .order-card {
    padding: 8px 10px;
    margin-bottom: 5px;
    border-radius: 8px;
  }
  body.density-compact .order-card .order-customer { font-size: 12px; }
  body.density-compact .order-card .order-title { font-size: 12px; }
  body.density-compact .order-card .order-num { font-size: 11px; }
  body.density-compact .order-card .order-meta { font-size: 10px; gap: 4px; }
  body.density-compact .order-card .meta-item { font-size: 10px; padding: 2px 5px; }
  body.density-compact .order-card .status-pill { font-size: 10px; padding: 2px 7px; }

  /* Stats */
  body.density-compact .stat-card { padding: 10px 12px; }
  body.density-compact .stat-value { font-size: 20px; }
  body.density-compact .stat-label { font-size: 10px; }
  body.density-compact .stats-grid { gap: 8px; }

  /* Tables */
  body.density-compact .orders-table th,
  body.density-compact .orders-table td {
    padding: 6px 9px;
    font-size: 12px;
  }

  /* Filter / orders bar */
  body.density-compact .filter-bar { gap: 5px; }
  body.density-compact .orders-filters { gap: 5px; padding: 8px; }
  body.density-compact .tabs-bar { gap: 4px; }

  /* Detail header */
  body.density-compact .detail-header { padding: 12px 16px; }
  body.density-compact .detail-title { font-size: 16px; }
  body.density-compact .detail-meta-item .value { font-size: 12px; }
  body.density-compact .detail-meta-item .label { font-size: 10px; }

  /* Dashboard */
  body.density-compact .dash-grid { gap: 10px; margin-top: 10px; }
  body.density-compact .dash-block { padding: 10px; }

  /* Form grid */
  body.density-compact .form-grid { gap: 8px; }
  body.density-compact .form-group { margin-bottom: 8px; }

  /* Badges */
  body.density-compact .badge-success,
  body.density-compact .badge-warn,
  body.density-compact .badge-muted,
  body.density-compact .urgent-tag {
    font-size: 10px;
    padding: 2px 6px;
  }

  /* Date banner in expanded mode */
  body.density-compact .order-date-banner { font-size: 11px; padding: 4px 8px; }
}
/* On mobile (≤768px) the density-compact has NO effect - mobile is already compact */
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ============ LOGIN ============ */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo .brand { font-size: 22px; font-weight: 600; color: var(--primary); margin: 0 0 4px; }
.login-logo .tagline { font-size: 13px; color: var(--text-muted); margin: 0; }
.login-field { margin-bottom: 14px; }
.login-field label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.login-field input, .login-field select {
  width: 100%; padding: 10px 12px;
  background: var(--bg-elev2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 15px;
}
.login-field input:focus, .login-field select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.pin-input { letter-spacing: 8px; text-align: center; font-size: 18px; }
.btn-primary {
  width: 100%; padding: 11px;
  background: var(--primary); color: var(--primary-text);
  border: none; border-radius: 8px;
  font-size: 15px; font-weight: 500;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--primary-hover); }
.login-hint {
  margin-top: 16px; padding: 10px 12px;
  background: var(--info-bg); color: var(--info-text);
  border-radius: 6px; font-size: 12px; line-height: 1.6;
}
.login-error {
  margin-top: 12px; padding: 8px 12px;
  background: var(--danger-bg); color: var(--danger-text);
  border-radius: 6px; font-size: 13px;
}
.theme-toggle-login {
  position: absolute; top: 20px; left: 20px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 50%; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}

/* ============ APP SHELL ============ */
.app-shell { display: flex; height: 100vh; }
.sidebar {
  width: 220px;
  background: var(--bg-elev);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-brand {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .brand-name {
  font-size: 16px; font-weight: 600;
  color: var(--primary); margin: 0;
}
.sidebar-brand .brand-sub {
  font-size: 11px; color: var(--text-faint); margin: 2px 0 0;
}
.sidebar-nav { flex: 1; padding: 8px; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: right;
  position: relative;
  text-decoration: none;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--primary); color: var(--primary-text); }
.nav-item .nav-icon { font-size: 16px; width: 18px; text-align: center; }
.nav-badge {
  margin-right: auto;
  background: var(--danger);
  color: white;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  font-weight: 600;
}
.nav-item.active .nav-badge { background: rgba(255,255,255,0.3); }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 6px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: var(--primary-text);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 11px; color: var(--text-muted); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow-x: hidden; }
.topbar {
  height: 54px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
}
.topbar h1 { font-size: 17px; font-weight: 600; margin: 0; flex: 1; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 8px; border: none;
  background: transparent; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; position: relative;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn .badge-dot {
  position: absolute; top: 6px; left: 6px;
  background: var(--danger); color: white;
  font-size: 10px; font-weight: 600;
  border-radius: 8px; padding: 1px 5px;
  min-width: 16px; text-align: center;
}
.content { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 20px 24px; min-width: 0; }

/* ============ DASHBOARD ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 600; color: var(--text); }
.stat-sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.section-title { font-size: 15px; font-weight: 600; margin: 0; }
.section-actions { display: flex; gap: 8px; }
.btn {
  padding: 8px 14px;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
}
.btn:hover { background: var(--bg-hover); }
.btn-accent {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
}
.btn-accent:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.filter-bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
}
.chip:hover { background: var(--bg-hover); }
.chip.active {
  background: var(--primary); color: var(--primary-text);
  border-color: var(--primary);
}

/* ============ ORDER CARDS ============ */
.order-list { display: flex; flex-direction: column; gap: 6px; }
.order-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
}
.order-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.order-card.urgent { border-right: 4px solid var(--danger); }
.order-row {
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 3px; flex-wrap: wrap;
}
.order-num {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px; color: var(--text-faint);
  background: var(--bg-elev2);
  padding: 1px 6px; border-radius: 4px;
}
.order-customer { font-weight: 600; font-size: 14px; flex: 1; min-width: 100px; }
.status-pill {
  padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 500; white-space: nowrap;
}
.status-draft   { background: var(--bg-elev2); color: var(--text-muted); border: 1px solid var(--border); }
.status-new     { background: var(--info-bg); color: var(--info-text); }
.status-progress{ background: var(--warning-bg); color: var(--warning-text); }
.status-done    { background: var(--success-bg); color: var(--success-text); }
.status-closed  { background: var(--bg-elev2); color: var(--text-faint); border: 1px solid var(--border); }
.order-meta {
  display: flex; gap: 12px; font-size: 11px;
  color: var(--text-muted); flex-wrap: wrap;
}
.meta-item { display: flex; align-items: center; gap: 4px; }
.urgent-tag {
  background: var(--danger-bg);
  color: var(--danger-text);
  padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
}
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }

/* ============ ORDER DETAIL ============ */
.detail-header {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
}
.detail-top-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px; flex-wrap: wrap;
}
.detail-customer { font-size: 20px; font-weight: 600; flex: 1; }
.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.detail-meta-item .label {
  font-size: 11px; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.detail-meta-item .value { font-size: 14px; }
.primary-action-bar {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}
.btn-big {
  padding: 12px 22px; font-size: 15px; font-weight: 600;
  background: var(--primary); color: var(--primary-text);
  border: none; border-radius: 8px;
  flex: 1; min-width: 200px; cursor: pointer;
}
.btn-big:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
.panel-title {
  font-size: 14px; font-weight: 600; margin: 0 0 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.note-list { display: flex; flex-direction: column; gap: 8px; }
.note {
  background: var(--bg-elev2);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
}
.note .note-meta {
  font-size: 11px; color: var(--text-faint); margin-bottom: 3px;
}
.note.issue { border-right: 3px solid var(--danger); }
.input-row { display: flex; gap: 8px; }
.input-row input, .input-row textarea, .input-row select {
  flex: 1; padding: 8px 12px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text); font-size: 13px;
}
.log-list { font-size: 12px; color: var(--text-muted); }
.log-entry { padding: 4px 0; border-bottom: 1px dashed var(--border); }
.log-entry:last-child { border-bottom: none; }

/* ============ FORMS ============ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-grid .full { grid-column: 1 / -1; }
.form-group label {
  display: block; font-size: 12px;
  color: var(--text-muted); margin-bottom: 4px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 10px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text); font-size: 13px;
}
.form-group textarea { resize: vertical; min-height: 60px; }
.checkbox-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text); cursor: pointer;
}

/* ============ NOTIFICATIONS ============ */
.notif-panel {
  position: fixed;
  top: 60px;
  left: 20px;
  width: 320px;
  max-height: 70vh;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  z-index: 50;
}
.notif-panel.active { display: flex; }
.notif-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.notif-list { overflow-y: auto; flex: 1; }
.notif-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: var(--info-bg); }
.notif-item.unread:hover { background: var(--info-bg); opacity: 0.85; }
.notif-item .notif-time { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.notif-empty {
  padding: 40px 16px; text-align: center;
  color: var(--text-muted); font-size: 13px;
}

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-right: 4px solid var(--success);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  z-index: 200;
  max-width: 320px;
  animation: slideIn 0.3s ease-out;
  transition: opacity 0.5s;
}
.toast.error { border-right-color: var(--danger); }
.toast.info { border-right-color: var(--primary); }
@keyframes slideIn {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============ MOBILE ============ */
.menu-toggle { display: none; }
@media (max-width: 720px) {
  .sidebar {
    position: fixed;
    right: 0; top: 0; bottom: 0;
    transform: translateX(100%);
    transition: transform 0.2s;
    z-index: 60;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .menu-toggle { display: flex; }
  .content { padding: 14px; }
  .topbar { padding: 0 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .notif-panel { left: 10px; right: 10px; width: auto; }
}

/* ============ V0.3 ADDITIONS ============ */

/* Date tags (delivery / return) */
.date-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  margin-left: 4px;
}
.date-tag-delivery {
  background: var(--info-bg);
  color: var(--info-text);
}
.date-tag-return {
  background: var(--warning-bg);
  color: var(--warning-text);
}

/* Customer kind badges */
.customer-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.customer-regular { background: var(--success-bg); color: var(--success-text); }
.customer-temp    { background: var(--warning-bg); color: var(--warning-text); }
.customer-system  { background: var(--bg-elev2); color: var(--text-faint); border: 1px solid var(--border); }

/* Tabs bar (order detail) */
.tabs-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: thin;
}
.tab {
  padding: 10px 16px;
  background: transparent;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s;
}
.tab:hover {
  color: var(--text);
  background: var(--bg-hover);
}
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Action bar (in detail header) */
.action-bar {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.action-form { margin: 0; }
.btn-action {
  padding: 8px 16px;
  background: var(--bg-elev2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
}
.btn-action:hover { background: var(--bg-hover); }
.btn-action.btn-accent {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
}
.btn-action.btn-accent:hover { background: var(--primary-hover); }
.btn-action.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}
.btn-action.btn-success:hover { background: #15803d; }
.action-status {
  color: var(--success);
  font-weight: 500;
  padding: 8px 12px;
}

/* Communication grid */
.comm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.comm-card {
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 12px;
  text-align: center;
  text-decoration: none;
  color: inherit;
  transition: transform 0.1s, border-color 0.15s;
}
.comm-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}
.comm-icon { font-size: 24px; margin-bottom: 4px; }
.comm-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.comm-value {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Customer search bar */
.customer-search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.customer-search-bar input,
.customer-search-bar select {
  padding: 8px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
}

/* Autocomplete */
.autocomplete-results {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  z-index: 20;
  max-height: 240px;
  overflow-y: auto;
  display: none;
  margin-top: 2px;
}
.autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--bg-hover); }
.autocomplete-empty {
  padding: 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ============ CALENDAR ============ */
.cal-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.cal-views { display: flex; gap: 6px; }
.cal-nav { display: flex; gap: 6px; }
.cal-title {
  font-size: 16px;
  font-weight: 600;
  margin-right: auto;
}

/* 1.14.19: Old .cal-legend removed - new version below at line ~7255 */

/* Day view events */
.day-events { display: flex; flex-direction: column; gap: 10px; }
.cal-event {
  display: flex;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.1s;
}
.cal-event:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.cal-event.urgent { border-right: 4px solid var(--danger); }
.cal-event-delivery { border-left: 4px solid var(--primary); }
.cal-event-return { border-left: 4px solid var(--warning); }
.cal-event-time {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  width: 60px;
  flex-shrink: 0;
  padding-left: 12px;
}
.cal-event-body { flex: 1; min-width: 0; }
.cal-event-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.cal-event-customer {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.cal-event-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

/* Week view */
.cal-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.cal-week-day {
  background: var(--bg-elev);
  min-height: 200px;
  display: flex;
  flex-direction: column;
}
.cal-week-day.today { background: var(--bg-elev2); }
.cal-week-day-header {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  background: var(--bg-elev2);
}
.cal-week-day.today .cal-week-day-header {
  background: var(--primary);
  color: var(--primary-text);
}
.cal-week-day-name {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}
.cal-week-day.today .cal-week-day-name { color: var(--primary-text); opacity: 0.9; }
.cal-week-day-num {
  font-size: 16px;
  font-weight: 600;
  margin-top: 2px;
}
.cal-week-day-events {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.cal-week-empty {
  text-align: center;
  color: var(--text-faint);
  font-size: 11px;
  padding: 6px;
}

.cal-mini-event {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11px;
  text-decoration: none;
  color: inherit;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  transition: transform 0.1s;
}
.cal-mini-event:hover { transform: translateY(-1px); }
.cal-mini-event.cal-mini-delivery {
  border-right: 3px solid var(--primary);
}
.cal-mini-event.cal-mini-return {
  border-right: 3px solid var(--warning);
}
.cal-mini-event.urgent {
  background: var(--danger-bg);
  color: var(--danger-text);
}
.cal-mini-time {
  font-weight: 600;
  font-size: 10px;
  flex-shrink: 0;
}
.cal-mini-tag {
  display: inline-block;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}
.cal-mini-delivery .cal-mini-tag {
  background: var(--info-bg);
  color: var(--info-text);
}
.cal-mini-return .cal-mini-tag {
  background: var(--warning-bg);
  color: var(--warning-text);
}
.cal-mini-customer {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Month view */
.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.cal-month-header {
  background: var(--bg-elev2);
  padding: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}
.cal-month-cell {
  background: var(--bg-elev);
  min-height: 90px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}
.cal-month-cell.empty { background: var(--bg-elev2); opacity: 0.4; }
.cal-month-cell.today {
  background: var(--bg-elev2);
  border: 2px solid var(--primary);
}
.cal-month-cell:not(.empty):hover { background: var(--bg-hover); }
.cal-month-day-num {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}
.cal-month-cell.today .cal-month-day-num {
  color: var(--primary);
  font-weight: 700;
}
.cal-month-day-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.cal-month-event {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--bg-elev2);
}
.cal-month-event.cal-mini-delivery {
  background: var(--info-bg);
  color: var(--info-text);
}
.cal-month-event.cal-mini-return {
  background: var(--warning-bg);
  color: var(--warning-text);
}
.cal-month-event.urgent { font-weight: 600; }
.cal-month-event .cal-mini-tag {
  background: rgba(255,255,255,0.4);
  color: inherit;
  font-size: 9px;
  width: 14px;
  height: 14px;
  line-height: 14px;
}
.cal-month-more {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Mobile adjustments for calendar */
@media (max-width: 720px) {
  .cal-toolbar { gap: 8px; }
  .cal-title {
    width: 100%;
    margin: 8px 0 0;
    text-align: center;
  }
  .cal-week-grid {
    grid-template-columns: 1fr;
  }
  .cal-week-day { min-height: auto; }
  /* Force month grid to keep 7 columns on narrow screens — minmax(0,1fr) prevents content from
     blowing out column widths (the "Sun-Wed only" cutoff bug). */
  .cal-month-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
  .cal-month-header { padding: 4px 2px; font-size: 10px; }
  .cal-month-cell {
    min-height: 64px;
    padding: 3px 2px;
    overflow: hidden;
  }
  .cal-month-day-num { font-size: 11px; }
  .cal-month-event {
    font-size: 8px;
    padding: 1px 2px;
    line-height: 1.15;
  }
  .cal-month-more { font-size: 9px; }
}

/* ============================================================
   v1.0 Additions
   ============================================================ */

/* Topbar adjustments */
.topbar-title {
  margin: 0;
  font-size: 16px;
  white-space: nowrap;
}

/* Tabs */
.tabs-bar {
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.chip-count {
  display: inline-block;
  background: rgba(0,0,0,0.08);
  padding: 0 6px;
  border-radius: 8px;
  font-size: 11px;
  margin-right: 4px;
  font-weight: 600;
}
.chip.active .chip-count {
  background: rgba(255,255,255,0.3);
}

/* Status pill */
.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}

/* Order cards */
.order-card.urgent {
  border-right: 4px solid var(--danger);
  background: linear-gradient(to left, var(--bg-elev) 95%, rgba(220,38,38,0.05));
}
.order-title {
  font-size: 14px;
  color: var(--text);
  margin: 4px 0;
  line-height: 1.4;
}
.badge-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}
.reminder-tag { background: var(--warning-bg); color: var(--warning-text); }
.note-indicator { color: var(--warning) !important; font-weight: 600; }

/* Sprint Polish: "🆕 חדש" badge - phase 2 (after 24h, until handled) */
/* Replaces the cell-wide flash with a focused, pulsing badge */
.badge-new-pulse {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 10px;
  font-weight: 700;
  background: #fde047;
  color: #713f12;
  border: 1px solid #eab308;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  animation: badge-new-pulse 1s infinite ease-in-out;
  text-shadow: 0 0 1px rgba(255,255,255,0.4);
}
@keyframes badge-new-pulse {
  0%, 100% {
    background: #fde047;
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.7);
  }
  50% {
    background: #f59e0b;
    color: #fff;
    transform: scale(1.12);
    box-shadow: 0 0 0 8px rgba(234, 179, 8, 0);
  }
}

/* Sprint Quick: Quick Order styles - banner, voice player, badge */
.quick-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 10px 0;
}
.quick-banner-icon { font-size: 28px; flex-shrink: 0; }
.quick-banner-title { font-size: 15px; font-weight: 600; }
.quick-banner-sub { font-size: 12px; opacity: 0.95; margin-top: 2px; }

.voice-player-card {
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-right: 3px solid #dc2626;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 10px 0;
}
.voice-player-row {
  display: flex; align-items: center; gap: 8px;
}

.badge-quick {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Sprint B #16: stuck order badges */
.stuck-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.stuck-badge.stuck-mild {
  background: rgba(251, 191, 36, 0.15);
  color: #92400e;
  border: 1px solid #fbbf24;
}
.stuck-badge.stuck-medium {
  background: rgba(249, 115, 22, 0.15);
  color: #c2410c;
  border: 1px solid #f97316;
}
.stuck-badge.stuck-severe {
  background: rgba(220, 38, 38, 0.15);
  color: #b91c1c;
  border: 1px solid #dc2626;
  animation: stuck-pulse 2s infinite;
}
@keyframes stuck-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.3); }
  50% { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0); }
}

/* Badges */
.badge-success { background: var(--success-bg); color: var(--success-text); padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.badge-warn { background: var(--warning-bg); color: var(--warning-text); padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.badge-muted { background: var(--bg-elev2); color: var(--text-muted); padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; border: 1px solid var(--border); }

/* Topbar search */
.topbar-search {
  position: relative;
  flex: 1;
  max-width: 400px;
}
.topbar-search input {
  width: 100%;
  padding: 7px 12px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
}
.topbar-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}
.search-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  margin-top: 4px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
}
.search-section { padding: 8px 0; border-bottom: 1px solid var(--border); }
.search-section:last-child { border-bottom: none; }
.search-section-title {
  padding: 4px 14px;
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.search-result-item {
  padding: 8px 14px;
  cursor: pointer;
  display: block;
  text-decoration: none;
  color: inherit;
}
.search-result-item:hover { background: var(--bg-hover); }
.search-result-title { font-size: 13px; font-weight: 500; }
.search-result-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Dropdowns */
.dropdown, .dropdown-wrap { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 200px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  overflow: hidden;
  display: none;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a,
.dropdown-menu .dropdown-item {
  display: block;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  text-align: right;
  cursor: pointer;
  font-family: inherit;
}
.dropdown-menu a:last-child,
.dropdown-menu .dropdown-item:last-child { border-bottom: none; }
.dropdown-menu a:hover,
.dropdown-menu .dropdown-item:hover { background: var(--bg-hover); }

/* Mobile bottom nav - see comprehensive definition below */

.mobile-only { display: none; }
@media (max-width: 768px) {
  .mobile-only { display: flex; }
  .sidebar {
    position: fixed;
    right: 0; top: 0; bottom: 0;
    z-index: 300;
    width: 260px;
    transform: translateX(100%);
    transition: transform 0.2s;
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 14px; padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding: 0 12px; }
  .topbar-search { max-width: none; }

  /* #10 fix: 5 stat cards in single row on mobile (compact mode) */
  .stats-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
  }
  .stats-grid .stat-card {
    padding: 6px 4px;
    text-align: center;
  }
  .stats-grid .stat-label {
    font-size: 9px;
    line-height: 1.1;
    margin-bottom: 2px;
    min-height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .stats-grid .stat-value {
    font-size: 18px;
    line-height: 1;
  }
  .stats-grid .stat-sub {
    display: none;
  }

  .form-grid { grid-template-columns: 1fr; }
  .detail-meta-grid { grid-template-columns: 1fr; }
}

/* Action bar */
.action-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  flex-wrap: wrap;
}

/* Stat cards (clickable) */
.stat-card-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s;
  display: block;
}
.stat-card-link:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

/* Dash grid */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  gap: 16px;
  margin-top: 20px;
  max-width: 100%;
  overflow-x: hidden;
}
.dash-block {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}
.empty-state-sm {
  text-align: center;
  padding: 24px 12px;
  color: var(--text-faint);
  font-size: 13px;
}
.order-list.compact .order-card { padding: 10px 12px; }
.order-list.compact .order-customer { font-size: 14px; }
.draft-card {
  background: var(--bg-elev2);
  border-style: dashed;
  opacity: 0.85;
}

/* Issue list */
.issue-list { display: flex; flex-direction: column; gap: 6px; }
.issue-row {
  padding: 10px 12px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-right: 3px solid var(--danger);
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  display: block;
}
.issue-row:hover { background: var(--bg-hover); }
.issue-title { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.issue-meta {
  display: flex; gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  align-items: center;
  flex-wrap: wrap;
}

/* Tables */
.orders-table {
  width: 100%;
  border-collapse: collapse;
}
.orders-table th {
  background: var(--bg-elev2);
  padding: 10px 12px;
  text-align: right;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.orders-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.orders-table tr:hover { background: var(--bg-hover); }
.orders-table tr:last-child td { border-bottom: none; }
.orders-table .row-urgent { background: rgba(220, 38, 38, 0.04); }
.order-num-cell { font-family: ui-monospace, monospace; color: var(--text-muted); }

/* Filter bar (orders) */
.orders-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.orders-filters input, .orders-filters select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elev2);
  color: var(--text);
  font-size: 13px;
}

/* Cards grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

/* Worker counters */
.worker-counters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.counter-pill {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  color: var(--text-muted);
}
.counter-pill strong { color: var(--text); margin-right: 4px; }
.counter-pill.urgent {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: rgba(220,38,38,0.3);
}
.counter-pill.urgent strong { color: var(--danger-text); }
.counter-pill.warn {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: rgba(217,119,6,0.3);
}
.counter-pill.warn strong { color: var(--warning-text); }

/* Worker order detail */
.worker-detail-header { padding: 14px 16px; }
.worker-info-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.info-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 12px;
}
.info-pill.warn {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: rgba(217,119,6,0.3);
}
.info-icon { font-size: 13px; }

.worker-panel { margin-bottom: 12px; }
.panel-title-sm {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.address-block {
  padding: 10px 12px;
  background: var(--bg-elev2);
  border-radius: 6px;
  margin-bottom: 8px;
}
.address-text { font-size: 14px; margin-bottom: 8px; }
.address-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.contact-block {
  padding: 10px 12px;
  background: var(--bg-elev2);
  border-radius: 6px;
}
.contact-block > div { margin-bottom: 6px; font-size: 13px; }
.contact-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.primary-action-bar {
  margin: 16px 0;
}
.btn-warning { background: var(--warning) !important; color: white !important; }

/* Notes */
.note {
  padding: 10px 12px;
  background: var(--bg-elev2);
  border-radius: 6px;
  margin-bottom: 6px;
  border-right: 3px solid transparent;
}
.note.issue { border-right-color: var(--danger); background: rgba(220,38,38,0.04); }
.note.closed { opacity: 0.6; }
.note-header, .note-header-sm {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
  flex-wrap: wrap;
  font-size: 13px;
}
.note-content {
  font-size: 13px;
  margin-bottom: 4px;
  white-space: pre-wrap;
}
.note-meta {
  font-size: 11px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.note-type-tag {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}
.note-type-tag.note { background: var(--bg-elev2); color: var(--text-muted); border: 1px solid var(--border); }
.note-type-tag.issue { background: var(--danger-bg); color: var(--danger-text); }
.note-status-tag {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}
.note-open { background: var(--warning-bg); color: var(--warning-text); }
.note-in_progress { background: var(--info-bg); color: var(--info-text); }
.note-closed { background: var(--bg-elev2); color: var(--text-faint); }

.secondary-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.template-list { display: flex; flex-wrap: wrap; gap: 6px; }
.template-pill {
  padding: 6px 12px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 12px;
  text-decoration: none;
  color: var(--text);
}
.template-pill:hover { background: var(--bg-hover); }

/* Messages */
.message-list { display: flex; flex-direction: column; gap: 8px; }
.message-card {
  padding: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.message-card.unread {
  background: var(--info-bg);
  border-color: var(--primary);
}
.message-card.urgent { border-right: 4px solid var(--danger); }
.message-header {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.msg-icon { font-size: 16px; }
.msg-title { font-size: 14px; }
.msg-time { font-size: 11px; color: var(--text-faint); }
.msg-content { font-size: 13px; margin-bottom: 6px; white-space: pre-wrap; }
.msg-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.msg-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.unread-dot {
  width: 8px; height: 8px;
  background: var(--primary);
  border-radius: 50%;
  display: inline-block;
}

/* Customer toggle in form */
.customer-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.radio-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: var(--bg-elev2);
  font-size: 13px;
}
.radio-chip:has(input:checked) {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.customer-pane { padding-top: 8px; }

/* Theme options */
.theme-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.theme-option {
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-elev);
  position: relative;
}
.theme-option:has(input:checked) {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.theme-option input { position: absolute; opacity: 0; }
.theme-preview {
  height: 80px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.theme-preview.light { background: linear-gradient(135deg, #f4f5f7 30%, #ffffff 70%); }
.theme-preview.dark { background: linear-gradient(135deg, #0f1419 30%, #1a1f26 70%); }
.theme-label { font-weight: 600; font-size: 14px; }
.theme-desc { font-size: 12px; color: var(--text-muted); }

/* Devices */
.device-list { display: flex; flex-direction: column; gap: 8px; }
.device-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.device-icon { font-size: 22px; }
.device-info { flex: 1; }
.device-name { font-weight: 500; font-size: 13px; }
.device-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Detail header */
.detail-title {
  font-size: 16px;
  color: var(--text-muted);
  margin: 0 0 8px;
}

/* Files */
.files-list { display: flex; flex-direction: column; gap: 6px; }
.file-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-elev2);
  border-radius: 6px;
}
.file-icon { font-size: 18px; }
.file-name { flex: 1; font-size: 13px; }

/* Comm */
.comm-list { display: flex; flex-direction: column; gap: 6px; }
.comm-row {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-elev2);
  border-radius: 6px;
}
.comm-channel {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-muted);
  padding-top: 2px;
}
.comm-content { flex: 1; font-size: 13px; }
.comm-meta { font-size: 11px; color: var(--text-faint); margin-top: 4px; }

/* Settings layout */
.settings-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 768px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-sidebar { order: -1; }
}
.settings-sidebar {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  position: sticky;
  top: 12px;
}
.settings-sidebar-title {
  font-size: 13px;
  margin: 0 0 10px;
  color: var(--text-muted);
  padding: 0 8px;
}
.settings-nav { display: flex; flex-direction: column; gap: 2px; }
.settings-nav a {
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13px;
  display: block;
}
.settings-nav a:hover { background: var(--bg-hover); color: var(--text); }
.settings-nav a.active { background: var(--primary); color: white; }
.settings-main { min-height: 400px; }

/* Color swatch */
.color-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid var(--border);
  vertical-align: middle;
  margin-left: 4px;
}

/* Permissions */
.perm-category { margin-bottom: 18px; }
.perm-category h4 {
  font-size: 13px;
  margin: 0 0 8px;
  color: var(--text-muted);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.perm-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 4px;
}
.perm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 13px;
  border-radius: 4px;
}
.perm-row:hover { background: var(--bg-hover); }
.perm-label { flex: 1; }
.perm-code {
  font-size: 10px;
  color: var(--text-faint);
  font-family: ui-monospace, monospace;
}

/* Error box */
.error-box {
  text-align: center;
  padding: 60px 20px;
  max-width: 480px;
  margin: 0 auto;
}
.error-icon { font-size: 48px; margin-bottom: 16px; }
.error-title { margin: 0 0 8px; font-size: 24px; }
.error-message { color: var(--text-muted); margin-bottom: 20px; }
.error-actions { display: flex; gap: 8px; justify-content: center; }

/* Calendar toolbar */
.cal-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-wrap: wrap;
}
.cal-title {
  margin: 0;
  font-size: 16px;
  flex: 1;
  text-align: center;
}

/* Calendar week grid */
.cal-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-week-day {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 200px;
  padding: 6px;
}
.cal-week-day.today { border-color: var(--primary); border-width: 2px; }
.cal-week-day-header {
  text-align: center;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.cal-week-day-name { font-size: 11px; color: var(--text-muted); }
.cal-week-day-num { font-size: 14px; font-weight: 600; }
.cal-week-day-events { display: flex; flex-direction: column; gap: 3px; }
.cal-week-empty { text-align: center; color: var(--text-faint); font-size: 11px; padding: 10px; }
.cal-mini-event {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px 6px;
  background: var(--info-bg);
  color: var(--info-text);
  border-radius: 4px;
  font-size: 11px;
  text-decoration: none;
  flex-wrap: wrap;
}
.cal-mini-event:hover { background: var(--bg-hover); }
.cal-mini-event.cal-mini-return { background: var(--warning-bg); color: var(--warning-text); }
.cal-mini-event.urgent { border-right: 2px solid var(--danger); }
.cal-mini-tag { font-size: 13px; }
.cal-mini-time { font-weight: 600; }
.cal-mini-customer { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 768px) {
  .cal-week-grid { grid-template-columns: 1fr; }
  .cal-week-day { min-height: auto; }
}

/* Calendar month grid */
.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-month-header {
  text-align: center;
  padding: 6px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-elev2);
}
.cal-month-cell {
  min-height: 80px;
  padding: 4px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}
.cal-month-cell.empty { background: transparent; border: none; }
.cal-month-cell.today { border-color: var(--primary); border-width: 2px; }
.cal-month-day-num { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.cal-month-day-events { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.cal-month-event {
  font-size: 10px;
  padding: 2px 4px;
  background: var(--info-bg);
  color: var(--info-text);
  border-radius: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-month-event.cal-mini-return { background: var(--warning-bg); color: var(--warning-text); }
.cal-month-more { font-size: 10px; color: var(--text-muted); }

/* Section title */
.section-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 14px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

/* Form grid */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-group { display: flex; flex-direction: column; }
.form-group.full { grid-column: 1 / -1; }
.form-group label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.form-group input, .form-group select, .form-group textarea {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elev2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}

/* Detail meta grid */
.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.detail-meta-item.full { grid-column: 1 / -1; }
.detail-meta-item .label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.detail-meta-item .value {
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.detail-header {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.detail-top-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.detail-customer {
  margin: 0;
  font-size: 18px;
}
.order-num {
  font-family: ui-monospace, monospace;
  color: var(--text-muted);
  font-size: 14px;
}
.urgent-tag {
  background: var(--danger-bg);
  color: var(--danger-text);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

/* Big button */
.btn-big {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.btn-big:hover { opacity: 0.9; }
.btn-big.btn-success { background: var(--success); }
.btn-big.btn-warning { background: var(--warning); }

/* Logout link */
.logout-link { margin-top: 8px; color: var(--text-faint) !important; }

/* Log entries */
.log-list { display: flex; flex-direction: column; gap: 4px; }
.log-entry {
  padding: 6px 10px;
  background: var(--bg-elev2);
  border-radius: 4px;
  font-size: 12px;
}
.log-time { color: var(--text-faint); margin-left: 8px; }
.log-actor { font-weight: 500; }
.log-note { color: var(--text-muted); font-size: 11px; margin-top: 2px; }

/* RTL bottom-nav */
[dir="rtl"] .nav-badge { margin-right: auto; margin-left: 0; }
.nav-badge {
  background: var(--danger);
  color: white;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  margin-right: auto;
}

/* Topbar minor */
.icon-btn {
  background: none;
  border: none;
  font-size: 18px;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 6px;
  color: var(--text-muted);
  position: relative;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.badge-dot {
  position: absolute;
  top: 2px;
  left: 2px;
  background: var(--danger);
  color: white;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 8px;
  font-weight: 600;
}


/* ============================================================
   Toast notifications
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.toast {
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  background: rgba(20, 25, 30, 0.92);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s;
  backdrop-filter: blur(8px);
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast-success { background: rgba(22, 163, 74, 0.95); }
.toast-error { background: rgba(220, 38, 38, 0.95); }
.toast-info { background: rgba(20, 25, 30, 0.92); }
@media (max-width: 768px) {
  #toast-container { bottom: 80px; }
}

/* ============================================================
   Editable fields (inline edit)
   ============================================================ */
.editable-text, .editable-textarea {
  cursor: text;
  position: relative;
  border-radius: 4px;
  transition: background 0.15s;
}
.editable-textarea {
  display: block;
  width: 100%;
}
.editable-pill {
  cursor: default;
}
.edit-pencil {
  display: none;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-content {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
/* Sprint 2: large modal for forms with 4+ fields - 80% of screen */
.modal-content-lg {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  max-width: 760px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}
@media (max-width: 700px) {
  .modal-content-lg {
    max-width: 100%;
    width: 95%;
    padding: 16px;
    max-height: 92vh;
  }
}
.modal-content h3 {
  margin-top: 0;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* Photo strip */
.photo-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  background: var(--bg-elev2);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}
.photo-del {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-del:hover {
  background: var(--danger);
}

.photo-upload-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.photo-upload-controls label.btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ============================================================
   Print styles
   ============================================================ */
@media print {
  .no-print, .sidebar, .topbar, .bottom-nav, #toast-container {
    display: none !important;
  }
  body, .app-shell, .main, .content {
    background: white !important;
    color: black !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .panel, .detail-header, .worker-panel {
    border: 1px solid #ccc !important;
    background: white !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    margin-bottom: 8mm !important;
    color: black !important;
  }
  .panel-title, .panel-title-sm, .detail-customer, .detail-title {
    color: black !important;
  }
  .info-pill, .badge-tag, .badge-success, .badge-warn, .badge-muted, .status-pill {
    border: 1px solid #999 !important;
    background: white !important;
    color: black !important;
  }
  .urgent-tag {
    border: 1px solid #c00 !important;
    background: white !important;
    color: #c00 !important;
  }
  a {
    color: black !important;
    text-decoration: none !important;
  }
  .content {
    padding: 10mm !important;
    max-width: 100% !important;
  }
  @page {
    size: A4;
    margin: 12mm;
  }
}

/* ============================================================
   Push prompt banner
   ============================================================ */
.push-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid #93c5fd;
  border-right: 4px solid #2563eb;
  border-radius: 10px;
  margin-bottom: 14px;
}
[data-theme="dark"], [data-theme="night-blue"] .push-banner {
  background: linear-gradient(135deg, rgba(37,99,235,0.15), rgba(37,99,235,0.08));
  border-color: rgba(37,99,235,0.4);
}
.push-banner-icon {
  font-size: 28px;
}
.push-banner-text {
  flex: 1;
  min-width: 0;
}
.push-banner-text strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}
.push-banner-text p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}
.push-banner-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
@media (max-width: 480px) {
  .push-banner {
    flex-direction: column;
    align-items: flex-start;
  }
  .push-banner-actions {
    width: 100%;
  }
  .push-banner-actions button {
    flex: 1;
  }
}

/* ============================================================
   Logo - sidebar + login
   ============================================================ */
.sidebar-brand {
  padding: 14px 12px 12px;
  border-bottom: 1px solid var(--border);
}
.brand-logo {
  display: block;
  max-width: 100%;
  max-height: 56px;
  height: auto;
  width: auto;
  object-fit: contain;
  margin: 0 auto 4px;
}
.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
}
.login-logo-img {
  display: block;
  max-width: 240px;
  max-height: 100px;
  height: auto;
  width: auto;
  object-fit: contain;
  margin: 0 auto 8px;
  border-radius: 6px;
}

/* Logo upload preview in settings */
.logo-preview {
  max-width: 280px;
  max-height: 80px;
  width: auto;
  height: auto;
  object-fit: contain;
  background: white;
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 8px;
  display: block;
}
.logo-preview-empty {
  padding: 28px;
  background: var(--bg-elev2);
  border: 1px dashed var(--border);
  border-radius: 6px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
}

/* ================================================================
   MOBILE & UX POLISH PASS — v1.0 final design layer
   ================================================================ */

/* ---------- Better mobile baseline ---------- */
@media (max-width: 768px) {
  body { font-size: 15px; }   /* slightly larger for readability */

  /* Tighter content padding on mobile */
  .content {
    padding: 12px 12px 80px !important;  /* extra bottom for bottom-nav */
  }

  /* Topbar sleeker on mobile */
  .topbar {
    padding: 0 10px !important;
    height: 52px;
    gap: 6px;
  }
  .topbar-title { font-size: 15px; }
  .topbar-search input { padding: 6px 10px; font-size: 14px; }

  /* Sidebar close on body click */
  .sidebar {
    width: 78%;
    max-width: 300px;
    box-shadow: var(--shadow-lg);
  }

  /* Cards more compact */
  .stat-card { padding: 12px 14px; }
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 11px; }

  /* Action bar wraps cleaner */
  .action-bar {
    padding: 8px 10px;
    gap: 6px;
  }
  .action-bar .btn,
  .action-bar a.btn {
    font-size: 13px;
  }

  /* Tabs scroll horizontally if too many */
  .tabs-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    padding-bottom: 10px;
  }
  .tabs-bar::-webkit-scrollbar { display: none; }
  .tabs-bar .chip {
    flex-shrink: 0;
  }

  /* Filter bar more breathable */
  .orders-filters {
    gap: 6px;
    padding: 8px 10px;
  }
  .orders-filters input,
  .orders-filters select {
    font-size: 14px;
    padding: 8px 10px;
    min-height: 38px;
  }

  /* Tables: convert to cards on mobile */
  .orders-table thead { display: none; }
  .orders-table, .orders-table tbody, .orders-table tr, .orders-table td {
    display: block;
    width: 100%;
  }
  .orders-table tr {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
  }
  .orders-table tr:hover {
    background: var(--bg-hover);
  }
  .orders-table td {
    padding: 4px 0 !important;
    border: none !important;
    font-size: 14px !important;
  }
  .orders-table td:first-child {
    font-weight: 600;
    font-size: 15px !important;
    margin-bottom: 4px;
  }
  .orders-table td:empty { display: none; }
}

/* ---------- Worker order detail mobile polish ---------- */
@media (max-width: 768px) {
  .worker-detail-header {
    padding: 12px 14px;
  }
  .detail-customer {
    font-size: 18px !important;
    line-height: 1.3;
  }
  .detail-title {
    font-size: 14px !important;
    color: var(--text-muted);
    line-height: 1.4;
  }

  .worker-info-row {
    gap: 6px;
  }
  .info-pill {
    padding: 6px 10px !important;
    font-size: 13px !important;
    min-height: 32px;
  }

  /* Address block */
  .address-text {
    font-size: 15px !important;
    line-height: 1.5;
    padding: 8px 0;
  }
  .address-actions {
    gap: 6px;
  }
  .address-actions .btn {
    flex: 1;
    min-width: 0;
    text-align: center;
    justify-content: center;
  }

  .contact-actions {
    gap: 6px;
    flex-wrap: wrap;
  }
  .contact-actions .btn {
    flex: 1;
    min-width: 80px;
    text-align: center;
    justify-content: center;
  }

  /* Primary action bar stays inline (in document flow) on mobile */
  /* The button is naturally placed after "instructions" panel - no fixed positioning */
  .primary-action-bar {
    margin: 16px 0;
    padding: 0;
  }
  .primary-action-bar .btn-big {
    width: 100%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  }
  /* Body padding only for bottom-nav + safe-area */
  body { padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- Big primary action button ---------- */
.btn-big {
  width: 100%;
  padding: 16px 20px;
  font-size: 17px;
  font-weight: 600;
  border-radius: 12px;
  background: var(--primary);
  color: var(--primary-text);
  border: none;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
  box-shadow: 0 2px 8px rgba(37,99,235,0.25);
  letter-spacing: 0.3px;
}
.btn-big:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(37,99,235,0.35);
  transform: translateY(-1px);
}
.btn-big:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(37,99,235,0.25);
}
.btn-big.btn-success {
  background: var(--success);
  box-shadow: 0 2px 8px rgba(22,163,74,0.25);
}
.btn-big.btn-success:hover {
  background: #15803d;
  box-shadow: 0 4px 12px rgba(22,163,74,0.35);
}
.btn-big.btn-warning {
  background: var(--warning);
  box-shadow: 0 2px 8px rgba(217,119,6,0.25);
}

/* ---------- Better buttons in general ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-elev2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  min-height: 36px;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
}
.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}
.btn:active { transform: scale(0.98); }
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  min-height: 30px;
}
.btn-accent {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
}
.btn-accent:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

/* ---------- Better chips/tabs ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.chip:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.chip.active {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(37,99,235,0.2);
}

/* ---------- Better panels ---------- */
.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.panel-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.panel-title-sm {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Order cards: cleaner look ---------- */
.order-card {
  display: block;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s;
  margin-bottom: 8px;
}
.order-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.order-card:active { transform: translateY(0); }
.order-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.order-customer {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
}
.order-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
  align-items: center;
}
.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

/* ---------- Toast: position bottom on mobile, top on desktop ---------- */
#toast-container {
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
}
@media (max-width: 768px) {
  #toast-container { bottom: 80px; }
}

.toast {
  pointer-events: auto;
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  background: rgba(20, 25, 30, 0.95);
  color: #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-right: 4px solid transparent;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast-success { background: rgba(22, 163, 74, 0.96); border-right-color: rgba(255,255,255,0.4); }
.toast-error { background: rgba(220, 38, 38, 0.96); border-right-color: rgba(255,255,255,0.4); }
.toast-info { background: rgba(37, 99, 235, 0.96); border-right-color: rgba(255,255,255,0.4); }

/* ---------- Better forms ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 14px;
}
.form-group { display: flex; flex-direction: column; }
.form-group.full { grid-column: 1 / -1; }
.form-group label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 5px;
  font-weight: 500;
}
.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev2);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  min-height: 40px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.form-group textarea {
  min-height: 70px;
  line-height: 1.5;
  resize: vertical;
}

/* ---------- Modal: full-screen on mobile, centered on desktop ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: modalFade 0.2s ease-out;
}
@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-content {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlide 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes modalSlide {
  from { transform: translateY(20px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-content h3 {
  margin: 0 0 14px;
  font-size: 17px;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
}

@media (max-width: 480px) {
  .modal {
    align-items: flex-end;
    padding: 0;
  }
  .modal-content {
    border-radius: 18px 18px 0 0;
    max-height: 92vh;
    width: 100%;
    padding: 20px 18px 24px;
  }
  .modal-actions {
    position: sticky;
    bottom: -22px;
    background: var(--bg-elev);
    padding-top: 12px;
    margin: 18px -18px -24px;
    padding: 12px 18px 8px;
    border-top: 1px solid var(--border);
  }
  .modal-actions .btn {
    flex: 1;
    justify-content: center;
    min-height: 44px;
  }
}

/* ---------- Photo strip on mobile ---------- */
@media (max-width: 480px) {
  .photo-strip {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
  }
  .photo-upload-controls .btn,
  .photo-upload-controls label.btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
    text-align: center;
  }
}

/* ---------- Calendar mobile: stack week, smaller month ---------- */
@media (max-width: 768px) {
  .cal-toolbar {
    padding: 8px 10px;
    flex-wrap: wrap;
    gap: 6px;
  }
  .cal-title {
    width: 100%;
    text-align: center;
    font-size: 14px;
    margin: 4px 0 0;
    order: 99;
  }
  .cal-month-cell {
    min-height: 56px;
    padding: 3px;
  }
  .cal-month-day-num {
    font-size: 12px;
  }
  .cal-month-event {
    font-size: 9px !important;
    padding: 1px 3px !important;
  }
  .cal-week-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .cal-week-day {
    min-height: auto;
  }
}

/* ---------- Detail header: tighter on mobile ---------- */
@media (max-width: 480px) {
  .detail-header,
  .worker-detail-header {
    padding: 12px 14px;
  }
  .detail-top-row {
    gap: 8px;
  }
  .order-num {
    font-size: 13px;
  }
  .urgent-tag,
  .badge-tag,
  .status-pill {
    font-size: 11px;
    padding: 2px 8px;
  }
}

/* ---------- Login screen polish ---------- */
.login-card {
  border-radius: 16px;
  padding: 32px 24px 28px;
}
.login-logo-img {
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.06));
}
@media (max-width: 480px) {
  .login-card {
    padding: 28px 20px 24px;
    max-width: 100%;
    border-radius: 16px;
  }
  .login-logo-img {
    max-width: 200px !important;
  }
}

/* ---------- Sidebar brand on mobile - show full logo ---------- */
.sidebar-brand {
  padding: 14px 12px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

/* ---------- Bottom nav - PWA-safe stack ---------- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 200;
  /* Visual content = 60px. Below it is the safe-area for iPhone home indicator. */
  height: 60px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  /* Make total height = 60px + safe-area: */
  height: calc(60px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.05);
}
.bottom-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-muted);
  position: relative;
  transition: color 0.15s;
  -webkit-user-select: none;
  user-select: none;
}
.bottom-item:hover { color: var(--text); }
.bottom-item.active { color: var(--primary); }
.bottom-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 30%;
  right: 30%;
  height: 2px;
  background: var(--primary);
  border-radius: 0 0 2px 2px;
}
.bn-icon { font-size: 20px; line-height: 1; }
.bn-label { font-size: 11px; font-weight: 500; }
.bn-badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 4px);
  background: var(--danger);
  color: white;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 8px;
  min-width: 14px;
  text-align: center;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* ---------- Notes & messages prettier ---------- */
.note {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-right: 3px solid var(--text-muted);
  transition: opacity 0.2s;
}
.note.issue {
  border-right-color: var(--danger);
  background: linear-gradient(to left, var(--bg-elev2) 90%, var(--danger-bg));
}
.note.closed {
  opacity: 0.65;
}
.note-content {
  font-size: 14px;
  line-height: 1.5;
  margin: 6px 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.note-meta {
  font-size: 11px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.note-header-sm {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  flex-wrap: wrap;
}

/* ---------- Status pill - more pop ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

/* ---------- Address actions buttons better mobile ---------- */
.address-actions, .contact-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* ---------- Push banner more prominent ---------- */
.push-banner {
  border-radius: 14px;
  padding: 14px 16px;
}
@media (max-width: 480px) {
  .push-banner {
    padding: 12px 14px;
  }
  .push-banner-icon {
    font-size: 24px;
  }
  .push-banner-text strong { font-size: 13px; }
  .push-banner-text p { font-size: 11px; }
}

/* ---------- Better empty states ---------- */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.empty-state-sm {
  text-align: center;
  padding: 24px 12px;
  color: var(--text-faint);
  font-size: 13px;
}

/* ---------- Hide brand-name fallback if logo is showing ---------- */
.sidebar-brand .brand-name { display: none; }
.sidebar-brand .brand-logo:not([style*="display: none"]) ~ .brand-name { display: none; }

/* ---------- Print style - close button hidden ---------- */
@media print {
  .actions-bar,
  .no-print,
  #toast-container,
  .sidebar,
  .topbar,
  .bottom-nav,
  .primary-action-bar,
  .push-banner,
  .modal {
    display: none !important;
  }
  body {
    background: white !important;
    color: black !important;
  }
  .panel, .detail-header {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }
  .content {
    padding: 0 !important;
  }
  @page {
    size: A4;
    margin: 12mm;
  }
}

/* ---------- Tap targets - everything 44px+ on mobile ---------- */
@media (max-width: 768px) {
  .btn, .chip, .icon-btn, .nav-item {
    min-height: 38px;
  }
  .btn-sm {
    min-height: 34px;
  }
  input[type="checkbox"], input[type="radio"] {
    width: 20px;
    height: 20px;
  }
}

/* ---------- Smooth focus ring for accessibility ---------- */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Scroll behavior ---------- */
html { scroll-behavior: smooth; }

/* ---------- Better link/touch on the main areas ---------- */
.contact-block strong {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  margin-left: 6px;
}

/* ---------- Issue-modal & edit-modal textareas ---------- */
#issue-modal-text,
#edit-modal-textarea {
  font-size: 16px;  /* prevents iOS zoom on focus */
  line-height: 1.5;
}
#edit-modal-input {
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev2);
  color: var(--text);
}
@media (max-width: 768px) {
  /* Critical: prevent iOS auto-zoom on focus */
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* ---------- Quick-action area visual ---------- */
.quick-actions-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.quick-actions-row > * {
  flex: 1;
  min-width: 110px;
}

/* ---------- Sidebar overlay on mobile ---------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 55;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (max-width: 768px) {
  .sidebar.open ~ .sidebar-overlay,
  .sidebar.mobile-open ~ .sidebar-overlay {
    display: block;
  }
}

/* ---------- Pretty scrollbars on desktop - comfortable thickness ---------- */
@media (min-width: 769px) {
  ::-webkit-scrollbar { width: 14px; height: 14px; }
  ::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
  }
  ::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 10px;
    border: 3px solid transparent;
    background-clip: padding-box;
    min-height: 40px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: var(--text-faint);
    background-clip: padding-box;
    border: 3px solid transparent;
  }
  ::-webkit-scrollbar-thumb:active {
    background: var(--primary);
    background-clip: padding-box;
    border: 3px solid transparent;
  }
  /* Firefox */
  * {
    scrollbar-width: auto;
    scrollbar-color: var(--border-strong) transparent;
  }
}

/* ---------- Helpful: prevent text selection on action buttons ---------- */
.btn, .chip, .nav-item, .bottom-item {
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

/* ---------- Counter pills on mobile - full row ---------- */
@media (max-width: 480px) {
  .worker-counters {
    margin-bottom: 10px;
    gap: 6px;
  }
  .counter-pill {
    font-size: 12px;
    padding: 5px 10px;
  }
}

/* Hide view-toggle on mobile (cards is always best) */
@media (max-width: 768px) {
  .view-toggle-bar { display: none; }
}

/* ---------- Stat cards: themed variants ---------- */
.stat-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  transition: all 0.15s;
}
.stat-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
}
.stat-card-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}
.stat-card-link:active {
  transform: translateY(0);
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.stat-sub {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 6px;
}

/* Themed variants - more subtle than inline */
.stat-card-danger {
  border-color: rgba(220, 38, 38, 0.25);
  background: linear-gradient(135deg, var(--bg-elev) 65%, rgba(220, 38, 38, 0.06));
}
.stat-card-danger .stat-label,
.stat-card-danger .stat-value {
  color: var(--danger);
}

.stat-card-warning {
  border-color: rgba(217, 119, 6, 0.25);
  background: linear-gradient(135deg, var(--bg-elev) 65%, rgba(217, 119, 6, 0.06));
}
.stat-card-warning .stat-label,
.stat-card-warning .stat-value {
  color: var(--warning);
}

.stat-card-attention {
  border-color: rgba(217, 119, 6, 0.20);
  background: linear-gradient(135deg, var(--bg-elev) 65%, rgba(252, 211, 77, 0.08));
}
.stat-card-attention .stat-label,
.stat-card-attention .stat-value {
  color: #b45309;
}

[data-theme="dark"], [data-theme="night-blue"] .stat-card-attention .stat-label,
[data-theme="dark"], [data-theme="night-blue"] .stat-card-attention .stat-value {
  color: #fcd34d;
}

/* Mobile: smaller stat cards */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
  }
  .stat-card {
    padding: 12px 14px;
  }
  .stat-value { font-size: 24px; }
  .stat-label { font-size: 11px; }
  .stat-sub { font-size: 10px; }
}

/* ---------- Dashboard blocks polish ---------- */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.dash-block {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
}
.section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

@media (max-width: 768px) {
  .dash-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .dash-block {
    padding: 14px;
  }
  .section-title { font-size: 14px; }
}

/* Show only on desktop / show only on mobile */
.desktop-only { display: initial; }
.mobile-only { display: none; }
@media (max-width: 768px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: initial !important; }
  /* Restore flex layout for nav-like elements */
  nav.mobile-only, .bottom-nav.mobile-only { display: flex !important; }
}

/* Theme toggle in profile - mobile users use that */

/* Quick new dropdown - mobile friendly */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  display: none;
  min-width: 180px;
  z-index: 100;
  padding: 4px;
}
.dropdown.open .dropdown-menu {
  display: block;
}
.dropdown-menu a {
  display: block;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
}
.dropdown-menu a:hover {
  background: var(--bg-hover);
}
@media (max-width: 480px) {
  .dropdown-menu {
    left: auto;
    right: 0;
    min-width: 200px;
  }
}

/* "+ חדש" button accent */
#quick-new-btn {
  font-weight: 600;
}


/* WhatsApp brand color */
.btn-whatsapp {
  background: #25d366 !important;
  color: white !important;
  border-color: #25d366 !important;
}
.btn-whatsapp:hover {
  background: #1ebe5d !important;
  border-color: #1ebe5d !important;
}

.order-card.urgent {
  border-right: 4px solid var(--danger);
}

/* Order title within card */
.order-title {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}
.order-num {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-elev2);
  padding: 1px 8px;
  border-radius: 6px;
  font-weight: 500;
}

/* Urgent tag - more striking */
.urgent-tag {
  display: inline-block;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

/* Reminder tag */
.reminder-tag {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid rgba(217,119,6,0.2);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.note-indicator {
  color: var(--warning) !important;
  font-weight: 600;
}

/* ---------- Photo strip styling ---------- */
.photo-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
  transition: transform 0.2s;
}
.photo-thumb:hover img {
  transform: scale(1.05);
}
.photo-del {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.photo-del:hover {
  background: var(--danger);
}

/* Photo upload buttons */
.photo-upload-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.photo-upload-controls > * {
  flex: 1;
  min-width: 130px;
  justify-content: center;
}


/* ============================================================
   ALLOW TEXT SELECTION EVERYWHERE BY DEFAULT
   Only buttons/chips/nav remain non-selectable
   ============================================================ */
body, .content, .panel, .detail-header, .order-card,
.address-text, .address-block, .contact-block,
.note, .note-content, .order-customer, .detail-title,
.detail-customer, .info-pill, p, span, h1, h2, h3, h4, h5, h6,
td, th, li, .editable-text, .editable-textarea {
  -webkit-user-select: text !important;
  user-select: text !important;
  -webkit-touch-callout: default !important;
}

/* Re-disable on actual interactive controls only */
.btn, .chip, .nav-item, .bottom-item, button,
.bn-icon, .bn-label, .nav-icon, .icon-btn,
.urgent-tag, .badge-tag, .reminder-tag, .status-pill {
  -webkit-user-select: none;
  user-select: none;
}

/* Re-enable on text content inside cards/links - they need to be selectable */
.order-card .order-customer,
.order-card .order-title,
.order-card .meta-item {
  -webkit-user-select: text;
  user-select: text;
}


/* ============================================================
   Edit button (separate from text - allows text selection)
   ============================================================ */
.edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--bg-elev2);
  color: var(--text-muted);
  border-radius: 50%;
  font-size: 13px;
  cursor: pointer;
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
  transition: all 0.15s;
}
.edit-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(1.05);
}
.edit-btn:active {
  transform: scale(0.95);
}

/* For inline edit buttons (next to text) - smaller */
.contact-block .edit-btn,
.address-block .edit-btn {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

/* Text that's editable - subtle hint without blocking selection */
.editable-text {
  border-radius: 3px;
  padding: 1px 3px;
  background: rgba(37, 99, 235, 0.04);
  border-bottom: 1px dashed rgba(37, 99, 235, 0.25);
}
[data-theme="dark"], [data-theme="night-blue"] .editable-text {
  background: rgba(96, 165, 250, 0.06);
  border-bottom-color: rgba(96, 165, 250, 0.3);
}
.editable-textarea {
  background: rgba(37, 99, 235, 0.03);
  border-radius: 4px;
  padding: 4px 6px;
}
[data-theme="dark"], [data-theme="night-blue"] .editable-textarea {
  background: rgba(96, 165, 250, 0.04);
}

/* Mobile - bigger edit buttons for easier tap */
@media (max-width: 768px) {
  .edit-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  .contact-block .edit-btn,
  .address-block .edit-btn {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }
}


/* Worker name in order card */
.meta-worker {
  color: var(--text-muted);
}
.meta-no-worker {
  color: var(--warning);
  font-weight: 500;
}

/* ============================================================
   Print-only elements + reports print styles
   ============================================================ */
.print-only { display: none; }
@media print {
  .print-only { display: block !important; }
  .no-print { display: none !important; }

  body {
    background: white !important;
    color: black !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 11pt;
  }
  .app-shell { display: block !important; height: auto !important; }
  .sidebar, .topbar, .bottom-nav, #toast-container, .modal { display: none !important; }
  .main { display: block !important; }
  .content { padding: 0 !important; }

  /* Print header */
  .print-header {
    display: flex !important;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #2563eb;
    padding-bottom: 8mm;
    margin-bottom: 8mm;
    page-break-after: avoid;
  }
  .print-business { display: flex; align-items: center; gap: 8mm; }
  .print-logo { max-width: 50mm; max-height: 18mm; }
  .print-business-name { font-size: 16pt; font-weight: bold; color: #2563eb; }
  .print-meta { text-align: left; }
  .print-title-big { font-size: 18pt; font-weight: bold; color: #111; }
  .print-date { font-size: 10pt; color: #666; margin-top: 2mm; }

  /* Tables print clean */
  .orders-table, .orders-table thead, .orders-table tbody,
  .orders-table tr, .orders-table td, .orders-table th {
    display: revert !important;
    width: auto !important;
    background: white !important;
    border-color: #ccc !important;
    color: black !important;
  }
  .orders-table {
    width: 100% !important;
    border-collapse: collapse;
    font-size: 10pt;
  }
  .orders-table thead { display: table-header-group !important; }
  .orders-table th {
    background: #f0f0f0 !important;
    border: 1px solid #ccc !important;
    padding: 4mm !important;
    text-align: right !important;
    font-weight: bold !important;
  }
  .orders-table td {
    border: 1px solid #ccc !important;
    padding: 3mm 4mm !important;
  }
  .orders-table tr:hover { background: white !important; }

  /* Stats grid for print */
  .stats-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 4mm;
  }
  .stat-card {
    border: 1px solid #999 !important;
    background: white !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    padding: 4mm !important;
  }
  .stat-value { color: black !important; font-size: 18pt !important; }
  .stat-label { color: #555 !important; }

  /* Order cards inline within reports */
  .order-card {
    border: 1px solid #ccc !important;
    background: white !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    padding: 3mm !important;
  }
  .order-card:hover { transform: none !important; }

  .panel {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }

  @page { size: A4; margin: 14mm; }
}

/* ============================================================
   Senzey panel
   ============================================================ */
.senzey-panel {
  border-right: 4px solid #10b981;
  background: linear-gradient(to left, var(--bg-elev) 88%, rgba(16,185,129,0.06));
}
[data-theme="dark"], [data-theme="night-blue"] .senzey-panel {
  background: linear-gradient(to left, var(--bg-elev) 85%, rgba(16,185,129,0.10));
}
.senzey-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.senzey-actions .btn {
  flex: 1;
  min-width: 130px;
  justify-content: center;
}
@media (max-width: 480px) {
  .senzey-actions .btn {
    flex-basis: calc(50% - 4px);
    min-width: 0;
  }
}

/* Senzey tag in customer list */
.senzey-tag {
  display: inline-block;
  margin-right: 6px;
  font-size: 13px;
  vertical-align: middle;
  cursor: help;
  opacity: 0.7;
}
.senzey-tag:hover {
  opacity: 1;
}

/* ============================================================
   COMPACT FORM PASS - tighter spacing on desktop forms
   ============================================================ */
.panel {
  padding: 14px 16px;
  margin-bottom: 12px;
}
.panel-title {
  font-size: 14px;
  margin: 0 0 10px;
  padding-bottom: 8px;
}
.panel-title-sm {
  font-size: 13px;
  margin: 0 0 8px;
}

/* Tighter form grid */
.form-grid {
  gap: 10px !important;
  grid-template-columns: repeat(3, 1fr);  /* 3 columns by default */
}
.form-grid .form-group { min-width: 0; }
.form-grid .full { grid-column: 1 / -1; }

/* Compact form fields */
.form-group label {
  font-size: 11px !important;
  margin-bottom: 3px !important;
}
.form-group input,
.form-group select,
.form-group textarea {
  padding: 6px 9px !important;
  font-size: 13px !important;
  min-height: 32px;
}
.form-group input[type="datetime-local"],
.form-group input[type="date"],
.form-group input[type="time"] {
  padding: 5px 9px !important;
}
.form-group textarea { min-height: 50px !important; }

/* Tablet/narrow → 2 columns */
@media (max-width: 1024px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Mobile → 1 column, but with bigger touch targets */
@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 9px 11px !important;
    font-size: 16px !important;  /* 16px to prevent iOS zoom */
    min-height: 40px;
  }
}

/* Customer toggle radio chips - compact */
.customer-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.radio-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.radio-chip input { margin: 0; }
.radio-chip:has(input:checked) {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Checkbox row tighter */
.checkbox-row {
  font-size: 13px;
  padding: 4px 0;
}

/* Action bar at top - smaller buttons */
.action-bar .btn {
  padding: 6px 12px;
  font-size: 13px;
}

/* Hide or shrink the giant blue checkbox */
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* Customer toggle - 3 chips need to wrap on mobile */
.customer-toggle {
  flex-wrap: wrap;
}
@media (max-width: 480px) {
  .customer-toggle .radio-chip {
    flex: 1;
    min-width: calc(33% - 4px);
    justify-content: center;
    text-align: center;
    padding: 8px 6px;
    font-size: 12px;
  }
}

/* Hint message for new customer mode */
.customer-pane p {
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(16,185,129,0.08);
  border-right: 3px solid var(--success);
}
[data-theme="dark"], [data-theme="night-blue"] .customer-pane p {
  background: rgba(16,185,129,0.12);
}
.customer-pane #customer-temporary p,
.customer-pane:nth-of-type(3) p {
  background: rgba(249,115,22,0.08);
  border-right-color: var(--warning);
}

/* ============================================================
   Custom Date/Time Picker
   ============================================================ */
.nn-dt-trigger {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2399a' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: 8px center !important;
  padding-left: 30px !important;
}
.nn-dt-trigger[type="text"] {
  /* Override text input that was originally type=time */
}
input[data-nn-enhanced][readonly] {
  background-color: var(--bg-elev2);
  cursor: pointer;
}
input[data-nn-enhanced][readonly]:hover {
  border-color: var(--primary);
}

.nn-dt-popup {
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  padding: 12px;
  width: 290px;
  font-family: inherit;
  direction: rtl;
}
[data-theme="dark"], [data-theme="night-blue"] .nn-dt-popup {
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.nn-dt-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.nn-dt-nav {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: var(--bg-elev2);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nn-dt-nav:hover { background: var(--primary); color: white; border-color: var(--primary); }
.nn-dt-month-label {
  flex: 1;
  display: flex;
  gap: 4px;
  background: transparent;
  border: none;
  padding: 0;
}
.nn-dt-month-sel, .nn-dt-year-sel {
  flex: 1;
  padding: 4px 6px;
  border: 1px solid var(--border);
  background: var(--bg-elev2);
  color: var(--text);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.nn-dt-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.nn-dt-chip {
  padding: 4px 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev2);
  color: var(--text);
  border-radius: 14px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.nn-dt-chip:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.nn-dt-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.nn-dt-dow {
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
  padding: 4px 0 6px;
  font-weight: 600;
}
.nn-dt-day {
  background: transparent;
  border: 1px solid transparent;
  padding: 0;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
}
.nn-dt-day:hover:not(.nn-dt-empty) {
  background: var(--bg-hover);
  border-color: var(--border);
}
.nn-dt-day.nn-dt-empty {
  cursor: default;
}
.nn-dt-day.nn-dt-today {
  border-color: var(--primary);
  font-weight: bold;
}
.nn-dt-day.nn-dt-selected {
  background: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
}
.nn-dt-day.nn-dt-shabbat {
  color: var(--warning);
}

.nn-dt-time {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.nn-dt-time-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.nn-dt-time-row label {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 30px;
}
.nn-dt-time-inputs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.nn-dt-time-inputs select {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--border);
  background: var(--bg-elev2);
  color: var(--text);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.nn-dt-time-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.nn-dt-footer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 6px;
  justify-content: space-between;
}
.nn-dt-clear, .nn-dt-ok {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  font-family: inherit;
}
.nn-dt-clear {
  background: var(--bg-elev2);
  color: var(--text-muted);
}
.nn-dt-ok {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.nn-dt-clear:hover { background: var(--bg-hover); }
.nn-dt-ok:hover { filter: brightness(1.1); }

/* Mobile */
@media (max-width: 480px) {
  .nn-dt-popup {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: auto !important;
    max-width: 100%;
    border-radius: 12px 12px 0 0;
    border-bottom: none;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.3);
  }
  .nn-dt-day { height: 38px; }
  .nn-dt-chip { padding: 6px 12px; font-size: 12px; }
}

/* ============================================================
   Bulk action bar (multi-select on orders list)
   ============================================================ */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(37,99,235,0.25);
}
.bulk-bar .btn {
  background: rgba(255,255,255,0.15);
  color: white;
  border-color: rgba(255,255,255,0.3);
}
.bulk-bar .btn:hover {
  background: rgba(255,255,255,0.25);
}
.bulk-cell {
  width: 32px;
  text-align: center;
}
.bulk-cell input[type="checkbox"] {
  cursor: pointer;
}

/* ============================================================
   Custom Date/Time Picker
   ============================================================ */
.np-wrap {
  position: relative;
  width: 100%;
}
.np-display {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 11px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-align: right;
  min-height: 38px;
  transition: border-color 0.15s, background 0.15s;
}
.np-display:hover {
  border-color: var(--primary);
  background: var(--bg-hover);
}
.np-display.np-empty .np-text {
  color: var(--text-muted);
}
.np-display .np-icon { font-size: 14px; opacity: 0.7; }
.np-display .np-text { flex: 1; text-align: right; }

/* Picker popup */
.np-picker {
  width: 320px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  z-index: 9999;
  padding: 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  direction: rtl;
}

/* Quick chips row */
.np-quick {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-bottom: 10px;
}
.np-quick button {
  padding: 6px 4px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.12s;
}
.np-quick button:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Calendar header */
.np-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 4px 0;
}
.np-cal-head .np-title {
  font-weight: 600;
  font-size: 14px;
}
.np-nav {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.np-nav:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
}

/* Calendar grid */
.np-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 10px;
}
.np-dow {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 4px 0;
}
.np-day {
  aspect-ratio: 1;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.np-day:hover:not(.np-empty) {
  background: var(--bg-hover);
  border-color: var(--border);
}
.np-day.np-today {
  border-color: var(--primary);
  font-weight: 700;
}
.np-day.np-selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.np-day.np-empty {
  cursor: default;
}

/* Time row */
.np-time-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.np-time-row label {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}
.np-time-row select {
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 6px;
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  min-height: 28px;
}
.np-time-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-right: auto;
}
.np-time-quick button {
  padding: 3px 7px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  transition: all 0.12s;
}
.np-time-quick button:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Action buttons */
.np-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.np-actions button {
  padding: 7px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border);
  background: var(--bg-elev2);
  color: var(--text);
}
.np-actions .np-ok {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 500;
}
.np-actions button:hover { opacity: 0.9; }

/* Mobile */
@media (max-width: 480px) {
  .np-picker {
    width: calc(100vw - 16px);
    max-width: 360px;
  }
  .np-display {
    font-size: 16px; /* prevent iOS zoom */
  }
}

/* ============================================================
   Clickable editable elements (no pencil pattern)
   - text spans show subtle dotted underline
   - pill clickable shows hover state
   - long-press still works for select+copy (default native)
   ============================================================ */
.editable-text {
  cursor: pointer;
  border-radius: 3px;
  padding: 1px 4px;
  border-bottom: 1px dotted rgba(37, 99, 235, 0.35);
  transition: background 0.15s, border-color 0.15s;
}
.editable-text:hover {
  background: rgba(37, 99, 235, 0.06);
  border-bottom-color: var(--primary);
}
[data-theme="dark"], [data-theme="night-blue"] .editable-text {
  border-bottom-color: rgba(96, 165, 250, 0.4);
}
[data-theme="dark"], [data-theme="night-blue"] .editable-text:hover {
  background: rgba(96, 165, 250, 0.08);
}

.editable-textarea {
  cursor: pointer;
  border-radius: 4px;
  padding: 6px 8px;
  background: rgba(37, 99, 235, 0.03);
  border: 1px dashed rgba(37, 99, 235, 0.2);
  transition: background 0.15s, border-color 0.15s;
}
.editable-textarea:hover {
  background: rgba(37, 99, 235, 0.08);
  border-color: var(--primary);
}
[data-theme="dark"], [data-theme="night-blue"] .editable-textarea {
  background: rgba(96, 165, 250, 0.04);
  border-color: rgba(96, 165, 250, 0.25);
}
[data-theme="dark"], [data-theme="night-blue"] .editable-textarea:hover {
  background: rgba(96, 165, 250, 0.10);
}

/* Pill clickable (date, return) */
.info-pill.clickable {
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.info-pill.clickable:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
}
.info-pill.clickable:active {
  transform: scale(0.98);
}

/* Hide stray edit buttons (legacy) */
.edit-btn { display: none !important; }

/* ============================================================
   Bigger clickable status pill in order list cards
   For workers - tap pill to advance status without opening order
   ============================================================ */
.status-pill-action {
  /* Override default pill: bigger, button-like, hover-able */
  font-size: 14px !important;
  font-weight: 700 !important;
  padding: 8px 18px !important;
  border-radius: 999px;
  border: 2px solid;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  letter-spacing: 0.2px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.status-pill-action:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
  filter: brightness(1.05);
}
.status-pill-action:active {
  transform: scale(0.97);
}
.status-pill-action.advancing {
  pointer-events: none;
  opacity: 0.6;
}
.status-pill-action.advancing::after {
  content: ' ⏳';
}

/* Mobile: even more tap-friendly */
@media (max-width: 768px) {
  .status-pill-action {
    font-size: 15px !important;
    padding: 10px 20px !important;
    min-height: 40px;
  }
}

/* ============================================================
   Print dropdown in action-bar - RTL safe positioning
   The menu must stay within viewport on mobile.
   ============================================================ */
.print-dropdown {
  position: relative;
}
.print-dropdown .dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  /* In RTL, "inset-inline-start: 0" anchors menu to the right edge of button (visual) */
  inset-inline-start: 0;
  inset-inline-end: auto;
  min-width: 220px;
  z-index: 200;
}
@media (max-width: 480px) {
  .print-dropdown .dropdown-menu {
    /* Anchor to the END of button (left visually in RTL) so menu opens leftward into the screen */
    inset-inline-start: auto;
    inset-inline-end: 0;
    min-width: 220px;
    max-width: calc(100vw - 32px);
  }
}

/* ============================================================
   Worker info pills - unified date/return display
   ============================================================ */
.info-pill .info-pill-label {
  font-weight: 600;
  font-size: 12px;
  opacity: 0.75;
  margin: 0 2px;
}
.info-pill .info-pill-value {
  font-weight: 500;
}
/* Override warn so date pills look the same regardless of which one */
.info-pill.warn:not(.clickable) {
  background: var(--bg-elev2);
  color: var(--text);
  border-color: var(--border);
}

/* ============================================================
   Desktop datetime picker (custom)
   - mobile uses native datetime-local
   - desktop uses this overlay with custom calendar
   ============================================================ */
.nndp-wrap {
  position: relative;
  width: 100%;
}
.nndp-display {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-align: right;
  min-height: 38px;
  transition: border-color 0.15s, background 0.15s;
}
.nndp-display:hover {
  border-color: var(--primary);
  background: var(--bg-hover);
}
.nndp-wrap.nndp-open .nndp-display {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}
.nndp-display .nndp-icon { font-size: 14px; opacity: 0.7; }
.nndp-display .nndp-text { flex: 1; text-align: right; }
.nndp-display .nndp-text.nndp-empty { color: var(--text-muted); }

.nndp-popup {
  position: absolute;
  top: calc(100% + 4px);
  inset-inline-start: 0;
  width: 200px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  padding: 6px;
  z-index: 9999;
  font-size: 11px;
  color: var(--text);
  direction: rtl;
}
.nndp-popup.nndp-popup-above {
  top: auto;
  bottom: calc(100% + 4px);
  box-shadow: 0 -6px 18px rgba(0,0,0,0.18);
}
.nndp-quick {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}
.nndp-quick button {
  padding: 3px 1px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  cursor: pointer;
  font-size: 9px;
  transition: all 0.12s;
  font-family: inherit;
}
.nndp-quick button:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.nndp-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
  padding: 1px 0;
}
.nndp-title { font-weight: 600; font-size: 11px; }
.nndp-nav {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 20px;
  height: 20px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 10px;
  padding: 0;
}
.nndp-nav:hover { background: var(--bg-hover); border-color: var(--primary); }

.nndp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  margin-bottom: 4px;
}
.nndp-dow {
  text-align: center;
  font-size: 8px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 1px 0;
}
.nndp-day {
  aspect-ratio: 1;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  border-radius: 3px;
  cursor: pointer;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  padding: 0;
  min-width: 0;
}
.nndp-day:hover:not(.nndp-empty) {
  background: var(--bg-hover);
  border-color: var(--border);
}
.nndp-day.nndp-today { border-color: var(--primary); font-weight: 700; }
.nndp-day.nndp-selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.nndp-day.nndp-empty { cursor: default; }

.nndp-time-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.nndp-time-row label {
  font-size: 10px;
  color: var(--text-muted);
  margin: 0;
}
.nndp-time-row select {
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 10px;
  font-family: inherit;
  min-height: 18px;
}
.nndp-time-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  width: 100%;
  margin-top: 2px;
}
.nndp-time-quick button {
  flex: 1;
  min-width: 18px;
  padding: 1px 2px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 9px;
  transition: all 0.12s;
  font-family: inherit;
}
.nndp-time-quick button:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.nndp-actions {
  display: flex;
  gap: 3px;
  justify-content: flex-end;
}
.nndp-actions button {
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 10px;
  font-family: inherit;
  border: 1px solid var(--border);
  background: var(--bg-elev2);
  color: var(--text);
}
.nndp-actions .nndp-ok {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 500;
}
.nndp-actions button:hover { opacity: 0.9; }

/* On mobile - hide custom display, native input shows naturally */
@media (max-width: 767px) {
  .nndp-wrap input[type="datetime-local"] {
    /* Reset hidden state - mobile uses native */
    position: static !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    height: auto !important;
    padding: 8px 11px !important;
    border: 1px solid var(--border) !important;
  }
  .nndp-display { display: none !important; }
}

/* ============================================================
   Order form (new/edit) - extra compact on desktop (-30%)
   ============================================================ */
@media (min-width: 768px) {
  .order-form-page .panel,
  .order-form .panel {
    padding: 6px 9px;
    margin-bottom: 5px;
    border-radius: 6px;
  }
  .order-form-page .panel-title,
  .order-form .panel-title {
    font-size: 11px;
    margin-bottom: 5px;
    font-weight: 600;
  }
  .order-form-page .form-group label,
  .order-form .form-group label {
    font-size: 10px;
    margin-bottom: 2px;
  }
  .order-form-page .form-group input,
  .order-form-page .form-group select,
  .order-form-page .form-group textarea,
  .order-form .form-group input,
  .order-form .form-group select,
  .order-form .form-group textarea {
    padding: 3px 6px;
    font-size: 11px;
    min-height: 22px;
  }
  .order-form-page .form-group textarea,
  .order-form .form-group textarea {
    min-height: 36px;
  }
  .order-form-page .form-grid,
  .order-form .form-grid {
    gap: 5px;
  }
  /* Customer mode toggle — more compact */
  .order-form .customer-mode-toggle {
    gap: 3px;
  }
  .order-form .customer-mode-toggle label {
    padding: 3px 7px;
    font-size: 10px;
  }
  /* Submit row buttons */
  .order-form .form-actions .btn,
  .order-form-page .form-actions .btn {
    padding: 5px 10px;
    font-size: 11px;
  }
  /* Two-column layout for non-textarea fields where it fits */
  .order-form .panel:not(.panel-customer) .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .order-form .form-group.full {
    grid-column: 1 / -1;
  }
  /* Action bar smaller */
  .order-form .action-bar {
    padding: 4px 0;
    margin-bottom: 6px;
  }
  .order-form .action-bar .btn {
    padding: 4px 9px;
    font-size: 11px;
  }
  /* Date picker display button shrinks too */
  .order-form .nndp-display {
    padding: 3px 7px;
    font-size: 11px;
    min-height: 22px;
  }
  /* Datetime-local inputs */
  .order-form input[type="datetime-local"],
  .order-form input[type="date"],
  .order-form input[type="time"] {
    padding: 3px 6px !important;
    font-size: 11px !important;
    min-height: 22px !important;
  }
}

/* Return-count badge inside tab chip */
.chip-count.chip-count-warn {
  background: rgba(234, 88, 12, 0.18) !important;
  color: #ea580c !important;
  margin-inline-start: 4px;
  font-weight: 700;
}
[data-theme="dark"], [data-theme="night-blue"] .chip-count.chip-count-warn {
  background: rgba(251, 146, 60, 0.22) !important;
  color: #fb923c !important;
}

/* ============================================================
   Date pills - filled color buttons (delivery=blue, return=orange)
   Same size as info-pill but with full color background
   ============================================================ */
.info-pill.pill-delivery {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 500;
}
.info-pill.pill-delivery .info-pill-label {
  opacity: 0.85;
}
.info-pill.pill-delivery.clickable:hover {
  background: var(--primary-hover, #1d4ed8);
  border-color: var(--primary-hover, #1d4ed8);
  color: white;
  filter: brightness(1.05);
}

.info-pill.pill-return {
  background: #ea580c;
  color: white;
  border-color: #ea580c;
  font-weight: 500;
}
.info-pill.pill-return .info-pill-label {
  opacity: 0.85;
}
.info-pill.pill-return.clickable:hover {
  background: #c2410c;
  border-color: #c2410c;
  color: white;
  filter: brightness(1.05);
}

/* Dark mode adjustments */
[data-theme="dark"], [data-theme="night-blue"] .info-pill.pill-delivery {
  background: #2563eb;
  border-color: #3b82f6;
}
[data-theme="dark"], [data-theme="night-blue"] .info-pill.pill-return {
  background: #c2410c;
  border-color: #ea580c;
}

/* Login footer - copyright + disclaimer */
.login-footer {
  position: fixed;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.7;
  line-height: 1.6;
  pointer-events: none;
  user-select: none;
  padding: 0 14px;
}
.login-footer div { display: block; }

/* ============================================================
   Worker tabs - colorful & sticky on mobile
   ============================================================ */
.worker-tabs-bar {
  margin-bottom: 12px;
}
.chip-vibrant {
  border-width: 2px;
  font-weight: 600;
  transition: transform 0.12s, box-shadow 0.12s;
}
.chip-vibrant:hover {
  transform: translateY(-1px);
}

/* Inactive: subtle colored border, no fill */
.chip-vibrant.chip-blue { border-color: rgba(37, 99, 235, 0.4); color: #2563eb; }
.chip-vibrant.chip-green { border-color: rgba(22, 163, 74, 0.4); color: #16a34a; }
.chip-vibrant.chip-purple { border-color: rgba(124, 58, 237, 0.4); color: #7c3aed; }
.chip-vibrant.chip-gray { border-color: rgba(107, 114, 128, 0.4); color: #4b5563; }
.chip-vibrant.chip-cyan { border-color: rgba(8, 145, 178, 0.4); color: #0891b2; }
.chip-vibrant.chip-orange { border-color: rgba(234, 88, 12, 0.4); color: #ea580c; }
.chip-vibrant.chip-pink { border-color: rgba(219, 39, 119, 0.4); color: #db2777; }

/* Active: filled vibrant background */
.chip-vibrant.chip-blue.active {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: white;
  border-color: #1d4ed8;
  box-shadow: 0 4px 10px rgba(37,99,235,0.3);
}
.chip-vibrant.chip-green.active {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: white;
  border-color: #15803d;
  box-shadow: 0 4px 10px rgba(22,163,74,0.3);
}
.chip-vibrant.chip-purple.active {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: white;
  border-color: #6d28d9;
  box-shadow: 0 4px 10px rgba(124,58,237,0.3);
}
.chip-vibrant.chip-gray.active {
  background: linear-gradient(135deg, #4b5563, #6b7280);
  color: white;
  border-color: #374151;
  box-shadow: 0 4px 10px rgba(75,85,99,0.3);
}
.chip-vibrant.chip-cyan.active {
  background: linear-gradient(135deg, #0891b2, #06b6d4);
  color: white;
  border-color: #0e7490;
  box-shadow: 0 4px 10px rgba(8,145,178,0.3);
}
.chip-vibrant.chip-orange.active {
  background: linear-gradient(135deg, #ea580c, #f97316);
  color: white;
  border-color: #c2410c;
  box-shadow: 0 4px 10px rgba(234,88,12,0.3);
}
.chip-vibrant.chip-pink.active {
  background: linear-gradient(135deg, #db2777, #ec4899);
  color: white;
  border-color: #be185d;
  box-shadow: 0 4px 10px rgba(219,39,119,0.3);
}
.chip-vibrant.active .chip-count {
  background: rgba(255,255,255,0.25) !important;
  color: white !important;
}

/* Dark mode adjustments for inactive chips */
[data-theme="dark"], [data-theme="night-blue"] .chip-vibrant.chip-blue { color: #60a5fa; }
[data-theme="dark"], [data-theme="night-blue"] .chip-vibrant.chip-green { color: #4ade80; }
[data-theme="dark"], [data-theme="night-blue"] .chip-vibrant.chip-purple { color: #c084fc; }
[data-theme="dark"], [data-theme="night-blue"] .chip-vibrant.chip-gray { color: #9ca3af; }
[data-theme="dark"], [data-theme="night-blue"] .chip-vibrant.chip-cyan { color: #22d3ee; }
[data-theme="dark"], [data-theme="night-blue"] .chip-vibrant.chip-orange { color: #fb923c; }
[data-theme="dark"], [data-theme="night-blue"] .chip-vibrant.chip-pink { color: #f472b6; }

/* Mobile: sticky tabs at top */
@media (max-width: 767px) {
  .worker-tabs-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
    padding: 10px 4px 8px;
    margin: -4px -10px 12px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  }
  [data-theme="dark"], [data-theme="night-blue"] .worker-tabs-bar {
    background: var(--bg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  }
  .worker-tabs-bar .chip {
    padding: 8px 10px;
    font-size: 13px;
    flex-shrink: 0;
  }
  .worker-tabs-bar .chip-count {
    margin-inline-start: 4px;
    font-size: 11px;
  }
}

/* ============================================================
   Quick reminder button on order cards
   ============================================================ */
.quick-reminder-btn {
  background: rgba(234, 88, 12, 0.12);
  color: #ea580c;
  border: 1px solid rgba(234, 88, 12, 0.4);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  margin-inline-start: 4px;
  transition: all 0.15s;
}
.quick-reminder-btn:hover {
  background: #ea580c;
  color: white;
  transform: scale(1.1);
}
.quick-reminder-btn.sending {
  pointer-events: none;
  opacity: 0.7;
}

/* ============================================================
   No-date tasks panel in calendar
   ============================================================ */
.cal-no-date-panel {
  border: 2px dashed #f59e0b;
  background: linear-gradient(135deg, rgba(245,158,11,0.05), rgba(245,158,11,0.02));
}
.cal-no-date-panel .panel-title {
  color: #d97706;
}
[data-theme="dark"], [data-theme="night-blue"] .cal-no-date-panel {
  border-color: #f59e0b;
  background: linear-gradient(135deg, rgba(245,158,11,0.12), rgba(245,158,11,0.04));
}
[data-theme="dark"], [data-theme="night-blue"] .cal-no-date-panel .panel-title {
  color: #fbbf24;
}
.cal-no-date-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.cal-no-date-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-elev);
  border: 1px solid rgba(245,158,11,0.4);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s;
}
.cal-no-date-item:hover {
  background: rgba(245,158,11,0.08);
  border-color: #f59e0b;
  transform: translateY(-1px);
}
.cal-no-date-item.urgent {
  border-color: #dc2626;
  background: rgba(220,38,38,0.04);
}
.cal-no-date-item.urgent:hover {
  background: rgba(220,38,38,0.1);
}
.cal-no-date-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.cal-no-date-text {
  flex: 1;
  min-width: 0;
}
.cal-no-date-customer {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-no-date-title {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Clear button in date picker */
.nndp-actions .nndp-clear {
  background: transparent;
  color: #dc2626;
  border-color: rgba(220,38,38,0.3);
}
.nndp-actions .nndp-clear:hover {
  background: rgba(220,38,38,0.1);
  border-color: #dc2626;
}

/* ============================================================
   Collapsible panels (details/summary)
   ============================================================ */
.collapsible-panel {
  cursor: default;
}
.collapsible-panel > summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
}
.collapsible-panel > summary::-webkit-details-marker { display: none; }
.collapsible-panel > summary::before {
  content: '▶';
  font-size: 10px;
  transition: transform 0.15s;
  display: inline-block;
}
.collapsible-panel[open] > summary::before {
  transform: rotate(90deg);
}

/* ============================================================
   Customer form - compact for desktop one-screen fit
   ============================================================ */
@media (min-width: 768px) {
  .customer-form-compact .panel {
    padding: 9px 12px;
    margin-bottom: 8px;
  }
  .customer-form-compact .form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .customer-form-compact .form-group.full {
    grid-column: 1 / -1;
  }
  .customer-form-compact .form-group label {
    font-size: 11px;
    margin-bottom: 3px;
  }
  .customer-form-compact .form-group input,
  .customer-form-compact .form-group select,
  .customer-form-compact .form-group textarea {
    padding: 5px 8px;
    font-size: 12px;
    min-height: 28px;
  }
  .customer-form-compact .form-group textarea {
    min-height: 50px;
  }
}

/* ============================================================
   Calendar toolbar - mobile-friendly stacked
   ============================================================ */
.cal-toolbar-mobile {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cal-toolbar-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cal-toolbar-title-row {
  justify-content: space-between;
}
.cal-toolbar-title-row .cal-title {
  flex: 1;
  margin: 0;
  font-size: 16px;
}
.cal-toolbar-nav-row {
  justify-content: center;
  gap: 8px;
}
.cal-toolbar-nav-row .btn {
  flex: 1;
  max-width: 140px;
}

/* Show full date on desktop, short on mobile */
.cal-date-short { display: none; }
.cal-date-full { display: inline; }

@media (max-width: 767px) {
  .cal-date-full { display: none; }
  .cal-date-short { display: inline; }
  .cal-print-btn .cal-btn-text { display: none; }
  .cal-print-btn {
    padding: 5px 8px;
    font-size: 13px;
    flex: 0 0 auto;
  }
  /* Mobile: ALL items in one row */
  .cal-toolbar-mobile {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    background: var(--bg-elev);
    border-radius: 8px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    gap: 4px;
  }
  /* Both title-row and nav-row become inline contents with display: contents */
  .cal-toolbar-title-row,
  .cal-toolbar-nav-row {
    display: contents;
  }
  /* Order: ← | היום | → | title | 🖨️ */
  .cal-toolbar-nav-row a:nth-child(1) { order: 1; }
  .cal-toolbar-nav-row a:nth-child(2) { order: 2; }
  .cal-toolbar-nav-row a:nth-child(3) { order: 3; }
  .cal-title { order: 4; flex: 1; min-width: 0; }
  .cal-print-btn { order: 5; }

  .cal-toolbar-title-row .cal-title {
    font-size: 13px;
    text-align: center;
    margin: 0;
    padding: 0 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .cal-toolbar-nav-row .btn {
    flex: 0 0 auto;
    max-width: none;
    padding: 5px 9px;
    font-size: 13px;
    min-width: 0;
  }
}

@media (min-width: 768px) {
  /* On desktop, put nav inline with title */
  .cal-toolbar-mobile {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .cal-toolbar-nav-row {
    order: -1;
  }
  .cal-toolbar-title-row {
    flex: 1;
  }
  .cal-toolbar-nav-row .btn {
    flex: 0 0 auto;
    max-width: none;
  }
}

/* Calendar worker filter dropdown */
.cal-worker-filter {
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 10px;
  border-radius: 16px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  min-width: 140px;
}
.cal-worker-filter:hover {
  border-color: var(--primary);
}
@media (max-width: 767px) {
  .cal-worker-filter {
    width: 100%;
    margin-top: 6px;
    flex-basis: 100%;
  }
}

/* ============================================================
   Order form - make it fill full screen width on desktop
   ============================================================ */
@media (min-width: 768px) {
  .order-form,
  .order-form-page {
    width: 100%;
    max-width: 100%;
    margin: 0;
  }
  .order-form .panel,
  .order-form-page .panel {
    width: 100%;
  }
  /* Use 3-col grid on wide screens for non-customer panels */
  .order-form .panel:not(.panel-customer) .form-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  /* Action bar full width */
  .order-form .action-bar,
  .order-form-page .action-bar {
    width: 100%;
  }
}

/* On very wide screens, 4 columns */
@media (min-width: 1280px) {
  .order-form .panel:not(.panel-customer) .form-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Customer form too */
@media (min-width: 768px) {
  .customer-form-compact {
    width: 100%;
    max-width: 100%;
  }
  .customer-form-compact .panel {
    width: 100%;
  }
}
@media (min-width: 1280px) {
  .customer-form-compact .form-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

/* Settings nav groups */
.settings-nav-group-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 14px 12px 4px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}
.settings-nav-group-label:first-child {
  margin-top: 0;
  border-top: none;
  padding-top: 8px;
}

/* ============================================================
   VIEW MODE TABS - Compact / Expanded / Line
   ============================================================ */
.view-mode-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
}

/* ============================================================
   v1.8.15+ Toolbar - 5 equal-width colored buttons
   First button cycles through view modes (text changes).
   ============================================================ */
.view-mode-tabs-v2 {
  /* override - tighter padding, no inner spacer needed */
  gap: 4px;
  padding: 4px;
}
.view-mode-tabs-v2 > button {
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 4px;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: white;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.05s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}
.view-mode-tabs-v2 > button:hover { filter: brightness(1.1); }
.view-mode-tabs-v2 > button:active { transform: scale(0.97); }

/* Color variants - solid backgrounds with white text */
.vmt-color-green  { background: #16a34a; }
.vmt-color-purple { background: #7c3aed; }
.vmt-color-yellow { background: #eab308; color: #422006; font-weight: 600; }
.vmt-color-orange { background: #d97706; }
.vmt-color-red    { background: #dc2626; }

/* Cycle button (view mode) - slightly emphasized */
.vmt-cycle { font-weight: 600; }

/* #9 fix: when toolbar is moved into topbar on desktop, override its layout */
.topbar .view-mode-tabs-in-topbar {
  flex: 0 1 auto;
  display: flex;
  gap: 4px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  max-width: 380px;
}
.topbar .view-mode-tabs-in-topbar > button {
  flex: 1 1 auto;
  min-width: 60px;
  padding: 6px 10px;
  font-size: 11px;
}
@media (max-width: 767px) {
  .topbar .view-mode-tabs-in-topbar { display: none; }
}

/* Mobile: smaller padding to fit narrow screens */
@media (max-width: 600px) {
  .view-mode-tabs-v2 > button {
    padding: 6px 3px;
    font-size: 11px;
  }
}

/* Legacy single-tab styles (for non-dashboard pages) */
.view-mode-tab {
  flex: 1 1 auto;
  min-width: 70px;
  padding: 8px 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
  white-space: nowrap;
}
.view-mode-tab:hover { color: var(--text); background: var(--bg-hover); }
.view-mode-tab.active {
  background: var(--primary);
  color: white;
  font-weight: 600;
}

/* Toolbar button color variants - kept for any remaining legacy usages */
.btn-toolbar-info {
  background: var(--info-bg) !important;
  color: var(--info-text) !important;
  border: 1px solid var(--primary) !important;
}
.btn-toolbar-warning {
  background: var(--warning-bg) !important;
  color: var(--warning-text) !important;
  border: 1px solid var(--warning) !important;
}
.btn-toolbar-info:hover, .btn-toolbar-warning:hover {
  filter: brightness(0.95);
}

/* ============================================================
   COMPACT MODE - smaller cards, all info visible
   ============================================================ */
.view-compact .stats-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.view-compact .stat-card {
  padding: 8px 10px;
}
.view-compact .stat-value {
  font-size: 20px;
}
.view-compact .stat-label {
  font-size: 10px;
}
.view-compact .stat-card .stat-sub {
  display: none;
}
.view-compact .order-card {
  padding: 8px 10px;
  margin-bottom: 4px;
}
.view-compact .order-card .order-title {
  font-size: 12px;
  margin-top: 2px;
  margin-bottom: 4px;
}
.view-compact .order-card .order-meta {
  gap: 4px;
  font-size: 10px;
  margin-top: 2px;
}
.view-compact .order-card .order-meta .meta-item {
  font-size: 10px;
  padding: 2px 4px;
}
.view-compact .order-card .order-row {
  gap: 6px;
}
.view-compact .order-card .order-num {
  font-size: 10px;
}
.view-compact .order-card .order-customer {
  font-size: 12px;
}
.view-compact .order-card .status-pill {
  font-size: 10px;
  padding: 2px 6px;
}

/* ============================================================
   EXPANDED MODE - large cards with prominent date banner
   ============================================================ */
.view-expanded .stats-grid {
  gap: 12px;
}
.view-expanded .stat-card {
  padding: 16px;
}
.view-expanded .stat-value {
  font-size: 30px;
}
.view-expanded .stat-label {
  font-size: 13px;
}
.view-expanded .order-card {
  padding: 18px 20px;
  margin-bottom: 14px;
  border-right-width: 5px;
  border-right-style: solid;
  border-right-color: var(--primary);
  font-size: 15px;
}
.view-expanded .order-card.urgent {
  border-right-color: #dc2626;
}
.view-expanded .order-card .order-title {
  font-size: 17px;
  font-weight: 700;
  margin: 8px 0;
  line-height: 1.4;
}
.view-expanded .order-card .order-customer {
  font-size: 16px;
  font-weight: 700;
}
.view-expanded .order-card .order-num {
  font-size: 14px;
}
.view-expanded .order-card .order-meta {
  font-size: 13px;
  gap: 8px;
  margin-top: 8px;
}
.view-expanded .order-card .order-meta .meta-item {
  font-size: 12px;
  padding: 4px 8px;
}
.view-expanded .order-card .status-pill {
  font-size: 12px;
  padding: 4px 10px;
}
/* Injected date banner */
.view-expanded .order-card .order-date-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(96,165,250,0.10);
  border-right: 3px solid var(--primary);
  border-radius: 6px;
  padding: 8px 12px;
  margin: 8px 0;
  font-size: 13px;
}
.view-expanded .order-card .order-date-banner .date-label {
  color: var(--text-muted);
  font-size: 11px;
}
.view-expanded .order-card .order-date-banner .date-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}
.view-expanded .order-card.return-soon .order-date-banner {
  background: rgba(251,146,60,0.10);
  border-right-color: #fb923c;
}
.view-expanded .order-card.return-soon .order-date-banner .date-value {
  color: #fb923c;
}
.view-expanded .order-card.return-late .order-date-banner {
  background: rgba(220,38,38,0.10);
  border-right-color: #dc2626;
}
.view-expanded .order-card.return-late .order-date-banner .date-value {
  color: #dc2626;
}

/* ============================================================
   LINE MODE - one tight horizontal line per order
   ============================================================ */
.view-line .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(85px, 1fr));
  gap: 4px;
}
.view-line .stat-card {
  padding: 4px 6px;
  text-align: center;
}
.view-line .stat-value {
  font-size: 14px;
  display: inline-block;
  margin-inline-end: 4px;
  font-weight: 700;
}
.view-line .stat-label {
  font-size: 9px;
  display: inline-block;
}
.view-line .stat-card .stat-sub {
  display: none;
}

/* Line mode - tight horizontal row per order */
.view-line .order-card {
  padding: 6px 10px;
  margin-bottom: 3px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow: hidden;
  border-right-width: 3px;
  border-right-style: solid;
  border-right-color: var(--primary);
  min-height: 34px;
}
.view-line .order-card.urgent {
  border-right-color: #dc2626;
}
/* Flatten the structure into a single flex line */
.view-line .order-card .order-row {
  display: contents;
}
.view-line .order-card .order-meta {
  display: contents;
}
/* Date prefix - compact, no background fill */
.view-line .order-card .order-line-date {
  font-family: monospace;
  font-weight: 700;
  color: var(--primary);
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 0;
}
/* Hide order # in line mode (too noisy) */
.view-line .order-card .order-num {
  display: none;
}
/* Customer name - the main visible text, gets priority */
.view-line .order-card .order-customer {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 80px;
  color: var(--text);
}
/* Title hidden in line mode */
.view-line .order-card .order-title {
  display: none;
}
/* Hide all meta items - too noisy in single-line */
.view-line .order-card .meta-item {
  display: none;
}
.view-line .order-card .meta-worker {
  display: inline-flex !important;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg-elev2);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.view-line .order-card .meta-no-worker {
  display: none;
}
.view-line .order-card .urgent-tag,
.view-line .order-card .reminder-tag,
.view-line .order-card .badge-tag,
.view-line .order-card .note-indicator {
  display: none;
}
/* Status pill - just a colored dot for the status, no text */
.view-line .order-card .status-pill {
  font-size: 0 !important;
  padding: 0 !important;
  width: 10px;
  height: 10px;
  border-radius: 50% !important;
  flex-shrink: 0;
  display: inline-block !important;
  border: none !important;
}
/* Hide reminder bell in line mode (use detail page) */
.view-line .order-card .quick-reminder-btn {
  display: none;
}
/* On wider screens, show status text again */
@media (min-width: 900px) {
  .view-line .order-card .status-pill {
    font-size: 10px !important;
    padding: 2px 8px !important;
    width: auto;
    height: auto;
    border-radius: 4px !important;
    display: inline-flex !important;
  }
}

/* ============================================================
   PHONEBOOK
   ============================================================ */
.phonebook-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(96,165,250,0.15);
}
.phonebook-list { display: flex; flex-direction: column; gap: 4px; }
.phonebook-letter-group {
  margin-bottom: 16px;
}
.phonebook-letter {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  padding: 6px 12px;
  border-bottom: 2px solid var(--primary);
  margin-bottom: 4px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
}
.phonebook-entry {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 4px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.phonebook-entry:hover { border-color: var(--border-strong); }
.phonebook-entry[open] {
  border-color: var(--primary);
  background: var(--bg-elev2);
}
.phonebook-summary {
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  font-size: 14px;
}
.phonebook-summary::-webkit-details-marker { display: none; }
.phonebook-summary::marker { display: none; }
.pb-icon { font-size: 18px; }
.pb-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-phone-mobile {
  font-family: monospace;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}
.pb-type-tag {
  font-size: 10px;
  background: var(--bg-elev2);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.phonebook-entry.pb-customer { border-right: 3px solid #2563eb; }
.phonebook-entry.pb-contact { border-right: 3px solid #16a34a; }
.phonebook-entry.pb-user { border-right: 3px solid #ea580c; }

.phonebook-details {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  font-size: 13px;
}
.pb-detail-row { margin-bottom: 6px; }
.pb-detail-row:last-of-type { margin-bottom: 0; }
.pb-key { color: var(--text-muted); margin-inline-end: 6px; }
.pb-link { color: var(--primary); text-decoration: none; }
.pb-link:hover { text-decoration: underline; }

.pb-action {
  font-size: 12px;
  padding: 5px 10px;
}

/* Mobile - stack tags differently */
@media (max-width: 640px) {
  .phonebook-summary {
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    gap: 4px 10px;
  }
  .pb-icon { grid-row: 1 / 3; }
  .pb-name { grid-column: 2; grid-row: 1; }
  .pb-phone-mobile { grid-column: 2; grid-row: 2; }
  .pb-type-tag { grid-column: 3; grid-row: 1 / 3; align-self: center; }
}

/* ============================================================
   PHONEBOOK
   ============================================================ */
.phonebook-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.phonebook-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.phonebook-letter {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  padding: 8px 12px;
  background: var(--bg-elev2);
  border-radius: 6px;
  position: sticky;
  top: 0;
  z-index: 2;
  border-right: 3px solid var(--primary);
}
.phonebook-entry {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.phonebook-entry[open] {
  border-color: var(--primary);
}
.phonebook-entry-header {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 40px 1fr 24px;
  gap: 10px;
  align-items: center;
  user-select: none;
}
.phonebook-entry-header::-webkit-details-marker { display: none; }
.phonebook-entry-header:hover { background: var(--bg-hover); }
.entry-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.entry-main {
  min-width: 0;
}
.entry-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entry-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.entry-cat {
  font-weight: 600;
}
.entry-expand {
  color: var(--text-muted);
  font-size: 10px;
  transition: transform 0.2s;
}
.phonebook-entry[open] .entry-expand {
  transform: rotate(180deg);
}
.phonebook-entry-body {
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev2);
}
.entry-row {
  display: flex;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 13px;
}
.entry-label {
  color: var(--text-muted);
  font-size: 12px;
  min-width: 70px;
  flex-shrink: 0;
}
.entry-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.action-btn:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
}
.action-call { background: rgba(22,163,74,0.1); color: #16a34a; border-color: rgba(22,163,74,0.3); }
.action-wa { background: rgba(34,197,94,0.1); color: #22c55e; border-color: rgba(34,197,94,0.3); }
.action-mail { background: rgba(37,99,235,0.1); color: #2563eb; border-color: rgba(37,99,235,0.3); }
.action-nav { background: rgba(234,88,12,0.1); color: #ea580c; border-color: rgba(234,88,12,0.3); }
.action-view { background: rgba(96,165,250,0.1); color: var(--primary); border-color: var(--primary); }
.action-edit { background: rgba(217,119,6,0.1); color: #d97706; border-color: rgba(217,119,6,0.3); }
.action-delete { background: rgba(220,38,38,0.1); color: #dc2626; border-color: rgba(220,38,38,0.3); }

/* ============================================================
   PHONEBOOK - View Modes
   ============================================================ */

/* Compact (default) - already styled by base CSS */
.view-compact .phonebook-letter {
  font-size: 16px;
  padding: 6px 10px;
}
.view-compact .phonebook-entry-header {
  padding: 8px 10px;
  grid-template-columns: 32px 1fr 24px;
  gap: 8px;
}
.view-compact .entry-icon {
  width: 30px;
  height: 30px;
  font-size: 16px;
}
.view-compact .entry-name { font-size: 13px; }
.view-compact .entry-meta { font-size: 10px; }

/* Expanded - all details open by default, larger */
.view-expanded .phonebook-letter {
  font-size: 22px;
  padding: 10px 14px;
}
.view-expanded .phonebook-entry-header {
  padding: 14px 16px;
  grid-template-columns: 50px 1fr 24px;
}
.view-expanded .entry-icon {
  width: 44px;
  height: 44px;
  font-size: 22px;
}
.view-expanded .entry-name { font-size: 16px; }
.view-expanded .entry-meta { font-size: 13px; }
/* Force open in expanded mode */
.view-expanded .phonebook-entry .phonebook-entry-body {
  display: block !important;
}
.view-expanded .phonebook-entry .entry-expand {
  display: none;
}

/* Line mode - single horizontal row, no letter groups */
.view-line .phonebook-letter {
  display: none;  /* hide letter headers in line mode */
}
.view-line .phonebook-list {
  gap: 0;
}
.view-line .phonebook-group {
  gap: 2px;
}
.view-line .phonebook-entry {
  border-radius: 6px;
}
.view-line .phonebook-entry-header {
  padding: 6px 10px;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  cursor: pointer;
}
.view-line .entry-icon {
  width: 26px;
  height: 26px;
  font-size: 14px;
}
.view-line .entry-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.view-line .entry-name {
  font-size: 13px;
  margin: 0;
  flex-shrink: 0;
}
.view-line .entry-meta {
  font-size: 11px;
  margin: 0;
  flex: 1;
  display: flex;
  gap: 6px;
  overflow: hidden;
  white-space: nowrap;
}
.view-line .entry-expand {
  font-size: 10px;
}
/* Line mode body - keep collapsed by default but don't hide if open */
.view-line .phonebook-entry-body {
  padding: 10px 14px;
}
/* Also hide labels in line-mode body to save space */
.view-line .phonebook-entry-body .entry-label {
  min-width: 50px;
  font-size: 11px;
}
.view-line .phonebook-entry-body .entry-row {
  font-size: 12px;
  margin-bottom: 4px;
}

/* ============================================================
   FLASH ANIMATION - for any NEW item (orders, issues, escalations)
   Strong, visible. Pulses until user clicks/views.
   ============================================================ */
/* ============================================================
   1.10.7: REMOVED .flash and .is-new card-level flashing.
   Replaced with the small inline "🆕 חדש" pulsing badge (.badge-new-pulse)
   in the order-card meta row. The badge disappears as soon as user
   opens the order (via user_seen_orders).
   ============================================================ */
/* (Old .flash / .is-new selectors removed) */

/* ============================================================
   NAV BADGES (red dot with count on sidebar items)
   ============================================================ */
/* ============================================================
   NAV BADGES — styles set entirely from JS (updateNavBadge)
   The HTML has style="display:none" by default; JS overrides
   when count > 0. CSS only provides the keyframe animation.
   ============================================================ */
.nav-item {
  position: relative;
}
@keyframes nav-badge-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(220,38,38,0.8);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(220,38,38,0);
    transform: scale(1.15);
  }
}

/* Mobile bottom-nav badge - keep absolute */
.bottom-nav .nav-badge {
  position: absolute !important;
  top: 4px !important;
  left: 50% !important;
  transform: translateX(-50%) translateY(0) !important;
  font-size: 9px !important;
  min-width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
}

/* ============================================================
   STAT CARD FLASH (when count changes)
   ============================================================ */
.stat-card.stat-flash {
  animation: stat-flash-anim 1.6s ease-out 1 !important;
}
@keyframes stat-flash-anim {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(34,197,94,0);
  }
  20% {
    transform: scale(1.06);
    box-shadow: 0 0 0 8px rgba(34,197,94,0.5), inset 0 0 0 2px #22c55e;
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(34,197,94,0);
  }
}
.stat-card.stat-flash-down {
  animation: stat-flash-down-anim 1.6s ease-out 1 !important;
}
@keyframes stat-flash-down-anim {
  0% {
    box-shadow: 0 0 0 0 rgba(96,165,250,0);
  }
  20% {
    box-shadow: 0 0 0 6px rgba(96,165,250,0.4), inset 0 0 0 2px #60a5fa;
  }
  100% {
    box-shadow: 0 0 0 0;
  }
}

/* ============================================================
   ACTIVITY FEED PANEL
   ============================================================ */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
}
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-elev2);
  border-radius: 8px;
  border-right: 3px solid transparent;
  transition: all 0.2s;
}
.activity-item.fresh {
  background: rgba(251,191,36,0.10);
  border-right-color: #fbbf24;
  animation: activity-fresh 1s ease-out;
}
@keyframes activity-fresh {
  0% { background: rgba(251,191,36,0.30); transform: translateX(-10px); }
  100% { background: rgba(251,191,36,0.10); transform: translateX(0); }
}
.activity-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}
.activity-body {
  flex: 1;
  min-width: 0;
}
.activity-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.activity-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.activity-time {
  font-size: 10px;
  color: var(--text-faint, var(--text-muted));
  flex-shrink: 0;
  white-space: nowrap;
}
.activity-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 30px 16px;
  font-size: 13px;
}

/* Live polling indicator */
@keyframes live-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(22,163,74,0.5); }
  50% { opacity: 0.5; box-shadow: 0 0 0 4px rgba(22,163,74,0); }
}

/* ============================================================
   HELP SYSTEM (v1.7.0)
   - Floating "?" button in top corner
   - Modal with help content
   - Inline ℹ️ tooltips for fields
   ============================================================ */

/* Floating help button */
.help-fab {
  position: fixed;
  top: 70px;
  left: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: white;
  border: none;
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.help-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.5);
}
.help-fab:active { transform: translateY(0); }
.help-fab-icon {
  display: inline-block;
  line-height: 1;
}

@media (max-width: 768px) {
  .help-fab {
    top: auto;
    bottom: 76px;
    left: 12px;
    width: 44px;
    height: 44px;
    font-size: 20px;
  }
}

body.density-compact .help-fab {
  top: 56px;
  width: 30px;
  height: 30px;
  font-size: 15px;
}

/* Help modal overlay */
.help-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.help-modal.is-open {
  display: flex;
  animation: helpModalFade 0.2s ease-out;
}
@keyframes helpModalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.help-modal-content {
  background: var(--bg, #fff);
  border-radius: 12px;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0,0,0,0.3);
  animation: helpModalSlide 0.25s ease-out;
}
@keyframes helpModalSlide {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.help-modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, rgba(37,99,235,0.08), rgba(59,130,246,0.04));
  border-radius: 12px 12px 0 0;
}
.help-modal-header h2 {
  margin: 0;
  font-size: 18px;
  color: var(--text);
  font-weight: 700;
}
.help-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: transparent;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.help-modal-close:hover {
  background: rgba(0,0,0,0.08);
  color: var(--text);
}

.help-modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}

.help-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.help-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.help-section-heading {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary, #2563eb);
  margin: 0 0 8px;
}
.help-section-content {
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.7;
}
.help-section-content p {
  margin: 0 0 8px;
}
.help-section-content p:last-child {
  margin-bottom: 0;
}
.help-section-content ul,
.help-section-content ol {
  margin: 6px 0 8px;
  padding-inline-start: 22px;
}
.help-section-content li {
  margin-bottom: 4px;
}
.help-section-content strong {
  color: var(--text);
  font-weight: 700;
}
.help-section-content code {
  background: var(--bg-elev2, rgba(0,0,0,0.05));
  padding: 1px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  color: var(--primary);
}
.help-section-content .help-tip {
  background: rgba(37,99,235,0.08);
  border-right: 3px solid var(--primary);
  padding: 8px 12px;
  border-radius: 4px;
  margin: 8px 0;
  font-size: 13px;
}
.help-section-content .help-warn {
  background: rgba(251,146,60,0.08);
  border-right: 3px solid #f97316;
  padding: 8px 12px;
  border-radius: 4px;
  margin: 8px 0;
  font-size: 13px;
}
.help-section-content .help-danger {
  background: rgba(239,68,68,0.08);
  border-right: 3px solid #ef4444;
  padding: 8px 12px;
  border-radius: 4px;
  margin: 8px 0;
  font-size: 13px;
}

/* Inline tooltip icon ℹ️ */
.help-tooltip {
  display: inline-block;
  position: relative;
  cursor: help;
  margin-inline-start: 4px;
  vertical-align: middle;
}
.help-tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-elev2, rgba(37,99,235,0.15));
  color: var(--primary, #2563eb);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  font-family: inherit;
}
.help-tooltip-text {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #1f2937;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  white-space: normal;
  width: max-content;
  max-width: 280px;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.help-tooltip-text::before {
  content: '';
  position: absolute;
  bottom: 100%;
  right: 12px;
  border: 5px solid transparent;
  border-bottom-color: #1f2937;
}
.help-tooltip:hover .help-tooltip-text,
.help-tooltip.is-open .help-tooltip-text {
  display: block;
}
@media (max-width: 768px) {
  .help-tooltip-text {
    right: -10px;
    max-width: 240px;
  }
}

/* Fix #4: Notification popup */
.notif-popup {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  width: 360px;
  max-width: calc(100vw - 24px);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  z-index: 100;
  overflow: hidden;
}
.notif-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.notif-popup-header strong { font-size: 14px; }
.notif-popup-list {
  max-height: 360px;
  overflow-y: auto;
}
.notif-popup-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.notif-popup-item:last-child { border-bottom: none; }
.notif-popup-item:hover { background: var(--bg-hover); }
.notif-popup-item.unread { background: rgba(59,130,246,0.08); border-right: 3px solid #3b82f6; }
/* 1.14.7: Urgent priority indicator */
.notif-popup-item.priority-urgent { border-right: 3px solid #dc2626; background: rgba(220,38,38,0.04); }
.notif-popup-item.priority-urgent.unread { background: rgba(220,38,38,0.08); }
.notif-popup-item .item-title { 
  font-weight: 600; 
  font-size: 13px; 
  margin-bottom: 3px; 
  color: var(--text);
  line-height: 1.3;
  /* Truncate long titles */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-popup-item .item-meta { 
  font-size: 11px; 
  color: var(--text-muted);
  /* 1.14.25: Allow text to wrap properly */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}
/* 1.14.25: Line 1 - order + customer (bold) */
.notif-popup-item .item-meta-line1 {
  color: var(--text);
  font-weight: 500;
  margin-top: 2px;
}
/* 1.14.25: Line 2 - sender + time (muted) */
.notif-popup-item .item-meta-line2 {
  color: var(--text-muted);
  font-size: 10.5px;
  margin-top: 1px;
}
.notif-popup-empty {
  padding: 30px 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.notif-popup-footer {
  padding: 8px 14px;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.notif-popup-footer a {
  color: var(--primary);
  font-size: 12px;
  text-decoration: none;
}
.notif-popup-footer a:hover { text-decoration: underline; }

/* ============================================================
   Mini Voice Player (Sprint Quick - 1.10.3 compact redesign)
   Replaces native HTML5 audio with a tiny inline pill-style player
   that fits anywhere - cards, lists, tight spaces.
   ============================================================ */
.mini-voice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elev2);
  border: 1px solid #fecaca;
  border-radius: 16px;
  padding: 3px 10px 3px 4px;
  font-size: 11px;
  color: var(--text);
  user-select: none;
  max-width: 100%;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.mini-voice:hover { border-color: #fca5a5; background: var(--bg-elev); }
.mini-voice-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #dc2626;
  color: #fff;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.mini-voice-btn:hover { background: #b91c1c; }
.mini-voice-btn.playing { background: #16a34a; }
.mini-voice-bar {
  flex: 1;
  min-width: 50px;
  max-width: 90px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.mini-voice-progress {
  position: absolute;
  inset: 0;
  width: 0%;
  background: #dc2626;
  border-radius: 2px;
  transition: width 0.15s linear;
}
.mini-voice-time {
  font-size: 10px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 28px;
  text-align: center;
}
.mini-voice-icon { font-size: 12px; opacity: 0.85; }

/* Mobile: keep it tight, allow wrapping if needed */
@media (max-width: 480px) {
  .mini-voice {
    font-size: 10px;
    padding: 3px 8px 3px 3px;
    gap: 5px;
  }
  .mini-voice-btn { width: 20px; height: 20px; font-size: 9px; }
  .mini-voice-bar { min-width: 40px; max-width: 70px; }
  .mini-voice-time { font-size: 9px; min-width: 26px; }
}

/* When used as a card section (in order detail page) - block style */
.mini-voice-block {
  display: flex;
  width: auto;
  align-self: flex-start;
}

/* === Reminder list (Sprint Polish 1.10.4) - 3 view modes === */
.reminder-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.reminder-item {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}
.reminder-item.is-done { opacity: 0.55; }
.rem-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.rem-role-tag, .rem-urgent {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
  white-space: nowrap;
}
.rem-role-tag { background: #dbeafe; color: #1e40af; }
.rem-urgent { background: #fee2e2; color: #991b1b; }
.rem-num {
  font-size: 10px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.rem-title {
  flex: 1;
  font-weight: 600;
  font-size: 13px;
  min-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rem-voice { margin-inline-start: auto; flex-shrink: 0; }
.rem-done-btn {
  font-size: 11px !important;
  padding: 3px 8px !important;
  background: var(--success-bg) !important;
  color: var(--success-text) !important;
  white-space: nowrap;
}
.rem-done-tag { font-size: 14px; }
.rem-detail {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  color: var(--text-muted);
}
.rem-desc { flex: 1; min-width: 100px; }
.rem-meta { white-space: nowrap; }

/* View modes */
.reminder-list.view-line .rem-detail { display: none; }
.reminder-list.view-line .reminder-item { padding: 6px 10px; }
.reminder-list.view-line .rem-head { flex-wrap: nowrap; overflow: hidden; }

.reminder-list.view-expanded .reminder-item { padding: 10px 12px; }
.reminder-list.view-expanded .rem-title { font-size: 14px; }
.reminder-list.view-expanded .rem-detail { font-size: 12px; }

@media (max-width: 480px) {
  .reminder-item { padding: 6px 8px; }
  .rem-title { font-size: 12px; }
  .rem-detail { font-size: 10px; }
  .reminder-list.view-line .rem-num { display: none; }
}

/* (1.10.10 sidebar-activity widget removed in 1.10.12 - replaced with /worker/activity page) */

/* ============================================================
   1.10.13: Execution Type meta-item with colored backgrounds
   ============================================================ */
.meta-item.meta-exec {
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 11px;
}
.meta-item.exec-self_pickup {
  background: rgba(8, 145, 178, 0.12);
  color: #0891b2;
  border: 1px solid rgba(8, 145, 178, 0.3);
}
.meta-item.exec-delivery_return {
  background: rgba(234, 88, 12, 0.12);
  color: #ea580c;
  border: 1px solid rgba(234, 88, 12, 0.3);
}
.meta-item.exec-transport_install {
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
  border: 1px solid rgba(124, 58, 237, 0.3);
}
.meta-item.exec-reminder_general {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.meta-item.exec-other {
  background: rgba(107, 114, 128, 0.12);
  color: #4b5563;
  border: 1px solid rgba(107, 114, 128, 0.3);
}

/* Dark mode */
[data-theme="dark"] .meta-item.exec-self_pickup,
[data-theme="night-blue"] .meta-item.exec-self_pickup { color: #22d3ee; }
[data-theme="dark"] .meta-item.exec-delivery_return,
[data-theme="night-blue"] .meta-item.exec-delivery_return { color: #fb923c; }
[data-theme="dark"] .meta-item.exec-transport_install,
[data-theme="night-blue"] .meta-item.exec-transport_install { color: #c084fc; }
[data-theme="dark"] .meta-item.exec-reminder_general,
[data-theme="night-blue"] .meta-item.exec-reminder_general { color: #fbbf24; }
[data-theme="dark"] .meta-item.exec-other,
[data-theme="night-blue"] .meta-item.exec-other { color: #9ca3af; }

/* 1.10.14: Delete button for reminders */
.rem-delete-btn {
  font-size: 12px !important;
  padding: 3px 7px !important;
  background: rgba(239, 68, 68, 0.1) !important;
  color: #dc2626 !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
  white-space: nowrap;
  transition: all 0.15s;
}
.rem-delete-btn:hover {
  background: #dc2626 !important;
  color: #fff !important;
  border-color: #b91c1c !important;
}

/* 1.10.14: Note delete button - smaller and red */
.note-delete-btn {
  background: rgba(239, 68, 68, 0.08) !important;
  color: #dc2626 !important;
  border: 1px solid rgba(239, 68, 68, 0.25) !important;
  padding: 3px 8px !important;
  font-size: 12px !important;
  transition: all 0.15s;
}
.note-delete-btn:hover {
  background: #dc2626 !important;
  color: #fff !important;
  border-color: #b91c1c !important;
}

/* 1.12.0: Live Search input - visual indicator */
.live-search-input {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'></circle><path d='m21 21-4.3-4.3'></path></svg>");
  background-repeat: no-repeat;
  background-position: 8px center;
  background-size: 16px;
  padding-inline-start: 30px !important;
}
.live-search-input:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
}

/* 1.13.0: Calendar reminder events */
.cal-mini-reminder {
  background: rgba(245, 158, 11, 0.08) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}
.cal-mini-reminder:hover {
  background: rgba(245, 158, 11, 0.15) !important;
}

/* ============================================================
   1.14.30: Old dashboard CSS DISABLED - new dashboard uses GridStack
   The following rules apply only if any code still uses #dashboard-content,
   but the new dashboard uses #nn-dashboard (with grid-stack class).
   ============================================================ */
#dashboard-content {
  display: block;
}
#dashboard-content > section,
#dashboard-content > .dash-block-wrapper,
#dashboard-content > .stats-grid,
#dashboard-content > .panel,
#dashboard-content > .dashboard-grid {
  margin-bottom: 12px;
  min-width: 0;
}

/* ============================================================
   1.14.18: Calendar Legend - examples row at top
   1.14.22: Real examples (icon + colored bg) - exactly like in calendar
   ============================================================ */
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin-bottom: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
}
.cal-legend-label {
  font-weight: 600;
  color: var(--text-muted);
  margin-inline-end: 4px;
  font-size: 11px;
}
.cal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  border-right: 3px solid;
  font-size: 11px;
  white-space: nowrap;
  color: var(--text);
}
.cal-legend-icon {
  font-size: 13px;
  font-weight: 600;
}
/* 1.14.23: Divider between stages and icons sections */
.cal-legend-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin-inline: 6px;
}
.cal-legend-icons-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.cal-legend-icon-only,
.cal-legend-item-icon {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-elev2);
  font-size: 11px;
  white-space: nowrap;
  color: var(--text);
}
@media (max-width: 600px) {
  .cal-legend {
    gap: 4px;
    padding: 6px 8px;
    font-size: 11px;
  }
  .cal-legend-item { padding: 2px 6px; font-size: 10px; gap: 3px }
  .cal-legend-icon { font-size: 12px; }
  .cal-legend-icon-only, .cal-legend-item-icon { padding: 2px 6px; font-size: 10px; }
  .cal-legend-label { display: none; }
}

/* ============================================================
   Calendar month v3 (2026-05-30): each event is its OWN link
   (tap → that order) showing execution emoji + time + full
   client name on EVERY screen size (no dots). The day-number is
   a separate link to the day view, so tapping an order no longer
   triggers the whole-day link. Appended last so it wins
   source-order over the earlier .cal-month-* rules.
   Scoped strictly to .cal-month-* / .cme-* — no other surfaces.
   ============================================================ */
/* minmax(0,1fr) keeps 7 equal columns that never overflow the viewport. */
.cal-month-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
/* min-width:0 lets the 7 grid columns shrink below the chips' content width
   (grid items default to min-width:auto) so the month never overflows on mobile. */
.cal-month-cell { min-height: 96px; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

/* Day number = standalone link (cell is no longer an <a>). */
.cal-month-day-num {
  align-self: flex-start; text-decoration: none;
  font-weight: 700; font-size: 12px; line-height: 1.2;
  color: var(--text); padding: 1px 6px; border-radius: 6px; margin-bottom: 2px;
}
.cal-month-day-num:hover { background: var(--bg-hover); }
.cal-month-cell.today .cal-month-day-num { background: var(--primary); color: #fff; }

.cal-month-day-events { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: hidden; }
.cal-month-event {
  display: flex; align-items: center; gap: 3px;
  font-size: 10px; line-height: 1.25; padding: 1px 4px;
  border-radius: 4px; text-decoration: none; color: var(--text);
  white-space: nowrap; overflow: hidden; max-width: 100%;
}
.cal-month-event:hover { filter: brightness(0.97); }
.cal-month-event .cme-ico  { flex: 0 0 auto; font-size: 10px; }
.cal-month-event .cme-time { flex: 0 0 auto; font-family: ui-monospace, monospace; font-size: 9px; opacity: 0.8; }
.cal-month-event .cme-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-month-event.urgent .cme-name { font-weight: 700; color: #b91c1c; }

/* Mobile (≤768px): keep emoji + time + name (no dots). Grid stays 7 columns
   so it remains a real month; names ellipsize and tapping opens the order. */
@media (max-width: 768px) {
  .cal-month-cell { min-height: 58px; }
  .cal-month-day-num { font-size: 11px; padding: 0 4px; }
  .cal-month-event { font-size: 9px; padding: 1px 4px; gap: 0; }
  /* Mobile month: show CLIENT NAME ONLY — no emoji, no time (status color kept). */
  .cal-month-event .cme-ico,
  .cal-month-event .cme-time { display: none; }
}

/* ============================================================
   Landscape PHONES behave like mobile: the side menu stays a
   hamburger-toggled off-canvas drawer (not always-open). A phone
   rotated to landscape is wider than 768px so it used to fall back
   to the desktop (open) sidebar; we catch it by its short height
   (laptops/tablets are taller, so they're unaffected). Mirrors the
   max-width:768px mobile rules.
   ============================================================ */
@media (orientation: landscape) and (max-height: 500px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: initial !important; }
  nav.mobile-only, .bottom-nav.mobile-only { display: flex !important; }
  .sidebar {
    position: fixed;
    right: 0; top: 0; bottom: 0;
    z-index: 300;
    width: 260px;
    transform: translateX(100%);
    transition: transform 0.2s;
  }
  .sidebar.open, .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.open ~ .sidebar-overlay,
  .sidebar.mobile-open ~ .sidebar-overlay { display: block; }
  /* Weekly view: keep ALL 7 day-columns visible (fit the landscape width).
     The grid has overflow:hidden, so without this the columns can't shrink and
     everything past ~Thursday gets clipped off-screen. */
  .cal-week-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .cal-week-day { min-width: 0; overflow: hidden; }
}
