:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --ink: #17211c;
  --muted: #66726c;
  --line: #dfe6e2;
  --green: #226b4a;
  --green-2: #e5f3eb;
  --blue: #1f5f8f;
  --blue-2: #e7f1f8;
  --amber: #a86709;
  --amber-2: #fbf0d8;
  --red: #b42318;
  --red-2: #fde8e5;
  --shadow: 0 18px 50px rgba(22, 35, 29, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

body:not(.authenticated) .app-header,
body:not(.authenticated) .workspace,
body:not(.authenticated) dialog,
body:not(.authenticated) .toast {
  display: none !important;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
  background:
    radial-gradient(circle at 18% 18%, rgba(22, 119, 255, 0.15), transparent 32%),
    radial-gradient(circle at 82% 75%, rgba(34, 107, 74, 0.13), transparent 34%),
    linear-gradient(145deg, #edf6ff 0%, #f5f8f7 52%, #e8f4ee 100%);
}

.authenticated .auth-shell {
  display: none;
}

.auth-card {
  width: min(430px, 100%);
  display: grid;
  gap: 22px;
  padding: 34px;
  border: 1px solid rgba(205, 218, 226, 0.9);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 30px 80px rgba(31, 68, 95, 0.15);
  backdrop-filter: blur(18px);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-brand h1 {
  font-size: 27px;
}

.auth-logo {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(145deg, #1677ff, #225fc3);
  box-shadow: 0 12px 30px rgba(22, 119, 255, 0.28);
  font-size: 24px;
  font-weight: 800;
}

.auth-intro,
.auth-tip,
.auth-change-title span {
  color: var(--muted);
  line-height: 1.7;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: #34443c;
  font-size: 14px;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  border: 1px solid #cfdbd5;
  border-radius: 12px;
  padding: 13px 14px;
  background: #fbfdfc;
  outline: none;
}

.auth-form input:focus {
  border-color: #1677ff;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
}

.auth-submit {
  min-height: 46px;
  border-radius: 12px;
}

.auth-tip {
  font-size: 12px;
  text-align: center;
}

.auth-change-title {
  display: grid;
  gap: 4px;
}

.auth-change-title strong {
  font-size: 18px;
}

.auth-error {
  border-radius: 10px;
  padding: 10px 12px;
  color: #9f1d16;
  background: #fff0ee;
  font-size: 13px;
}

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

.app-header {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(420px, 0.9fr);
  gap: 24px;
  align-items: end;
  padding: 26px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 16px;
}

.subhead {
  color: var(--muted);
  margin-top: 8px;
}

.session-chip {
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 13px;
  padding: 7px 8px 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
}

.session-chip span {
  display: grid;
  gap: 1px;
}

.session-chip small {
  color: var(--muted);
}

.session-chip button {
  border: 0;
  border-radius: 999px;
  padding: 6px 11px;
  color: #fff;
  background: #263a31;
  cursor: pointer;
}

.authenticated .role-sidebar {
  display: none;
}

.authenticated .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

.header-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.header-metrics article,
.panel,
.sub-panel,
.order-card,
.duty-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.header-metrics article {
  padding: 14px;
  box-shadow: var(--shadow);
}

.header-metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.header-metrics strong {
  font-size: 26px;
}

.workspace {
  display: grid;
  gap: 18px;
  padding: 0 26px 26px;
}

.app-shell {
  grid-template-columns: 154px minmax(0, 1fr);
  align-items: start;
}

.role-sidebar {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 10px;
}

.role-switch {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(22, 35, 29, 0.05);
}

.role-switch strong {
  font-size: 16px;
}

.role-switch span {
  color: var(--muted);
  font-size: 12px;
}

.role-switch.active {
  border-color: #ff7a4d;
  background: #fff6f1;
  color: #d94f22;
}

.role-switch.active span {
  color: #9f5839;
}

.role-stage {
  display: grid;
  justify-items: center;
}

.role-screen {
  display: none;
  width: min(430px, 100%);
}

.role-screen:not(.active) {
  display: none !important;
}

.role-screen.active {
  display: block;
}

.phone-panel.role-screen.active {
  display: flex;
}

.role-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.panel {
  padding: 18px;
  box-shadow: var(--shadow);
}

.ride-app-panel {
  padding: 0;
  overflow: hidden;
  background: #f8faf9;
}

.phone-panel {
  width: min(430px, 100%);
  height: 812px;
  overflow: hidden;
  border-radius: 22px;
  padding: 18px;
  background: #f8faf9;
  display: flex;
  flex-direction: column;
  position: relative;
}

.phone-panel .panel-head {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: -18px -18px 16px;
  padding: 18px;
  background: rgba(248, 250, 249, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.phone-panel .sub-panel,
.phone-panel .duty-card,
.phone-panel .order-card {
  box-shadow: none;
}

.phone-panel .dispatcher-layout,
.phone-panel .form-grid {
  grid-template-columns: 1fr;
}

.phone-panel .span-2 {
  grid-column: span 1;
}

.phone-panel table {
  min-width: 760px;
}

.ride-phone-shell {
  position: relative;
  height: 812px;
  overflow: hidden;
  background: #f7f8f8;
}

.ride-phone-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 20px 12px;
  background: linear-gradient(#fff8f3 0%, rgba(255, 248, 243, 0.94) 68%, rgba(255, 248, 243, 0) 100%);
}

.ride-service-tabs {
  display: flex;
  align-items: flex-end;
  font-size: 22px;
}

.ride-service-tabs strong {
  position: relative;
  color: #ff6a3a;
}

.ride-service-tabs strong::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: -8px;
  height: 4px;
  border-radius: 999px;
  background: #ff6a3a;
}

.user-map-shell {
  position: relative;
  height: 350px;
  min-height: 350px;
  background:
    linear-gradient(115deg, transparent 0 46%, rgba(255,255,255,.74) 46% 49%, transparent 49%),
    linear-gradient(25deg, transparent 0 38%, rgba(255,255,255,.7) 38% 41%, transparent 41%),
    linear-gradient(90deg, rgba(162, 192, 172, .28) 0 18%, transparent 18%),
    #e9f1ec;
}

.user-map-panel {
  position: absolute;
  inset: 0;
  min-height: 350px;
}

.map-fallback {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 350px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  background:
    linear-gradient(115deg, transparent 0 45%, rgba(255,255,255,.82) 45% 49%, transparent 49%),
    linear-gradient(18deg, transparent 0 34%, rgba(255,255,255,.78) 34% 38%, transparent 38%),
    linear-gradient(88deg, transparent 0 55%, rgba(126, 201, 150, .22) 55% 70%, transparent 70%),
    #e8f0eb;
}

.map-status-pill {
  position: absolute;
  top: 76px;
  right: 14px;
  z-index: 5;
}

.city-chip {
  position: absolute;
  top: 88px;
  left: 18px;
  z-index: 5;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.92);
  color: #1f2924;
  box-shadow: 0 8px 24px rgba(22, 35, 29, 0.08);
}

.map-callout {
  position: absolute;
  left: 50%;
  top: 152px;
  z-index: 5;
  display: grid;
  gap: 3px;
  min-width: 210px;
  transform: translateX(-32%);
  border-radius: 8px;
  padding: 12px 14px 12px 38px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 34px rgba(22, 35, 29, 0.14);
}

.callout-dot {
  position: absolute;
  left: 16px;
  top: 23px;
  width: 12px;
  height: 12px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #1fb083;
  box-shadow: 0 0 0 3px rgba(31, 176, 131, 0.2);
}

.map-callout span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.ride-card {
  position: absolute;
  left: 0;
  right: 0;
  top: 350px;
  bottom: 58px;
  z-index: 6;
  width: 100%;
  overflow: auto;
  border: 0;
  border-radius: 18px 18px 0 0;
  background: #fff;
  box-shadow: 0 -14px 42px rgba(22, 35, 29, 0.13);
  padding: 18px;
}

.ride-tabs {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 8px 8px 10px;
  border-top: 1px solid #f1f2f2;
  background: #fff;
  margin: 0;
}

.ride-tab {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px;
  cursor: pointer;
}

.ride-tab.active {
  background: transparent;
  color: #ff6a3a;
  box-shadow: none;
  font-weight: 700;
}

.user-tab-panel {
  display: none;
}

.user-tab-panel.active {
  display: block;
}

.compact-title {
  margin: 12px 0 8px;
}

.ride-form {
  display: grid;
  gap: 10px;
}

.ride-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#bossRideForm .ride-options {
  grid-template-columns: 1fr;
}

.ride-submit {
  flex: 1;
}

.ride-pickup-line,
.ride-destination-line {
  display: flex;
  align-items: center;
  gap: 11px;
}

.ride-pickup-line {
  color: #17a678;
  font-weight: 700;
  border: 2px solid #20ad83;
  border-radius: 999px;
  padding: 8px 14px;
}

.ride-pickup-line input {
  border: 0;
  padding: 4px 0;
  color: #17a678;
  font-size: 22px;
  font-weight: 800;
}

.pickup-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #18af81;
}

.ride-destination-line {
  border: 2px solid #ff7a4d;
  border-radius: 999px;
  padding: 8px 14px;
}

.ride-destination-line input {
  border: 0;
  padding: 4px 0;
  font-size: 22px;
  font-weight: 800;
}

.ride-pickup-line input:focus,
.ride-destination-line input:focus {
  outline: 0;
}

.search-mark {
  position: relative;
  width: 18px;
  height: 18px;
  border: 3px solid #161616;
  border-radius: 50%;
}

.search-mark::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 3px;
  right: -7px;
  bottom: -4px;
  transform: rotate(45deg);
  border-radius: 999px;
  background: #161616;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid #f0f1f1;
  padding-bottom: 9px;
}

.quick-actions button {
  border: 0;
  border-right: 1px solid #ecefed;
  background: transparent;
  color: #78827d;
  padding: 7px 4px;
  cursor: pointer;
}

.quick-actions button:last-child {
  border-right: 0;
}

.quick-actions button.active {
  color: #ff6a3a;
  font-weight: 700;
}

.ride-extra-panel {
  display: grid;
  gap: 10px;
  border: 1px solid #f0e6df;
  border-radius: 8px;
  padding: 10px;
  background: #fff9f5;
}

.ride-mode-summary {
  border: 1px solid #f0e6df;
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff9f5;
  color: #a14d29;
  font-size: 13px;
}

.phone-subpage {
  position: absolute;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #f8faf9;
}

.subpage-head {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 14px 12px;
  background: #fff;
}

.subpage-head button {
  border: 0;
  background: transparent;
  color: #ff6a3a;
  cursor: pointer;
  text-align: left;
}

.subpage-head strong {
  text-align: center;
}

.subpage-body {
  display: grid;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 16px 16px calc(72px + env(safe-area-inset-bottom));
}

.quick-page-list {
  align-content: start;
}

.quick-page-card {
  display: grid;
  gap: 5px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.quick-page-card span {
  color: var(--muted);
  font-size: 13px;
}

.subpage-actions {
  display: flex;
  gap: 10px;
  padding: 12px 16px 18px;
  background: #fff;
  border-top: 1px solid var(--line);
}

.subpage-actions .btn {
  flex: 1;
}

.city-subpage {
  background: #fff;
}

.city-subpage-body {
  gap: 20px;
  padding: 16px 18px 28px;
  background: #fff;
}

.city-search-field {
  display: grid;
  gap: 8px;
}

.city-search-field span {
  color: var(--muted);
  font-size: 13px;
}

.city-search-field input {
  border: 0;
  border-radius: 8px;
  padding: 13px 14px;
  background: #f1f3f5;
  font-size: 16px;
}

.city-section {
  display: grid;
  gap: 12px;
}

.city-section h3 {
  font-size: 16px;
}

.city-button-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.city-button-grid button,
.city-list button {
  border: 0;
  border-radius: 8px;
  padding: 12px 8px;
  background: #f2f4f6;
  color: #1f2924;
  cursor: pointer;
}

.city-button-grid button.active,
.city-list button.active {
  background: #fff0ea;
  color: #ff6a3a;
  font-weight: 700;
}

.city-list {
  display: grid;
  gap: 18px;
}

.city-group {
  display: grid;
  gap: 10px;
}

.city-group h4 {
  margin: 0;
  color: #1f2924;
  font-size: 17px;
}

.city-group div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.driver-tab-panel {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-bottom: 14px;
}

.driver-tab-panel.active {
  display: block;
}

.driver-mine-menu {
  display: grid;
  gap: 10px;
}

.driver-mine-menu button {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.driver-mine-menu strong {
  font-size: 17px;
}

.driver-mine-menu span {
  color: var(--muted);
  font-size: 13px;
}

.driver-bottom-tabs {
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 10px -18px -18px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.driver-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 13px 8px;
  cursor: pointer;
}

.driver-tab.active {
  color: #ff6a3a;
  font-weight: 700;
}

.admin-tab-panel {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-bottom: 14px;
}

.admin-tab-panel.active {
  display: block;
}

.admin-bottom-tabs {
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin: 10px -18px -18px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.admin-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 13px 2px;
  cursor: pointer;
  font-size: 12px;
}

.admin-tab.active {
  color: #ff6a3a;
  font-weight: 700;
}

.admin-phone-title > div {
  display: grid;
  gap: 3px;
}

.admin-form {
  display: grid;
  gap: 11px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segmented button {
  border: 0;
  border-radius: 6px;
  padding: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.segmented button.active {
  background: #fff1e9;
  color: #ff6a3a;
  font-weight: 700;
}

.contact-field {
  z-index: 15;
}

.contact-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  display: grid;
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(22, 35, 29, 0.14);
}

.contact-suggestions button {
  display: grid;
  gap: 3px;
  border: 0;
  border-bottom: 1px solid #edf1ef;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.contact-suggestions button:last-child {
  border-bottom: 0;
}

.contact-suggestions span {
  color: var(--muted);
  font-size: 12px;
}

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

.admin-stat-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.admin-stat-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.admin-stat-grid strong {
  font-size: 20px;
}

.admin-driver-list,
.contact-list,
.account-list {
  display: grid;
  gap: 10px;
}

.admin-driver-card,
.contact-list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.admin-driver-card {
  display: grid;
  gap: 10px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.admin-driver-card header,
.contact-list-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.admin-driver-card header span,
.contact-list-item span {
  color: var(--muted);
  font-size: 12px;
}

.admin-driver-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  color: #405149;
  font-size: 12px;
}

.fleet-tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}

.fleet-view {
  display: none;
}

.fleet-view.active {
  display: block;
}

.fleet-manage-list {
  display: grid;
  gap: 10px;
}

.fleet-item {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.fleet-item.inactive {
  background: #f7f8f7;
  color: #6f7c76;
}

.account-list-item.inactive {
  background: #f7f8f7;
  color: #6f7c76;
}

.account-role-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.account-list-item small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.role-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.fleet-item header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.fleet-item header span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.compact-info {
  display: grid;
  gap: 4px;
  color: #405149;
  font-size: 13px;
}

.compact-info p {
  margin: 0;
}

.odometer-warning,
.warning-text,
.detail-warning {
  color: #9f1d16;
}

.odometer-warning {
  border: 1px solid #ffd5cc;
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff3ef;
  font-size: 13px;
}

.order-card.distance-alert {
  border-color: #e53e2f;
  box-shadow: 0 0 0 2px rgba(229, 62, 47, 0.09);
}

.order-card.distance-alert header h4 {
  color: #9f1d16;
}

.phone-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.phone-title strong {
  font-size: 22px;
}

.phone-title span {
  color: var(--muted);
  font-size: 13px;
}

.driver-dev-head {
  margin-bottom: 12px;
}

.history-filter,
.stat-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 12px;
}

.driver-history-list {
  display: grid;
  gap: 8px;
}

.driver-history-item {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.driver-history-item span {
  overflow: hidden;
  color: #405149;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.driver-history-item small {
  color: var(--muted);
}

.driver-stats-grid {
  display: grid;
  gap: 10px;
}

.driver-stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.driver-stat-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.driver-stat-card strong {
  font-size: 24px;
}

.stat-detail-card {
  display: grid;
  gap: 8px;
}

.detail-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.detail-list div {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid #edf1ef;
  padding: 12px;
}

.detail-list div:last-child {
  border-bottom: 0;
}

.detail-list span {
  color: var(--muted);
  font-size: 13px;
}

.mine-panel {
  display: grid;
  gap: 12px;
}

.mine-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff8f4;
}

.mine-card span,
.mine-card p {
  color: var(--muted);
}

.mine-card strong {
  font-size: 24px;
}

.mine-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.mine-list button {
  border: 0;
  border-bottom: 1px solid #edf1ef;
  padding: 14px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.mine-list button strong,
.mine-list button span {
  display: block;
}

.mine-list button span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.mine-list button:last-child {
  border-bottom: 0;
}

.role-grid,
.dispatcher-layout,
.dispatch-side,
.panel,
.sub-panel {
  min-width: 0;
}

.panel-head,
.section-title,
.order-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-head {
  margin-bottom: 16px;
}

.section-title {
  align-items: center;
  margin-bottom: 12px;
}

.sub-panel {
  padding: 14px;
  margin-top: 14px;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
}

.city-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 8px;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: #33433b;
  font-size: 14px;
  position: relative;
}

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

.compact-grid {
  gap: 10px;
}

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

.form-actions,
.card-actions,
menu {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.form-actions {
  margin-top: 2px;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.btn.primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.btn.blue {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  padding: 7px 9px;
  font-size: 13px;
}

.btn.danger {
  border-color: #f0c2bd;
  color: var(--red);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: #edf1ef;
  color: #405149;
  font-size: 12px;
}

.badge.green {
  background: var(--green-2);
  color: var(--green);
}

.badge.blue {
  background: var(--blue-2);
  color: var(--blue);
}

.badge.amber {
  background: var(--amber-2);
  color: var(--amber);
}

.badge.red {
  background: var(--red-2);
  color: var(--red);
}

.card-list {
  display: grid;
  gap: 10px;
}

.order-card {
  padding: 14px;
}

.order-card h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.route {
  margin-top: 10px;
  line-height: 1.55;
}

.route-plan {
  border: 1px dashed #b9c8c0;
  border-radius: 8px;
  padding: 10px 11px;
  background: #f8fbf9;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.route-plan.ready {
  border-color: #9bc3ad;
  background: var(--green-2);
  color: var(--green);
}

.location-status {
  margin-top: 0;
  border-color: rgba(26, 115, 232, 0.22);
  background: rgba(26, 115, 232, 0.07);
  color: #174ea6;
}

.location-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
  margin-top: 10px;
}

.location-actions .btn {
  white-space: nowrap;
}

.driver-tracking-card {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(26, 115, 232, 0.22);
  background: linear-gradient(135deg, rgba(26, 115, 232, 0.08), rgba(33, 177, 126, 0.08));
  color: #174ea6;
  font-size: 14px;
  line-height: 1.5;
}

.driver-tracking-card strong {
  display: block;
  margin-bottom: 3px;
  color: #0b57d0;
  font-size: 15px;
}

.driver-tracking-card small {
  display: block;
  color: var(--muted);
}

.car-marker {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #1677ff;
  color: #fff;
  box-shadow: 0 8px 18px rgba(22, 119, 255, 0.28);
  border: 2px solid #fff;
  font-size: 19px;
}

.route-plan-button {
  width: 100%;
}

.map-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 12;
  display: grid;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(22, 35, 29, 0.14);
}

.map-suggestions.hidden {
  display: none;
}

.suggestion-item {
  display: grid;
  gap: 3px;
  border: 0;
  border-bottom: 1px solid #edf1ef;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.suggestion-item:hover {
  background: #f6faf8;
}

.suggestion-item:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.58;
}

.suggestion-item:last-child {
  border-bottom: 0;
}

.suggestion-item span,
.suggestion-empty {
  color: var(--muted);
  font-size: 12px;
}

.destination-quick {
  display: flex;
  gap: 7px;
  align-items: center;
  overflow-x: auto;
  padding: 2px 0 8px;
  scrollbar-width: thin;
}

.destination-quick > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.destination-quick button {
  flex: 0 0 auto;
  max-width: 220px;
  overflow: hidden;
  border: 1px solid #eadfd8;
  border-radius: 999px;
  padding: 7px 10px;
  background: #fff9f5;
  color: #8b4a2e;
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-address-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.saved-address-main {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.saved-address-main span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.driver-note {
  display: grid;
  gap: 5px;
  border: 1px solid #ff9b73;
  border-left: 5px solid #ff6a3a;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff4ee;
  color: #7d3218;
}

.driver-note span {
  line-height: 1.55;
}

.level-heading {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  color: var(--ink);
}

.level-heading span {
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--green-2);
  color: var(--green);
  font-size: 12px;
}

.month-order-filter {
  display: grid;
  grid-template-columns: minmax(130px, 0.6fr) minmax(180px, 1.4fr) auto;
  gap: 8px;
  margin-bottom: 12px;
}

@media (max-width: 560px) {
  .saved-address-card,
  .month-order-filter,
  .location-actions {
    grid-template-columns: 1fr;
  }

  .saved-address-actions {
    justify-content: flex-end;
  }
}

.suggestion-empty {
  padding: 11px 12px;
}

.map-panel {
  width: 100%;
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #edf1ef;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.muted {
  color: var(--muted);
}

.duty-card {
  padding: 14px;
}

.duty-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.duty-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.dispatcher-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: start;
}

.compact-form {
  align-self: start;
}

.dispatch-side {
  display: grid;
  gap: 14px;
}

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

.status-item,
.mini-report-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfb;
}

.status-item strong,
.mini-report-row strong {
  display: block;
  margin-bottom: 4px;
}

.mini-report {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  background: #f8faf9;
}

td {
  font-size: 14px;
}

.stack {
  display: grid;
  gap: 4px;
}

.actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.toast {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 20;
  max-width: 460px;
  border-radius: 8px;
  padding: 12px 14px;
  background: #15231b;
  color: #fff;
  box-shadow: var(--shadow);
}

.toast.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.24);
}

