:root {
  --primary: #2d6a2d;
  --primary-light: #4a9e4a;
  --bg: #f5f7f5;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

body.dark {
  --bg: #111827;
  --card: #1f2937;
  --text: #f9fafb;
  --muted: #9ca3af;
  --border: #374151;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html {
  overflow-x: hidden;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 60px;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: -webkit-fill-available;
}
input, select, textarea {
  font-size: 16px !important;
  max-width: 100%;
}

.hidden { display: none !important; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-wrap { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.brand-logo { width: 34px; height: 34px; border-radius: 6px; }
.mobile-role-badge, .mobile-cart-btn { display: none; }
.role-badge {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
}
.role-worker { background: rgba(245, 158, 11, 0.2); color: #b45309; }
.role-founder { background: rgba(22, 163, 74, 0.2); color: #0f7a33; }
.sync-indicator { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; display: inline-block; }
.sync-dot.pulse { animation: syncPulse 1s ease; background: #16a34a; }
@keyframes syncPulse { 0% { transform: scale(1); } 50% { transform: scale(1.35); } 100% { transform: scale(1); } }

.month-nav { display: flex; align-items: center; gap: 8px; }
#monthLabel { margin: 0; min-width: 190px; text-align: center; font-size: 1rem; }

.header-actions, .subbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
}
.subbar { justify-content: space-between; flex-wrap: wrap; }
.search-wrap {
  position: relative;
  width: min(460px, 100%);
}
.search-wrap .input { padding-right: 36px; }
.clear-search-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: var(--border);
  color: var(--muted);
  cursor: pointer;
}

.input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--card);
  color: var(--text);
}
.input.compact { width: auto; min-width: 120px; }

.btn {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}
.btn:hover { background: var(--primary-light); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }

.stats-bar, .month-summary { color: var(--muted); font-size: 0.95rem; }
.stats-bar {
  background: linear-gradient(135deg, #2d6a2d, #4a9e4a);
  color: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
}
.readonly-banner {
  background: rgba(45, 106, 45, 0.1);
  color: var(--primary);
  border-bottom: 1px solid rgba(45, 106, 45, 0.25);
  padding: 6px 12px;
  font-size: 0.82rem;
  text-align: center;
}

.app-layout {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 12px;
  padding: 0 16px 16px;
}

.calendar-panel, .day-panel { padding: 12px; }
.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  font-weight: 700;
  color: var(--muted);
  padding: 6px 0;
}
.weekdays span { text-align: center; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.day-cell {
  min-height: 72px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  background: var(--card);
  cursor: pointer;
}
.day-cell:hover { background: rgba(74, 158, 74, 0.12); }
.day-cell.other { opacity: 0.35; }
.day-cell.today { border: 1px solid var(--border); border-left: 3px solid var(--primary); }
.day-cell.today .day-num { font-weight: 800; }
.day-cell.today::after {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  margin-top: 3px;
}
.day-cell.selected { border: 2px solid var(--primary-light); background: rgba(74, 158, 74, 0.15); }

.day-num { font-weight: 700; font-size: 0.9rem; }
.day-dots { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.confirmed { background: var(--success); }
.dot.completed { background: #1a6b8a; }
.dot.cancelled { background: var(--danger); }
.dot.pending { background: #f59e0b; }
.dot.website { background: #3b82f6; }
.day-stere { color: var(--muted); font-size: 0.75rem; margin-top: 4px; }
.dot-more { color: var(--muted); font-size: 0.7rem; margin-left: 2px; }

.slot-block { border: 1px solid var(--border); border-radius: 12px; padding: 10px; margin-top: 10px; }
.slot-block.slot-08h00-10h00 { background: #fff8e6; }
.slot-block.slot-10h00-12h00 { background: #fefce8; }
.slot-block.slot-12h00-14h00 { background: #f8fafc; }
.slot-block.slot-14h00-16h00 { background: #eff6ff; }
.slot-block.slot-16h00-18h00 { background: #eef2ff; }
.slot-title { font-weight: 800; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.delivery-list { display: flex; flex-direction: column; gap: 8px; }

.delivery-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 0;
  box-shadow: var(--shadow);
}
.delivery-card.status-completed-card { border-left-color: #1a6b8a; }
.delivery-card.status-cancelled-card { border-left-color: var(--danger); }
.delivery-card:hover { box-shadow: 0 4px 10px rgba(0,0,0,0.12); }
.card-header-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; background: #f3f4f6; border-bottom: 1px solid var(--border); }
.card-client-row { padding: 10px; border-bottom: 1px solid var(--border); }
.card-order-row { padding: 10px; border-bottom: 1px solid var(--border); }
.row { margin: 3px 0; font-size: 13px; }
.card-actions { display: flex; gap: 6px; padding: 10px; }
.small-btn {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 6px 10px;
  cursor: pointer;
  flex: 1;
}
.status-badge { border-radius: 999px; padding: 2px 8px; font-size: 0.75rem; }
.source-website {
  background: rgba(59, 130, 246, 0.15);
  color: #1d4ed8;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}
.source-manual {
  background: rgba(107, 114, 128, 0.15);
  color: #374151;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
}
.status-confirmed { background: rgba(22,163,74,.2); color: var(--success); }
.status-pending { background: rgba(245,158,11,0.2); color: #b45309; }
.status-completed { background: rgba(245,158,11,.2); color: var(--warning); }
.status-cancelled { background: rgba(220,38,38,.2); color: var(--danger); }
.status-completed-yes { background: rgba(22,163,74,.2); color: #0f7a33; }
.status-completed-no { background: rgba(220,38,38,.18); color: #b91c1c; }
.status-facture-yes { background: rgba(22,163,74,.2); color: #0f7a33; }
.status-facture-no { background: rgba(220,38,38,.18); color: #b91c1c; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}
.modal-card {
  width: min(500px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--card);
  color: var(--text);
  border-radius: 16px;
  padding: 16px;
  animation: slideIn .18s ease;
}
.modal-card.small { width: min(360px, 100%); }
@keyframes slideIn { from { transform: translateY(15px); opacity: .5; } to { transform: translateY(0); opacity: 1; } }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.column-actions { flex-direction: column; align-items: stretch; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.slot-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.slot-option {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  flex: 1;
  justify-content: center;
}
.slot-option:has(input:checked) {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.slot-option input { display: none; }
.badge { background: rgba(74, 158, 74, 0.15); color: var(--primary); padding: 2px 8px; border-radius: 999px; }
.search-month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 13px;
  color: var(--primary);
  padding: 12px 4px 6px;
  border-bottom: 2px solid var(--primary);
  margin-bottom: 8px;
  margin-top: 16px;
}
.search-month-header:first-child { margin-top: 0; }

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: max(70px, env(safe-area-inset-top, 0px) + 70px);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 9999;
  width: calc(100% - 48px);
  max-width: 420px;
  text-align: center;
  font-size: 14px;
}

.offline-banner {
  background: #f97316;
  color: #fff;
  text-align: center;
  padding: 8px;
}

.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 20;
}
.mobile-nav button {
  width: 33.33%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
}
.day-panel-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 23;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.day-panel-overlay.active {
  display: block;
  opacity: 1;
  pointer-events: all;
}
.day-panel-overlay.hidden {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.panel-handle {
  width: 40px;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  margin: 10px auto 8px;
  flex-shrink: 0;
  cursor: grab;
  display: none;
}
body.dark .panel-handle { background: #4b5563; }
.day-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.day-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.mobile-close-btn { display: none; min-width: 44px; min-height: 44px; }
.day-panel,
#deliveryForm,
.modal-card { -webkit-overflow-scrolling: touch; }

.error { color: var(--danger); font-size: 0.9rem; margin-top: 6px; }

@media print {
  .topbar, .subbar, .calendar-panel, .mobile-nav, .btn, .card-actions, .offline-banner { display: none !important; }
  .app-layout { display: block; padding: 0; }
  .day-panel { border: 0; box-shadow: none; }
}

@media (max-width: 768px) {
  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    height: 56px;
    gap: 8px;
    flex-wrap: nowrap;
    overflow: hidden;
    padding-top: 0;
  }
  .brand-wrap strong {
    font-size: 14px;
    white-space: nowrap;
  }
  .brand-logo { width: 28px; height: 28px; }
  .header-actions { display: none; }
  .mobile-role-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11px;
    min-height: 32px;
    line-height: 1;
  }
  .mobile-cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    color: var(--text);
    flex-shrink: 0;
  }

  .month-nav {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 9;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
  }
  #todayBtn { display: none; }
  #monthLabel {
    font-size: 15px;
    font-weight: 700;
    min-width: 160px;
    text-align: center;
  }
  #prevMonthBtn, #nextMonthBtn { min-width: 44px; min-height: 44px; }

  .subbar { padding: 8px 10px; }
  .stats-bar {
    font-size: 11px;
    padding: 8px 12px;
    border-radius: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    overflow: hidden;
    width: 100%;
  }
  .stats-bar > * {
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .app-layout {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 104px 0 0;
  }
  .calendar-panel {
    border-radius: 0;
    margin: 0;
    border-left: 0;
    border-right: 0;
  }
  .weekdays span {
    font-size: 11px;
    text-transform: uppercase;
  }
  .calendar-grid { gap: 3px; }
  .day-cell {
    min-height: 54px;
    padding: 4px 3px;
    border-radius: 8px;
  }
  .day-num {
    font-size: 13px;
    font-weight: 700;
  }
  .day-dots {
    gap: 2px;
    margin-top: 4px;
    flex-wrap: wrap;
  }
  .dot { width: 6px; height: 6px; }
  .day-stere {
    font-size: 9px;
    margin-top: 2px;
    overflow: hidden;
    white-space: nowrap;
  }
  .day-cell.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
  }
  .day-cell.selected .day-stere,
  .day-cell.selected .dot-more { color: #e5f9e5; }

  .day-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    height: 88vh;
    width: 100%;
    z-index: 25;
    border-radius: 20px 20px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    padding-bottom: env(safe-area-inset-bottom, 16px);
  }
  .day-panel.open { transform: translateY(0); }
  .panel-handle { display: block; }
  .mobile-close-btn { display: inline-flex; }

  .delivery-card {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 10px;
  }
  .card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    border-radius: 0;
  }
  .card-client-row {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
  }
  .card-order-row {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
  }
  .card-actions {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: var(--card);
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .small-btn {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
  }
  .row {
    font-size: 13px;
    line-height: 1.4;
    margin: 2px 0;
  }
  .row strong { font-size: 14px; }
  .status-badge { font-size: 11px; }

  .modal {
    align-items: flex-end;
    padding: 0;
  }
  .modal-card {
    width: 100%;
    max-height: 95vh;
    min-height: unset;
    height: auto;
    border-radius: 20px 20px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.25s ease;
  }
  @keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }
  .modal-card > h3 {
    padding: 16px 16px 12px;
    margin: 0;
    font-size: 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: var(--card);
    z-index: 1;
  }
  #deliveryForm {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    padding-bottom: 100px;
  }
  .form-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  #deliveryForm .input {
    min-height: 48px;
    border-radius: 10px;
  }
  #deliveryForm textarea.input { min-height: 80px; }
  #deliveryForm .modal-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 12px 16px;
    padding-bottom: env(safe-area-inset-bottom, 12px);
    z-index: 50;
    display: flex;
    gap: 8px;
  }
  #deliveryForm .modal-actions .btn {
    flex: 1;
    min-height: 50px;
    font-size: 15px;
    font-weight: 600;
  }

  .slot-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .slot-option {
    padding: 10px 8px;
    font-size: 13px;
    text-align: center;
    justify-content: center;
  }
  .slot-picker .slot-option:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--card);
    border-top: 2px solid var(--border);
    padding: 0 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 20;
    gap: 4px;
    align-items: center;
  }
  .mobile-nav button {
    flex: 1;
    min-height: 52px;
    border: none;
    background: transparent;
    border-radius: 10px;
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    transition: background 0.15s;
  }
  .mobile-nav button:active { background: rgba(45,106,45,0.1); }
  .mobile-nav button .nav-icon {
    font-size: 20px;
    line-height: 1;
  }
  .mobile-nav button .nav-label {
    font-size: 10px;
    color: var(--muted);
  }
  body { padding-bottom: 64px; }
}

.mobile-role-badge.role-worker { background: rgba(245, 158, 11, 0.2); color: #b45309; }
.mobile-role-badge.role-founder { background: rgba(22, 163, 74, 0.2); color: #0f7a33; }

.new-booking-alert {
  position: fixed;
  top: 70px;
  right: 16px;
  background: #1d4ed8;
  color: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 320px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 9999;
  animation: slideInRight 0.3s ease;
}
@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.alert-icon { font-size: 24px; }
.alert-body { flex: 1; font-size: 13px; }
.alert-body strong { font-size: 14px; }
.new-booking-alert button {
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

@media (max-width: 390px) {
  .brand-wrap strong { font-size: 13px; }
  #monthLabel { min-width: 145px; font-size: 14px; }
}

@media (max-width: 380px) {
  .brand-wrap strong { display: none; }
  .brand-logo { width: 32px; height: 32px; }
  .day-cell { min-height: 46px; padding: 3px 2px; }
  .day-num { font-size: 12px; }
  .dot { width: 5px; height: 5px; }
  .day-stere { display: none; }
  .calendar-grid { gap: 2px; }
  .weekdays span { font-size: 9px; }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .app-layout {
    grid-template-columns: 1.1fr 1fr;
    gap: 10px;
    padding: 12px;
  }
  .day-cell { min-height: 68px; }
  .delivery-card { font-size: 13px; }
  .modal-card { width: min(480px, 95%); }
}

@media (min-width: 1024px) {
  .app-layout {
    max-width: 1400px;
    margin: 0 auto;
    grid-template-columns: 1.4fr 1fr;
    gap: 16px;
    padding: 16px 24px;
  }
  .day-cell {
    min-height: 88px;
    padding: 8px;
  }
  .day-num { font-size: 15px; }
  .modal-card { width: min(520px, 90%); }
  .topbar { padding: 12px 24px; }
}

@media (min-width: 1400px) {
  .app-layout { padding: 20px 40px; }
  .day-cell { min-height: 96px; }
}

/* ===== Mobile scroll & responsive hardening ===== */
html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.app-layout {
  overflow: visible;
}

.calendar-panel {
  overflow: visible;
}

.day-panel {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-card {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .topbar {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--card);
    border-bottom: 2px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    flex-wrap: nowrap;
    overflow: hidden;
    gap: 6px;
  }

  .header-actions { display: none !important; }
  .subbar {
    padding: 6px 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .brand-wrap {
    flex-shrink: 0;
    gap: 6px;
  }
  .brand-wrap strong {
    font-size: 13px;
    white-space: nowrap;
  }
  .brand-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
  }

  .month-nav {
    position: fixed !important;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 99;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    height: 48px;
  }
  #monthLabel {
    font-size: 15px;
    font-weight: 700;
    min-width: 170px;
    text-align: center;
    white-space: nowrap;
  }
  #prevMonthBtn,
  #nextMonthBtn,
  #todayBtn {
    min-width: 40px;
    min-height: 40px;
    border-radius: 8px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-role-badge {
    display: inline-flex !important;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .mobile-cart-btn {
    display: inline-flex !important;
    min-width: 40px;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
  }

  .app-layout {
    padding-top: 110px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }
}

@media (max-width: 380px) {
  .brand-wrap strong { display: none; }
  #monthLabel {
    min-width: 140px;
    font-size: 13px;
  }
}

@media (max-width: 768px) {
  .calendar-panel {
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    padding: 8px !important;
    margin: 0 !important;
  }

  .weekdays {
    padding: 4px 0;
  }
  .weekdays span {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    text-align: center;
  }

  .calendar-grid {
    gap: 4px;
  }

  .day-cell {
    min-height: 58px !important;
    padding: 4px 3px !important;
    border-radius: 10px !important;
    cursor: pointer;
    position: relative;
  }
  .day-cell:active {
    transform: scale(0.95);
    transition: transform 0.1s;
  }
  .day-num {
    font-size: 13px !important;
    font-weight: 700;
    line-height: 1;
  }
  .day-dots {
    gap: 2px;
    margin-top: 3px;
    flex-wrap: wrap;
  }
  .dot {
    width: 6px !important;
    height: 6px !important;
  }
  .day-stere {
    font-size: 9px;
    margin-top: 2px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .day-cell.selected {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: white !important;
  }
  .day-cell.selected .day-num,
  .day-cell.selected .day-stere {
    color: white !important;
  }

  .day-cell.today {
    border-left: 3px solid var(--primary) !important;
  }
}

@media (max-width: 380px) {
  .day-cell { min-height: 50px !important; }
  .day-num { font-size: 12px !important; }
  .day-stere { display: none; }
  .calendar-grid { gap: 2px; }
  .weekdays span { font-size: 9px; }
}

@media (max-width: 768px) {
  .day-panel-overlay {
    display: none !important;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 23;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .day-panel-overlay.active {
    display: block !important;
    opacity: 1 !important;
    pointer-events: all !important;
  }

  .day-panel {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    height: 88vh !important;
    z-index: 25 !important;
    border-radius: 20px 20px 0 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    transform: translateY(100%) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    padding: 0 0 80px 0 !important;
    background: var(--card) !important;
  }
  .day-panel.open {
    transform: translateY(0) !important;
  }

  .panel-handle {
    display: block !important;
    width: 40px;
    height: 5px;
    background: var(--border);
    border-radius: 999px;
    margin: 12px auto 8px;
    flex-shrink: 0;
  }

  .day-header {
    padding: 8px 16px 12px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--card);
    z-index: 2;
  }
  #selectedDateLabel {
    font-size: 16px;
    font-weight: 700;
  }
  .day-meta {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
  }
  .mobile-close-btn {
    display: inline-flex !important;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 18px;
  }
}

@media (max-width: 768px) {
  .slot-block {
    margin: 8px 12px;
    border-radius: 12px;
    overflow: hidden;
  }
  .slot-title {
    padding: 10px 14px;
    font-size: 13px;
    border-radius: 0;
  }

  .delivery-card {
    border-radius: 0 !important;
    border-left-width: 4px !important;
    margin-bottom: 0 !important;
    border-bottom: 1px solid var(--border) !important;
  }
  .delivery-card:last-child {
    border-bottom: none !important;
  }

  .card-header-row {
    padding: 8px 12px !important;
    background: rgba(0,0,0,0.03) !important;
    border-bottom: 1px solid var(--border) !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .card-client-row {
    padding: 8px 12px !important;
    border-bottom: 1px solid var(--border) !important;
  }
  .card-order-row {
    padding: 8px 12px !important;
    border-bottom: 1px solid var(--border) !important;
  }
  .card-actions {
    padding: 8px 12px !important;
    gap: 6px !important;
    flex-wrap: wrap;
  }
  .row {
    font-size: 13px !important;
    line-height: 1.4;
    margin: 2px 0 !important;
  }
  .row strong { font-size: 14px !important; }
  .small-btn {
    min-height: 36px !important;
    font-size: 12px !important;
    padding: 6px 10px !important;
    flex: 0 0 auto !important;
    white-space: nowrap;
  }
  .status-badge { font-size: 11px !important; }
}

@media (max-width: 768px) {
  .modal {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  .modal-card {
    width: 100% !important;
    max-height: 95vh !important;
    min-height: unset !important;
    border-radius: 20px 20px 0 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    animation: slideUpModal 0.25s ease !important;
  }
  @keyframes slideUpModal {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }
  .modal-card > h3 {
    padding: 16px 16px 12px !important;
    margin: 0 !important;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    font-size: 16px;
    position: sticky;
    top: 0;
    background: var(--card);
    z-index: 2;
  }
  #deliveryForm {
    flex: 1 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 16px !important;
    padding-bottom: 100px !important;
  }
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
  #deliveryForm .input {
    min-height: 48px !important;
    font-size: 16px !important;
  }
  #deliveryForm textarea.input {
    min-height: 80px !important;
  }
  .slot-picker {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
  }
  .slot-option {
    padding: 10px 6px !important;
    font-size: 12px !important;
    text-align: center !important;
    justify-content: center !important;
    border-radius: 10px !important;
  }
  .slot-picker .slot-option:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  #deliveryForm .modal-actions {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: var(--card) !important;
    border-top: 1px solid var(--border) !important;
    padding: 12px 16px !important;
    padding-bottom: env(safe-area-inset-bottom, 12px) !important;
    z-index: 50 !important;
    display: flex !important;
    gap: 8px !important;
  }
  #deliveryForm .modal-actions .btn {
    flex: 1 !important;
    min-height: 50px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
  }
}

@media (max-width: 768px) {
  .stats-bar {
    font-size: 11px !important;
    padding: 8px 10px !important;
    white-space: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    gap: 12px;
    border-radius: 10px;
    margin: 6px 10px;
  }
}

@media (max-width: 768px) {
  .mobile-nav {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 64px !important;
    background: var(--card) !important;
    border-top: 2px solid var(--border) !important;
    padding: 4px 8px !important;
    padding-bottom: env(safe-area-inset-bottom, 4px) !important;
    z-index: 20 !important;
    gap: 4px !important;
    align-items: center !important;
  }
  .mobile-nav button {
    flex: 1 !important;
    min-height: 52px !important;
    border: none !important;
    background: transparent !important;
    border-radius: 10px !important;
    color: var(--text) !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    cursor: pointer !important;
    transition: background 0.15s !important;
    padding: 0 !important;
  }
  .mobile-nav button:active {
    background: rgba(45,106,45,0.12) !important;
  }
  body {
    padding-bottom: 64px !important;
  }
}

@media (max-width: 768px) {
  .toast {
    top: 68px !important;
    width: calc(100% - 24px) !important;
    max-width: 100% !important;
    left: 12px !important;
    right: 12px !important;
    transform: none !important;
    font-size: 13px !important;
  }
}

* {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}
input, select, textarea {
  font-size: 16px !important;
}
html { overflow-x: hidden; }


