/* ======================================================
   Delivery System "КУРК 2026" — Ultra Premium Dark CSS
   ====================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* Apple Dark Mode Palette */
  --bg-dark-base: #0b0f19;
  --bg-dark-card: rgba(22, 30, 46, 0.7);
  --bg-dark-panel: rgba(15, 23, 42, 0.85);
  --bg-dark-header: rgba(11, 17, 30, 0.85);

  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.16);

  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(56, 189, 248, 0.35);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-cyan: #38bdf8;
  --accent-blue: #0284c7;
  --accent-bright-blue: #38bdf8;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-purple: #c084fc;
  --accent-red: #f43f5e;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  --apple-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --apple-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --apple-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --apple-blur: blur(20px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Custom Apple Slim Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.5);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Plus Jakarta Sans", "Inter", sans-serif;
  background-color: var(--bg-dark-base);
  color: var(--text-main);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ======================================================
   APPLE-STYLE TOP HEADER CONTROL BAR
   ====================================================== */
.top-header {
  background: var(--bg-dark-header);
  backdrop-filter: var(--apple-blur);
  -webkit-backdrop-filter: var(--apple-blur);
  border-bottom: 1px solid var(--glass-border);
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  box-shadow: var(--apple-shadow-md);
  z-index: 1000;
  flex-shrink: 0;
}

.header-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  font-size: 20px;
  filter: drop-shadow(0 2px 6px rgba(56, 189, 248, 0.4));
}

.brand-section h1 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.4px;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}

.nav-tab {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-tab.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
  font-weight: 700;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-top {
  background: var(--glass-bg);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
}

.btn-top:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--glass-border-hover);
  transform: translateY(-1px);
}

.btn-optimize {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: #fff;
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
  font-weight: 700;
}

.btn-optimize:hover {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  box-shadow: 0 6px 18px rgba(56, 189, 248, 0.45);
}

.btn-green {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}
.btn-green:hover {
  background: linear-gradient(135deg, #34d399 0%, #059669 100%);
  transform: translateY(-1px);
}

.header-sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  overflow: hidden;
}

.date-pills-scroll {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 6px 2px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.4) rgba(255, 255, 255, 0.04);
}

.date-pills-scroll::-webkit-scrollbar {
  height: 4px;
}

.date-pills-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
}

.date-pills-scroll::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.3);
  border-radius: 4px;
}

.date-group-month {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  padding: 2px 4px;
  flex-shrink: 0;
}

.date-group-month-label {
  font-size: 10px;
  font-weight: 800;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
}

