/* =========================================================
   CMVR OPERATIONS PORTAL
   Device Light / Dark Theme
========================================================= */

/* LIGHT THEME */
:root {
  color-scheme: light;

  --bg: #f4f6fb;
  --sidebar: #ffffff;
  --panel: #ffffff;
  --panel-soft: #eef2f8;
  --panel-hover: #e5eaf4;
  --input: #ffffff;

  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --purple: #8b5cf6;

  --text: #172033;
  --text-soft: #334155;
  --muted: #526176;
  --muted-dark: #64748b;
  --border: #cbd5e1;

  --green: #047857;
  --green-soft: #047857;
  --orange: #92400e;
  --orange-soft: #92400e;
  --red: #b91c1c;
  --red-soft: #b91c1c;
  --blue: #1d4ed8;

  --accent-text: #4f46e5;
  --purple-text: #6d28d9;
  --security-text: #065f46;

  --login-start: #ffffff;
  --login-end: #f8faff;
  --hero-start: #eef2ff;
  --hero-end: #ffffff;
  --topbar-bg: rgba(244, 246, 251, 0.97);

  --table-head: #eef2f8;
  --file-button: #e2e8f0;
  --file-button-hover: #cbd5e1;
  --scroll-thumb: #a5b1c2;
  --scroll-thumb-hover: #7b8ba1;

  --radius: 14px;
  --shadow: 0 12px 32px rgba(30, 41, 59, 0.08);
  --login-shadow: 0 28px 70px rgba(30, 41, 59, 0.12);
  --modal-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

/* DARK THEME */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --bg: #09111f;
    --sidebar: #0d1729;
    --panel: #111d31;
    --panel-soft: #16243a;
    --panel-hover: #1a2a43;
    --input: #0b1628;

    --text: #f8fafc;
    --text-soft: #dbe5f2;
    --muted: #94a3b8;
    --muted-dark: #94a3b8;
    --border: #263651;

    --green: #10b981;
    --green-soft: #34d399;
    --orange: #f59e0b;
    --orange-soft: #fbbf24;
    --red: #ef4444;
    --red-soft: #fca5a5;
    --blue: #93c5fd;

    --accent-text: #a5b4fc;
    --purple-text: #c4b5fd;
    --security-text: #a7f3d0;

    --login-start: #121e32;
    --login-end: #0e182a;
    --hero-start: #121f35;
    --hero-end: #101a2d;
    --topbar-bg: rgba(9, 17, 31, 0.97);

    --table-head: #16243a;
    --file-button: #273752;
    --file-button-hover: #354863;
    --scroll-thumb: #293953;
    --scroll-thumb-hover: #3a4b67;

    --shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    --login-shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
    --modal-shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
  }
}

/* RESET */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* GENERAL */
.muted {
  color: var(--muted);
}

.eyebrow {
  color: var(--accent-text);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.full-width {
  grid-column: 1 / -1;
}

/* LOGIN PAGE */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;

  background:
    radial-gradient(
      circle at 18% 20%,
      rgba(99, 102, 241, 0.17),
      transparent 35%
    ),
    radial-gradient(
      circle at 85% 80%,
      rgba(139, 92, 246, 0.13),
      transparent 35%
    ),
    var(--bg);
}

.login-card {
  width: min(440px, 100%);
  padding: 34px;
  background: linear-gradient(
    180deg,
    var(--login-start),
    var(--login-end)
  );
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--login-shadow);
}

/* BRAND */
.login-brand,
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand {
  margin-bottom: 30px;
}

.brand {
  padding: 0 8px 28px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 12px;
  background: linear-gradient(
    135deg,
    var(--primary),
    var(--purple)
  );
  color: #ffffff;
  font-size: 21px;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.22);
}

.login-brand h1,
.brand h1 {
  font-size: 22px;
}

.login-brand p,
.brand p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

/* LOGIN HEADING */
.login-heading {
  margin-bottom: 24px;
}

.login-heading h2 {
  margin: 7px 0;
  font-size: 28px;
}

