/*
  THD Ops Hub Bootstrap theme
  Bootstrap provides the structure and components.
  This file supplies the app palette, typography, and a small set of
  app-specific wrappers based on the original Estes prototype.
*/

/* Theme tokens */
:root {
  --ops-red: #cc0000;
  --ops-red-dark: #8b0000;
  --ops-gold: #f5a800;
  --ops-gold-soft: #fff3d6;
  --ops-ink: #1a1a1a;
  --ops-muted: #6c757d;
  --ops-border: #dfdfdf;
  --ops-surface: rgba(255, 255, 255, 0.96);
  --ops-bg-top: #ececec;
  --ops-bg-bottom: #dddddd;
  --ops-shadow: 0 20px 60px rgba(0, 0, 0, 0.16);
  --ops-shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.12);
  --ops-radius: 1.15rem;
  --ops-radius-sm: 0.9rem;

  /* Bootstrap theme overrides */
  --bs-primary: var(--ops-red);
  --bs-primary-rgb: 204, 0, 0;
  --bs-secondary: var(--ops-ink);
  --bs-secondary-rgb: 26, 26, 26;
  --bs-warning: var(--ops-gold);
  --bs-warning-rgb: 245, 168, 0;
  --bs-danger: var(--ops-red);
  --bs-danger-rgb: 204, 0, 0;
  --bs-dark: var(--ops-ink);
  --bs-dark-rgb: 26, 26, 26;
  --bs-body-color: var(--ops-ink);
  --bs-body-color-rgb: 26, 26, 26;
  --bs-body-bg: #e6e6e6;
  --bs-body-bg-rgb: 230, 230, 230;
  --bs-border-color: var(--ops-border);
  --bs-link-color: var(--ops-red);
  --bs-link-hover-color: var(--ops-red-dark);
  --bs-card-border-radius: var(--ops-radius);
  --bs-card-border-color: rgba(0, 0, 0, 0.08);
  --bs-card-cap-bg: rgba(255, 255, 255, 0.72);
  --bs-btn-border-radius: 0.85rem;
  --bs-btn-font-weight: 700;
  --bs-btn-padding-y: 0.7rem;
  --bs-btn-padding-x: 1rem;
  --bs-form-control-border-radius: 0.85rem;
  --bs-form-select-border-radius: 0.85rem;
  --bs-form-control-bg: #ffffff;
  --bs-form-control-disabled-bg: #f8f9fa;
  --bs-form-select-bg: #ffffff;
  --bs-modal-border-radius: 1rem;
  --bs-modal-header-border-color: rgba(0, 0, 0, 0.08);
  --bs-modal-footer-border-color: rgba(0, 0, 0, 0.08);
  --bs-focus-ring-color: rgba(204, 0, 0, 0.16);
}

html,
body {
  min-height: 100%;
}

body {
  font-family: "Barlow", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(245, 168, 0, 0.08), transparent 28%),
    linear-gradient(180deg, var(--ops-bg-top) 0%, var(--ops-bg-bottom) 100%);
}

h1,
h2,
h3,
h4,
h5,
h6,
.font-condensed {
  font-family: "Barlow Condensed", sans-serif;
}

