/* ===================================================
   Island Time Transport - Management Console
   Gold & Dark theme inspired by the brand logo
   =================================================== */

/* ----- CSS Custom Properties ----- */
:root {
  --bg-primary: #0c0f14;
  --bg-secondary: #12161e;
  --bg-card: #161b26;
  --bg-card-hover: #1c2230;
  --bg-input: #111620;
  --bg-header: rgba(12, 15, 20, 0.92);
  --bg-table-stripe: rgba(22, 27, 38, 0.6);

  --border-color: rgba(234, 179, 8, 0.08);
  --border-subtle: rgba(148, 163, 184, 0.06);
  --border-focus: #eab308;

  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-heading: #f8fafc;

  /* Brand gold from logo */
  --gold: #eab308;
  --gold-hover: #ca8a04;
  --gold-light: rgba(234, 179, 8, 0.1);
  --gold-glow: rgba(234, 179, 8, 0.2);
  --gold-dark: #a16207;

  --color-success: #22c55e;
  --color-success-hover: #16a34a;
  --color-success-bg: rgba(34, 197, 94, 0.1);

  --color-danger: #ef4444;
  --color-danger-hover: #dc2626;
  --color-danger-bg: rgba(239, 68, 68, 0.1);

  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.1);

  --color-info: #3b82f6;
  --color-info-bg: rgba(59, 130, 246, 0.1);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.5);
  --shadow-gold: 0 0 30px rgba(234, 179, 8, 0.1);
  --shadow-gold-lg: 0 4px 20px rgba(234, 179, 8, 0.15);

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ----- Reset & Base ----- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-heading);
  font-weight: 600;
  line-height: 1.3;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--gold-hover);
}

img {
  max-width: 100%;
  display: block;
}

/* ----- Utilities ----- */
.hidden {
  display: none !important;
}

.error-msg {
  color: var(--color-danger);
  font-size: 0.875rem;
  margin-top: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: var(--color-danger-bg);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.15);
}

.change-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gold);
  color: #0c0f14;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  margin-left: 0.75rem;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.ride-id {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  background: rgba(100, 116, 139, 0.08);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

/* ----- Toast Notification ----- */
.toast {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 10000;
  transform: translateX(calc(100% + 2rem));
  opacity: 0;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  word-wrap: break-word;
  backdrop-filter: blur(12px);
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.success {
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.95), rgba(34, 197, 94, 0.95));
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.toast.error {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.95), rgba(239, 68, 68, 0.95));
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.toast.info {
  background: linear-gradient(135deg, rgba(161, 98, 7, 0.95), rgba(234, 179, 8, 0.95));
  border: 1px solid rgba(234, 179, 8, 0.3);
  color: #0c0f14;
}

.toast.warning {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.95), rgba(245, 158, 11, 0.95));
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #0c0f14;
}

/* Dashboard "Special Request" column: cap width and show full text on hover. */
#ridesTable td.special-request-cell {
  max-width: 220px;
  white-space: normal;
  word-break: break-word;
}

/* On mobile, show the toast low on the screen, full width and centered,
   so submission success/error is easy to notice. */
@media (max-width: 768px) {
  .toast {
    top: auto;
    bottom: 1.5rem;
    left: 1rem;
    right: 1rem;
    max-width: none;
    text-align: center;
    font-size: 1rem;
    padding: 1rem 1.25rem;
    /* slide up from the bottom instead of in from the right */
    transform: translateY(calc(100% + 3rem));
  }

  .toast.show {
    transform: translateY(0);
  }
}

/* ----- Loading Overlay ----- */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(12, 15, 20, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(8px);
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(234, 179, 8, 0.15);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ----- Confirm Modal ----- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(12, 15, 20, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  backdrop-filter: blur(8px);
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.modal-card p {
  color: var(--text-primary);
  font-size: 1.05rem;
  text-align: center;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-actions button {
  min-width: 120px;
}

/* ----- Header ----- */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(16px) saturate(180%);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1.25;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#userName {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

#btnLogout {
  padding: 0.35rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid rgba(234, 179, 8, 0.15);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-family);
}

#btnLogout:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* ----- Views ----- */
.view {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem;
}

/* ----- Login View ----- */
#loginView {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.25rem;
}

.login-container {
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-logo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 2rem;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid rgba(234, 179, 8, 0.1);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem 1.75rem;
  box-shadow: var(--shadow-lg);
}

.login-card h2 {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.login-card .btn-primary {
  margin-top: 0.5rem;
  background: var(--gold);
  border: none;
  font-size: 0.95rem;
  padding: 0.7rem 1.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #0c0f14;
}

.login-card .btn-primary:hover {
  background: #d4a006;
}

/* ----- Form Elements ----- */
.form-group {
  margin-bottom: 1rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid rgba(234, 179, 8, 0.15);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  outline: none;
}

.form-group select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  cursor: pointer;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23eab308' d='M6 8.825L1.175 4 2.238 2.938 6 6.7 9.763 2.937 10.825 4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
}

.form-group input:hover,
.form-group textarea:hover,
.form-group select:hover {
  border-color: rgba(234, 179, 8, 0.25);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-light);
}

/* Date & Time picker icons - white and bigger */
.form-group input[type="date"]::-webkit-calendar-picker-indicator,
.form-group input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
  width: 22px;
  height: 22px;
  opacity: 0.8;
}

.form-group input[type="date"]::-webkit-calendar-picker-indicator:hover,
.form-group input[type="time"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .form-group {
  flex: 1;
}

/* ----- Password Toggle ----- */
.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 2.5rem;
}

.password-toggle {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--text-secondary);
}

/* ----- Buttons ----- */
button {
  cursor: pointer;
  font-family: var(--font-family);
  transition: all var(--transition-fast);
  outline: none;
}