.date-pill {
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.date-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.date-pill.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #38bdf8;
  font-weight: 700;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

.date-pill.is-today {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.date-pill.is-today.active {
  background: #059669;
  color: #ffffff;
  border-color: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.4);
}

.date-pill .pill-wd {
  font-size: 9px;
  opacity: 0.75;
  font-weight: 700;
}

.btn-add-date {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px dashed var(--accent-green);
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-add-date:hover {
  background: rgba(16, 185, 129, 0.25);
}

.inline-metrics-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.metric-badge {
  background: var(--bg-dark-card);
  border: 1px solid var(--border-color);
  padding: 3px 10px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-lbl {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.metric-val {
  font-size: 12px;
  font-weight: 800;
}

.metric-val.blue { color: var(--accent-bright-blue); }
.metric-val.amber { color: var(--accent-amber); }
.metric-val.green { color: var(--accent-green); }

.paste-hint-text {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}
.paste-hint-text kbd {
  background: rgba(255, 255, 255, 0.12);
  padding: 1px 4px;
  border-radius: 3px;
  color: #fff;
}

/* ======================================================
   MAIN SPLIT LAYOUT (Sidebar + Content Area)
   ====================================================== */
.main-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  width: 100%;
}

/* Left Sidebar - Apple Glass Panel */
.sidebar-panel {
  width: 360px;
  min-width: 240px;
  max-width: 650px;
  background: var(--bg-dark-panel);
  backdrop-filter: var(--apple-blur);
  -webkit-backdrop-filter: var(--apple-blur);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

/* Layout Resizer Splitter Handle */
.layout-resizer {
  width: 5px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 1px solid var(--glass-border);
  border-right: 1px solid var(--glass-border);
  cursor: col-resize;
  position: relative;
  z-index: 100;
  transition: background 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

.layout-resizer:hover, .layout-resizer.resizing {
  background: var(--accent-bright-blue);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
}

.search-box {
  padding: 10px 12px;
  border-bottom: 1px solid var(--glass-border);
}

.search-box input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}
.search-box input:focus {
  border-color: var(--accent-bright-blue);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
  background: rgba(0, 0, 0, 0.45);
}

.filter-chips-row {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  border-bottom: 1px solid var(--glass-border);
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}
.filter-chips-row::-webkit-scrollbar { display: none; }

.filter-chip {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid var(--glass-border);
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.filter-chip:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
}

.filter-chip.active {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-bright-blue);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

.filter-chip.chip-not-ready {
  color: #f43f5e;
}

.route-info-banner {
  background: rgba(56, 189, 248, 0.08);
  color: var(--accent-bright-blue);
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  border-bottom: 1px solid var(--glass-border);
  letter-spacing: 0.2px;
}

.orders-list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

/* Sidebar Order Cards - Glassmorphism */
.sidebar-order-card {
  background: var(--bg-dark-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 8px;
  position: relative;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--apple-shadow-sm);
}

.sidebar-order-card:hover, .sidebar-order-card.hover-highlight {
  border-color: var(--accent-amber);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.2);
}

.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.card-seq-badge {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #fff;
  font-weight: 800;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.4);
}

.card-order-num {
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: -0.2px;
}

.card-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.card-status-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  text-transform: lowercase;
}

.status-not-ready { background: rgba(244, 63, 94, 0.15); color: #f43f5e; border: 1px solid rgba(244, 63, 94, 0.4); }
.status-ready { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.status-warehouse { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.status-assembly { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.4); }
.status-docs { background: rgba(234, 179, 8, 0.15); color: #facc15; border: 1px solid rgba(234, 179, 8, 0.4); }

.card-address {
  font-size: 11.5px;
  color: var(--text-main);
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 4px;
}

.card-client {
  font-size: 10.5px;
  color: var(--text-muted);
}

.card-reorder-arrows {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  gap: 3px;
}

.arrow-btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 10px;
  transition: all 0.15s ease;
}

.arrow-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-dark-panel);
  flex-shrink: 0;
}

.btn-sidebar-paste {
  background: var(--glass-bg);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.btn-sidebar-paste:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--glass-border-hover);
}

.btn-sidebar-gmaps {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border: none;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
  transition: all 0.2s ease;
}

.btn-sidebar-gmaps:hover {
  background: linear-gradient(135deg, #34d399 0%, #059669 100%);
  transform: translateY(-1px);
}

/* ======================================================
   MAIN CONTENT AREA (Map & Editable Grid Table)
   ====================================================== */
.content-area {
  flex: 1;
  min-height: 0;
  min-width: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#map-view-container {
  width: 100%;
  height: 100%;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

/* Map Legend - Apple Floating Card */
.map-status-legend {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: var(--apple-blur);
  -webkit-backdrop-filter: var(--apple-blur);
  border: 1px solid var(--glass-border);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  display: flex;
  gap: 12px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: var(--apple-shadow-md);
}

/* Editable Table View - Apple Glass Table Container */
#table-view-container {
  padding: 10px 14px 12px 14px;
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.table-header-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.table-header-title h2 {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-row-count-badge {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-bright-blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
}

.table-scroll-wrapper {
  flex: 1;
  min-height: 0;
  overflow: auto !important;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: var(--apple-blur);
  -webkit-backdrop-filter: var(--apple-blur);
  position: relative;
  box-shadow: var(--apple-shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  -webkit-overflow-scrolling: touch;
}

/* Premium Scrollbar styling for table wrapper */
.table-scroll-wrapper::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-scroll-wrapper::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
}

.table-scroll-wrapper::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.4);
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.table-scroll-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--accent-bright-blue);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.8);
}

/* Editable Spreadsheet Dark Table - Apple Glass Aesthetic */
.spreadsheet-dark-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11.5px;
  line-height: 1.35;
}

.spreadsheet-dark-table th {
  background: rgba(22, 32, 54, 0.95);
  backdrop-filter: blur(10px);
  color: var(--accent-bright-blue);
  padding: 8px 10px;
  text-align: left;
  font-weight: 700;
  border-bottom: 2px solid rgba(56, 189, 248, 0.4);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 10.5px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

.spreadsheet-dark-table tbody tr {
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.spreadsheet-dark-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.012);
}

.spreadsheet-dark-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.08) !important;
  box-shadow: inset 3px 0 0 var(--accent-bright-blue);
}

