:root {
  --app-bg: #f3f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #111827;
  --muted: #64748b;
  --primary: #2d8cff;
  --primary-dark: #176fd6;
  --success: #62c63a;
  --warning: #f8a21a;
  --danger: #ef4d45;
  --teal: #42b8a6;
  --cyan: #35a9d6;
  --purple: #8b5cf6;
  --sidebar-bg: #ffffff;
  --sidebar-bg-2: #f7fbff;
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 34px rgba(31, 45, 61, 0.12);
}

body {
  min-height: 100vh;
  color: var(--text);
  background: var(--app-bg);
  font-feature-settings: "tnum";
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: #111827;
  font-weight: 760;
}

.sidebar {
  min-height: 100vh;
  border-right: 1px solid #dfe8f3;
  background:
    linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  box-shadow: 8px 0 28px rgba(31, 45, 61, 0.06);
}

.sidebar-brand {
  position: relative;
  padding: 6px 4px 18px 38px;
  border-bottom: 1px solid #e5edf6;
  color: #162033 !important;
  letter-spacing: 0;
}

.sidebar-brand::before {
  position: absolute;
  left: 4px;
  top: 6px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: linear-gradient(135deg, #62c63a, #2d8cff);
  content: "$";
  font-size: 15px;
  font-weight: 900;
}

.sidebar .nav-link {
  margin-bottom: 7px;
  padding: 12px 14px;
  color: #53647c;
  border-radius: 6px;
  font-weight: 720;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, #62c63a, #42b8a6);
  box-shadow: 0 8px 18px rgba(66, 184, 166, 0.22);
  transform: translateX(2px);
}

.sidebar .nav-link::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 10px;
  border: 2px solid currentColor;
  border-radius: 2px;
  opacity: 0.62;
  content: "";
}

.content-wrap {
  max-width: 1480px;
}

.app-main {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #dce7f3;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.auth-wrap {
  display: grid;
  min-height: calc(100vh - 48px);
  place-items: center;
  background:
    linear-gradient(135deg, rgba(31, 111, 235, 0.08), rgba(23, 138, 82, 0.06)),
    var(--app-bg);
}

.auth-card {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(12px);
}

.auth-card h1 {
  margin-bottom: 20px !important;
  font-size: 1.65rem;
}