.btn-primary {
  padding: 0.55rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #0c0f14;
  background: var(--gold);
  border: none;
  border-radius: var(--radius-sm);
}

.btn-primary:hover {
  background: #d4a006;
}

.btn-success {
  padding: 0.55rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--color-success);
  border: none;
  border-radius: var(--radius-sm);
}

.btn-success:hover {
  background: var(--color-success-hover);
}

.btn-danger {
  padding: 0.55rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--color-danger);
  border: none;
  border-radius: var(--radius-sm);
}

.btn-danger:hover {
  background: var(--color-danger-hover);
}

.btn-secondary {
  padding: 0.55rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.btn-secondary:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
}

.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

/* ----- Tab Navigation ----- */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: sticky;
  top: 117px;
  z-index: 900;
  background: var(--bg-primary);
}

.tab-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-secondary);
}

.tab-btn.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ----- Stats Bar ----- */
.stats-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold);
}

.stat-number {
  display: block;
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.stat-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.2rem;
}

/* ----- Filters Row ----- */
.filters-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
  align-items: center;
}

.filters-row select {
  padding: 0.6rem 2.2rem 0.6rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font-family);
  color: var(--text-primary);
  background-color: var(--bg-card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23eab308' d='M6 8.825L1.175 4 2.238 2.938 6 6.7 9.763 2.937 10.825 4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  outline: none;
  transition: all var(--transition-normal);
  min-width: 130px;
  box-shadow: var(--shadow-sm);
}

.filters-row select:hover {
  border-color: rgba(234, 179, 8, 0.4);
  background-color: var(--bg-card-hover);
}

/* Specific-date picker on the dashboard filters row */
.filter-date-input {
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font-family);
  color: var(--text-primary);
  background-color: var(--bg-card);
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color-scheme: dark;
}

.filter-date-input:hover {
  border-color: rgba(234, 179, 8, 0.4);
  background-color: var(--bg-card-hover);
}

.filter-date-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-light), var(--shadow-sm);
  outline: none;
}

/* Labeled wrapper so the date filter is clearly identifiable */
.filter-date-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-date-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.filters-row select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-light), var(--shadow-sm);
}

/* ----- Dropdown Option Styling (native fallback) ----- */
select option {
  background: #1a1f2e;
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
}

select option:checked {
  background: linear-gradient(0deg, rgba(234, 179, 8, 0.2) 0%, rgba(234, 179, 8, 0.2) 100%);
  color: var(--gold);
}

/* ----- Custom Select Dropdown ----- */
.custom-select {
  position: relative;
  display: inline-block;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-select-trigger .cs-arrow {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  transition: transform var(--transition-fast);
}

.custom-select.open .cs-arrow {
  transform: rotate(180deg);
}

.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  max-height: 280px;
  overflow-y: auto;
  background: #1a1f2e;
  border: 1px solid rgba(234, 179, 8, 0.25);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.1);
  z-index: 5000;
  display: none;
  padding: 4px 0;
}

.custom-select.open .custom-select-dropdown {
  display: block;
  animation: csDropIn 0.15s ease;
}

@keyframes csDropIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.custom-select-option {
  padding: 0.45rem 0.85rem;
  font-size: inherit;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.custom-select-option:hover {
  background: rgba(234, 179, 8, 0.15);
  color: var(--gold);
}

.custom-select-option.selected {
  background: rgba(234, 179, 8, 0.2);
  color: var(--gold);
  font-weight: 600;
}

.custom-select-dropdown::-webkit-scrollbar {
  width: 5px;
}

.custom-select-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.custom-select-dropdown::-webkit-scrollbar-thumb {
  background: rgba(234, 179, 8, 0.2);
  border-radius: 3px;
}

/* Inherit styles from parent contexts */
.filters-row .custom-select { min-width: 130px; }
.filters-row .custom-select-trigger {
  padding: 0.6rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font-family);
  color: var(--text-primary);
  background-color: var(--bg-card);
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}
.filters-row .custom-select-trigger:hover {
  border-color: rgba(234, 179, 8, 0.4);
  background-color: var(--bg-card-hover);
}
.filters-row .custom-select.open .custom-select-trigger,
.filters-row .custom-select-trigger:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-light), var(--shadow-sm);
}

/* Table cell custom selects */
#ridesTable td .custom-select-trigger {
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: var(--font-family);
  color: var(--text-primary);
  background-color: var(--bg-input);
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
#ridesTable td .custom-select-trigger:hover {
  border-color: rgba(234, 179, 8, 0.4);
}
#ridesTable td .custom-select.open .custom-select-trigger {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-light);
}
#ridesTable td .custom-select-dropdown {
  min-width: 160px;
}

/* Card footer custom selects */
.ride-card-footer .custom-select {
  flex: 1;
  min-width: 0;
}
.ride-card-footer .custom-select-trigger {
  padding: 0.5rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: var(--font-family);
  color: var(--text-primary);
  background-color: var(--bg-input);
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}
.ride-card-footer .custom-select-trigger:hover {
  border-color: rgba(234, 179, 8, 0.4);
}
.ride-card-footer .custom-select.open .custom-select-trigger {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-light);
}


/* ----- Update All Changes (inside filters row) ----- */
.filters-row #changeCount {
  margin-left: auto;
}

.filters-row #btnUpdateAll {
  margin-left: auto;
  white-space: nowrap;
}

/* When changeCount is visible, btnUpdateAll should not also push left */
.filters-row #changeCount:not(.hidden) ~ #btnUpdateAll {
  margin-left: 0;
}

/* ----- Table ----- */
.table-container {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 400px);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  background: var(--bg-card);
}

#ridesTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  white-space: nowrap;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

#ridesTable thead {
  background: var(--bg-secondary);
}

#ridesTable th {
  padding: 0.7rem 0.8rem;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gold-hover);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-secondary);
}

#ridesTable td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