.spreadsheet-dark-table td {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
  border-right: 1px solid rgba(255, 255, 255, 0.02);
  vertical-align: middle;
}

.cell-input {
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-main);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-family: inherit;
  outline: none;
  transition: all 0.15s ease;
}

.cell-input:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

.cell-input:focus {
  background: rgba(15, 23, 42, 0.9);
  border-color: var(--accent-bright-blue);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

/* Modals - Apple VisionOS Glass Sheet */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: var(--apple-blur);
  -webkit-backdrop-filter: var(--apple-blur);
  border: 1px solid var(--glass-border-hover);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 90%;
  box-shadow: var(--apple-shadow-lg);
  transform: scale(0.96);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.modal-body textarea, .modal-body input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 12px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: all 0.2s ease;
}

.modal-body textarea:focus, .modal-body input:focus {
  border-color: var(--accent-bright-blue);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.modal-footer {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ======================================================
   Drag and Drop & Enhanced Table Editing Styles
   ====================================================== */
.draggable-row {
  user-select: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.draggable-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.drag-handle {
  cursor: grab;
  font-size: 14px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s ease, color 0.15s ease;
}

.drag-handle:hover, .drag-handle:active {
  color: var(--accent-bright-blue);
  background: rgba(56, 189, 248, 0.15);
  cursor: grabbing;
}

.draggable-row.dragging {
  opacity: 0.45;
  background: rgba(56, 189, 248, 0.15) !important;
  border: 2px dashed var(--accent-bright-blue) !important;
}

.draggable-row.drag-over-top {
  border-top: 2px solid var(--accent-bright-blue) !important;
  box-shadow: inset 0 2px 0 var(--accent-bright-blue);
}

.draggable-row.drag-over-bottom {
  border-bottom: 2px solid var(--accent-bright-blue) !important;
  box-shadow: inset 0 -2px 0 var(--accent-bright-blue);
}

/* Company / Recipient & Phone Integrated Cell */
.company-cell-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 1px 0;
}

.company-input {
  font-weight: 700 !important;
  color: #f8fafc !important;
  font-size: 11.5px !important;
  padding: 2px 4px !important;
}

.phone-subrow {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 4px;
  padding: 1px 4px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.phone-subrow:focus-within {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.18);
}

.phone-icon {
  font-size: 10px;
  opacity: 0.85;
}

.phone-input-inline {
  width: 100%;
  background: transparent;
  border: none;
  color: #10b981 !important;
  font-weight: 700 !important;
  font-size: 10.5px !important;
  outline: none;
  padding: 0;
}

.phone-input-inline::placeholder {
  color: rgba(16, 185, 129, 0.5);
  font-weight: 400;
}

/* Quick Row Action Buttons */
.row-actions-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.btn-row-action {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  width: 20px;
  height: 20px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: all 0.12s ease;
}

.btn-row-action:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
}

.btn-row-action.delete-row:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.5);
}

/* Pinned Deliveries Styling */
.is-pinned-badge, .is-pinned-seq {
  background: rgba(245, 158, 11, 0.25) !important;
  color: #f59e0b !important;
  border: 1px solid rgba(245, 158, 11, 0.5) !important;
  font-weight: 800 !important;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.3) !important;
}

.sidebar-order-card.pinned-card {
  border-left: 4px solid #f59e0b !important;
  background: rgba(245, 158, 11, 0.05) !important;
}

.btn-row-action.btn-pin-row.pinned {
  background: rgba(245, 158, 11, 0.25) !important;
  color: #f59e0b !important;
  border-color: #f59e0b !important;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.btn-row-action.btn-pin-row:hover {
  background: rgba(245, 158, 11, 0.2) !important;
  color: #f59e0b !important;
  border-color: #f59e0b !important;
}

/* Compact Ultra-Dense Table View Mode */
.table-scroll-wrapper.compact-table .spreadsheet-dark-table th {
  padding: 4px 6px;
  font-size: 10px;
}
.table-scroll-wrapper.compact-table .spreadsheet-dark-table td {
  padding: 2px 3px;
}
.table-scroll-wrapper.compact-table .cell-input {
  font-size: 11px;
  padding: 2px 4px;
  height: 24px;
}
.table-scroll-wrapper.compact-table select.cell-input {
  padding: 1px 2px;
  height: 24px;
}
.table-scroll-wrapper.compact-table .btn-row-action {
  padding: 1px 3px;
  font-size: 10px;
}

