/* =============================================
   ADMIN DASHBOARD — Cortinas & Rollers
   ============================================= */

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

:root {
  --admin-bg: #F8F9FA;
  --admin-sidebar: #1A1A1A;
  --admin-sidebar-hover: #2A2A2A;
  --admin-sidebar-active: #333333;
  --admin-white: #FFFFFF;
  --admin-text: #333333;
  --admin-text-light: #888888;
  --admin-border: #E8E8E8;
  --admin-accent: #E07832;
  --admin-accent-hover: #C96628;
  --admin-success: #2E7D32;
  --admin-success-bg: #E8F5E9;
  --admin-warning: #F57C00;
  --admin-warning-bg: #FFF3E0;
  --admin-error: #C62828;
  --admin-error-bg: #FFEBEE;
  --admin-info: #1565C0;
  --admin-info-bg: #E3F2FD;
  --admin-radius: 12px;
  --admin-radius-sm: 8px;
  --admin-shadow: 0 1px 3px rgba(0,0,0,0.06);
  --admin-shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --admin-transition: 250ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--admin-text);
  background: var(--admin-bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; border: none; outline: none; background: none; }
button { cursor: pointer; }

/* =============================================
   LOGIN
   ============================================= */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #F5F5F5 0%, #EBEBEB 100%);
  padding: 20px;
}

.login-card {
  background: var(--admin-white);
  border-radius: var(--admin-radius);
  box-shadow: var(--admin-shadow-md);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}
.login-logo img {
  height: 32px;
  width: auto;
}
.login-logo span {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--admin-text);
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--admin-text);
  margin-bottom: 4px;
}
.login-subtitle {
  font-size: 0.88rem;
  color: var(--admin-text-light);
  margin-bottom: 32px;
}

.login-form { text-align: left; }

.form-field {
  margin-bottom: 20px;
}
.form-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--admin-text);
  margin-bottom: 6px;
}
.form-field input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-sm);
  font-size: 0.9rem;
  transition: border-color var(--admin-transition);
  background: var(--admin-white);
}
.form-field input:focus {
  border-color: var(--admin-text);
}
.form-field input::placeholder {
  color: #CCCCCC;
}

.login-error {
  background: var(--admin-error-bg);
  color: var(--admin-error);
  padding: 10px 14px;
  border-radius: var(--admin-radius-sm);
  font-size: 0.82rem;
  margin-bottom: 16px;
  display: none;
}
.login-error.visible { display: block; }

.password-wrapper {
  position: relative;
}
.password-wrapper input {
  padding-right: 48px;
}
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--admin-text-light);
  transition: color var(--admin-transition);
  cursor: pointer;
}
.password-toggle svg {
  width: 18px;
  height: 18px;
}
.password-toggle:hover {
  color: var(--admin-text);
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: var(--admin-sidebar);
  color: var(--admin-white);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 9999px;
  transition: all var(--admin-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.login-btn:hover { background: #333; }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-footer {
  margin-top: 24px;
  font-size: 0.78rem;
  color: var(--admin-text-light);
}
.login-footer a {
  color: var(--admin-accent);
  font-weight: 500;
}

/* =============================================
   DASHBOARD LAYOUT
   ============================================= */
.dashboard-wrapper {
  display: none;
  min-height: 100vh;
}
.dashboard-wrapper.active { display: flex; }

/* SIDEBAR */
.sidebar {
  width: 260px;
  background: var(--admin-sidebar);
  color: rgba(255,255,255,0.7);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--admin-transition);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand img {
  height: 28px;
  filter: brightness(10);
}
.sidebar-brand span {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--admin-white);
}
.sidebar-tag {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 10px;
  background: rgba(255,255,255,0.1);
  border-radius: 9999px;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--admin-radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  transition: all var(--admin-transition);
  cursor: pointer;
}
.nav-item svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  flex-shrink: 0;
}
.nav-item:hover {
  background: var(--admin-sidebar-hover);
  color: rgba(255,255,255,0.9);
}
.nav-item.active {
  background: var(--admin-sidebar-active);
  color: var(--admin-white);
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  margin-bottom: 8px;
}
.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--admin-white);
  flex-shrink: 0;
}
.sidebar-user-info {
  flex: 1;
  min-width: 0;
}
.sidebar-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--admin-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  width: 100%;
  border-radius: var(--admin-radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255,255,255,0.5);
  transition: all var(--admin-transition);
}
.logout-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}
.logout-btn:hover {
  background: rgba(198,40,40,0.15);
  color: #EF5350;
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
}