#ridesTable tbody tr:nth-child(even) {
  background: var(--bg-table-stripe);
}

#ridesTable td select {
  padding: 0.35rem 1.7rem 0.35rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: var(--font-family);
  color: var(--text-primary);
  background-color: var(--bg-input);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23eab308' d='M6 8.825L1.175 4 2.238 2.938 6 6.7 9.763 2.937 10.825 4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  outline: none;
  transition: all var(--transition-fast);
}

#ridesTable td select:hover {
  border-color: rgba(234, 179, 8, 0.4);
}

#ridesTable td select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-light);
}

#ridesTable td input {
  padding: 0.32rem 0.55rem;
  font-size: 0.78rem;
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid rgba(234, 179, 8, 0.12);
  border-radius: var(--radius-sm);
  outline: none;
  width: 80px;
  transition: all var(--transition-fast);
}

#ridesTable td input:hover {
  border-color: rgba(234, 179, 8, 0.3);
}

#ridesTable td input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-light);
}

#ridesTable td input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
  cursor: pointer;
}

/* ----- Status Row Colors (admin table) ----- */
#ridesTable tr.status-completed {
  background: rgba(34, 197, 94, 0.08);
}
#ridesTable tr.status-inprogress {
  background: rgba(59, 130, 246, 0.08);
}
#ridesTable tr.status-onmyway {
  background: rgba(234, 179, 8, 0.08);
}
#ridesTable tr.status-arrived {
  background: rgba(168, 85, 247, 0.08);
}
#ridesTable tr.status-confirmed {
  background: rgba(6, 182, 212, 0.08);
}

/* ----- Card select row (mobile admin) ----- */
.card-select-row {
  display: flex;
  gap: 12px;
}
.card-select-row .card-select-field {
  flex: 1;
}
.card-select-row .card-select-field label {
  display: block;
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
  letter-spacing: 0.04em;
}
.card-select-row .card-select-field select {
  width: 100%;
}

/* ----- Status Badges ----- */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 9999px;
  white-space: nowrap;
  line-height: 1.4;
}

.status-badge.unassigned {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid rgba(245, 158, 11, 0.15);
}

.status-badge.assigned {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid rgba(34, 197, 94, 0.15);
}

.status-badge.completed {
  background: var(--gold-light);
  color: var(--gold);
  border: 1px solid rgba(234, 179, 8, 0.15);
}

.status-badge.cancelled {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid rgba(239, 68, 68, 0.15);
}

.status-badge.in-progress {
  background: var(--color-info-bg);
  color: var(--color-info);
  border: 1px solid rgba(59, 130, 246, 0.15);
}

/* ----- Cards Container ----- */
.cards-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

/* ----- Ride Card (Admin mobile) ----- */
.ride-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  overflow: visible;
}

.ride-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.ride-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-heading);
}

.ride-card-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.ride-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.85rem;
  margin-bottom: 0.75rem;
}

.ride-card-field {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.ride-card-field .field-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ride-card-field .field-value {
  font-size: 0.85rem;
  color: var(--text-primary);
}

.ride-card-field.full-width {
  grid-column: 1 / -1;
}

/* Card footer */
.ride-card-footer {
  display: flex;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
  gap: 0.5rem;
}

.ride-card-footer select {
  padding: 0.5rem 2rem 0.5rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: var(--font-family);
  color: var(--text-primary);
  background-color: var(--bg-input);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23eab308' d='M6 8.825L1.175 4 2.238 2.938 6 6.7 9.763 2.937 10.825 4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  outline: none;
  flex: 1;
  min-width: 0;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.ride-card-footer select:hover {
  border-color: rgba(234, 179, 8, 0.4);
}

.ride-card-footer select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-light);
}

/* Card inline edit fields */
.card-edit-fields {
  padding-top: 0.65rem;
}

.card-field-row {
  display: flex;
  gap: 0.5rem;
}

.card-field-inline {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.card-field-inline label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-field-inline input {
  padding: 0.42rem 0.55rem;
  font-size: 0.8rem;
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid rgba(234, 179, 8, 0.12);
  border-radius: var(--radius-sm);
  outline: none;
  width: 100%;
  transition: all var(--transition-fast);
}

.card-field-inline input:hover {
  border-color: rgba(234, 179, 8, 0.3);
}

.card-field-inline input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-light);
}

/* ----- Search Section ----- */
/* ----- GHL Booking Iframe ----- */
.ghl-booking-wrapper {
  width: 100%;
  min-height: calc(100vh - 200px);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.ghl-booking-iframe {
  width: 100%;
  height: calc(100vh - 200px);
  min-height: 700px;
  border: none;
  border-radius: var(--radius-md);
  background: #fff;
}

.ghl-booking-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(12, 15, 20, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  z-index: 10;
}

.ghl-overlay-content {
  text-align: center;
  color: #fff;
  padding: 2rem;
}

.ghl-overlay-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  font-size: 2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.ghl-overlay-content h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.ghl-overlay-content p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.ghl-booking-actions {
  text-align: center;
  padding: 1rem 0;
}

.search-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  margin-bottom: 1.25rem;
}

.search-section h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-heading);
}

.search-form {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.search-form .form-group {
  flex: 1;
  min-width: 150px;
  margin-bottom: 0;
}

.search-form .btn-primary {
  align-self: flex-end;
  margin-bottom: 0;
  white-space: nowrap;
}

/* ----- Search Results ----- */
#searchResults {
  margin-bottom: 1.25rem;
}

#searchResults h3 {
  font-size: 1rem;
  margin-bottom: 0.85rem;
  color: var(--text-heading);
}

.search-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  cursor: pointer;
  position: relative;
}

.search-result-card::after {
  content: 'Click to edit';
  position: absolute;
  bottom: 0.6rem;
  right: 0.85rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.search-result-card .ride-card-header {
  margin-bottom: 0.5rem;
}

/* ----- Edit Form Section ----- */
#editFormSection {
  margin-bottom: 1.25rem;
}