/* Bootstrap polish */
.btn {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-primary {
  background: linear-gradient(90deg, var(--ops-red-dark), var(--ops-red));
  border-color: var(--ops-red-dark);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background: linear-gradient(90deg, #760000, #b40000);
  border-color: #760000;
}

.btn-outline-light:hover,
.btn-outline-light:focus {
  color: var(--ops-ink);
}

.form-control,
.form-select {
  min-height: 48px;
  background-color: #fff;
}

.form-control[readonly],
.form-control:disabled,
.form-select:disabled {
  background-color: #f8f9fa;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: rgba(204, 0, 0, 0.4);
  box-shadow: 0 0 0 0.25rem rgba(204, 0, 0, 0.12);
}

.table {
  --bs-table-bg: transparent;
}

.table thead th {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--ops-muted);
}

.modal-content {
  border: 0;
  box-shadow: var(--ops-shadow);
}

.modal {
  z-index: 2000;
}

.modal-backdrop {
  z-index: 1990;
}

.badge {
  letter-spacing: 0.02em;
}

/* App shell */
.ops-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.ops-topbar {
  background: linear-gradient(90deg, var(--ops-red-dark), var(--ops-red));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  position: sticky;
  top: 0;
  z-index: 1030;
}

.ops-brand {
  color: #fff;
  text-decoration: none;
}

.ops-brand:hover {
  color: #fff;
}

.ops-brand-mark {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--ops-gold);
  color: var(--ops-ink);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.ops-brand-title {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ops-brand-subtitle {
  display: block;
  font-size: 0.72rem;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.7);
}

.ops-topbar-tools {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ops-topbar-actions {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ops-scorecard-upload {
  width: min(100%, 980px);
  margin-right: auto;
  padding: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(18, 18, 18, 0.18);
  backdrop-filter: blur(8px);
}

.ops-scorecard-upload-form {
  display: grid;
  grid-template-columns: minmax(260px, 1.7fr) 120px 120px 160px;
  gap: 0.75rem;
  align-items: end;
}

.ops-scorecard-upload-field .form-label {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ops-scorecard-upload .form-control,
.ops-scorecard-upload .form-select {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(255, 255, 255, 0.25);
}

.ops-scorecard-upload .form-control:focus,
.ops-scorecard-upload .form-select:focus {
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.18);
}

.scorecard-upload-status {
  font-size: 0.88rem;
  padding: 0.55rem 0.75rem;
}

.ops-page {
  flex: 1;
  padding: 2rem 0 3rem;
}

.ops-shell-body {
  flex: 1;
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  min-height: 0;
}

.ops-sidebar {
  background: linear-gradient(180deg, #111, #1b1b1b);
  color: #fff;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ops-sidebar-top {
  padding: 0.4rem 0.4rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ops-sidebar-kicker,
.ops-nav-group-label,
.ops-current-view-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ops-sidebar-kicker,
.ops-nav-group-label {
  color: rgba(255, 255, 255, 0.45);
}

.ops-sidebar-title {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  margin-top: 0.35rem;
}

.ops-sidebar-copy {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.88rem;
  margin-top: 0.55rem;
}

.ops-sidebar-my-markets {
  margin-left: 0.4rem;
  margin-right: 0.4rem;
}

.ops-sidebar-my-markets h5 {
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
}

.ops-sidebar-my-markets .small {
  color: rgba(255, 255, 255, 0.62);
}

.ops-sidebar-form {
  display: grid;
  gap: 0.9rem;
}

.ops-sidebar-form .ops-form-label {
  color: rgba(255, 255, 255, 0.72);
}

.ops-nav {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.ops-nav-group + .ops-nav-group {
  margin-top: 0.85rem;
}

.ops-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: rgba(255, 255, 255, 0.66);
  text-decoration: none;
  padding: 0.72rem 0.85rem;
  border-radius: 0.9rem;
  border-left: 3px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ops-nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.ops-nav-link.is-active {
  color: #fff;
  background: rgba(204, 0, 0, 0.28);
  border-left-color: var(--ops-gold);
}

.ops-nav-link-icon {
  width: 1.25rem;
  text-align: center;
  color: var(--ops-gold);
}

.ops-nav-link-label {
  font-size: 0.94rem;
  font-weight: 600;
}

.ops-sidebar-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ops-sidebar-summary .ops-chip {
  background: rgba(245, 168, 0, 0.14);
  border-color: rgba(245, 168, 0, 0.28);
  color: #fff;
}

.ops-page-shell {
  min-width: 0;
}

.ops-current-view {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  background: linear-gradient(180deg, rgba(255, 243, 214, 0.86), rgba(255, 255, 255, 0.92));
  border: 1px solid rgba(245, 168, 0, 0.3);
}

.ops-current-view-icon {
  width: 3rem;
  height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ops-red-dark), var(--ops-red));
  color: #fff;
  font-size: 1.25rem;
}

.ops-current-view-name {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
}

.ops-sidebar-toggle {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 1045;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  box-shadow: 0 0.75rem 1.5rem rgba(17, 17, 17, 0.28);
  display: none;
  align-items: center;
  justify-content: center;
}

.ops-sidebar-toggle .bi,
.ops-sidebar-close .bi {
  font-size: 1.3rem;
}

.ops-sidebar-close {
  display: none;
}

.ops-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 17, 0.48);
  z-index: 1035;
}

body.ops-mobile-nav-open {
  overflow: hidden;
}

.ops-market-grid {
  display: grid;
  gap: 0.9rem;
}

.ops-market-card {
  border: 1px solid rgba(27, 27, 27, 0.08);
  border-radius: 1rem;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 248, 248, 0.95));
  box-shadow: 0 0.6rem 1.5rem rgba(17, 17, 17, 0.06);
}