.login-hero {
  position: fixed;
  inset: 0;
  display: grid;
  min-height: 100vh;
  overflow: hidden;
  place-items: center;
  padding: 24px;
  z-index: 20;
  background:
    radial-gradient(circle at 78% 14%, #ffe45c 0 15%, transparent 15.4%),
    linear-gradient(180deg, #2298f6 0%, #20a7f6 58%, #1fa2ef 100%);
}

.login-hero::before {
  content: none;
}

.login-panel {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  padding: 0 28px;
  text-align: center;
}

.login-title {
  margin-bottom: 30px;
  color: #fff;
}

.login-title h1 {
  margin: 0;
  color: #fff;
  font-size: 1.72rem;
  text-shadow: 0 2px 10px rgba(24, 95, 160, 0.18);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-field .form-control {
  height: 54px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 113, 213, 0.38);
  box-shadow: inset 0 2px 7px rgba(0, 73, 155, 0.16);
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
}

.login-field .form-control::placeholder {
  color: rgba(255, 255, 255, 0.76);
}

.login-field .form-control:focus {
  background: rgba(0, 113, 213, 0.46);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2), inset 0 2px 7px rgba(0, 73, 155, 0.16);
}

.login-submit {
  height: 58px;
  margin-top: 24px;
  border: 0;
  border-radius: 999px;
  color: #2d6f9f;
  background: rgba(238, 252, 255, 0.92);
  box-shadow: 0 14px 24px rgba(24, 95, 160, 0.16);
  font-size: 1.08rem;
  font-weight: 800;
}

.login-submit:hover {
  background: #fff;
}

.login-language-switch {
  display: inline-flex;
  justify-self: center;
  gap: 4px;
  margin-top: 6px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  background: rgba(0, 113, 213, 0.18);
  box-shadow: inset 0 1px 5px rgba(0, 73, 155, 0.12);
}

.login-language-switch a {
  min-width: 82px;
  padding: 8px 12px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.92rem;
  font-weight: 760;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.login-language-switch a:hover,
.login-language-switch a.active {
  color: #2472a8;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 18px rgba(24, 95, 160, 0.14);
}

.table td,
.table th {
  vertical-align: middle;
}

.table {
  color: #1f2937;
}

.table thead th {
  color: #53647c;
  border-bottom-color: #e5edf6;
  background: #f7fbff;
  font-size: 0.875rem;
  font-weight: 760;
}

.table tbody td {
  border-color: #edf2f7;
}

.table-hover tbody tr:hover {
  background-color: #f2f8ff;
}

.card {
  border: 1px solid #dce7f3;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card-header {
  border-bottom-color: #e5edf6;
  background: #ffffff !important;
  color: #111827;
  font-weight: 760 !important;
}

.shadow-sm {
  box-shadow: var(--shadow-sm) !important;
}

.form-label {
  color: #334155;
  font-weight: 600;
}

.form-control,
.form-select {
  min-height: 42px;
  color: #111827;
  border-color: #c8d6e6;
  border-radius: 8px;
  background-color: #fff;
  box-shadow: inset 0 1px 1px rgba(15, 23, 42, 0.02);
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(31, 111, 235, 0.72);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}

.btn {
  border-radius: 8px;
  font-weight: 720;
}

.btn-primary {
  border-color: var(--primary);
  background: linear-gradient(135deg, #2d8cff, #246ee9);
  box-shadow: 0 8px 18px rgba(45, 140, 255, 0.22);
}

.btn-primary:hover,
.btn-primary:focus {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
}

.btn-success {
  border-color: var(--success);
  background: linear-gradient(135deg, #62c63a, #3dac60);
}

.btn-outline-primary {
  color: var(--primary);
  border-color: rgba(31, 111, 235, 0.45);
}

.btn-outline-primary:hover {
  border-color: var(--primary);
  background: var(--primary);
}

.btn-outline-secondary {
  color: #475569;
  border-color: var(--line-strong);
}

.btn-outline-danger {
  color: var(--danger);
  border-color: rgba(194, 65, 58, 0.45);
}

.alert {
  border-radius: 8px;
  border-width: 1px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.amount {
  font-variant-numeric: tabular-nums;
}

.dashboard-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.dashboard-head h1,
.driver-header h1,
.content-wrap > h1 {
  position: relative;
}

.dashboard-head h1::after,
.driver-header h1::after,
.content-wrap > h1::after {
  display: block;
  width: 42px;
  height: 3px;
  margin-top: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #62c63a, #2d8cff);
  content: "";
}

.dashboard-filter {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.metric-card,
.ops-card {
  height: 100%;
  border: 1px solid #dce7f3;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 150px;
  padding: 22px 24px;
  border: 0;
  color: #fff;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.metric-card::after {
  position: absolute;
  right: 24px;
  bottom: 14px;
  display: grid;
  width: 94px;
  height: 94px;
  place-items: center;
  border: 10px solid rgba(0, 0, 0, 0.07);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.16);
  content: attr(data-icon);
  font-size: 3.6rem;
  font-weight: 900;
  line-height: 1;
}

.metric-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.metric-income {
  background: linear-gradient(135deg, #62c63a, #42b833);
}

.metric-cost {
  background: linear-gradient(135deg, #f8a21a, #f2bd36);
}

.metric-profit {
  background: linear-gradient(135deg, #42b8a6, #35a9d6);
}

.metric-loss {
  background: linear-gradient(135deg, #ef4d45, #f37a72);
}

.metric-rate {
  background: linear-gradient(135deg, #35a9d6, #2d8cff);
}

.metric-package {
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
}

.metric-average {
  background: linear-gradient(135deg, #42b8a6, #62c63a);
}

.metric-label,
.ops-label {
  color: var(--muted);
  font-weight: 600;
}

.metric-card .metric-label,
.metric-card .metric-note {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.86);
}

.metric-value {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  color: #111827;
  font-size: 2.35rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.metric-card .metric-value {
  color: #ffffff;
  text-shadow: 0 1px 1px rgba(15, 23, 42, 0.12);
}

.metric-note {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.875rem;
}

.dashboard-metrics {
  align-items: stretch;
}

.dashboard-ops .ops-card {
  min-height: 90px;
}

.dashboard-analysis .card {
  min-height: 100%;
}

.chart-card .card-body {
  padding: 24px 26px;
}

.chart-card .card-header {
  padding: 18px 24px;
  font-size: 1.05rem;
}

.ops-card {
  padding: 14px 16px;
  border-left: 0;
  background: #fff;
}

.ops-value {
  margin-top: 4px;
  color: #111827;
  font-size: 1.45rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ops-good {
  border-color: #bfeacb;
  background: linear-gradient(135deg, #f6fff8, #effcf3);
}

.ops-warning {
  border-color: #f7dda4;
  background: linear-gradient(135deg, #fffaf0, #fff4db);
}

.ops-danger {
  border-color: #f2c6c2;
  background: linear-gradient(135deg, #fff7f6, #fff0ef);
}

.profit-chart {
  display: grid;
  gap: 18px;
}

.profit-bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr minmax(120px, auto);
  align-items: center;
  gap: 12px;
}

.profit-bar-label {
  overflow: hidden;
  color: #53647c;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profit-bar-track {
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f7;
}

.profit-bar {
  height: 100%;
  min-width: 6px;
  border-radius: 999px;
}

.profit-bar-good {
  background: #16a34a;
}

.profit-bar-danger {
  background: #dc2626;
}

.profit-bar-value {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.dashboard-filter .form-select,
.dashboard-filter .form-control,
.dashboard-filter .btn {
  min-height: 42px;
}

.profit-bar-stack {
  display: grid;
  gap: 5px;
}

.profit-mini {
  height: 10px;
  min-width: 6px;
  border-radius: 999px;
}

.profit-mini.income {
  background: #62c63a;
}

.profit-mini.profit.good {
  background: #35a9d6;
}

.profit-mini.profit.danger {
  background: #ef4d45;
}

.dashboard-filter .card-body {
  padding: 20px;
}

.dashboard-filter .form-label {
  color: #24344d;
}

.card:has(.profit-chart),
.driver-statement-summary {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.driver-page {
  --driver-border: #e5e7eb;
  --driver-muted: #64748b;
}

.driver-page .card {
  overflow: hidden;
}

.driver-language-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid #dce7f3;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.driver-language-switch a {
  padding: 6px 10px;
  border-radius: 999px;
  color: #53647c;
  font-size: 0.875rem;
  font-weight: 760;
  text-decoration: none;
}

.driver-language-switch a.active {
  color: #fff;
  background: linear-gradient(135deg, #2d8cff, #42b8a6);
}

.driver-amount-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #eef2f7;
}

.driver-amount-value {
  color: #111827;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.driver-statement-summary {
  border-color: #dbeafe;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.driver-status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.driver-status-pills span {
  padding: 6px 10px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  color: #1d4ed8;
  background: #eff6ff;
  font-size: 0.875rem;
  font-weight: 700;
}

.driver-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding-top: 14px;
}

.driver-summary-grid div {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #fff;
}

.driver-summary-grid span {
  color: var(--driver-muted);
  font-size: 0.875rem;
  font-weight: 600;
}

.driver-summary-grid strong {
  color: #111827;
  font-variant-numeric: tabular-nums;
}

.driver-collapse-button {
  width: 100%;
  border: 0;
  text-align: left;
}

.driver-collapse-button::after {
  float: right;
  color: #64748b;
  content: "+";
}

.driver-collapse-button[aria-expanded="true"]::after {
  content: "-";
}

@media (max-width: 768px) {
  body {
    background: #f8fafc;
  }

  main.col-12,
  main.col-lg-10 {
    padding: 12px !important;
  }

  .dashboard-head {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-actions {
    justify-content: flex-start;
  }

  .profit-bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .profit-bar-value {
    text-align: left;
  }

  .driver-header h1 {
    font-size: 1.45rem;
  }

  .driver-header-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
  }

  .driver-header-actions .driver-language-switch {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .driver-header-actions .btn {
    min-height: 42px;
  }

  .driver-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .driver-summary > [class*="col-"] {
    width: auto;
  }

  .driver-total-card {
    grid-column: span 2;
  }

  .driver-page .ops-card {
    padding: 13px 14px;
  }

  .driver-page .ops-value {
    overflow-wrap: anywhere;
    font-size: 1.25rem;
  }

  .driver-list-card .table,
  .driver-disputes-card .table,
  .driver-statement-page .table {
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  .driver-list-card thead,
  .driver-disputes-card thead,
  .driver-statement-page thead {
    display: none;
  }

  .driver-list-card tbody,
  .driver-list-card tr,
  .driver-list-card td,
  .driver-disputes-card tbody,
  .driver-disputes-card tr,
  .driver-disputes-card td,
  .driver-statement-page tbody,
  .driver-statement-page tr,
  .driver-statement-page td {
    display: block;
    width: 100%;
  }

  .driver-list-card tr,
  .driver-disputes-card tr,
  .driver-statement-page tr {
    padding: 12px;
    border: 1px solid var(--driver-border);
    border-radius: 8px;
    background: #fff;
  }

  .driver-list-card td,
  .driver-disputes-card td,
  .driver-statement-page td {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 0;
    border: 0;
    text-align: right;
  }

  .driver-list-card td::before,
  .driver-disputes-card td::before,
  .driver-statement-page td::before {
    flex: 0 0 42%;
    color: var(--driver-muted);
    font-weight: 700;
    text-align: left;
    content: attr(data-label);
  }

  .driver-row-action {
    display: block !important;
    padding-top: 10px !important;
  }

  .driver-row-action::before {
    display: none;
  }

  .driver-row-action .btn {
    width: 100%;
    min-height: 42px;
  }

  .driver-amount-hero {
    display: grid;
  }

  .driver-amount-value {
    font-size: 2.35rem;
  }

  .driver-status-pills {
    justify-content: flex-start;
  }

  .driver-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .driver-action-card .d-flex {
    display: grid !important;
  }

  .driver-action-card form,
  .driver-action-card .btn,
  .driver-action-card .form-control {
    width: 100%;
  }

  .driver-action-card textarea {
    min-height: 88px;
  }

  .driver-primary-action {
    min-height: 46px;
  }

  .driver-package-card {
    margin-bottom: 16px;
  }
}