#editFormSection h3 {
  font-size: 1rem;
  margin-bottom: 0.65rem;
  color: var(--text-heading);
}

.ride-info-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  background: var(--gold-light);
  border: 1px solid rgba(234, 179, 8, 0.15);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--gold);
  font-weight: 500;
  margin-bottom: 1rem;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.edit-form {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.35rem;
}

/* ----- Driver View ----- */
.driver-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.15rem;
}

.driver-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

/* ----- Driver Ride Card ----- */
.driver-ride-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
}

.driver-ride-card .ride-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.driver-ride-card .ride-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.85rem;
  margin-bottom: 0.85rem;
}

.driver-ride-card .ride-card-body .ride-card-field {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.driver-ride-card .ride-card-body .ride-card-field .field-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.driver-ride-card .ride-card-body .ride-card-field .field-value {
  font-size: 0.85rem;
  color: var(--text-primary);
}

.driver-action-area {
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.driver-confirm-area {
  display: flex;
  gap: 0.75rem;
}

.btn-confirm {
  flex: 1;
  padding: 0.75rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-family);
  color: #fff;
  background: var(--color-success);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-confirm:hover {
  background: var(--color-success-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-reject {
  padding: 0.75rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-family);
  color: var(--color-danger);
  background: transparent;
  border: 1.5px solid var(--color-danger);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-reject:hover {
  background: var(--color-danger-bg);
  transform: translateY(-1px);
}

/* ----- Driver Modal ----- */
.driver-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.driver-modal-overlay.hidden {
  display: none;
}

.driver-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.driver-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.driver-modal-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-heading);
}

.driver-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color var(--transition-fast);
}

.driver-modal-close:hover {
  color: var(--text-primary);
}

.driver-modal-body {
  padding: 1.25rem;
}

.driver-modal-body p {
  margin: 0 0 1rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.5;
}

.driver-modal-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.driver-modal-input-wrap.hidden {
  display: none;
}

.driver-modal-input-wrap label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.driver-modal-input-wrap textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  font-size: 0.88rem;
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  resize: vertical;
  min-height: 70px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.driver-modal-input-wrap textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-light);
}

.driver-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
}

.btn-modal-cancel {
  padding: 0.6rem 1.2rem;
  font-size: 0.88rem;
  font-weight: 500;
  font-family: var(--font-family);
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-modal-cancel:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.btn-modal-confirm {
  padding: 0.6rem 1.2rem;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font-family);
  color: #fff;
  background: var(--gold);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-modal-confirm:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-modal-success {
  background: var(--color-success);
}

.btn-modal-success:hover {
  background: var(--color-success-hover);
}

.btn-modal-danger {
  background: var(--color-danger);
}

.btn-modal-danger:hover {
  background: #dc2626;
}

/* ----- Rejected Tag (admin dashboard) ----- */
.rejected-tag {
  display: inline-block;
  margin-top: 0.3rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-danger);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
}

.status-badge.rejected {
  background: rgba(239, 68, 68, 0.12);
  color: var(--color-danger);
  border-color: rgba(239, 68, 68, 0.3);
}

tr.status-rejected {
  border-left: 3px solid var(--color-danger);
}

.stat-card-rejected .stat-number {
  color: var(--color-danger);
}

.stat-card-rejected {
  border-color: rgba(239, 68, 68, 0.25);
}

.rejected-reason {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--color-danger);
  font-style: italic;
  opacity: 0.85;
}

.rejected-reason-card {
  padding: 0.5rem 0.85rem;
  margin: -0.25rem 0 0.25rem;
  font-size: 0.78rem;
  color: var(--color-danger);
  font-style: italic;
  background: rgba(239, 68, 68, 0.08);
  border-left: 2px solid var(--color-danger);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ----- Driver Tab Nav ----- */
.driver-tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}

.driver-tab-btn {
  padding: 0.75rem 1.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font-family);
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
}

.driver-tab-btn:hover {
  color: var(--text-primary);
}

.driver-tab-btn.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.driver-tab-content {
  display: none;
}

.driver-tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* ----- Availability Grid ----- */
.avail-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.avail-day-row {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  transition: border-color var(--transition-fast);
}

.avail-day-row:hover {
  border-color: rgba(234, 179, 8, 0.2);
}

.avail-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.avail-day-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-heading);
}

/* Toggle Switch */
.avail-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.avail-toggle input {
  display: none;
}

.avail-toggle-slider {
  width: 40px;
  height: 22px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 11px;
  position: relative;
  transition: background 0.25s;
}

.avail-toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s;
}

.avail-toggle input:checked + .avail-toggle-slider {
  background: var(--color-success);
}

.avail-toggle input:checked + .avail-toggle-slider::after {
  transform: translateX(18px);
}

.avail-toggle-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 55px;
}

.avail-toggle input:checked ~ .avail-toggle-label {
  color: var(--color-success);
}

/* Slot Container */
.avail-slots-container {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-color);
}

.avail-slots-container.hidden {
  display: none;
}

.avail-slot-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.avail-slot-row select {
  flex: 1;
  padding: 0.5rem 2rem 0.5rem 0.7rem;
  font-size: 0.84rem;
  font-family: var(--font-family);
  color: var(--text-primary);
  background-color: var(--bg-input);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23eab308' d='M6 8.825L1.175 4 2.238 2.938 6 6.7 9.763 2.937 10.825 4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-radius: var(--radius-sm);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  outline: none;
  cursor: pointer;
}

.avail-slot-row select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-light);
}

.avail-remove-slot-btn {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-danger);
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.avail-remove-slot-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: var(--color-danger);
}

