/* ============================================
   关务通 · 保税区车辆协同系统 样式文件
   ============================================ */

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
  --blue-900: #1a365d;
  --blue-800: #1e4d8c;
  --blue-700: #2563eb;
  --blue-600: #3b82f6;
  --blue-500: #4f8ff7;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;
  --orange: #f59e0b;
  --orange-light: #fef3c7;
  --red: #ef4444;
  --red-light: #fef2f2;
  --green: #10b981;
  --green-light: #ecfdf5;
  --gray-900: #111827;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50: #f9fafb;
  --white: #fafbfc;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.05);
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: linear-gradient(135deg, #f0f4f8 0%, #e8edf3 100%);
  color: var(--gray-900);
  min-height: 100vh;
  line-height: 1.5;
}

/* ============================================
   Login Page
   ============================================ */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-800) 50%, #15406a 100%);
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 400px;
  max-width: 95%;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
  font-size: 24px;
  font-weight: 700;
  color: var(--blue-900);
  letter-spacing: 1px;
}
.login-group { margin-bottom: 18px; }
.login-group label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--gray-700); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .5px;
}
.login-input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm); font-size: 14px;
  font-family: var(--font); transition: border-color .15s;
  background: var(--white);
}
.login-input:focus {
  outline: none; border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}
.login-btn {
  width: 100%; padding: 13px; background: var(--blue-700);
  color: white; border: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 600; cursor: pointer;
  font-family: var(--font); margin-top: 12px;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
  transition: all .15s ease;
}
.login-btn:hover { background: var(--blue-800); transform: translateY(-1px); }
.login-error {
  color: var(--red); font-size: 12px;
  text-align: center; margin-top: 10px; display: none;
}
.login-hint {
  text-align: center; font-size: 11px; color: var(--gray-400);
  margin-top: 16px; line-height: 1.6;
}
.login-switch {
  text-align: center; font-size: 13px; color: var(--gray-500);
  margin-top: 16px;
}
.login-switch a {
  color: var(--blue-700); font-weight: 600; text-decoration: none;
  cursor: pointer;
}
.login-switch a:hover { color: var(--blue-600); text-decoration: underline; }

/* ============================================
   Main App (hidden before login)
   ============================================ */
#app-main { display: none; }
#app-main.logged-in { display: block; }

/* ============================================
   Navigation Tabs
   ============================================ */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(135deg, var(--blue-900), var(--blue-800));
  padding: 0 20px;
  display: flex; align-items: center; gap: 4px;
  box-shadow: var(--shadow-lg);
  border-bottom: 2px solid rgba(255,255,255,.1);
}
.nav-logo {
  color: var(--white);
  font-size: 15px; font-weight: 700;
  letter-spacing: .5px; margin-right: 24px;
  white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.nav-logo::before {
  content: '';
  width: 28px; height: 28px;
  background: var(--orange);
  border-radius: 6px;
  display: inline-block;
}
.nav-tabs { display: flex; gap: 0; overflow-x: auto; }
.nav-tab {
  background: none; border: none; color: rgba(255,255,255,.55);
  padding: 14px 18px; font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all .15s ease;
  font-family: var(--font); letter-spacing: .3px;
}
.nav-tab:hover { color: rgba(255,255,255,.8); }
.nav-tab.active {
  color: var(--white);
  border-bottom-color: var(--orange);
  font-weight: 600;
}
.nav-user {
  margin-left: auto; color: rgba(255,255,255,.7);
  font-size: 12px; display: flex; align-items: center; gap: 10px;
}
.nav-logout {
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.8); padding: 4px 12px;
  border-radius: 20px; font-size: 11px; cursor: pointer;
  font-family: var(--font);
}
.nav-logout:hover { background: rgba(255,255,255,.2); }

/* ============================================
   View Container
   ============================================ */
.view { display: none; padding: 20px; max-width: 1400px; margin: 0 auto; }
.view.active { display: block; }