.login-heading .muted {
  font-size: 13px;
}

/* FORMS */
label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-dark);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

textarea {
  resize: vertical;
}

select option {
  background: var(--input);
  color: var(--text);
}

#loginForm,
#signupForm,
#passwordResetForm {
  display: flex;
  flex-direction: column;
  gap: 17px;
}

#signupForm,
#passwordResetForm {
  margin-top: 18px;
}

/* PASSWORD */
.password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
}

.password-toggle:hover {
  background: var(--panel-hover);
}

/* LOGIN OPTIONS */
.login-options {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.remember-login {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 500;
}

.remember-login input {
  width: auto;
  accent-color: var(--primary);
}

.forgot-password-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -3px;
}

.forgot-password-btn {
  border: none;
  background: transparent;
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 600;
}

.forgot-password-btn:hover {
  text-decoration: underline;
}

.login-error {
  min-height: 18px;
  color: var(--red-soft);
  text-align: center;
  font-size: 12px;
}

/* LOGIN SECURITY AND FOOTER */
.login-security {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 20px;
  padding: 12px 14px;
  background: rgba(16, 185, 129, 0.07);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 10px;
  color: var(--security-text);
}

.login-security p {
  font-size: 11px;
}

.login-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.login-footer p {
  font-size: 12px;
  font-weight: 600;
}

.login-footer span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

/* SIGNUP PROMPT */
.signup-prompt {
  list-style: none;
  text-align: center;
  cursor: pointer;
  margin-top: 24px;
  color: var(--text-soft);
}

.signup-prompt::-webkit-details-marker {
  display: none;
}

.signup-prompt span {
  color: var(--purple-text);
  font-weight: 700;
}

.signup-prompt:hover span {
  text-decoration: underline;
}

/* BUTTONS */
.primary-btn,
.secondary-btn,
.text-btn,
.table-btn,
.icon-btn {
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 18px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(
    135deg,
    var(--primary),
    var(--purple)
  );
  color: #ffffff;
  font-weight: 600;
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 7px 18px rgba(99, 102, 241, 0.22);
}

.login-btn {
  width: 100%;
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
}

.secondary-btn:hover:not(:disabled) {
  background: var(--panel-hover);
}

.text-btn {
  border: none;
  background: transparent;
  color: var(--accent-text);
  font-weight: 600;
}

.text-btn:hover {
  text-decoration: underline;
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
}

.icon-btn:hover:not(:disabled) {
  background: var(--panel-hover);
}

/* APP SHELL */
.app-shell {
  min-height: 100vh;
  display: flex;
}

/* SIDEBAR */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 18px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 100;
}

/* NAVIGATION */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item span {
  width: 23px;
  text-align: center;
  font-size: 16px;
}

.nav-item:hover {
  background: rgba(99, 102, 241, 0.09);
  color: var(--text);
}

.nav-item.active {
  background: linear-gradient(
    90deg,
    rgba(99, 102, 241, 0.22),
    rgba(139, 92, 246, 0.06)
  );
  border-left: 3px solid var(--primary);
  color: var(--accent-text);
}

/* SIDEBAR CARD */
.sidebar-card {
  margin-top: auto;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.sidebar-card strong {
  display: block;
  margin: 5px 0;
  font-size: 13px;
}

.sidebar-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

/* MAIN AREA */
.main-area {
  width: calc(100% - 260px);
  min-width: 0;
  min-height: 100vh;
  margin-left: 260px;
}

/* TOPBAR */
.topbar {
  position: sticky;
  top: 0;
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 32px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  z-index: 60;
}

.topbar h2 {
  margin-top: 2px;
  font-size: 23px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 13px;
}

/* SEARCH */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 12px;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.search-box input {
  padding: 10px 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.search-box input:focus {
  box-shadow: none;
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.top-search {
  width: 260px;
}

.search-box.wide {
  flex: 1;
}

/* USER CHIP */
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 5px;
}

.avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--primary),
    var(--purple)
  );
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.user-chip strong {
  display: block;
  font-size: 12px;
}