.topbar {
  background: var(--admin-white);
  border-bottom: 1px solid var(--admin-border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--admin-text);
}
.topbar-subtitle {
  font-size: 0.82rem;
  color: var(--admin-text-light);
}

.hamburger {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--admin-radius-sm);
  transition: background var(--admin-transition);
}
.hamburger:hover { background: var(--admin-bg); }
.hamburger svg {
  width: 22px;
  height: 22px;
  stroke: var(--admin-text);
  stroke-width: 1.8;
  fill: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--admin-text-light);
  border-radius: 9999px;
  border: 1px solid var(--admin-border);
  transition: all var(--admin-transition);
}
.topbar-back svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}
.topbar-back:hover {
  background: var(--admin-bg);
  color: var(--admin-text);
}

.content-area {
  padding: 28px 32px;
}

/* SECTIONS */
.admin-section {
  display: none;
  animation: adminFadeIn 0.3s ease;
}
.admin-section.active { display: block; }

@keyframes adminFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =============================================
   STAT CARDS
   ============================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--admin-white);
  border-radius: var(--admin-radius);
  padding: 24px;
  border: 1px solid var(--admin-border);
  transition: all var(--admin-transition);
}
.stat-card:hover {
  box-shadow: var(--admin-shadow-md);
  transform: translateY(-2px);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--admin-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
  fill: none;
}
.stat-icon.blue { background: var(--admin-info-bg); }
.stat-icon.blue svg { stroke: var(--admin-info); }
.stat-icon.green { background: var(--admin-success-bg); }
.stat-icon.green svg { stroke: var(--admin-success); }
.stat-icon.orange { background: var(--admin-warning-bg); }
.stat-icon.orange svg { stroke: var(--admin-warning); }
.stat-icon.red { background: var(--admin-error-bg); }
.stat-icon.red svg { stroke: var(--admin-error); }

.stat-trend {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 9999px;
}
.stat-trend.up { background: var(--admin-success-bg); color: var(--admin-success); }
.stat-trend.down { background: var(--admin-error-bg); color: var(--admin-error); }

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--admin-text);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 0.82rem;
  color: var(--admin-text-light);
}

/* =============================================
   TABLES
   ============================================= */
.table-card {
  background: var(--admin-white);
  border-radius: var(--admin-radius);
  border: 1px solid var(--admin-border);
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--admin-border);
}
.table-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--admin-text);
}

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

.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--admin-sidebar);
  color: var(--admin-white);
  font-weight: 600;
  font-size: 0.82rem;
  border-radius: 9999px;
  transition: all var(--admin-transition);
}
.btn-add svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}
.btn-add:hover { background: #333; }

/* Filter Pills */
.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-pill {
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid var(--admin-border);
  color: var(--admin-text-light);
  background: var(--admin-white);
  transition: all var(--admin-transition);
  cursor: pointer;
}
.filter-pill:hover {
  border-color: var(--admin-text-light);
  color: var(--admin-text);
}
.filter-pill.active {
  background: var(--admin-sidebar);
  color: var(--admin-white);
  border-color: var(--admin-sidebar);
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}
thead {
  background: var(--admin-bg);
}
th {
  text-align: left;
  padding: 12px 24px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--admin-text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
td {
  padding: 14px 24px;
  font-size: 0.88rem;
  border-top: 1px solid var(--admin-border);
  white-space: nowrap;
}
tbody tr {
  transition: background var(--admin-transition);
}
tbody tr:hover { background: #FAFAFA; }

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-pending { background: var(--admin-warning-bg); color: var(--admin-warning); }
.badge-completed { background: var(--admin-success-bg); color: var(--admin-success); }
.badge-cancelled { background: var(--admin-error-bg); color: var(--admin-error); }
.badge-processing { background: var(--admin-info-bg); color: var(--admin-info); }

/* Table action buttons */
.table-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--admin-transition);
  color: var(--admin-text-light);
}
.table-action-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}
.table-action-btn:hover {
  background: var(--admin-bg);
  color: var(--admin-text);
}
.table-action-btn.delete:hover {
  background: var(--admin-error-bg);
  color: var(--admin-error);
}

