:root {
  --ink: #17242b;
  --muted: #65747d;
  --line: #c8d4d9;
  --navy: #00616a;
  --navy-dark: #004950;
  --navy-deep: #00353b;
  --blue: #d9eaf7;
  --green: #e2f0d9;
  --amber: #fff2cc;
  --red: #fce4d6;
  --gray: #f4f7f8;
  --white: #ffffff;
  --shadow: 0 10px 30px rgba(23, 36, 43, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: #f3f6f7;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
}

button, input, select, textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

.launch-hidden {
  display: none !important;
}

body.sales-trip-view .ops-only-trip-action {
  display: none;
}

body:not(.is-admin) .admin-only {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #f3f6f7;
}

.login-card {
  width: min(420px, 100%);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  gap: 14px;
}

.login-card .brand-mark {
  background: var(--navy);
  color: var(--white);
}

.login-logo {
  width: 82px;
  height: 82px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  padding: 6px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border: 1px solid rgba(255,255,255,0.28);
  background: var(--white);
  padding: 4px;
}

.login-card h1 {
  margin: 0;
  font-size: 26px;
}

.login-card p {
  margin: -8px 0 4px;
  color: var(--muted);
}

.association-box {
  border: 1px solid var(--line);
  background: var(--gray);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.35;
}

.demo-logins {
  display: grid;
  gap: 4px;
  padding: 10px;
  background: var(--gray);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
}

.record-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  padding: 12px;
  background: var(--gray);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.record-summary div {
  display: grid;
  gap: 3px;
}

.record-summary span {
  color: var(--muted);
  font-size: 11px;
}

.record-summary strong {
  font-size: 13px;
  font-weight: 700;
}

.login-message {
  min-height: 20px;
  color: #8a1f11;
  font-weight: 700;
}

.notification-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: min(360px, calc(100vw - 32px));
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 5px solid var(--navy);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px;
  z-index: 3000;
}

.notification-toast-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.notification-toast strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.notification-toast p {
  flex: 1;
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.notification-bell {
  position: relative;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  margin-right: 10px;
}

.notification-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #b3261e;
  color: var(--white);
  font-size: 11px;
  line-height: 20px;
  text-align: center;
}

.app-shell {
  min-height: 100vh;
  display: block;
}

.sidebar {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: var(--white);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 8px 22px rgba(23, 36, 43, 0.16);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255,255,255,0.28);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.brand h1 {
  margin: 0;
  font-size: 15px;
  line-height: 1.15;
  white-space: nowrap;
}

.brand p {
  margin: 3px 0 0;
  color: rgba(255,255,255,0.68);
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  padding: 2px 0;
  scrollbar-width: thin;
}

.nav-item {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.78);
  text-align: center;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  flex: 0 0 auto;
  min-height: 36px;
  white-space: nowrap;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255,255,255,0.12);
  color: var(--white);
}

.nav-user-chip {
  color: var(--white);
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 6px;
  padding: 8px 10px;
  font-weight: 800;
  white-space: nowrap;
  flex: 0 0 auto;
  margin-left: auto;
}

.logout-nav {
  background: rgba(255,255,255,0.08);
  color: #ffd8ce;
  border: 1px solid rgba(255,255,255,0.14);
  margin-left: 0;
}

.logout-nav:hover {
  background: rgba(255,255,255,0.16);
  color: var(--white);
}

.storage-card {
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,0.16);
  padding: 8px 10px;
  border-radius: 6px;
  display: grid;
  gap: 3px;
  min-width: 160px;
}

.storage-card span {
  color: rgba(255,255,255,0.68);
}

.storage-card,
.legacy-dashboard-metrics {
  display: none !important;
}

.workspace {
  min-width: 0;
  padding: 12px;
}

.topbar {
  display: none !important;
}

.topbar h2 {
  margin: 0;
  font-size: 19px;
}

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
}

.top-actions,
.form-actions,
.settings-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.header-user {
  min-width: 200px;
  border: 1px solid var(--line);
  background: var(--gray);
  border-radius: 8px;
  padding: 8px 10px;
  display: grid;
  gap: 3px;
}

.user-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

#currentUserName {
  color: var(--ink);
  font-size: 14px;
}

#currentUserRole {
  color: var(--navy);
  font-weight: 700;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 12px;
  cursor: pointer;
  background: var(--white);
}

.primary-btn {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
  font-weight: 700;
}