.user-chip span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

/* PAGE VIEWS */
.view {
  display: none;
  padding: 30px;
}

.view.active {
  display: block;
}

/* HERO */
.hero-card {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 24px;
  padding: 28px 30px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    radial-gradient(
      circle at 90% 20%,
      rgba(99, 102, 241, 0.24),
      transparent 38%
    ),
    linear-gradient(
      135deg,
      var(--hero-start),
      var(--hero-end)
    );
  box-shadow: var(--shadow);
}

.hero-card h3 {
  margin: 12px 0 8px;
  font-size: 27px;
}

.hero-card p {
  max-width: 680px;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.13);
  color: var(--accent-text);
  font-size: 10px;
  font-weight: 700;
}

/* STAT CARDS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stats-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.financial-stats-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stat-card {
  min-width: 0;
  min-height: 110px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 19px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-card:hover {
  border-color: rgba(99, 102, 241, 0.42);
}

.stat-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.12);
  font-size: 21px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.stat-card strong {
  display: block;
  margin: 3px 0;
  font-size: 25px;
  overflow-wrap: anywhere;
}

.stat-card small {
  display: block;
  color: var(--muted-dark);
  font-size: 10px;
}

/* PANELS */
.panel {
  min-width: 0;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-top: 22px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.panel-head h3 {
  margin-top: 3px;
  font-size: 17px;
}

/* DASHBOARD GRIDS */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 20px;
}

.fleet-dashboard-grid {
  margin-top: 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* TOOLBARS AND FILTERS */
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.section-toolbar h3 {
  margin: 3px 0 4px;
  font-size: 22px;
}

.filters-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.filters-row select {
  width: auto;
  min-width: 180px;
}

/* TABLES */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--table-head);
}

th {
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.45px;
  white-space: nowrap;
}

td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 12px;
  vertical-align: middle;
}

tbody tr {
  transition: background 0.12s ease;
}

tbody tr:hover {
  background: rgba(99, 102, 241, 0.04);
}

/* RECENT LIST */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.recent-item > div {
  min-width: 0;
}

.recent-item strong {
  display: block;
  margin-bottom: 2px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.recent-item span {
  color: var(--muted);
  font-size: 10px;
  overflow-wrap: anywhere;
}

/* DOCUMENT SUMMARY */
.dept-chart {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.chart-row {
  display: grid;
  grid-template-columns: 120px 1fr 35px;
  align-items: center;
  gap: 10px;
}

.chart-label {
  color: var(--muted);
  font-size: 11px;
}

.chart-track {
  height: 8px;
  overflow: hidden;
  background: var(--input);
  border-radius: 999px;
}

.chart-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--primary),
    var(--purple)
  );
}

/* FORM GRID */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px;
}

/* FILE INPUT */
input[type="file"] {
  padding: 8px;
}

input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 8px 11px;
  border: none;
  border-radius: 7px;
  background: var(--file-button);
  color: var(--text);
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
  background: var(--file-button-hover);
}

/* UNLOAD AND DELIVERY */
#unloadView .panel,
.delivery-confirmation-panel {
  max-width: 1050px;
  margin: 0 auto;
}

#unloadView textarea,
.delivery-confirmation-panel textarea {
  min-height: 110px;
}

.delivery-confirmation-panel .panel-head {
  margin-bottom: 24px;
}

/* STATUS BADGES */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.status-draft {
  background: rgba(148, 163, 184, 0.13);
  color: var(--text-soft);
}

.status-active {
  background: rgba(59, 130, 246, 0.13);
  color: var(--blue);
}

.status-in-transit {
  background: rgba(99, 102, 241, 0.14);
  color: var(--accent-text);
}

.status-unloaded,
.status-pending,
.status-pending-confirmation,
.status-documents-pending {
  background: rgba(245, 158, 11, 0.13);
  color: var(--orange-soft);
}

.status-delivered,
.status-delivered-successfully,
.status-complete,
.status-approved {
  background: rgba(16, 185, 129, 0.13);
  color: var(--green-soft);
}