.table-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--admin-text-light);
  font-size: 0.9rem;
}

/* =============================================
   ORDER DETAIL
   ============================================= */
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  margin-bottom: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--admin-text-light);
  border: 1px solid var(--admin-border);
  border-radius: 9999px;
  transition: all var(--admin-transition);
}
.detail-back:hover { background: var(--admin-white); color: var(--admin-text); }

.detail-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.detail-order-id {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--admin-text);
  margin-right: 12px;
  display: inline;
}
.detail-date {
  font-size: 0.88rem;
  color: var(--admin-text-light);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
}

.detail-card {
  background: var(--admin-white);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 24px;
  margin-bottom: 20px;
}
.detail-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--admin-text);
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--admin-border);
}
.detail-card-title svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  color: var(--admin-text-light);
}

.detail-rows { display: flex; flex-direction: column; gap: 12px; }
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.detail-label {
  font-size: 0.82rem;
  color: var(--admin-text-light);
  flex-shrink: 0;
  min-width: 120px;
}
.detail-value {
  font-size: 0.88rem;
  color: var(--admin-text);
  text-align: right;
  word-break: break-word;
}
.detail-value a {
  color: var(--admin-info);
  text-decoration: underline;
}
.detail-total {
  font-size: 1rem;
  font-weight: 700;
  color: var(--admin-accent);
}

/* Map */
.map-placeholder {
  margin-top: 16px;
  background: var(--admin-bg);
  border: 2px dashed var(--admin-border);
  border-radius: var(--admin-radius-sm);
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.map-placeholder span {
  font-size: 0.82rem;
  color: var(--admin-text-light);
}
.map-link {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--admin-info);
  text-decoration: underline;
}

/* Operator */
.operator-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.operator-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--admin-sidebar);
  color: var(--admin-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  flex-shrink: 0;
}
.operator-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--admin-text);
}
.operator-zone {
  font-size: 0.78rem;
  color: var(--admin-text-light);
}
.operator-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.btn-operator-wa, .btn-operator-call {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: var(--admin-radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--admin-transition);
}
.btn-operator-wa {
  background: #25D366;
  color: #fff;
}
.btn-operator-wa:hover { background: #1EBE57; }
.btn-operator-call {
  border: 1px solid var(--admin-border);
  color: var(--admin-text);
}
.btn-operator-call:hover { background: var(--admin-bg); }

.no-operator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px;
  text-align: center;
}
.no-operator span {
  font-size: 0.85rem;
  color: var(--admin-text-light);
}
.operator-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-sm);
  font-size: 0.85rem;
  color: var(--admin-text);
  background: var(--admin-white);
  cursor: pointer;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 0;
}
.timeline-item {
  display: flex;
  gap: 14px;
  position: relative;
  padding-bottom: 20px;
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--admin-border);
  background: var(--admin-white);
  flex-shrink: 0;
  margin-top: 2px;
  z-index: 2;
  position: relative;
}
.timeline-item.done .timeline-dot {
  background: var(--admin-success);
  border-color: var(--admin-success);
}