.ops-market-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.ops-market-card-link:hover {
  color: inherit;
  transform: translateY(-1px);
  border-color: rgba(204, 0, 0, 0.22);
  box-shadow: 0 0.8rem 1.7rem rgba(17, 17, 17, 0.1);
}

.ops-market-row-link {
  cursor: pointer;
}

.ops-market-row-link td {
  transition: background-color 0.15s ease;
}

.ops-market-row-link:hover td,
.ops-market-row-link:focus-visible td {
  background: rgba(204, 0, 0, 0.06);
}

.ops-market-card-title {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
}

.ops-market-card-subtitle,
.ops-market-card-label {
  color: var(--ops-text-muted);
  font-size: 0.82rem;
}

.ops-market-card-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.ops-market-card-metric {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 0.8rem;
  border-radius: 0.85rem;
  background: rgba(17, 17, 17, 0.04);
}

.ops-market-card-progress {
  border-top: 1px solid rgba(17, 17, 17, 0.08);
  padding-top: 0.9rem;
}

.ops-view-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
}

.ops-launch-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  min-height: 100%;
  padding: 1rem 1.1rem;
  border-radius: var(--ops-radius-sm);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 245, 245, 0.96));
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: var(--ops-shadow-soft);
  color: var(--ops-ink);
  text-decoration: none;
  font-weight: 700;
}

.ops-launch-card i {
  color: var(--ops-red);
  font-size: 1.2rem;
}

.ops-selector-form {
  width: min(100%, 46rem);
}

.ops-form-label {
  color: var(--ops-red);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ops-selector-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.ops-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  background: var(--ops-gold-soft);
  border: 1px solid rgba(245, 168, 0, 0.35);
  color: var(--ops-ink);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.ops-panel {
  height: 100%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--ops-radius-sm);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 245, 245, 0.96));
  box-shadow: var(--ops-shadow-soft);
}

.ops-panel-title {
  color: var(--ops-red);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ops-list-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.ops-list-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.settings-tabs-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.settings-tabs {
  flex-wrap: nowrap;
  width: max-content;
  min-width: 100%;
}

.settings-tabs .nav-link {
  white-space: nowrap;
}

.driver-hero {
  background: linear-gradient(135deg, rgb(31, 41, 55), rgb(15, 23, 42));
}

.driver-hero-avatar {
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1.1rem;
}

.driver-hero-title {
  font-size: 2rem;
}

.driver-hero-meta {
  color: rgba(255, 255, 255, 0.7);
}

.driver-hero-clock {
  color: rgba(255, 255, 255, 0.55);
}

.driver-next-stop {
  background: rgb(240, 247, 255);
}

.driver-next-stop-seq {
  width: 28px;
  height: 28px;
}

.director-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.9rem;
}

.director-kpi-card,
.director-panel,
.director-alert-card {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--ops-radius-sm);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 245, 245, 0.96));
  box-shadow: var(--ops-shadow-soft);
}

.director-kpi-card {
  padding: 1rem;
  min-height: 156px;
}