.avail-add-slot-btn {
  display: block;
  width: 100%;
  padding: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
  background: transparent;
  border: 1px dashed rgba(234, 179, 8, 0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.avail-add-slot-btn:hover {
  background: var(--gold-light);
  border-color: var(--gold);
}

.avail-time-sep {
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Week Navigation */
.avail-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.avail-nav-btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
  background: var(--gold-light);
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.avail-nav-btn:hover {
  background: rgba(234, 179, 8, 0.2);
  border-color: var(--gold);
}

.avail-week-header {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gold);
}

.avail-day-row.avail-today {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.15);
}

.avail-today-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--bg-dark);
  background: var(--gold);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  margin-left: 0.4rem;
  vertical-align: middle;
}

.avail-save-btn {
  margin-top: 1rem;
  width: 100%;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
}

.driver-action-area .action-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.driver-action-area select {
  flex: 1;
  padding: 0.55rem 2.2rem 0.55rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font-family);
  color: var(--text-primary);
  background-color: var(--bg-input);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23eab308' d='M6 8.825L1.175 4 2.238 2.938 6 6.7 9.763 2.937 10.825 4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  outline: none;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.driver-action-area select:hover {
  border-color: rgba(234, 179, 8, 0.4);
}

.driver-action-area select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-light);
}

.driver-action-area textarea {
  width: 100%;
  padding: 0.5rem 0.7rem;
  font-size: 0.84rem;
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  resize: vertical;
  min-height: 50px;
  transition: border-color var(--transition-fast);
}

.driver-action-area textarea::placeholder {
  color: var(--text-muted);
}

.driver-action-area textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-light);
}

.driver-action-area .btn-primary {
  white-space: nowrap;
}

/* ----- No Data Message ----- */
.no-data {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.no-data-icon {
  font-size: 2.5rem;
  margin-bottom: 0.65rem;
  display: block;
  opacity: 0.5;
}

.no-data-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.no-data-sub {
  font-size: 0.82rem;
  margin-top: 0.3rem;
}

/* ----- Fare & Payment ----- */
.fare-cell {
  font-weight: 700;
  color: var(--gold) !important;
}

.paid-cell {
  font-weight: 600;
  color: var(--color-success);
}

/* ----- Scrollbar ----- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(234, 179, 8, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(234, 179, 8, 0.3);
}

/* ----- Manage Drivers ----- */
.drivers-list-section {
  margin-top: 1.25rem;
}

.drivers-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.drivers-list-header h3 {
  font-size: 1rem;
  color: var(--text-heading);
  margin: 0;
}

.driver-manage-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
  transition: border-color var(--transition-fast);
}

.driver-manage-card:hover {
  border-color: rgba(234, 179, 8, 0.2);
}

.driver-manage-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.driver-manage-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-heading);
}

.driver-manage-username {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.driver-manage-card-actions {
  display: flex;
  gap: 0.5rem;
}

/* ===================================================
   Responsive Design
   =================================================== */

@media (min-width: 769px) {
  .table-container {
    display: block;
  }

  #ridesCards {
    display: none;
  }

  .cards-container {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  }

  .stat-card {
    padding: 1.15rem 1.35rem;
  }

  .stat-number {
    font-size: 2.15rem;
  }
}

@media (min-width: 1200px) {
  .view {
    padding: 1.5rem 2rem;
  }

  .cards-container {
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  }
}