.timeline-line {
  position: absolute;
  left: 6px;
  top: 16px;
  width: 2px;
  bottom: 0;
  background: var(--admin-border);
  z-index: 1;
}
.timeline-item.done .timeline-line { background: var(--admin-success); }

.timeline-step {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--admin-text);
}
.timeline-item:not(.done) .timeline-step { color: var(--admin-text-light); }
.timeline-date {
  font-size: 0.75rem;
  color: var(--admin-text-light);
}

/* Clickable rows */
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #F5F5F5 !important; }

/* =============================================
   MODAL
   ============================================= */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--admin-white);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: adminFadeIn 0.25s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px;
  border-bottom: 1px solid var(--admin-border);
  flex-shrink: 0;
}
.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.modal-close {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--admin-text-light);
  transition: all var(--admin-transition);
}
.modal-close:hover {
  background: var(--admin-bg);
  color: var(--admin-text);
}

.modal-card form {
  padding: 24px 28px;
  overflow-y: auto;
  flex: 1;
}
.modal-card .form-field {
  margin-bottom: 14px;
}
.modal-card .form-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--admin-text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.modal-card .form-field input,
.modal-card .form-field select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--admin-border);
  border-radius: 10px;
  font-size: 0.88rem;
  background: #F8F8F8;
  color: var(--admin-text);
  transition: all 0.2s ease;
}
.modal-card .form-field input::placeholder {
  color: #B0B0B0;
}
.modal-card .form-field input:focus,
.modal-card .form-field select:focus {
  outline: none;
  border-color: var(--admin-sidebar);
  background: var(--admin-white);
  box-shadow: 0 0 0 3px rgba(26,26,26,0.06);
}
.modal-card .form-field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--admin-border);
  flex-shrink: 0;
}
.btn-cancel {
  padding: 11px 24px;
  border: 1.5px solid var(--admin-border);
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--admin-text-light);
  transition: all var(--admin-transition);
}
.btn-cancel:hover { background: var(--admin-bg); color: var(--admin-text); border-color: var(--admin-text-light); }
.btn-save {
  padding: 11px 28px;
  background: var(--admin-sidebar);
  color: var(--admin-white);
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--admin-transition);
}
.btn-save:hover { background: #333; transform: translateY(-1px); }

/* Operator status badges */
.badge-available { background: var(--admin-success-bg); color: var(--admin-success); }
.badge-busy { background: var(--admin-warning-bg); color: var(--admin-warning); }

/* WhatsApp notify button in order detail */
.btn-wa-notify {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: #25D366;
  color: #fff;
  font-weight: 600;
  font-size: 0.82rem;
  border-radius: 9999px;
  transition: all var(--admin-transition);
  margin-top: 16px;
}
.btn-wa-notify svg { width: 16px; height: 16px; fill: currentColor; }
.btn-wa-notify:hover { background: #1EBE57; }

/* Search Box */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--admin-border);
  border-radius: 9999px;
  background: var(--admin-white);
  transition: border-color var(--admin-transition);
  min-width: 220px;
}
.search-box:focus-within { border-color: var(--admin-text); }
.search-box svg {
  width: 16px;
  height: 16px;
  stroke: var(--admin-text-light);
  stroke-width: 1.8;
  fill: none;
  flex-shrink: 0;
}
.search-box input {
  flex: 1;
  font-size: 0.82rem;
  color: var(--admin-text);
  min-width: 0;
}
.search-box input::placeholder { color: #CCCCCC; }

/* Export Button */
.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1px solid var(--admin-border);
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--admin-text-light);
  background: var(--admin-white);
  transition: all var(--admin-transition);
  white-space: nowrap;
}
.btn-export svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}
.btn-export:hover {
  background: var(--admin-bg);
  color: var(--admin-text);
  border-color: var(--admin-text-light);
}

/* Client Detail - Actions Row */
.client-actions-row {
  display: flex;
  gap: 8px;
}