.status-rejected,
.status-error,
.status-inactive {
  background: rgba(239, 68, 68, 0.14);
  color: var(--red-soft);
}

/* Preserve badge colors inside recent lists */
.recent-item .status-badge {
  color: var(--text-soft);
}

.recent-item .status-active {
  color: var(--blue);
}

.recent-item .status-in-transit {
  color: var(--accent-text);
}

.recent-item .status-unloaded,
.recent-item .status-pending,
.recent-item .status-pending-confirmation,
.recent-item .status-documents-pending {
  color: var(--orange-soft);
}

.recent-item .status-delivered,
.recent-item .status-delivered-successfully,
.recent-item .status-complete,
.recent-item .status-approved {
  color: var(--green-soft);
}

.recent-item .status-rejected,
.recent-item .status-error,
.recent-item .status-inactive {
  color: var(--red-soft);
}

/* TABLE BUTTONS */
.action-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.table-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 9px;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-soft);
  font-size: 10px;
}

.table-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--panel-hover);
}

.table-btn.delete {
  color: var(--red-soft);
}

.table-btn.view {
  display: inline-flex;
  color: var(--blue);
}

.table-btn.document {
  color: var(--purple-text);
}

/* FINANCIAL OVERVIEW */
#financialsView {
  max-width: 1600px;
}

#financialsView .section-toolbar select {
  width: auto;
  min-width: 170px;
}

.financial-summary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.financial-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 15px;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.financial-summary-row:hover {
  background: rgba(99, 102, 241, 0.055);
  border-color: rgba(99, 102, 241, 0.27);
}

.financial-summary-row span {
  color: var(--muted);
  font-size: 11px;
}

.financial-summary-row strong {
  color: var(--text);
  font-size: 14px;
}

#draftRevenue,
#summaryDraftRevenue,
#financialDraftLoads {
  color: var(--orange-soft);
}

/* REVENUE CHART */
.financial-chart-panel {
  margin-top: 22px;
}

.revenue-chart {
  min-height: 300px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 28px 20px 20px;
  overflow-x: auto;
  background: linear-gradient(
    180deg,
    rgba(99, 102, 241, 0.045),
    var(--input)
  );
  border: 1px solid var(--border);
  border-radius: 12px;
}