.danger-btn {
  color: #8a1f11;
  border-color: #e3ad9e;
  background: #fff7f4;
}

.file-btn input {
  display: none;
}

.view { display: none; }
.view.active { display: block; }

.dashboard-hero {
  background: linear-gradient(135deg, var(--navy-deep), var(--navy));
  color: var(--white);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  box-shadow: var(--shadow);
}

.dashboard-hero h3 {
  margin: 3px 0 0;
  font-size: 20px;
  letter-spacing: 0;
}

.dashboard-eyebrow,
.dashboard-date {
  color: rgba(255,255,255,0.76);
  font-weight: 700;
}

.dashboard-date {
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 6px;
  padding: 8px 10px;
  white-space: nowrap;
}

.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.snapshot-card,
.mini-stat,
.alert-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}

.snapshot-card {
  min-height: 108px;
  padding: 14px;
  display: grid;
  gap: 7px;
  box-shadow: var(--shadow);
}

.snapshot-card span,
.mini-stat span,
.alert-card span {
  color: var(--muted);
  font-weight: 700;
}

.snapshot-card strong {
  font-size: 27px;
  line-height: 1;
}

.snapshot-card small {
  color: var(--muted);
  line-height: 1.35;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr);
  gap: 12px;
  margin-bottom: 12px;
}

.module-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.module-dashboard-grid > .panel:nth-child(3),
.module-dashboard-grid > .panel:nth-child(6) {
  grid-column: span 2;
}

.mini-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
  padding: 12px;
}

.mini-stat {
  min-height: 84px;
  padding: 12px;
  display: grid;
  gap: 6px;
  align-content: center;
}

.mini-stat strong {
  font-size: 23px;
  line-height: 1.1;
}

.mini-stat.green {
  border-color: #bad9b4;
  background: #f2fbef;
}

.mini-stat.amber {
  border-color: #ead49b;
  background: #fff8df;
}

.mini-stat.red {
  border-color: #e8b8af;
  background: #fff1ee;
}

.alert-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.alert-card {
  min-height: 88px;
  padding: 14px;
  display: grid;
  gap: 8px;
  align-content: center;
}

.alert-card strong {
  font-size: 25px;
}

.alert-card.danger {
  border-color: #e7b3b3;
  background: #fff1f1;
  color: #b3261e;
}

.alert-card.amber {
  border-color: #ead49b;
  background: #fff8df;
  color: #9a6200;
}

.alert-card.blue {
  border-color: #b8d2eb;
  background: #eef7ff;
  color: #1c5c94;
}

.today-work-panel {
  min-width: 0;
}

.dashboard-view .topbar {
  display: none;
}

.dashboard-view .workspace {
  padding: 18px 20px;
}

.dashboard-view .sidebar {
  padding-top: 8px;
}

.dashboard-view .storage-card {
  display: none;
}

.founder-secondary-hidden {
  display: none !important;
}

.duplicate-action-panel,
.duplicate-action-btn {
  display: none !important;
}