/* Client Order History List */
.client-orders-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.client-order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--admin-border);
  cursor: pointer;
  transition: background var(--admin-transition);
  gap: 12px;
}
.client-order-item:last-child { border-bottom: none; }
.client-order-item:hover { background: #FAFAFA; margin: 0 -24px; padding: 14px 24px; }
.client-order-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.client-order-info strong { font-size: 0.88rem; color: var(--admin-text); }
.client-order-info span { font-size: 0.78rem; color: var(--admin-text-light); }
.client-order-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.client-order-meta strong { font-size: 0.88rem; color: var(--admin-accent); }

/* Supplier Material Tags */
.supplier-materials-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.supplier-material-tag {
  display: inline-block;
  padding: 6px 14px;
  background: var(--admin-bg);
  border: 1px solid var(--admin-border);
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--admin-text);
  transition: all var(--admin-transition);
}
.supplier-material-tag:hover {
  background: var(--admin-sidebar);
  color: var(--admin-white);
  border-color: var(--admin-sidebar);
}

/* Stat icon color variants */
.stat-icon.green { background: #E8F5E9; color: #2E7D32; }
.stat-icon.red { background: #FFEBEE; color: #C62828; }
.stat-icon.blue { background: #E3F2FD; color: #1565C0; }
.stat-icon.orange { background: #FFF3E0; color: #E65100; }
.stat-icon.green svg, .stat-icon.red svg, .stat-icon.blue svg, .stat-icon.orange svg {
  stroke: currentColor; fill: none; stroke-width: 1.8;
}

/* Payment Status Display */
.payment-status-display { text-align: center; padding: 8px 0; }
.payment-status-icon {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 9999px;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.payment-status-icon.badge-completed { background: #E8F5E9; color: #2E7D32; }
.payment-status-icon.badge-pending { background: #FFF3E0; color: #E65100; }
.payment-status-icon.badge-cancelled { background: #FFEBEE; color: #C62828; }
.payment-status-icon.badge-processing { background: #E3F2FD; color: #1565C0; }

/* Wide Modal */
.modal-wide { max-width: 680px; }

/* 2-Column Form Grid */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

/* Checkbox Label */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--admin-text);
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--admin-sidebar);
  cursor: pointer;
}

/* Enhanced Modal Header */
.modal-header-enhanced {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.modal-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--admin-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.modal-icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--admin-white);
  stroke-width: 2;
  fill: none;
}
.modal-subtitle {
  font-size: 0.78rem;
  color: var(--admin-text-light);
  margin-top: 2px;
  font-weight: 400;
}

/* Form Sections */
.form-section {
  padding: 18px;
  margin-bottom: 16px;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: #FAFAFA;
}
.form-section-last {
  margin-bottom: 8px;
}

/* Google Places autocomplete dropdown above modal */
.pac-container { z-index: 9999 !important; }
.form-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--admin-border);
}
.form-section-header svg {
  width: 18px;
  height: 18px;
  stroke: var(--admin-sidebar);
  stroke-width: 1.8;
  fill: none;
  flex-shrink: 0;
}
.form-section-header span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--admin-sidebar);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.form-section .form-field input,
.form-section .form-field select {
  background: var(--admin-white);
}

/* Save button icon */
.btn-save svg {
  vertical-align: -2px;
  margin-right: 2px;
}

/* Checkbox enhanced */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--admin-text);
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--admin-border);
  background: var(--admin-white);
  transition: all 0.2s ease;
}
.checkbox-label:hover {
  border-color: var(--admin-text-light);
}
.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--admin-sidebar);
  cursor: pointer;
  flex-shrink: 0;
}

/* =============================================
   ROUTES OPTIMIZATION
   ============================================= */