/* Mobile device frame for phone views */
.phone-frame {
  max-width: 390px; margin: 0 auto;
  background: var(--white);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 2px solid var(--gray-200);
}
.phone-header {
  background: var(--blue-900); color: var(--white);
  padding: 12px 16px; font-size: 14px; font-weight: 600;
  text-align: center; letter-spacing: .3px;
}

/* ============================================
   Broker Dashboard (View 1)
   ============================================ */
.broker-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 20px;
}
.broker-stats-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px; margin-bottom: 20px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--blue-700);
}
.stat-card.warn   { border-left-color: var(--orange); }
.stat-card.good   { border-left-color: var(--green); }
.stat-card.info   { border-left-color: var(--blue-600); }
.stat-card.danger { border-left-color: var(--red); background: var(--red-light); }
.stat-label {
  font-size: 12px; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 6px;
}
.stat-value { font-size: 28px; font-weight: 700; color: var(--gray-900); }
.stat-sub { font-size: 11px; color: var(--gray-500); margin-top: 2px; }

.broker-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.broker-header h2 { font-size: 18px; font-weight: 700; color: var(--gray-900); }
.broker-identity {
  display: flex; align-items: center; gap: 8px;
}
.broker-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue-700); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.broker-id-text { font-size: 13px; font-weight: 700; }
.broker-id-sub { font-size: 10px; color: var(--gray-500); }

/* Buttons */
.btn {
  padding: 9px 20px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer; border: none;
  font-family: var(--font); transition: all .15s ease;
  letter-spacing: .3px;
}
.btn-primary {
  background: var(--blue-700); color: white;
  box-shadow: 0 2px 4px rgba(37,99,235,.3);
}
.btn-primary:hover { background: var(--blue-800); transform: translateY(-1px); }
.btn-outline {
  background: transparent; color: var(--blue-700);
  border: 1.5px solid var(--blue-700);
}
.btn-outline:hover { background: var(--blue-50); }
.btn-ghost {
  background: transparent; color: var(--gray-600);
  padding: 6px 12px;
}
.btn-ghost:hover { background: var(--gray-100); }
.btn-sm { padding: 5px 12px; font-size: 11px; }

/* Kanban Board */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px; min-height: 400px;
}
.kanban-5 {
  grid-template-columns: repeat(5, 1fr);
}
.kanban-col {
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  padding: 12px; min-height: 100px;
}
.kanban-col-title {
  font-size: 12px; font-weight: 700; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: .8px;
  margin-bottom: 10px; padding: 0 4px;
  display: flex; justify-content: space-between; align-items: center;
}
.kanban-col-title .count {
  background: var(--gray-300); color: var(--gray-600);
  border-radius: 20px; padding: 2px 8px; font-size: 11px; font-weight: 600;
}
.kanban-col.unclaimed-pool {
  border: 2px dashed var(--orange);
  border-radius: var(--radius);
  background: #fff8f0;
}

.vehicle-card {
  background: var(--white); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px;
  box-shadow: var(--shadow); cursor: pointer;
  transition: all .15s ease;
  border-left: 3px solid transparent;
}
.vehicle-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.vehicle-card.overdue {
  border-left-color: var(--red);
  background: var(--red-light);
}
.vehicle-card.warning {
  border-left-color: var(--orange);
}
.vehicle-card.unclaimed {
  border: 1.5px dashed var(--orange);
}
.vehicle-card .plate {
  font-size: 15px; font-weight: 700; color: var(--gray-900);
  margin-bottom: 4px;
}
.vehicle-card .customer {
  font-size: 12px; color: var(--gray-500); margin-bottom: 6px;
}
.vehicle-card .meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px;
}
.vehicle-card .duration { color: var(--gray-500); }
.vehicle-card.overdue .duration { color: var(--red); font-weight: 600; }
.vehicle-card .claim-btn-row {
  margin-top: 10px;
  display: flex; gap: 6px;
}

/* ============================================
   Field Staff View (View 2)
   ============================================ */
.field-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.field-header h2 { font-size: 18px; font-weight: 700; color: var(--gray-900); }