/* Tablet & Mobile */
@media (max-width: 768px) {
  html {
    font-size: 15px;
    overflow-x: hidden;
  }

  body {
    overflow-x: hidden;
  }

  .table-container {
    display: block;
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 350px);
  }

  #ridesCards {
    display: none;
  }

  .view {
    padding: 0.85rem 0.75rem;
    /* overflow-x: hidden; */
  }

  /* Prevent selects from overflowing on mobile */
  select {
    max-width: 100%;
    text-overflow: ellipsis;
  }

  header {
    position: relative;
    top: auto;
    backdrop-filter: none;
  }

  .header-content {
    padding: 0.45rem 0.75rem;
  }

  .header-logo {
    width: 45px;
    height: 45px;
  }

  .header-brand {
    gap: 0.5rem;
  }

  .brand-name {
    font-size: 0.8rem;
    letter-spacing: 0;
  }

  #userName {
    display: none;
  }

  .stats-bar {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 0.35rem;
  }

  .stat-card {
    padding: 0.45rem 0.3rem;
    overflow: visible;
  }

  .stat-number {
    font-size: 1.15rem;
    line-height: 1.3;
  }

  .stat-label {
    font-size: 0.55rem;
    letter-spacing: 0.04em;
  }

  .filters-row {
    flex-direction: column;
    gap: 0.45rem;
  }

  .filters-row select {
    width: 100%;
    min-width: unset;
    padding: 0.6rem 2rem 0.6rem 0.85rem;
  }

  .filters-row .custom-select {
    width: 100%;
    min-width: unset;
  }

  .filters-row .custom-select-trigger {
    width: 100%;
    padding: 0.6rem 0.85rem;
  }

  .custom-select-dropdown {
    max-width: calc(100vw - 1.5rem);
  }

  .filters-row .btn-secondary {
    width: 100%;
    padding: 0.6rem 1.25rem;
  }

  .filters-row #btnUpdateAll {
    width: 100%;
    margin-left: 0;
    order: 10;
  }

  .filters-row #changeCount {
    text-align: center;
    margin-left: 0;
    width: 100%;
    order: 9;
  }

  /* Date filter: stacked label + full-width input on mobile (clear on iPhone) */
  .filter-date-wrap {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
  }

  .filter-date-wrap .filter-date-input {
    width: 100%;
    min-height: 44px;
  }

  /* Keep the notification button full width & prominent on mobile */
  .filters-row #btnSendNotifs {
    width: 100%;
  }

  .tab-nav {
    position: relative;
    top: auto;
    z-index: auto;
    margin-bottom: 0.75rem;
  }

  .tab-btn {
    flex: 0 0 auto;
    text-align: center;
    padding: 0.55rem 0.85rem;
    font-size: 0.78rem;
  }

  .form-row {
    flex-direction: column;
    gap: 0.15rem;
  }

  .search-section {
    padding: 1.1rem;
    border-radius: var(--radius-md);
  }

  .search-section h3 {
    font-size: 0.95rem;
    margin-bottom: 0.85rem;
  }

  .search-form {
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
  }

  .search-form .form-group {
    min-width: unset;
    margin-bottom: 0.75rem;
  }

  .search-form .form-group input {
    padding: 0.65rem 0.85rem;
  }

  .search-form .btn-primary {
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.7rem 1.25rem;
    font-size: 0.9rem;
  }

  .edit-form {
    padding: 1.15rem;
  }

  .edit-form .form-group input,
  .edit-form .form-group textarea {
    padding: 0.65rem 0.85rem;
  }

  #editFormSection h3 {
    font-size: 0.95rem;
  }

  .ride-info-badge {
    font-size: 0.72rem;
    padding: 0.4rem 0.75rem;
  }

  .btn-row {
    flex-direction: column;
    gap: 0.55rem;
    margin-top: 1.25rem;
  }

  .btn-row button {
    width: 100%;
    padding: 0.65rem 1.25rem;
    font-size: 0.88rem;
  }

  .login-logo {
    width: 96px;
    height: 96px;
  }

  .login-card {
    padding: 1.5rem 1.15rem 1.35rem;
  }

  .login-card h2 {
    font-size: 0.85rem;
  }

  .driver-header {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .driver-header h2 {
    font-size: 1.1rem;
  }

  .driver-action-area .action-row {
    flex-direction: column;
  }

  .driver-action-area .action-row .btn-primary {
    width: 100%;
  }

  .driver-tab-btn {
    flex: 1;
    text-align: center;
    padding: 0.6rem 0.35rem;
    font-size: 0.75rem;
  }

  .avail-slot-row {
    flex-wrap: wrap;
  }

  .avail-slot-row select {
    min-width: 0;
  }

  .avail-nav {
    gap: 0.3rem;
  }

  .avail-nav-btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.72rem;
  }

  .avail-week-header {
    font-size: 0.78rem;
    text-align: center;
  }

  .cards-container {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .ride-card {
    padding: 0.85rem;
  }

  .driver-ride-card {
    padding: 0.85rem;
  }

  .card-field-row {
    flex-direction: column;
    gap: 0.4rem;
  }

  .driver-manage-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .driver-manage-card-actions {
    width: 100%;
  }

  .driver-manage-card-actions button {
    flex: 1;
  }

}

@media (max-width: 400px) {
  html {
    font-size: 14px;
  }

  .stats-bar {
    flex-direction: column;
  }

  .stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    padding: 0.65rem 0.85rem;
  }

  .stat-number {
    font-size: 1.3rem;
    order: 2;
  }

  .stat-label {
    order: 1;
    margin-top: 0;
    font-size: 0.7rem;
  }

  .ride-card-body {
    grid-template-columns: 1fr;
  }

  .driver-ride-card .ride-card-body {
    grid-template-columns: 1fr;
  }

  .header-logo {
    width: 42px;
    height: 42px;
  }

  .brand-name {
    font-size: 0.65rem;
  }

  .ride-card-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .login-logo {
    width: 84px;
    height: 84px;
  }
}

/* ===================================================
   Earnings Tab
   =================================================== */

.custom-date-range {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.custom-date-range input[type="date"] {
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  font-family: var(--font-family);
  color: var(--text-primary);
  background-color: var(--bg-card);
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.custom-date-range input[type="date"]:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-light), var(--shadow-sm);
  outline: none;
}

.date-range-sep {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.earnings-total-card {
  border-color: var(--gold) !important;
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(234, 179, 8, 0.08) 100%) !important;
}

.earnings-total-card .stat-number {
  color: var(--gold) !important;
}

.payout-cell {
  color: var(--gold);
}

.earnings-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
  margin: 1.5rem 0 0.75rem;
}

.earnings-not-completed {
  opacity: 0.45;
}

.earnings-not-completed-card {
  opacity: 0.45;
  border-style: dashed !important;
}

.earnings-status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.earnings-status-badge.completed {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.earnings-status-badge.pending {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.earnings-grand-total {
  border-top: 2px solid var(--gold);
  background: rgba(234, 179, 8, 0.05);
}

.earnings-grand-total td {
  color: var(--text-heading) !important;
}

#earningsDriverTable,
#earningsDetailTable,
#driverEarningsDetailTable {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

#earningsDriverTable th,
#earningsDetailTable th,
#driverEarningsDetailTable th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}

#earningsDriverTable td,
#earningsDetailTable td,
#driverEarningsDetailTable td {
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

#earningsDriverTable tbody tr:hover,
#earningsDetailTable tbody tr:hover,
#driverEarningsDetailTable tbody tr:hover {
  background: var(--bg-card-hover);
}

#driverEarningsDetailSection {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

#earningsCards,
#driverEarningsCards {
  display: none;
}

.earnings-payout-value {
  color: var(--gold);
  font-weight: 700;
}

@media (max-width: 768px) {
  .earnings-filters {
    flex-direction: column;
    gap: 0.45rem;
  }

  .earnings-filters select,
  .earnings-filters .btn-primary,
  .earnings-filters .btn-secondary {
    width: 100%;
  }

  .custom-date-range {
    flex-direction: column;
    width: 100%;
  }

  .custom-date-range input[type="date"] {
    width: 100%;
  }

  #earningsDriverSummary,
  #earningsDetailSection {
    display: none;
  }

  #earningsCards {
    display: grid !important;
  }

  #driverEarningsDetailSection {
    display: none;
  }

  #driverEarningsCards {
    display: grid !important;
  }
}