.routes-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  height: calc(100vh - 140px);
}
.routes-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
}
.routes-controls {
  padding: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-bottom: 1px solid var(--admin-border);
  margin-bottom: 16px;
}
.routes-controls .form-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--admin-text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  display: block;
}
.routes-controls select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--admin-border);
  border-radius: 10px;
  font-size: 0.88rem;
  background: #F8F8F8;
}
.routes-type-toggle {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--admin-border);
  border-radius: 10px;
  overflow: hidden;
}
.route-type-btn {
  flex: 1;
  padding: 10px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  background: var(--admin-white);
  color: var(--admin-text-light);
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}
.route-type-btn.active {
  background: var(--admin-sidebar);
  color: var(--admin-white);
}
.routes-map-container {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--admin-border);
}

/* Summary */
.route-summary-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.route-summary-item {
  background: var(--admin-bg);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
  border: 1px solid var(--admin-border);
}
.route-summary-value {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--admin-text);
}
.route-summary-label {
  display: block;
  font-size: 0.7rem;
  color: var(--admin-text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* Stops List */
.routes-stops-list {
  flex: 1;
  overflow-y: auto;
}
.route-stop {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--admin-border);
  margin-bottom: 0;
  background: var(--admin-white);
  transition: all 0.2s ease;
}
.route-stop:hover { background: #F8F8F8; }
.route-stop-link { cursor: pointer; }
.route-stop-link:hover { opacity: 0.7; }
.route-depot { background: #FAFAFA; border-style: dashed; }
.route-stop-done { opacity: 0.45; text-decoration: line-through; }
.route-stop-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--admin-sidebar);
  color: var(--admin-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.route-depot .route-stop-number {
  background: var(--admin-success);
}
.route-stop-info {
  flex: 1;
  min-width: 0;
}
.route-stop-info strong {
  display: block;
  font-size: 0.88rem;
  color: var(--admin-text);
  margin-bottom: 2px;
}
.route-stop-info > span {
  display: block;
  font-size: 0.78rem;
  color: var(--admin-text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.route-stop-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.route-stop-meta .badge {
  font-size: 0.68rem;
  padding: 2px 8px;
}
.route-complete-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--admin-white);
  color: var(--admin-text-light);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-top: 2px;
}
.route-complete-btn svg {
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.route-complete-btn:hover {
  background: var(--admin-success);
  color: var(--admin-white);
  border-color: var(--admin-success);
}

/* Leg connector */
.route-leg-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 0;
  color: var(--admin-text-light);
  font-size: 0.72rem;
}
.route-leg-info svg {
  stroke: var(--admin-text-light);
  fill: none;
  stroke-width: 2;
}

/* =============================================
   MOBILE SIDEBAR OVERLAY
   ============================================= */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }

  .main-content { margin-left: 0; }

  .hamburger { display: flex; }

  .topbar { padding: 12px 16px; }
  .topbar-title { font-size: 1.1rem; }

  .content-area { padding: 20px 16px; }

  .stats-grid { grid-template-columns: 1fr; gap: 12px; }
  .stat-card { padding: 18px; }
  .stat-value { font-size: 1.4rem; }

  th { padding: 10px 16px; font-size: 0.7rem; }
  td { padding: 12px 16px; font-size: 0.82rem; }

  .table-header { padding: 16px; flex-direction: column; gap: 12px; align-items: flex-start; }
  .table-actions { flex-direction: column; align-items: stretch; width: 100%; gap: 8px; }
  .search-box { min-width: 100%; }
  .filter-pills { flex-wrap: wrap; }
  .btn-export { justify-content: center; }
  .client-actions-row { flex-direction: column; }
  .client-order-item:hover { margin: 0 -18px; padding: 14px 18px; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .modal-wide { max-width: 95vw; }
  .routes-layout { grid-template-columns: 1fr; height: auto; }
  .routes-map-container { min-height: 350px; }

  .login-card { padding: 32px 24px; }

  .detail-grid { grid-template-columns: 1fr; }
  .detail-card { padding: 18px; }
  .detail-header-row { flex-direction: column; gap: 8px; align-items: flex-start; }
  .operator-actions { flex-direction: column; }
}