.field-table-wrap {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.field-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.field-table thead { background: var(--gray-50); }
.field-table th {
  padding: 10px 12px; text-align: left;
  font-size: 11px; color: var(--gray-500); font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}
.field-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.field-table tbody tr:hover { background: var(--blue-50); }

/* Badges */
.status-tag {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600;
}
.status-tag.early { background: var(--blue-50); color: var(--blue-700); }
.status-tag.mid   { background: var(--orange-light); color: #92400e; }
.status-tag.late  { background: var(--green-light); color: #059669; }
.status-tag.overdue-tag { background: var(--red-light); color: var(--red); }

.exc-tag {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 700; letter-spacing: .5px;
}
.exc-tag.inspect { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.exc-tag.reject  { background: #fff7ed; color: #ea580c; border: 1px solid #fed7aa; }
.exc-tag.err     { background: #fefce8; color: #ca8a04; border: 1px solid #fef08a; }

/* Exception card / row styles */
.vehicle-card.exception { border-color: var(--red); box-shadow: 0 0 0 1px rgba(220,38,38,0.1); }
.exc-badge {
  display: inline-block; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px;
  margin-top: 6px; letter-spacing: .5px;
}
.exc-badge-sm {
  display: inline-block; background: var(--red); color: #fff;
  font-size: 9px; font-weight: 600; padding: 1px 6px; border-radius: 8px;
}
.wh-unload-card.exc-card { border-left: 3px solid var(--red); background: #fff5f5; }
.exc-row { background: #fff5f5; }
.exc-row:hover { background: #fee2e2 !important; }

.operator-cell { font-size: 11px; color: var(--gray-600); }
.operator-cell .op-name { font-weight: 600; }
.operator-cell .op-time { color: var(--gray-400); margin-left: 4px; }

.act-btn {
  padding: 5px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 600; border: none; cursor: pointer;
  font-family: var(--font); white-space: nowrap;
}
.act-btn.confirm { background: var(--green); color: white; }
.act-btn.confirm:hover { background: #059669; }
.act-btn.out { background: var(--blue-700); color: white; }
.act-btn.out:hover { background: var(--blue-800); }
.act-btn.done { background: var(--gray-200); color: var(--gray-500); cursor: default; }

/* ============================================
   Driver View (View 3)
   ============================================ */
.driver-content { padding: 20px; }
.driver-hero { text-align: center; margin-bottom: 24px; }
.driver-hero .greeting { font-size: 13px; color: var(--gray-500); margin-bottom: 2px; }
.driver-hero .status-badge {
  display: inline-block; background: var(--blue-100); color: var(--blue-700);
  padding: 4px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 600; margin-top: 6px;
}

/* Progress Steps */
.progress-steps {
  display: flex; justify-content: space-between;
  position: relative; margin-bottom: 30px; padding: 0 4px;
}
.progress-steps::before {
  content: ''; position: absolute; top: 12px; left: 20px; right: 20px;
  height: 2px; background: var(--gray-200); z-index: 0;
}
.progress-steps.mini::before { left: 28px; right: 28px; top: 14px; }
.progress-steps.mini .step { width: auto; }
.progress-steps.mini .step-dot { width: 28px; height: 28px; }
.progress-steps.mini .step-label { font-size: 10px; max-width: 60px; }

.step {
  display: flex; flex-direction: column; align-items: center;
  position: relative; z-index: 1; width: 52px;
}
.step-dot {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--gray-200); border: 2px solid #fff;
  box-shadow: var(--shadow-sm); margin-bottom: 6px;
  transition: all .3s ease;
}
.step.done .step-dot { background: var(--green); }
.step.current .step-dot {
  background: var(--blue-700);
  box-shadow: 0 0 0 4px rgba(37,99,235,.2);
}
.step-label {
  font-size: 9px; color: var(--gray-400); text-align: center;
  line-height: 1.2; max-width: 52px;
}
.step.done .step-label { color: var(--green); font-weight: 600; }
.step.current .step-label { color: var(--blue-700); font-weight: 700; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--gray-700); margin-bottom: 4px;
}
.form-input {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm); font-size: 14px;
  font-family: var(--font); transition: border-color .15s;
  background: var(--white);
}
.form-input:focus {
  outline: none; border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.submit-btn {
  width: 100%; padding: 12px; background: var(--blue-700);
  color: white; border: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 600; cursor: pointer;
  font-family: var(--font); margin-top: 8px;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.submit-btn:hover { background: var(--blue-800); }

.driver-contact-btns {
  margin-top: 20px;
  display: flex; flex-direction: column; gap: 10px;
}
.driver-contact-btns a {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 8px; padding: 12px 0;
  font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
  color: #fff;
}
.btn-call-office { background: var(--blue-600); }
.btn-call-field  { background: var(--green); }

/* ============================================
   Warehouse View (View 4)
   ============================================ */
.wh-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.wh-header h2 { font-size: 18px; font-weight: 700; color: var(--gray-900); }
.wh-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.wh-panel {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.wh-panel.full { grid-column: 1 / -1; }
.wh-panel h3 {
  font-size: 14px; font-weight: 700; color: var(--gray-900);
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}

.wh-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wh-table th {
  padding: 8px 10px; text-align: left;
  font-size: 10px; color: var(--gray-500); font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 2px solid var(--gray-200);
}
.wh-table td {
  padding: 9px 10px; border-bottom: 1px solid var(--gray-100);
}
.wh-table tr:hover { background: var(--gray-50); }

.wh-unload-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.wh-unload-card {
  background: var(--green-light);
  border-radius: var(--radius);
  padding: 14px;
  border-left: 3px solid var(--green);
}
.wh-unload-card .u-plate { font-size: 14px; font-weight: 700; }
.wh-unload-card .u-info { font-size: 11px; color: var(--gray-500); margin-top: 4px; }
.wh-unload-card .u-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; flex-wrap: wrap; gap: 6px;
}
.wh-unload-card .u-duration { font-size: 12px; font-weight: 600; color: var(--green); }

.wh-history-card {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  border-left: 3px solid var(--green);
  min-width: 200px;
}
.wh-history-card .h-plate { font-size: 13px; font-weight: 700; }
.wh-history-card .h-info { font-size: 11px; color: var(--gray-500); margin-top: 2px; }
.wh-history-card .h-meta { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

/* ============================================
   Customer View (View 5)
   ============================================ */
.cust-content { padding: 24px 20px; }
.cust-header { text-align: center; margin-bottom: 28px; }
.cust-header .icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--blue-50); margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
}
.cust-header .plate { font-size: 20px; font-weight: 700; }
.cust-header .order { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

.cust-progress {
  display: flex; justify-content: space-between;
  position: relative; margin-bottom: 10px; padding: 0 8px;
}
.cust-progress::before {
  content: ''; position: absolute; top: 14px; left: 30px; right: 30px;
  height: 2px; background: var(--gray-200); z-index: 0;
}
.c-step {
  display: flex; flex-direction: column; align-items: center;
  position: relative; z-index: 1;
}
.c-step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gray-200); margin-bottom: 8px;
  transition: all .3s ease;
}
.c-step.done .c-step-dot { background: var(--green); }
.c-step.current .c-step-dot {
  background: var(--blue-700);
  box-shadow: 0 0 0 5px rgba(37,99,235,.15);
}
.c-step-label {
  font-size: 10px; color: var(--gray-400); text-align: center;
  max-width: 60px; line-height: 1.3;
}
.c-step.done .c-step-label { color: var(--green); }
.c-step.current .c-step-label { color: var(--blue-700); font-weight: 600; }

.cust-status-card {
  background: var(--blue-50); border-radius: var(--radius);
  padding: 16px; text-align: center; margin-top: 20px;
}
.cust-status-card .status-text {
  font-size: 15px; font-weight: 600; color: var(--blue-700);
}
.cust-status-card .status-time {
  font-size: 11px; color: var(--gray-500); margin-top: 4px;
}
.cust-footer {
  text-align: center; margin-top: 24px;
  font-size: 11px; color: var(--gray-400);
}

/* ============================================
   Admin Dashboard (View 6)
   ============================================ */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.admin-panel {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.admin-panel.full { grid-column: 1 / -1; }
.admin-panel h3 {
  font-size: 14px; font-weight: 700; color: var(--gray-900);
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
}
.dot.red { background: var(--red); }
.dot.orange { background: var(--orange); }
.dot.blue { background: var(--blue-700); }
.dot.green { background: var(--green); }

.admin-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.admin-header h2 { font-size: 18px; font-weight: 700; }
.date-filter {
  display: flex; align-items: center; gap: 8px;
}
.date-filter select {
  padding: 7px 12px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-300); font-size: 13px;
  font-family: var(--font); background: var(--white); cursor: pointer;
}
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 16px;
}
.admin-stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--blue-700);
  display: flex; flex-direction: column;
}
.admin-stat-card .stat-val {
  font-size: 28px; font-weight: 700; color: var(--gray-900);
}
.admin-stat-card.red-border { border-left-color: var(--red); }

/* Anomaly */
.anomaly-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--gray-100);
}
.anomaly-item:last-child { border-bottom: none; }
.anomaly-icon {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--red-light); color: var(--red);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; flex-shrink: 0;
}
.anomaly-info { flex: 1; }
.anomaly-info .plate { font-size: 13px; font-weight: 700; }
.anomaly-info .desc { font-size: 11px; color: var(--gray-500); }
.anomaly-time { font-size: 12px; font-weight: 600; color: var(--red); white-space: nowrap; }

/* Broker bars */
.broker-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
}
.broker-row:last-child { margin-bottom: 0; }
.broker-name { font-size: 13px; font-weight: 600; width: 50px; flex-shrink: 0; text-align: right; }
.broker-bar-wrap {
  flex: 1; height: 28px; background: var(--gray-100);
  border-radius: 14px; overflow: hidden; position: relative;
}
.broker-bar {
  height: 100%; border-radius: 14px;
  display: flex; align-items: center; padding-left: 12px;
  font-size: 11px; font-weight: 600; color: white;
  transition: width .6s ease; min-width: 60px;
}
.broker-bar.g1 { background: linear-gradient(90deg, var(--blue-700), var(--blue-600)); }
.broker-bar.g2 { background: linear-gradient(90deg, var(--green), #34d399); }
.broker-bar.g3 { background: linear-gradient(90deg, var(--orange), #fbbf24); }
.broker-detail { font-size: 11px; color: var(--gray-500); width: 110px; flex-shrink: 0; }

/* Status bars */
.status-bars { display: flex; flex-direction: column; gap: 10px; }
.status-row { display: flex; align-items: center; gap: 10px; }
.status-label { font-size: 12px; color: var(--gray-600); width: 72px; flex-shrink: 0; text-align: right; font-weight: 500; }
.status-bar-track { flex: 1; height: 20px; background: var(--gray-100); border-radius: 10px; overflow: hidden; }
.status-bar-fill {
  height: 100%; border-radius: 10px;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 8px; font-size: 10px; font-weight: 700; color: white;
  min-width: 28px;
}
.status-bar-fill.s1 { background: var(--blue-700); }
.status-bar-fill.s2 { background: var(--blue-600); }
.status-bar-fill.s3 { background: var(--orange); }
.status-bar-fill.s4 { background: var(--green); }
.status-bar-fill.s5 { background: #14b8a6; }
.status-count { font-size: 13px; font-weight: 700; color: var(--gray-900); width: 24px; text-align: left; flex-shrink: 0; }

/* Customer table */
.cust-table { width: 100%; border-collapse: collapse; }
.cust-table th {
  font-size: 11px; color: var(--gray-500); text-align: left;
  padding: 8px 12px; border-bottom: 2px solid var(--gray-200);
  font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
}
.cust-table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); font-size: 13px; }
.cust-table .cust-name { font-weight: 600; }
.cust-table .cust-count { font-weight: 700; color: var(--blue-700); }
.cust-table .cust-avg { font-size: 11px; color: var(--gray-500); }

/* Trend bars */
.trend-chart {
  display: flex; align-items: stretch; gap: 0;
  height: 140px; padding: 4px 8px 0 0;
  overflow: hidden; /* prevent bars from spilling outside the card */
}
/* Y-axis */
.trend-yaxis {
  position: relative; width: 36px; flex-shrink: 0;
  border-right: 1px solid var(--gray-200); margin-right: 8px;
}
.trend-yaxis-tick {
  position: absolute; right: 6px;
  font-size: 9px; color: var(--gray-400); font-weight: 500;
  transform: translateY(50%);
}
/* Bars area */
.trend-bars {
  display: flex; align-items: flex-end; gap: 10px;
  flex: 1; min-width: 0;
}
.trend-bar-col {
  flex: 1; min-width: 0; text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.trend-bar {
  width: 100%; max-width: 48px; border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--blue-700), var(--blue-100));
  min-height: 4px;
}
.trend-bar.today { background: linear-gradient(180deg, var(--orange), var(--orange-light)); }
.trend-bar-val {
  font-size: 11px; font-weight: 700; color: var(--blue-700);
  margin-bottom: 2px; line-height: 1.2;
}
.trend-bar-col:has(.trend-bar.today) .trend-bar-val { color: var(--orange); }
.trend-label { font-size: 10px; color: var(--gray-400); margin-top: 4px; white-space: nowrap; }
/* Empty state */
.trend-empty {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; color: var(--gray-400); font-size: 14px;
}

/* Timeline cards */
.timeline-cards {
  display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px;
}
.tl-card {
  min-width: 180px; background: var(--green-light);
  border-radius: var(--radius); padding: 14px;
  border-left: 3px solid var(--green); flex-shrink: 0;
}
.tl-card .tl-plate { font-size: 14px; font-weight: 700; }
.tl-card .tl-cust { font-size: 11px; color: var(--gray-500); }
.tl-card .tl-detail { margin-top: 6px; font-size: 11px; color: var(--gray-500); }
.tl-card .tl-duration { font-size: 12px; font-weight: 600; color: var(--green); margin-top: 2px; }
.tl-card .tl-broker { font-size: 10px; color: var(--gray-400); }

/* Delete vehicle button in admin timeline */
/* Admin: Edit Vehicle */
.admin-jump-select {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: #fff;
  color: var(--gray-700);
  outline: none;
  cursor: pointer;
}
.admin-jump-select:focus { border-color: var(--blue); }

/* Admin: User Management */
#user-mgmt-panel .cust-table { width: 100%; }

.btn-user-delete {
  background: none;
  border: 1px solid var(--red);
  color: var(--red);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-user-delete:hover { background: var(--red); color: #fff; }

/* Admin: Clear All Danger Button */
.btn-danger-clear {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 10px 28px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-danger-clear:hover { background: #cc0000; transform: scale(1.02); }

.btn-delete-vehicle {
  margin-top: 8px;
  padding: 4px 12px;
  font-size: 11px;
  font-family: var(--font);
  color: var(--red);
  background: var(--red-light);
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-delete-vehicle:hover {
  background: var(--red);
  color: #fff;
}

/* ============================================
   Modal Overlay for Vehicle Detail
   ============================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 200; display: none; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--white); border-radius: var(--radius-lg);
  width: 90%; max-width: 640px; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  padding: 24px;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: start;
  margin-bottom: 20px;
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close {
  background: none; border: none; font-size: 20px;
  color: var(--gray-400); cursor: pointer; padding: 4px;
  font-family: var(--font);
}
.modal-close:hover { color: var(--gray-700); }

/* Log table in modal */
.log-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.log-table th {
  padding: 8px 10px; text-align: left;
  font-size: 10px; color: var(--gray-500); font-weight: 600;
  border-bottom: 2px solid var(--gray-200);
  background: var(--gray-50);
}
.log-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--gray-100);
}
.log-table tr.current-row { background: var(--blue-50); }
.log-row-done { color: var(--green); font-weight: 600; }
.log-row-current { color: var(--blue-700); font-weight: 600; }
.log-row-pending { color: var(--gray-400); }

/* ============================================
   Claim Modal
   ============================================ */
.claim-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 1000;
  justify-content: center; align-items: center;
}
.claim-overlay.show { display: flex; }
.claim-card {
  background: var(--white); border-radius: 12px;
  padding: 24px; width: 440px; max-width: 95%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
}
.claim-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.claim-label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--gray-600); margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.claim-input {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius); font-size: 13px;
  font-family: var(--font); box-sizing: border-box;
}
.claim-input:focus {
  outline: none; border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.autocomplete-wrap { position: relative; }
.autocomplete-list {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  background: var(--white); border: 1.5px solid var(--gray-200);
  border-top: none; border-radius: 0 0 var(--radius) var(--radius);
  max-height: 160px; overflow-y: auto; z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.autocomplete-list .ac-item {
  padding: 8px 12px; font-size: 12px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
}
.autocomplete-list .ac-item:hover,
.autocomplete-list .ac-item.active { background: var(--blue-50); }
.ac-full { color: var(--gray-800); font-weight: 600; }
.ac-short { color: var(--gray-400); font-size: 10px; }

.biz-type-card {
  flex: 1; padding: 12px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius); cursor: pointer;
  text-align: center; transition: all 0.15s;
}
.biz-type-card:hover { border-color: var(--blue-300); background: var(--blue-50); }
.biz-type-card.selected {
  border-color: var(--blue-700); background: var(--blue-50);
  box-shadow: 0 0 0 3px rgba(29,78,216,0.12);
}
.biz-type-name { font-size: 14px; font-weight: 700; color: var(--gray-800); }
.biz-type-desc { font-size: 11px; color: var(--gray-500); margin-top: 2px; }
.biz-type-nodes { font-size: 10px; color: var(--gray-400); margin-top: 4px; }

/* ============================================
   Toast Notifications
   ============================================ */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 3000;
  padding: 12px 20px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; color: white;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s;
  max-width: 360px;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.info { background: var(--blue-700); }

@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ============================================
   Loading Spinner
   ============================================ */
.spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--blue-700);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   Pulse Animation
   ============================================ */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }
.pulse { animation: pulse 2s ease-in-out infinite; }

/* ============================================
   Utilities
   ============================================ */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.text-center { text-align: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ============================================
   Notification Bell & Panel
   ============================================ */
.notif-bell {
  position: relative;
  cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  transition: background .15s;
}
.notif-bell:hover { background: rgba(255,255,255,.12); }
.notif-badge {
  position: absolute; top: -4px; right: -6px;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--blue-900);
}
.notif-panel {
  display: none; position: fixed; top: 52px; right: 16px; z-index: 1500;
  width: 360px; max-width: 92vw; max-height: 70vh; overflow-y: auto;
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); border: 1px solid var(--gray-200);
}
.notif-panel.show { display: block; }
.notif-panel-header {
  padding: 14px 16px; font-size: 13px; font-weight: 700; color: var(--gray-800);
  border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; background: var(--white);
}
.notif-panel-list { padding: 8px; }
.notif-item {
  display: flex; gap: 10px; padding: 10px; border-radius: var(--radius-sm);
  cursor: pointer; border-bottom: 1px solid var(--gray-100);
}
.notif-item:hover { background: var(--blue-50); }
.notif-item.unread { background: var(--blue-50); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue-600); margin-top: 6px; flex-shrink: 0; }
.notif-dot.overdue { background: var(--red); }
.notif-body { flex: 1; }
.notif-msg { font-size: 12px; color: var(--gray-700); line-height: 1.4; }
.notif-time { font-size: 10px; color: var(--gray-400); margin-top: 4px; }