.director-kpi-card.is-good,
.director-alert-card.good {
  background: linear-gradient(180deg, #f4fbf6, #ebf7ef);
}

.director-kpi-label,
.director-alert-label {
  color: var(--ops-muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.director-kpi-value,
.director-alert-value {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 2.35rem;
  font-weight: 800;
  line-height: 1;
  margin-top: 0.45rem;
}

.director-kpi-unit {
  font-size: 1.15rem;
}

.director-kpi-sub,
.director-kpi-trend,
.director-alert-copy,
.director-market-meta,
.director-task-meta,
.director-panel-sub {
  color: var(--ops-muted);
  font-size: 0.83rem;
}

.director-kpi-trend.up {
  color: var(--bs-success);
}

.director-kpi-trend.down {
  color: #9a6800;
}

.director-kpi-trend.nc {
  color: var(--ops-muted);
}

.director-split {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 1fr);
  gap: 1rem;
}

.director-panel {
  padding: 0;
  overflow: hidden;
}

.director-panel-head {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.director-panel-title,
.director-market-name,
.director-task-title {
  font-weight: 700;
}

.director-trend-chart {
  padding: 1rem 1rem 0.5rem;
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  min-height: 86px;
}

.director-trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
}

.director-trend-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  opacity: 0.9;
}

.director-trend-bar.good {
  background: var(--bs-success);
}

.director-trend-bar.warn {
  background: #9a6800;
}

.director-trend-bar.bad {
  background: var(--bs-danger);
}

.director-trend-label,
.director-trend-foot {
  color: var(--ops-muted);
  font-size: 0.72rem;
}

.director-trend-foot {
  display: flex;
  justify-content: space-between;
  padding: 0 1rem 0.75rem;
}

.director-trend-note {
  margin: 0 1rem 1rem;
  padding: 0.6rem 0.8rem;
  border-radius: 0.65rem;
  font-size: 0.82rem;
}

.director-trend-note.good {
  background: #ebf7ef;
  color: var(--bs-success);
}

.director-trend-note.warn {
  background: #fff8e6;
  color: #9a6800;
}

.director-market-list {
  display: flex;
  flex-direction: column;
}

.director-market-row,
.director-task-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.director-market-row:first-child,
.director-task-row:first-of-type {
  border-top: 0;
}

.director-market-dot,
.director-task-icon {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.director-market-dot.success,
.director-market-csat.success,
.director-task-owner {
  color: var(--bs-success);
}

.director-market-dot.warning,
.director-market-csat.warning {
  color: #9a6800;
}

.director-market-dot.danger,
.director-market-csat.danger {
  color: var(--bs-danger);
}

.director-market-dot.success {
  background: var(--bs-success);
}

.director-market-dot.warning {
  background: #9a6800;
}

.director-market-dot.danger {
  background: var(--bs-danger);
}

.director-market-name span {
  color: var(--ops-muted);
  font-size: 0.8rem;
  font-weight: 400;
}

.director-market-csat {
  font-weight: 700;
}

.director-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.director-flag.pay {
  background: #fff8e6;
  color: #9a6800;
}

.director-flag.comp {
  background: #ffebeb;
  color: var(--bs-danger);
}

.director-alert-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.director-alert-card {
  padding: 1rem;
}

.director-alert-card.warn {
  background: linear-gradient(180deg, #fffaf0, #fff3d6);
}

.director-task-icon.review {
  background: var(--ops-gold);
}

.director-task-icon.flag {
  background: var(--bs-danger);
}

.director-task-icon.done {
  background: var(--bs-success);
}

/* Cards and sections */
.dashboard-card,
.auth-card {
  background: var(--ops-surface);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-top: 5px solid var(--ops-red);
  border-radius: var(--ops-radius);
  box-shadow: var(--ops-shadow);
  overflow: hidden;
}

.dashboard-card {
  backdrop-filter: blur(4px);
}

.ops-stat-card {
  height: 100%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--ops-radius-sm);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 245, 245, 0.96));
  box-shadow: var(--ops-shadow-soft);
}