dialog::backdrop {
  background: rgba(13, 22, 17, 0.38);
}

.dialog-card {
  display: grid;
  gap: 14px;
  width: min(500px, calc(100vw - 30px));
  padding: 20px;
}

.confirm-body {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8faf9;
}

.confirm-body div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #ebf0ed;
  padding-bottom: 7px;
}

.confirm-body div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-check input {
  width: auto;
}

menu {
  justify-content: flex-end;
  padding: 0;
  margin: 6px 0 0;
}

@media (max-width: 1180px) {
  .app-header,
  .role-grid,
  .dispatcher-layout {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 138px minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .auth-card {
    padding: 26px 20px;
    border-radius: 18px;
  }

  .app-header,
  .workspace {
    padding-left: 14px;
    padding-right: 14px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .role-sidebar {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .role-switch {
    padding: 10px 9px;
    text-align: center;
  }

  .header-metrics,
  .form-grid,
  .status-grid,
  .mini-report {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .panel-head,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .user-map-shell {
    height: 350px;
    min-height: 350px;
    display: block;
  }

  .user-map-panel {
    position: absolute;
    min-height: 350px;
  }

  .map-fallback {
    min-height: 350px;
  }

  .ride-card {
    position: absolute;
    left: 0;
    right: 0;
    top: 350px;
    bottom: 58px;
    width: 100%;
    margin: 0;
  }

  .ride-options {
    grid-template-columns: 1fr;
    display: grid;
  }

  .map-status-pill {
    top: 76px;
    right: 10px;
  }
}