/* ============================================
   Overdue Banner (超时待处理)
   ============================================ */
.overdue-banner {
  background: linear-gradient(135deg, #fff5f5, #ffe8e8);
  border: 1px solid var(--red); border-left: 4px solid var(--red);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px;
}
.od-title { font-size: 13px; font-weight: 700; color: var(--red); margin-bottom: 8px; }
.od-item {
  display: inline-block; background: #fff; border: 1px solid var(--red);
  color: var(--red); font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 14px; margin: 0 8px 8px 0; cursor: pointer;
}
.od-item:hover { background: var(--red); color: #fff; }
@media (max-width: 768px) {
  .view { padding: 12px; }
  .nav { padding: 0 8px; }
  .nav-logo { font-size: 13px; margin-right: 8px; }
  .nav-tab { padding: 10px 10px; font-size: 11px; }
  .broker-stats, .admin-stats, .broker-stats-5 {
    grid-template-columns: repeat(2, 1fr); gap: 8px;
  }
  .stat-card, .admin-stat-card { padding: 12px; }
  .stat-value, .stat-val { font-size: 22px; }
  .kanban, .kanban-5 {
    grid-template-columns: repeat(4, minmax(220px, 1fr));
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }
  .kanban-col { min-width: 220px; }
  .field-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .field-table { min-width: 700px; }
  .admin-grid, .wh-grid { grid-template-columns: 1fr; }
  .wh-table { min-width: 500px; }
  .wh-panel { overflow-x: auto; }
  .step-label { font-size: 8px; max-width: 40px; }
  .modal { width: 95%; padding: 16px; max-height: 90vh; }
  .broker-header { flex-direction: column; align-items: flex-start; }
  .claim-card { width: 90%; padding: 20px; }
  .toast { max-width: 90%; font-size: 12px; }
  .login-card { width: 90%; padding: 24px; }
}

/* ============================================
   Flow Stepper (详情弹窗流程可视化)
   ============================================ */
.flow-stepper {
  background: var(--gray-50);
  border-radius: 10px;
  padding: 16px 14px;
}
.flow-stepper-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 12px;
}
.flow-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
  padding-bottom: 18px;
}
.flow-step:last-child { padding-bottom: 0; }
/* 连接线 */
.flow-step::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: -4px;
  width: 2px;
  background: var(--gray-200);
}
.flow-step:last-child::before { display: none; }
.flow-step.done::before { background: var(--green); }
/* 圆点 */
.flow-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  z-index: 1;
  background: var(--white);
  border: 2px solid var(--gray-300);
  color: var(--gray-400);
}
.flow-step.done .flow-step-dot {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.flow-step.current .flow-step-dot {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(255,107,53,.15);
  animation: flowPulse 2s ease-in-out infinite;
}
@keyframes flowPulse {
  0%,100% { box-shadow: 0 0 0 4px rgba(255,107,53,.15); }
  50%     { box-shadow: 0 0 0 8px rgba(255,107,53,.08); }
}
/* 内容 */
.flow-step-body {
  flex: 1;
  padding-top: 2px;
}
.flow-step-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 2px;
}
.flow-step.current .flow-step-name { color: var(--orange); }
.flow-step.done .flow-step-name { color: var(--gray-600); }
.flow-step-pending .flow-step-name { color: var(--gray-400); }
.flow-step-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 11px;
  color: var(--gray-400);
}
.flow-step-role {
  background: var(--gray-200);
  color: var(--gray-600);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}
.flow-step.current .flow-step-role {
  background: rgba(255,107,53,.12);
  color: var(--orange);
}
.flow-step.done .flow-step-role {
  background: rgba(74,222,128,.12);
  color: var(--green);
}
.flow-step-time {
  font-size: 11px;
  color: var(--gray-400);
}
.flow-step.current .flow-step-time {
  color: var(--orange);
  font-weight: 600;
}

@media (max-width: 768px) {
  .flow-step-dot { width: 24px; height: 24px; font-size: 11px; }
  .flow-step::before { left: 11px; top: 24px; }
  .flow-step-name { font-size: 12px; }
}