a.ops-stat-card,
button.ops-stat-card,
.ops-stat-card-link,
.ops-stat-card-hover,
.ops-stat-card[role="button"],
.ops-stat-card[role="link"],
.ops-stat-card[data-tile],
.ops-stat-card[data-status] {
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.ops-stat-card-hover {
  cursor: default;
}

.ops-stat-card-hover[role="button"],
.ops-stat-card-hover[role="link"] {
  cursor: pointer;
}

a:hover .ops-stat-card,
a:focus-visible .ops-stat-card,
.ops-stat-card-link:hover .ops-stat-card,
.ops-stat-card-link:focus-visible .ops-stat-card,
.ops-stat-card-hover:hover,
.ops-stat-card-hover:focus-visible,
a.ops-stat-card:hover,
a.ops-stat-card:focus-visible,
button.ops-stat-card:hover,
button.ops-stat-card:focus-visible,
.ops-stat-card[role="button"]:hover,
.ops-stat-card[role="button"]:focus-visible,
.ops-stat-card[role="link"]:hover,
.ops-stat-card[role="link"]:focus-visible,
.ops-stat-card[data-tile]:hover,
.ops-stat-card[data-tile]:focus-visible,
.ops-stat-card[data-status]:hover,
.ops-stat-card[data-status]:focus-visible {
  border-color: rgba(13, 110, 253, 0.45);
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.35), var(--ops-shadow-soft) !important;
  transform: translateY(-1px);
}

.ops-stat-card.active,
.ops-stat-card.is-active,
.ops-stat-card[aria-current="true"] {
  border-color: #0d6efd;
  box-shadow: 0 0 0 2px #0d6efd, var(--ops-shadow-soft);
}

.ops-stat-label {
  color: var(--ops-red);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-eyebrow,
.auth-eyebrow {
  color: var(--ops-red);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-title,
.auth-title {
  font-family: "Barlow Condensed", sans-serif;
  font-size: clamp(2rem, 3vw, 2.6rem);
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.page-copy,
.auth-copy {
  color: var(--ops-muted);
  font-size: 1rem;
}

.routes-filter-form {
  width: min(100%, 28rem);
}

.routes-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.routes-table td {
  vertical-align: middle;
}

.routes-table .badge {
  min-width: 9rem;
}

.routes-table td.text-end {
  white-space: nowrap;
}

/* Auth layout */
.auth-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 30rem;
}

.auth-card.wide {
  max-width: 36rem;
}

.auth-card-body {
  padding: 2rem;
}

.auth-links a,
.ops-link {
  font-weight: 600;
  text-decoration: none;
}

.auth-links a:hover,
.ops-link:hover {
  text-decoration: underline;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.9rem;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--ops-muted);
  padding: 0;
}

.password-requirements small {
  display: block;
  margin-top: 0.25rem;
}

/* Flash messages */
#globalFlashContainer {
  position: fixed;
  top: 5rem;
  left: 0;
  right: 0;
  z-index: 1085;
  display: flex;
  justify-content: center;
  padding: 0 1rem;
  pointer-events: none;
}

#globalFlashContainer .alert {
  width: min(42rem, 100%);
  border: 0;
  box-shadow: var(--ops-shadow-soft);
  pointer-events: auto;
}

/* Compatibility aliases while pages migrate */
.btn-ops-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--ops-red);
  --bs-btn-border-color: var(--ops-red-dark);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #b40000;
  --bs-btn-hover-border-color: #760000;
  --bs-btn-focus-shadow-rgb: 204, 0, 0;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #760000;
  --bs-btn-active-border-color: #760000;
  background: linear-gradient(90deg, var(--ops-red-dark), var(--ops-red));
  border-color: var(--ops-red-dark);
}

/* Responsive */
@media (max-width: 575.98px) {
  .ops-brand-title {
    font-size: 1.1rem;
  }

  .ops-brand-subtitle {
    font-size: 0.63rem;
  }

  .auth-card-body {
    padding: 1.5rem;
  }
}