/* ===================================================
   Calendar View
   =================================================== */

#calendarTab { padding: 0 1rem 2rem; }

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.cal-month-label {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-heading);
  text-align: center;
  flex: 1;
  margin: 0;
}

.cal-nav-btn {
  min-width: 90px;
}

/* ----- Calendar view toggle (Month / Agenda) ----- */
.cal-view-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.cal-toggle-btn {
  padding: 0.5rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-family);
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.cal-toggle-btn:hover {
  border-color: rgba(234, 179, 8, 0.4);
}

.cal-toggle-btn.active {
  color: #0c0f14;
  background: var(--gold);
  border-color: var(--gold);
}

/* ----- Calendar Agenda (list) view ----- */
.cal-agenda {
  margin-bottom: 1.25rem;
}

.agenda-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.agenda-day {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 0.9rem;
  overflow: hidden;
}

.agenda-day.agenda-today {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
}

.agenda-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  background: rgba(234, 179, 8, 0.08);
  border-bottom: 1px solid var(--border-color);
}

.agenda-day-date {
  font-weight: 700;
  color: var(--text-heading);
  font-size: 0.95rem;
}

.agenda-day-count {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.agenda-ride {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.agenda-ride:last-child {
  border-bottom: none;
}

.agenda-ride-time {
  flex: 0 0 80px;
  font-weight: 700;
  color: var(--gold);
  font-size: 0.85rem;
  padding-top: 0.1rem;
}

.agenda-ride-main {
  flex: 1;
  min-width: 0;
}

.agenda-ride-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.agenda-pax {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.agenda-ride-route {
  color: var(--text-secondary);
  font-size: 0.83rem;
  margin-top: 0.15rem;
  word-break: break-word;
}

.agenda-arrow {
  color: var(--gold);
  font-weight: 700;
}

/* Schedule view: inline "City to City - pax" after the name */
.agenda-route-inline {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Cancelled bookings on the Schedule: struck through with a red pill */
.agenda-ride-cancelled .agenda-ride-name,
.agenda-ride-cancelled .agenda-ride-time,
.agenda-ride-cancelled .agenda-route-inline {
  text-decoration: line-through;
  opacity: 0.55;
}

.agenda-cancel-pill {
  flex: 0 0 auto;
  align-self: center;
  font-size: 0.74rem;
  font-weight: 700;
  color: #f87171;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.4);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* Cancelled rows in the month-view day detail */
.cal-detail-cancelled td,
.ride-card.cal-detail-cancelled .ride-card-title,
.ride-card.cal-detail-cancelled .ride-card-subtitle {
  text-decoration: line-through;
  opacity: 0.6;
}

.status-badge.cancelled {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
  text-decoration: none;
}

/* Flash highlight when jumping to a day from the mini picker */
.agenda-day-flash {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 8px;
  transition: outline-color 0.4s ease;
}

/* Mini month day-picker (Schedule view) */
.cal-mini-picker {
  margin: 0 0 0.9rem 0;
}

.cal-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(30px, 44px));
  gap: 3px;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem;
}

.cal-mini-head {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 2px 0;
}

.cal-mini-cell {
  text-align: center;
  font-size: 0.8rem;
  padding: 4px 0;
  border-radius: 6px;
  color: var(--text-muted);
}

.cal-mini-cell.cal-mini-has {
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  font-weight: 600;
  cursor: pointer;
}

.cal-mini-cell.cal-mini-has:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.cal-mini-cell.cal-mini-today {
  box-shadow: inset 0 0 0 1.5px var(--gold);
  color: var(--gold);
}

.agenda-ride-driver {
  flex: 0 0 auto;
  align-self: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

.cal-grid-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-header-cell {
  padding: 0.65rem 0.5rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.cal-cell {
  position: relative;
  min-height: 70px;
  padding: 0.45rem;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
}

.cal-cell:hover {
  background: var(--bg-card-hover);
  border-color: rgba(234, 179, 8, 0.15);
}

.cal-cell.cal-empty {
  background: var(--bg-primary);
  cursor: default;
  border-color: transparent;
}

.cal-cell.cal-empty:hover {
  background: var(--bg-primary);
}

.cal-cell.cal-today {
  background: var(--gold-light);
  border-color: var(--gold);
}

.cal-cell.cal-today .cal-day-num {
  color: var(--gold);
  font-weight: 800;
}

.cal-cell.cal-selected {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold);
  background: var(--gold-glow);
}

.cal-day-num {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}

.cal-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 9999px;
  background: var(--color-info-bg);
  color: var(--color-info);
}

.cal-badge-busy {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.cal-badge-hot {
  background: var(--gold-light);
  color: var(--gold);
}

.cal-cell.cal-has-rides {
  background: rgba(59, 130, 246, 0.03);
}

.cal-cell.cal-today.cal-has-rides {
  background: var(--gold-light);
}

/* Day Detail Panel */
.cal-day-detail {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem 2rem 2rem;
  margin: 1.25rem 1rem 2rem;
  animation: fadeIn 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.cal-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.cal-detail-header h3 {
  font-size: 1.2rem;
  color: var(--text-heading);
  margin: 0;
  font-weight: 700;
}

.cal-detail-count {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gold);
  background: var(--gold-light);
  padding: 0.3rem 0.85rem;
  border-radius: 9999px;
}

.cal-detail-close {
  margin-left: auto;
}

.cal-detail-table { margin-bottom: 0; border: 1px solid var(--border-color); border-radius: var(--radius-sm); overflow: hidden; }
.cal-detail-table table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.cal-detail-table thead { background: var(--bg-secondary); }
.cal-detail-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold-hover);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-color);
}
.cal-detail-table td {
  padding: 0.65rem 1rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.cal-detail-table td:nth-child(4),
.cal-detail-table td:nth-child(5) {
  white-space: normal;
  max-width: 220px;
}
.cal-detail-table tr:last-child td { border-bottom: none; }
.cal-detail-table tr:nth-child(even) { background: var(--bg-table-stripe); }
.cal-detail-table tr:hover { background: var(--bg-card-hover); }

.cal-detail-cards { display: none; }

.cal-stats { margin-bottom: 1rem; }

@media (max-width: 768px) {
  .cal-nav { gap: 0.5rem; }
  .cal-month-label { font-size: 1rem; }
  .cal-nav-btn { min-width: 70px; padding: 0.5rem 0.75rem; font-size: 0.8rem; }
  .cal-header-cell { padding: 0.45rem 0.15rem; font-size: 0.6rem; }
  .cal-cell { min-height: 50px; padding: 0.3rem; }
  .cal-day-num { font-size: 0.75rem; }
  .cal-badge { font-size: 0.6rem; min-width: 18px; height: 16px; }
  .cal-detail-table { display: none !important; }
  .cal-detail-cards { display: grid !important; grid-template-columns: 1fr; gap: 0.75rem; }
  .cal-day-detail { padding: 1rem 1rem 1.5rem; margin: 1rem 0.25rem 1.5rem; }
  .cal-detail-header h3 { font-size: 1rem; }
}

@media (max-width: 400px) {
  .cal-cell { min-height: 42px; padding: 0.2rem; }
  .cal-day-num { font-size: 0.68rem; }
  .cal-badge { font-size: 0.55rem; min-width: 16px; height: 14px; }
  .cal-stats { flex-direction: column; }
}

/* ----- Print ----- */
/* ----- Company Stats tab ----- */
.cs-range-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.cs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.cs-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
}

.cs-panel h3 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: var(--text-heading);
}