.revenue-bar-item {
  min-width: 48px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.revenue-bar {
  width: 100%;
  max-width: 42px;
  min-height: 4px;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(
    180deg,
    var(--purple),
    var(--primary)
  );
}

.revenue-bar-value {
  color: var(--accent-text);
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}

.revenue-bar-label {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.growth-positive {
  color: var(--green-soft) !important;
}

.growth-negative {
  color: var(--red-soft) !important;
}

.growth-neutral {
  color: var(--text) !important;
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(3, 8, 18, 0.72);
  z-index: 1000;
}

.modal-backdrop.show {
  display: flex;
}

.modal-card {
  width: min(600px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--modal-shadow);
}

.large-modal {
  width: min(920px, 100%);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.modal-head > div {
  min-width: 0;
}

.modal-head h3 {
  margin-top: 3px;
  font-size: 19px;
  overflow-wrap: anywhere;
}

.modal-head .muted {
  margin-top: 5px;
  font-size: 11px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding-top: 22px;
}

/* DOCUMENT VIEWER */
.document-viewer-card {
  width: min(1050px, 96vw);
  height: min(850px, 92vh);
  display: flex;
  flex-direction: column;
}

.document-viewer-card .modal-head {
  flex-shrink: 0;
}

.document-preview-frame {
  width: 100%;
  flex: 1;
  min-height: 540px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.document-preview-image {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 650px;
  margin: 0 auto;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input);
}

#documentPreviewUnavailable {
  flex: 1;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* EMPTY STATES */
.empty-state {
  width: 100%;
  padding: 34px 20px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}

.empty-state strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
  font-size: 13px;
}

/* TOAST */
.toast {
  position: fixed;
  right: 25px;
  bottom: 25px;
  min-width: 250px;
  max-width: 390px;
  padding: 13px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  color: var(--text);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 2000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* OWNER VISIBILITY IS CONTROLLED BY JAVASCRIPT */
.owner-only {
  transition: opacity 0.15s ease;
}

/* SCROLLBARS */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
}

.mobile-only {
  display: none;
}

/* RESPONSIVE: 1400px */
@media (max-width: 1400px) {
  .financial-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* RESPONSIVE: 1200px */
@media (max-width: 1200px) {
  .stats-grid,
  .financial-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-grid,
  .fleet-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* RESPONSIVE: 900px */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 18px 0 50px rgba(0, 0, 0, 0.25);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-area {
    width: 100%;
    margin-left: 0;
  }

  .mobile-only {
    display: grid;
  }

  .topbar {
    padding: 14px 18px;
  }

  .top-search {
    display: none;
  }

  .view {
    padding: 22px 18px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .full-width {
    grid-column: auto;
  }

  #financialsView .section-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  #financialsView .section-toolbar select {
    width: 100%;
  }

  .document-viewer-card {
    height: 88vh;
  }

  .document-preview-frame {
    min-height: 450px;
  }
}

/* RESPONSIVE: 700px */
@media (max-width: 700px) {
  .stats-grid,
  .stats-grid.compact,
  .financial-stats-grid {
    grid-template-columns: 1fr;
  }

  .filters-row {
    flex-direction: column;
  }

  .filters-row select {
    width: 100%;
  }
}

/* RESPONSIVE: 600px */
@media (max-width: 600px) {
  .login-page {
    padding: 14px;
  }

  .login-card {
    padding: 24px 20px;
    border-radius: 16px;
  }

  .login-heading h2 {
    font-size: 23px;
  }

  /* Prevent automatic input zoom on mobile browsers */
  input,
  select,
  textarea {
    font-size: 16px;
  }

  .hero-card {
    min-height: auto;
    flex-direction: column;
    align-items: flex-start;
    padding: 22px;
  }

  .hero-card h3 {
    font-size: 22px;
  }

  .hero-card .primary-btn,
  .section-toolbar .primary-btn {
    width: 100%;
  }

  .section-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar {
    gap: 8px;
    padding: 12px 13px;
  }

  .topbar h2 {
    font-size: 17px;
  }

  .topbar-actions {
    gap: 6px;
  }

  .user-chip > div:not(.avatar) {
    display: none;
  }

  .avatar {
    width: 36px;
    height: 36px;
  }

  .icon-btn {
    width: 37px;
    height: 37px;
  }

  #logoutBtn {
    padding: 8px 10px;
    font-size: 10px;
  }

  .panel {
    padding: 17px;
  }

  .panel-head,
  .delivery-confirmation-panel .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal-card {
    padding: 18px;
  }

  .modal-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .modal-actions button,
  .modal-actions a {
    width: 100%;
  }

  .financial-summary-row {
    padding: 12px;
  }

  .financial-summary-row strong {
    font-size: 12px;
  }

  .revenue-chart {
    min-height: 240px;
  }

  .chart-row {
    grid-template-columns: 90px 1fr 28px;
  }

  .document-viewer-card {
    width: 100%;
    height: 92vh;
  }

  .document-preview-frame {
    min-height: 360px;
  }

  .document-preview-image {
    max-height: 500px;
  }

  .recent-item {
    flex-wrap: wrap;
  }

  .toast {
    left: 14px;
    right: 14px;
    bottom: 14px;
    min-width: auto;
    max-width: none;
  }
}

/* VERY SMALL PHONES */
@media (max-width: 420px) {
  .view {
    padding: 18px 12px;
  }

  .topbar {
    padding: 10px 11px;
  }

  .topbar .eyebrow {
    display: none;
  }

  .hero-card {
    padding: 18px;
  }

  .stat-card {
    padding: 16px;
  }

  .panel {
    padding: 14px;
  }

  th,
  td {
    padding: 11px 9px;
  }
}

/* REDUCED MOTION PREFERENCE */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