@media (max-width: 1199.98px) {
  .director-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 991.98px) {
  .ops-shell-intro {
    display: none;
  }

  .ops-topbar-actions {
    gap: 0.75rem;
  }

  .ops-scorecard-upload-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ops-scorecard-upload-file,
  .ops-scorecard-upload-action {
    grid-column: 1 / -1;
  }

  .ops-shell-body {
    grid-template-columns: 1fr;
  }

  .ops-sidebar-toggle,
  .ops-sidebar-close {
    display: inline-flex;
  }

  .ops-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(320px, 86vw);
    max-width: 100%;
    height: 100dvh;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 0;
    z-index: 1040;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    padding-bottom: 5rem;
  }

  .ops-shell-body.has-mobile-sidebar-open .ops-sidebar {
    transform: translateX(0);
  }

  .ops-page {
    padding-bottom: 5rem;
  }

  .ops-sidebar-top {
    display: none;
  }

  .ops-sidebar-form .ops-form-label {
    display: none;
  }

  .ops-sidebar-form {
    gap: 0.7rem;
  }

  .director-split,
  .director-alert-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991.98px) {
  .table-responsive {
    overflow: visible;
  }

  .ops-mobile-table thead,
  .ops-mobile-table tr.ops-mobile-pair-row .ops-mobile-row-header {
    display: none;
  }

  .ops-mobile-table,
  .ops-mobile-table tbody,
  .ops-mobile-table tr,
  .ops-mobile-table td,
  .ops-mobile-table th {
    display: block;
    width: 100%;
  }

  .ops-mobile-table {
    border-collapse: separate;
    border-spacing: 0;
  }

  .ops-mobile-table tbody {
    display: grid;
    gap: 0.85rem;
  }

  .ops-mobile-table tbody tr {
    border: 1px solid rgba(27, 27, 27, 0.08);
    border-radius: 1rem;
    padding: 1rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 248, 248, 0.95));
    box-shadow: 0 0.6rem 1.5rem rgba(17, 17, 17, 0.06);
    overflow: hidden;
  }

  .ops-mobile-table tbody td {
    display: grid;
    grid-template-columns: minmax(92px, 112px) minmax(0, 1fr);
    gap: 0.9rem;
    align-items: start;
    border: 0;
    padding: 0.45rem 0;
    text-align: left !important;
    white-space: normal !important;
  }

  .ops-mobile-table tbody td::before {
    content: attr(data-label);
    color: var(--ops-text-muted);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .ops-mobile-table tbody td[data-label=""] {
    grid-template-columns: 1fr;
  }

  .ops-mobile-table tbody td[data-label=""]::before {
    display: none;
  }

  .ops-mobile-table tbody tr.ops-mobile-pair-row td {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .ops-mobile-table tbody tr.ops-mobile-pair-row td::before {
    display: block;
  }

  .ops-mobile-table tbody .badge,
  .ops-mobile-table tbody .btn,
  .ops-mobile-table tbody .progress {
    justify-self: start;
  }

  .ops-mobile-table tbody .form-select,
  .ops-mobile-table tbody .form-control,
  .ops-mobile-table tbody .btn {
    width: 100%;
    max-width: none !important;
  }

  .ops-mobile-table tbody .text-end {
    text-align: left !important;
  }

  .settings-toolbar-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch !important;
  }

  .settings-toolbar-actions .form-control,
  .settings-toolbar-actions .form-select {
    max-width: none !important;
    width: 100%;
  }

  .settings-tabs .nav-link {
    padding: 0.7rem 0.85rem;
    font-size: 0.92rem;
  }

  .driver-subpage .page-title {
    font-size: 1.7rem;
  }

  .driver-hero {
    padding: 1.15rem !important;
  }

  .driver-hero-layout {
    flex-direction: column;
    align-items: stretch !important;
  }

  .driver-hero-avatar {
    width: 48px;
    height: 48px;
    font-size: 1rem;
  }

  .driver-hero-title {
    font-size: 1.65rem;
  }

  .driver-hero-status {
    text-align: left !important;
  }

  .driver-next-stop {
    flex-direction: column;
    align-items: flex-start !important;
  }

  .driver-next-stop-meta {
    width: 100%;
    text-align: left !important;
  }

  .ops-list-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .director-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .director-market-row,
  .director-task-row {
    flex-wrap: wrap;
  }
}

@media (max-width: 575.98px) {
  .ops-scorecard-upload-form {
    grid-template-columns: 1fr;
  }

  .ops-current-view-label {
    display: none;
  }

  .ops-current-view {
    width: 100%;
    padding-right: 0.85rem;
  }

  .ops-current-view-icon {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
  }

  .ops-current-view-name {
    font-size: 1.15rem;
  }

  .ops-scorecard-upload-file,
  .ops-scorecard-upload-action {
    grid-column: auto;
  }

  .director-kpi-grid {
    grid-template-columns: 1fr;
  }
}