.cs-list-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}
.cs-list-row:last-child { border-bottom: none; }

.cs-rank {
  flex: 0 0 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 50%;
  background: rgba(234, 179, 8, 0.15);
  color: var(--gold);
  font-weight: 700;
  font-size: 0.78rem;
}

.cs-name {
  flex: 1;
  min-width: 0;
  color: var(--text-primary);
  font-size: 0.88rem;
  word-break: break-word;
}

.cs-value {
  flex: 0 0 auto;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.85rem;
  white-space: nowrap;
}

.cs-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.6rem 0;
}

@media (max-width: 768px) {
  .cs-grid { grid-template-columns: 1fr; }
}

/* Company Stats print/PDF colors (dark theme -> printable) */
@media print {
  #companyStatsTab .stat-card,
  #companyStatsTab .cs-panel {
    background: #ffffff !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
  }
  #companyStatsTab .stat-number,
  #companyStatsTab .stat-label,
  #companyStatsTab .cs-panel h3,
  #companyStatsTab .cs-name,
  #companyStatsTab .cs-value,
  #companyStatsTab .cs-range-label {
    color: #000000 !important;
  }
  #companyStatsTab .cs-rank {
    background: #eeeeee !important;
    color: #000000 !important;
  }
}

@media print {
  body {
    background: #ffffff;
    color: #000000;
  }

  header,
  .tab-nav,
  .filters-row,
  .btn-row,
  .driver-action-area,
  .card-edit-fields,
  #btnLogout,
  .toast,
  .loading-overlay {
    display: none !important;
  }

  .table-container {
    display: block !important;
    border: 1px solid #ccc;
  }

  #ridesTable th,
  #ridesTable td {
    color: #000;
    border-color: #ccc;
  }

  #ridesTable thead {
    background: #f0f0f0;
  }

  #ridesCards {
    display: none !important;
  }
}

/* ─── Admin Driver Availability Overview ─── */

.admin-avail-week-label {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.admin-avail-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.admin-avail-nav span {
  font-weight: 600;
  color: var(--gold);
}

/* Desktop table */
.admin-avail-desktop { display: block; }
.admin-avail-mobile { display: none; }

.admin-avail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.admin-avail-table th,
.admin-avail-table td {
  padding: 0.6rem 0.5rem;
  text-align: center;
  border: 1px solid var(--border-subtle);
}

.admin-avail-table th {
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admin-avail-driver-col {
  text-align: left !important;
  min-width: 130px;
}

.admin-avail-driver-name {
  text-align: left !important;
  font-weight: 600;
  color: var(--text-primary);
}

.admin-avail-cell-on {
  background: rgba(34, 197, 94, 0.12);
  color: var(--color-success);
  font-weight: 600;
  font-size: 0.78rem;
}

.admin-avail-cell-off {
  background: rgba(239, 68, 68, 0.08);
  color: var(--text-muted);
  font-style: italic;
}

.admin-avail-cell-none {
  color: var(--text-muted);
  opacity: 0.4;
}

.admin-avail-today {
  border-left: 2px solid var(--gold) !important;
  border-right: 2px solid var(--gold) !important;
}

th.admin-avail-today {
  color: var(--gold);
  border-top: 2px solid var(--gold) !important;
}

.admin-avail-today-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--gold);
  border-radius: 50%;
  margin-left: 4px;
  vertical-align: middle;
}

/* Mobile cards */
.admin-avail-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
}

.admin-avail-card-name {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.admin-avail-card-days {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.admin-avail-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
}

.admin-avail-badge-on {
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-success);
}

.admin-avail-badge-off {
  background: rgba(239, 68, 68, 0.1);
  color: var(--text-muted);
}

.admin-avail-badge-none {
  background: var(--bg-secondary);
  color: var(--text-muted);
  opacity: 0.5;
}

.admin-avail-badge-today {
  border: 1.5px solid var(--gold);
}

@media (max-width: 768px) {
  .admin-avail-desktop { display: none; }
  .admin-avail-mobile { display: block; }
}