.founder-kpi-grid {
  display: none;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.founder-kpi {
  min-height: 128px;
  background: var(--white);
  border: 1px solid #dde6ea;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(23, 36, 43, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 18px 14px;
  text-align: center;
  color: inherit;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.founder-kpi:hover {
  border-color: #9fc7d0;
  box-shadow: 0 10px 24px rgba(23, 36, 43, 0.1);
  transform: translateY(-1px);
}

.founder-kpi:focus-visible {
  outline: 3px solid rgba(0, 104, 114, 0.26);
  outline-offset: 2px;
}

.founder-kpi div {
  display: grid;
  gap: 5px;
}

.founder-kpi span {
  color: #2a363b;
  font-weight: 800;
}

.founder-kpi strong {
  color: #111b20;
  font-size: 30px;
  line-height: 1;
}

.founder-kpi small {
  color: #3e4d54;
  font-weight: 700;
}

.founder-summary-grid {
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.founder-summary-card {
  min-height: 260px;
  padding: 18px;
}

.founder-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.founder-panel-head h3,
.quick-action-panel h3 {
  margin: 0;
  font-size: 18px;
}

.founder-panel-head span {
  color: #1b70ad;
  font-weight: 800;
}

.summary-chart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) 150px;
  align-items: center;
  gap: 14px;
}

.summary-lines {
  display: grid;
}

.summary-lines div {
  min-height: 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-top: 1px solid #e6edf0;
}

.summary-lines div:first-child {
  border-top: 0;
}

.summary-lines span {
  color: #3a474d;
  font-weight: 700;
}

.summary-lines strong {
  font-size: 15px;
}

.danger-text {
  color: #e3403d;
}

.line-chart-card {
  position: relative;
  height: 150px;
  border-left: 1px solid #e1e9ed;
  background:
    linear-gradient(180deg, rgba(107, 181, 92, 0.18), rgba(107, 181, 92, 0.03)),
    linear-gradient(90deg, transparent 24%, rgba(0,0,0,0.04) 25%, transparent 26%, transparent 49%, rgba(0,0,0,0.04) 50%, transparent 51%, transparent 74%, rgba(0,0,0,0.04) 75%, transparent 76%);
  overflow: hidden;
}

.line-chart-card span,
.line-chart-card::before,
.line-chart-card::after {
  position: absolute;
  left: 8px;
  right: 8px;
  content: "";
}

.line-chart-card span {
  bottom: 24px;
  height: 82px;
  border-bottom: 4px solid #78b76a;
  border-right: 4px solid #78b76a;
  transform: skewY(-32deg);
  transform-origin: bottom left;
}

.line-chart-card::before {
  bottom: 62px;
  height: 50px;
  border-bottom: 4px solid #78b76a;
  border-right: 4px solid #78b76a;
  transform: skewY(28deg);
  opacity: 0.88;
}

.line-chart-card::after {
  bottom: 10px;
  height: 1px;
  background: #e1e9ed;
}

.donut-chart {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  position: relative;
  margin: auto;
}

.donut-chart::after {
  content: "";
  position: absolute;
  inset: 38px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: inset 0 0 0 1px #e6edf0;
}

.trip-donut {
  background: conic-gradient(#2b78bd 0 var(--completed, 62%), #84b5e4 var(--completed, 62%) var(--ongoing, 82%), #dfe9f4 var(--ongoing, 82%) 100%);
}

.payment-donut {
  background: conic-gradient(#66b33f 0 var(--received, 58%), #f6aa27 var(--received, 58%) var(--pending, 78%), #e74d40 var(--pending, 78%) 100%);
}

.quick-action-panel {
  padding: 18px;
}

.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 24px;
  margin-top: 18px;
}

.quick-action-tile {
  min-height: 116px;
  border-radius: 8px;
  border: 1px solid #dce7eb;
  background: var(--white);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(23, 36, 43, 0.04);
}

.quick-action-tile strong {
  font-size: 15px;
  line-height: 1.25;
}

.quick-action-tile.green { background: #f4fbf4; border-color: #d5ebd5; color: #1e9d48; }
.quick-action-tile.blue { background: #f3f8ff; border-color: #d6e7fb; color: #2878c8; }
.quick-action-tile.teal { background: #f1fbfb; border-color: #d1eded; color: #188e94; }
.quick-action-tile.purple { background: #f8f4ff; border-color: #e4d9fa; color: #7752b8; }
.quick-action-tile.lime { background: #f5fbf1; border-color: #d9edcf; color: #4f9d33; }
.quick-action-tile.orange { background: #fff7ef; border-color: #f3dfcb; color: #ef7e1b; }

.quick-action-tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 20px rgba(23, 36, 43, 0.08);
}

.module-dashboard {
  margin-bottom: 16px;
}

.module-dashboard-shell {
  display: grid;
  gap: 14px;
}

.module-title-card {
  background: linear-gradient(135deg, var(--navy-deep), var(--navy));
  color: var(--white);
  border-radius: 8px;
  padding: 14px 18px;
  display: block;
  box-shadow: var(--shadow);
}

.module-title-card span {
  color: rgba(255,255,255,0.72);
  font-weight: 800;
}

.module-title-card h3 {
  margin: 0;
  font-size: 21px;
}

.module-title-card p {
  margin: 0;
  color: rgba(255,255,255,0.82);
  max-width: 520px;
  line-height: 1.45;
  text-align: right;
}

.module-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.module-kpi {
  min-height: 112px;
  border: 1px solid #dde6ea;
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 6px 18px rgba(23, 36, 43, 0.05);
  padding: 14px;
  display: grid;
  place-items: center;
  text-align: center;
}

.module-kpi div {
  display: grid;
  gap: 7px;
  min-width: 0;
  justify-items: center;
}

.module-kpi span {
  color: #35454c;
  font-weight: 800;
}

.module-kpi strong {
  font-size: 22px;
  line-height: 1.15;
  word-break: break-word;
}

.module-kpi small {
  color: var(--muted);
  font-weight: 700;
}

.module-kpi.green { background: #eaf8ed; border-color: #b8dfc0; }
.module-kpi.blue { background: #eaf4ff; border-color: #b9d7f4; }
.module-kpi.orange { background: #fff1df; border-color: #edc99f; }
.module-kpi.lime { background: #edf8e7; border-color: #c6e0b9; }
.module-kpi.purple { background: #f1ebff; border-color: #d5c4f3; }
.module-kpi.red { background: #ffebeb; border-color: #e9b8b8; }
.module-kpi.teal { background: #e7f7f7; border-color: #b8dddd; }

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

.module-summary-card {
  min-height: 212px;
  padding: 16px;
}

.module-action-panel {
  padding: 16px;
}

.module-action-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.module-action-grid .quick-action-tile {
  min-height: 96px;
}

.dashboard-module-overview-panel {
  padding: 18px;
  margin-bottom: 18px;
}

.dashboard-home-modules {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.home-dashboard-card {
  border: 1px solid #dce7eb;
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 6px 18px rgba(23, 36, 43, 0.05);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
}

.home-dashboard-head {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-bottom: 1px solid #e2eaee;
  background: #f8fbfc;
  color: var(--ink);
  display: grid;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  text-align: center;
  cursor: pointer;
}

.home-dashboard-head strong {
  font-size: 18px;
}

.home-dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  background: transparent;
  padding: 14px;
}

.home-dashboard-metric {
  min-height: 128px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--white);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 20px 16px;
  text-align: center;
  color: var(--ink);
  cursor: pointer;
}

.home-dashboard-metric span {
  color: #4d5d64;
  font-weight: 800;
  font-size: 15px;
}

.home-dashboard-metric strong {
  font-size: 28px;
  line-height: 1.1;
  word-break: break-word;
}

.home-dashboard-head:hover,
.home-dashboard-metric:hover {
  background: #f2f8fa;
}

.home-dashboard-card.green { border-color: #b8dfc0; }
.home-dashboard-card.blue { border-color: #b9d7f4; }
.home-dashboard-card.orange { border-color: #edc99f; }
.home-dashboard-card.purple { border-color: #d5c4f3; }
.home-dashboard-card.lime { border-color: #c6e0b9; }
.home-dashboard-card.red { border-color: #e9b8b8; }

.home-dashboard-card.green .home-dashboard-head { background: #eaf8ed; }
.home-dashboard-card.blue .home-dashboard-head { background: #eaf4ff; }
.home-dashboard-card.orange .home-dashboard-head { background: #fff1df; }
.home-dashboard-card.purple .home-dashboard-head { background: #f1ebff; }
.home-dashboard-card.lime .home-dashboard-head { background: #edf8e7; }
.home-dashboard-card.red .home-dashboard-head { background: #ffebeb; }

.home-dashboard-metric.green { background: #eaf8ed; border: 1px solid #b8dfc0; }
.home-dashboard-metric.blue { background: #eaf4ff; border: 1px solid #b9d7f4; }
.home-dashboard-metric.orange { background: #fff1df; border: 1px solid #edc99f; }
.home-dashboard-metric.purple { background: #f1ebff; border: 1px solid #d5c4f3; }
.home-dashboard-metric.lime { background: #edf8e7; border: 1px solid #c6e0b9; }
.home-dashboard-metric.red { background: #ffebeb; border: 1px solid #e9b8b8; }

.dashboard-module-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-module-card {
  min-height: 106px;
  border: 1px solid #dce7eb;
  border-radius: 8px;
  background: var(--white);
  display: grid;
  gap: 6px;
  align-content: center;
  text-align: left;
  padding: 14px;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(23, 36, 43, 0.04);
}

.dashboard-module-card span {
  color: #35454c;
  font-weight: 900;
}

.dashboard-module-card strong {
  font-size: 22px;
  line-height: 1.1;
}

.dashboard-module-card small {
  color: var(--muted);
  font-weight: 700;
}

.dashboard-module-card.green { border-color: #d5ebd5; background: #f4fbf4; color: #1e9d48; }
.dashboard-module-card.blue { border-color: #d6e7fb; background: #f3f8ff; color: #2878c8; }
.dashboard-module-card.orange { border-color: #f3dfcb; background: #fff7ef; color: #ef7e1b; }
.dashboard-module-card.lime { border-color: #d9edcf; background: #f5fbf1; color: #4f9d33; }
.dashboard-module-card.purple { border-color: #e4d9fa; background: #f8f4ff; color: #7752b8; }
.dashboard-module-card.red { border-color: #efcdcd; background: #fff1f1; color: #d5332f; }
.dashboard-module-card.teal { border-color: #d1eded; background: #f1fbfb; color: #188e94; }

.dashboard-module-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 20px rgba(23, 36, 43, 0.08);
}

.section-title {
  background: var(--navy);
  color: var(--white);
  text-align: center;
  padding: 8px 10px;
  margin: 12px 0 0;
  border-radius: 6px 6px 0 0;
}

.section-title h3 {
  margin: 0;
  font-size: 14px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  align-items: start;
}

.summary-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.summary-card h3 {
  margin: 0;
  background: var(--navy);
  color: var(--white);
  padding: 8px 10px;
  font-size: 14px;
}

.summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
}

.summary-row:nth-child(even) {
  background: #f7fbfc;
}

.summary-row span {
  color: var(--ink);
  font-weight: 700;
}

.summary-row strong {
  min-width: 48px;
  text-align: right;
  color: var(--navy);
  font-size: 20px;
}

.payment-card {
  grid-column: span 2;
}

.metric-grid {
  display: grid;
  gap: 0;
  margin-bottom: 8px;
}

.metric-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.metric-grid.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.metric {
  min-height: 92px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 10px;
}

.metric span {
  font-weight: 700;
}

.metric strong {
  display: block;
  font-size: 28px;
}

.blue { background: var(--blue); }
.green { background: var(--green); }
.amber { background: var(--amber); }
.red { background: var(--red); }

.split-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.alert-panel {
  grid-column: 1 / -1;
  border-color: #e3ad9e;
}

.alert-panel .panel-head {
  background: #fff7f4;
}

.alert-panel .panel-head h3 {
  color: #8a1f11;
}

.no-financial .financial-only {
  display: none !important;
}

.role-dashboard-panel {
  margin-top: 18px;
}

.role-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  padding: 14px;
}

.role-detail {
  border: 1px solid var(--line);
  background: var(--gray);
  border-radius: 6px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.role-detail span {
  color: var(--muted);
  font-weight: 700;
}

.role-detail strong {
  color: var(--navy);
  font-size: 24px;
}

.notification-panel {
  margin-top: 18px;
}

.notification-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
}

.notification-card {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px;
  display: grid;
  gap: 6px;
  min-height: 78px;
}

.notification-card span {
  color: var(--muted);
  font-weight: 700;
}

.notification-card strong {
  color: #8a1f11;
  font-size: 24px;
}

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-head h3 {
  margin: 0;
  font-size: 15px;
}

.panel-head span {
  color: var(--muted);
}

.panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-btn:disabled,
.mini-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.form-grid,
.inline-form {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 10px;
  box-shadow: var(--shadow);
}

.form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.inline-form {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  margin-bottom: 16px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.wide {
  grid-column: span 2;
}

.form-section-title {
  grid-column: 1 / -1;
  padding-top: 4px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  border-top: 1px solid var(--line);
}

.form-section-title:first-of-type {
  border-top: 0;
  padding-top: 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 9px;
  color: var(--ink);
  background: var(--white);
  min-height: 34px;
}

textarea {
  resize: vertical;
}

.form-summary {
  grid-column: 1 / -1;
  background: var(--gray);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.form-actions {
  grid-column: 1 / -1;
}

.table-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 220px;
  gap: 10px;
  margin-bottom: 12px;
}

.table-wrap {
  overflow: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.table-wrap.compact {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 680px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr:nth-child(even) {
  background: #f7fbfc;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.mini-btn {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 5px;
  padding: 5px 8px;
  cursor: pointer;
}

.status-pill {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--gray);
  border: 1px solid var(--line);
}

.status-button {
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.status-button:hover {
  border-color: var(--blue);
  background: #eaf4ff;
}

.table-control {
  min-width: 132px;
  min-height: 32px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--white);
}

.status-date,
.muted-dash {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--muted);
  font-weight: 700;
}

.lock-note {
  display: inline-flex;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(23, 36, 43, 0.42);
}

.modal-panel {
  width: min(860px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(23, 36, 43, 0.24);
}

.trip-modal-panel {
  width: min(1040px, 100%);
}

.small-modal {
  width: min(560px, 100%);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
}

.modal-head span {
  color: var(--muted);
  font-weight: 700;
}

.modal-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.settings-table {
  display: grid;
}

.settings-row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.settings-row:first-child {
  border-top: 0;
}

.settings-row > label:first-child {
  color: var(--ink);
}

.settings-row select,
.settings-row .settings-actions {
  max-width: 560px;
}

.role-panel {
  margin-top: 16px;
}

.report-grid {
  display: grid;
  gap: 16px;
}

.profile-card {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.profile-card div {
  background: var(--gray);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.profile-card span {
  color: var(--muted);
  font-weight: 700;
}

.password-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  padding: 14px;
}

.driver-trip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  padding: 14px;
}

.driver-trip-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.driver-trip-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.driver-trip-card header span {
  color: var(--navy);
  font-weight: 700;
}

.driver-trip-card p {
  margin: 0;
  color: var(--muted);
}

.driver-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.driver-detail-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--gray);
  display: grid;
  gap: 4px;
}

.driver-detail-item.wide {
  grid-column: 1 / -1;
}

.driver-detail-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.driver-detail-item strong {
  color: var(--ink);
  white-space: pre-wrap;
}

.driver-detail-actions {
  padding: 0 18px 18px;
}

.driver-submit-step {
  display: grid;
  gap: 14px;
}

.inner-modal-form {
  padding: 0;
}

.signature-box {
  display: grid;
  gap: 8px;
}

.signature-box span {
  color: var(--ink);
  font-weight: 800;
}

.signature-box canvas,
.signature-preview {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.signature-box canvas {
  height: 220px;
  touch-action: none;
  cursor: crosshair;
}

.signature-preview {
  min-height: 120px;
  object-fit: contain;
}

.driver-submit-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.driver-submit-form textarea,
.driver-submit-form button {
  grid-column: span 2;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.query-status-new-lead td {
  background: #f7fbff;
}

.query-status-quotation-send td {
  background: #fff8df;
}

.query-status-follow-up td {
  background: #eef6fb;
}

.query-status-awaiting-confirmation td {
  background: #f3f1ff;
}

.query-status-confirmed td {
  background: #edf8ef;
}

.query-status-cancelled td {
  background: #f4f7f8;
  color: #6f7b82;
}

.query-overdue td {
  background: #fff0eb;
}

.query-due-today td {
  background: #fff8df;
}

.query-needs-followup td {
  background: #eef6fb;
}

.trip-status-upcoming td {
  background: #f7fbff;
}

.trip-status-assigned td {
  background: #edf8ef;
}

.trip-status-ongoing td {
  background: #fff8df;
}

.trip-status-submitted-to-ops td {
  background: #eef6fb;
}

.trip-status-completed td {
  background: #f4f7f8;
}

.trip-status-cancelled td {
  background: #fff0eb;
  color: #6f4c46;
}

.activity-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.activity-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--white);
  display: grid;
  gap: 4px;
}

.activity-list span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.activity-list p {
  margin: 0;
  line-height: 1.45;
}

.admin-only {
  margin-bottom: 16px;
}

.staff-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)) auto;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar {
    padding: 12px;
    gap: 10px;
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .brand {
    width: 100%;
  }
  .brand-mark {
    width: 38px;
    height: 38px;
  }
  .brand h1 {
    font-size: 15px;
  }
  .brand p,
  .storage-card {
    display: none;
  }
  .nav {
    width: 100%;
    gap: 8px;
  }
  .nav-item {
    background: rgba(255,255,255,0.08);
  }
  .topbar { align-items: flex-start; flex-direction: column; }
  .header-user { width: 100%; min-width: 0; }
  .dashboard-hero {
    align-items: flex-start;
    flex-direction: column;
  }
  .founder-kpi-grid,
  .quick-action-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .founder-summary-grid {
    grid-template-columns: 1fr;
  }
  .module-title-card {
    align-items: flex-start;
    flex-direction: column;
  }
  .module-title-card p {
    text-align: left;
  }
  .module-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .dashboard-home-modules {
    grid-template-columns: 1fr;
  }
  .home-dashboard-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .dashboard-module-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .module-summary-grid {
    grid-template-columns: 1fr;
  }
  .snapshot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-layout,
  .module-dashboard-grid,
  .module-dashboard-grid > .panel:nth-child(3),
  .module-dashboard-grid > .panel:nth-child(6) {
    grid-template-columns: 1fr;
    grid-column: auto;
  }
  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .notification-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .payment-card {
    grid-column: span 2;
  }
  .split-panels,
  .form-grid,
  .modal-form,
  .inline-form,
  .driver-form {
    grid-template-columns: 1fr;
  }
  .wide { grid-column: auto; }
}

@media (max-width: 700px) {
  body {
    font-size: 13px;
    background: var(--white);
  }

  .workspace {
    padding: 12px;
  }

  .topbar {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 12px;
  }

  .topbar h2 {
    font-size: 19px;
  }

  .topbar p {
    font-size: 12px;
  }

  .top-actions,
  .form-actions,
  .settings-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary-btn,
  .ghost-btn,
  .danger-btn {
    min-height: 42px;
    width: 100%;
  }

  .section-title {
    margin-top: 12px;
    border-radius: 6px;
  }

  .metric-grid {
    gap: 8px;
    margin-top: 8px;
  }

  .metric {
    min-height: 76px;
    border-radius: 6px;
  }

  .metric-grid.three,
  .metric-grid.four,
  .metric-grid.five,
  .metric-grid.six {
    grid-template-columns: 1fr;
  }

  .summary-strip,
  .snapshot-grid,
  .mini-stat-grid,
  .alert-card-grid,
  .payment-card,
  .notification-grid {
    grid-template-columns: 1fr;
    grid-column: auto;
  }

  .dashboard-hero h3 {
    font-size: 18px;
  }

  .dashboard-view .sidebar {
    padding-top: 12px;
  }

  .founder-kpi-grid,
  .quick-action-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .founder-kpi {
    min-height: 94px;
    justify-content: flex-start;
    text-align: left;
  }

  .summary-chart-layout {
    grid-template-columns: 1fr;
  }

  .line-chart-card,
  .donut-chart {
    width: 100%;
    max-width: 180px;
    justify-self: center;
  }

  .quick-action-grid {
    margin-top: 12px;
  }

  .module-kpi-grid,
  .dashboard-home-modules,
  .dashboard-module-strip,
  .module-action-grid {
    grid-template-columns: 1fr;
  }

  .home-dashboard-card {
    grid-template-columns: 1fr;
  }

  .home-dashboard-head {
    min-height: 62px;
    border-right: 0;
    border-bottom: 1px solid #e2eaee;
  }

  .home-dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .module-kpi {
    min-height: 90px;
  }

  .summary-card {
    border-radius: 6px;
  }

  .summary-row {
    min-height: 42px;
  }

  .metric strong {
    font-size: 24px;
  }

  .split-panels {
    gap: 12px;
  }

  .panel,
  .form-grid,
  .inline-form {
    border-radius: 6px;
    padding: 12px;
  }

  .panel {
    padding: 0;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  label {
    gap: 5px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .form-summary {
    display: grid;
    gap: 8px;
  }

  .table-toolbar {
    grid-template-columns: 1fr;
  }

  .settings-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
  }

  .staff-form {
    grid-template-columns: 1fr;
  }

  .profile-card,
  .driver-detail-grid,
  .password-form,
  .driver-submit-form {
    grid-template-columns: 1fr;
  }

  .driver-submit-form textarea,
  .driver-submit-form button {
    grid-column: auto;
  }

  .settings-row select,
  .settings-row .settings-actions {
    max-width: none;
  }

  .table-wrap {
    border: 0;
    box-shadow: none;
    overflow: visible;
    background: transparent;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody tr {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 10px;
    overflow: hidden;
  }

  tbody tr:nth-child(even) {
    background: var(--white);
  }

  td {
    border-bottom: 1px solid var(--line);
    display: grid;
    grid-template-columns: 42% 1fr;
    gap: 10px;
    white-space: normal;
    padding: 10px 12px;
    min-height: 38px;
  }

  td:last-child {
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 700;
  }

  td[colspan] {
    display: block;
    text-align: center;
  }

  td[colspan]::before {
    content: "";
  }

  .row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .mini-btn {
    min-height: 36px;
  }
}
