/* ===== CSS Variables ===== */
:root {
  --touch-target-min: 44px;
  --color-bg: #f5f6fa;
  --color-surface: #ffffff;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-danger: #dc2626;
  --color-danger-hover: #b91c1c;
  --color-border: #e2e8f0;
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --color-text-inverse: #ffffff;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
  --transition: 150ms ease;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--color-bg); color: var(--color-text); line-height: 1.6; min-height: 100vh; overscroll-behavior: contain; font-size: clamp(14px, 2.5vw, 16px); }
img { max-width: 100%; height: auto; }
a, button, select, input[type="date"], .btn, .sidebar__item, .plate-link, .img-thumb, .img-upload-btn, .part-img-add-btn, .pagination button {
  touch-action: manipulation;
}

/* ===== App Header ===== */
.app-header { background: #1a3a5c; color: #fff; padding: 16px 32px; font-size: 22px; font-weight: 700; letter-spacing: 2px; }

/* ===== Layout ===== */
.layout { display: flex; min-height: calc(100vh - 58px); }

/* ===== Sidebar ===== */
.sidebar { width: 220px; min-width: 220px; background: #1e293b; color: #fff; display: flex; flex-direction: column; }
.sidebar__title { padding: 16px 20px; font-size: 16px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar__menu { padding: 8px 0; }
.sidebar__item { display: block; padding: 10px 20px; color: #cbd5e1; text-decoration: none; font-size: 14px; cursor: pointer; transition: background 100ms, color 100ms; }
.sidebar__item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.sidebar__item--active { background: #334155; color: #fff; }
.sidebar__footer { padding: 12px 20px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 12px; color: #94a3b8; display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
.sidebar__footer a { color: #94a3b8; text-decoration: none; }
.sidebar__footer a:hover { color: #fff; }
.sidebar__logout-btn { padding: 4px 12px; border: 1px solid #ef4444; color: #ef4444 !important; border-radius: 4px; font-size: 12px; transition: background 100ms, color 100ms; }
.sidebar__logout-btn:hover { background: #ef4444; color: #fff !important; }

/* ===== Content Header ===== */
.content-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 32px; }
.content-header h1 { font-size: 20px; font-weight: 700; }
.content-header__actions { display: flex; gap: 12px; align-items: center; }
/* ===== Buttons ===== */
.btn { padding: 8px 20px; border: none; border-radius: var(--radius); font-size: 14px; font-weight: 500; cursor: pointer; transition: background var(--transition); font-family: var(--font); }
.btn--primary { background: var(--color-primary); color: var(--color-text-inverse); }
.btn--primary:hover { background: var(--color-primary-hover); }
.btn--secondary { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); }
.btn--secondary:hover { background: #f8fafc; }
.btn--danger { background: var(--color-danger); color: var(--color-text-inverse); }
.btn--danger:hover { background: var(--color-danger-hover); }
.btn--text { background: transparent; color: var(--color-primary); padding: 8px 12px; }
.btn--text:hover { background: #eff6ff; }
.btn--sm { padding: 8px 14px; font-size: 13px; min-height: var(--touch-target-min); }

/* ===== Badge ===== */
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge--in { background: #dbeafe; color: #1e40af; }
.badge--out { background: #fce7f3; color: #9d174d; }
.badge--paid { background: #d1fae5; color: #065f46; }
.badge--unpaid { background: #fef3c7; color: #92400e; }
.btn--xs { padding: 4px 10px; font-size: 11px; min-height: var(--touch-target-min); min-width: var(--touch-target-min); display: inline-flex; align-items: center; justify-content: center; }
.btn-toggle-outbound { padding: 6px 12px; font-size: 13px; white-space: nowrap; min-height: var(--touch-target-min); }

/* ===== Export Dropdown ===== */
.export-dropdown { position: relative; }
.export-dropdown__menu { position: absolute; top: 100%; left: 0; margin-top: 4px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 100; min-width: 180px; }
.export-dropdown__menu button { display: block; width: 100%; padding: 10px 16px; border: none; background: transparent; text-align: left; cursor: pointer; font-size: 14px; font-family: var(--font); }
.export-dropdown__menu button:hover { background: #f1f5f9; }

/* ===== Filter Bar ===== */
.filter-bar { padding: 16px 32px; display: flex; flex-direction: column; gap: 10px; }
.filter-bar__row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.filter-bar__search { flex: 1; min-width: 220px; padding: 8px 12px; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: 14px; }
.filter-bar__select { padding: 8px 12px; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: 14px; background: var(--color-surface); min-width: 140px; }
.filter-bar__date { padding: 8px 12px; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: 14px; }

/* ===== Main ===== */
.main { flex: 1; overflow-x: hidden; padding: 0 32px 32px; }

/* ===== Stats ===== */
.stats { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.stat-card { flex: 1; min-width: 180px; background: var(--color-surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-card-group { display: flex; flex-direction: column; gap: 16px; flex: 1; min-width: 180px; }
.stat-card-group .stat-card { flex: none; }
.stat-card__label { font-size: 13px; color: var(--color-text-muted); margin-bottom: 6px; }
.stat-card__value { font-size: 28px; font-weight: 700; color: var(--color-text); }
.stat-card__sub { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }

/* ===== Model Stats ===== */
.model-stats-section { width: 100%; margin-top: 16px; }
.model-stats-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.model-stats-title { margin: 0; font-size: 14px; color: var(--color-text-secondary); }
.model-stats-toggle { padding: 4px 14px; border: 1px solid var(--color-primary); border-radius: 14px; background: transparent; color: var(--color-primary); font-size: 12px; cursor: pointer; transition: background 0.15s, color 0.15s; }
.model-stats-toggle:hover { background: var(--color-primary); color: #fff; }
.model-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.model-stat-card { background: var(--color-surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); cursor: pointer; transition: box-shadow 0.15s, transform 0.15s; border: 1px solid transparent; }
.model-stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); transform: translateY(-1px); border-color: var(--color-primary); }
.model-stat-card--hidden { display: none; }
.model-stat-card__name { font-size: 14px; font-weight: 600; color: var(--color-text); margin-bottom: 8px; }
.model-stat-card__detail { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--color-text-muted); }
.model-stat-card__detail span { display: block; }

.stat-detail { margin-bottom: 24px; }
.stat-detail__toggle { display: block; width: 100%; padding: 10px 0; border: none; background: transparent; text-align: left; font-size: 14px; font-weight: 600; color: var(--color-primary); cursor: pointer; }
.stat-detail__body { display: flex; gap: 24px; flex-wrap: wrap; }
.stat-detail__table { flex: 1; min-width: 200px; }
.stat-detail__table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stat-detail__table th { text-align: left; padding: 6px 8px; color: var(--color-text-muted); font-weight: 500; border-bottom: 1px solid var(--color-border); }
.stat-detail__table td { padding: 6px 8px; border-bottom: 1px solid var(--color-border); }

.recent-section { margin-top: 32px; }
.recent-section h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; color: var(--color-text); }

/* ===== Table ===== */
.table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; background: var(--color-surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table thead { background: #f8fafc; }
.data-table th { padding: 12px 16px; text-align: left; font-size: 13px; font-weight: 600; color: var(--color-text-muted); white-space: nowrap; border-bottom: 2px solid var(--color-border); }
.data-table td { padding: 10px 16px; font-size: 14px; border-bottom: 1px solid var(--color-border); white-space: nowrap; }
.data-table tbody tr:hover { background: #f8fafc; }
.th-actions { width: 120px; text-align: center; }
.data-table td:last-child { text-align: center; }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 80px 20px; }
.empty-state__icon { font-size: 48px; margin-bottom: 16px; }
.empty-state__text { font-size: 16px; color: var(--color-text-muted); margin-bottom: 20px; }

/* ===== Pagination ===== */
.pagination { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 20px 0; font-size: 14px; color: var(--color-text-muted); }
.pagination button { padding: 6px 12px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); cursor: pointer; font-size: 14px; min-height: var(--touch-target-min); min-width: var(--touch-target-min); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination button:not(:disabled):hover { background: #f1f5f9; }
.pagination select { padding: 4px 8px; border: 1px solid var(--color-border); border-radius: var(--radius); margin-left: 4px; }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.5); display: flex; justify-content: center; align-items: center; z-index: 200; }
.modal { background: var(--color-surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 90vw; max-width: 680px; max-height: 85vh; display: flex; flex-direction: column; }
.modal--small { max-width: 420px; }
.modal__header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 16px; border-bottom: 1px solid var(--color-border); }
.modal__header h2 { font-size: 18px; }
.modal__close { border: none; background: transparent; font-size: 20px; cursor: pointer; color: var(--color-text-muted); padding: 4px 8px; border-radius: 4px; }
.modal__close:hover { background: #f1f5f9; }
.modal__body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal__footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px 20px; border-top: 1px solid var(--color-border); }
.modal--detail { max-width: 600px; }
.plate-link { color: var(--color-primary); text-decoration: none; cursor: pointer; }
.plate-link:hover { text-decoration: underline; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; }
.detail-item { display: flex; flex-direction: column; gap: 2px; }
.detail-item__label { font-size: 12px; color: var(--color-text-muted); }
.detail-item__value { font-size: 15px; color: var(--color-text); word-break: break-all; }
.detail-section-title { grid-column: 1 / -1; font-size: 15px; font-weight: 600; color: var(--color-primary); padding-top: 16px; margin-top: 4px; border-top: 1px solid var(--color-border); }
.detail-subsection-title { grid-column: 1 / -1; font-size: 13px; font-weight: 600; color: var(--color-text); margin-top: 12px; margin-bottom: 4px; }
.dismantle-material-table { grid-column: 1 / -1; width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 4px; }
.dismantle-material-table th { text-align: left; padding: 6px 8px; color: var(--color-text-muted); font-weight: 500; border-bottom: 1px solid var(--color-border); }
.dismantle-material-table th:not(:first-child) { text-align: right; }
.dismantle-material-table td { padding: 6px 8px; border-bottom: 1px solid var(--color-border); }
.dismantle-material-table td:not(:first-child) { text-align: right; }
.dismantle-total-row { font-weight: 700; background: #f0f9ff; }
.dismantle-total-row td { border-top: 2px solid var(--color-primary); padding: 8px; }
.dismantle-total-row td:last-child { text-align: right; }

/* ===== Form ===== */
.form-section-title { font-size: 15px; font-weight: 600; color: var(--color-primary); margin: 16px 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--color-primary); grid-column: 1 / -1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 4px; position: relative; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--color-text); }
.form-group input, .form-group select, .form-group textarea { padding: 8px 12px; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: 14px; font-family: var(--font); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-group input.error, .form-group select.error { border-color: var(--color-danger); }
.form-error { font-size: 12px; color: var(--color-danger); min-height: 16px; }
.required { color: var(--color-danger); }

/* ===== Storage Warning ===== */
.storage-warning { position: fixed; bottom: 16px; right: 16px; background: #fef3c7; border: 1px solid #f59e0b; color: #92400e; padding: 12px 20px; border-radius: var(--radius); font-size: 13px; z-index: 300; }

/* ===== Image Thumbnail ===== */
.img-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: transform 200ms;
}
.img-thumb:hover {
  transform: scale(3);
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 50;
}
.img-thumbs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.img-thumb-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  background: var(--color-danger);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  line-height: 24px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Multi-Image Preview ===== */
.image-preview-container {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-top: 4px;
}
.img-preview-item {
  position: relative;
  width: 90px;
  height: 90px;
}
.img-preview-thumb {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--color-border);
}
.img-preview-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  background: var(--color-danger);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 16px;
  line-height: 28px;
  text-align: center;
  cursor: pointer;
}
.img-upload-btn {
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  font-size: 32px;
  color: #94a3b8;
  cursor: pointer;
  background: #f8fafc;
}
.img-upload-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ===== Form File Input ===== */
.form-group input[type="file"] {
  padding: 6px 0;
  border: none;
  font-size: 13px;
}

/* ===== Dismantle Part Row Image Previews ===== */
.part-img-container {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  min-width: 80px;
}
.part-img-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  cursor: pointer;
}
.part-img-thumb:hover {
  border-color: var(--color-primary);
}
.part-img-add-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #cbd5e1;
  border-radius: 4px;
  font-size: 20px;
  color: #94a3b8;
  cursor: pointer;
  background: #f8fafc;
  flex-shrink: 0;
  user-select: none;
}
.part-img-add-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.part-img-wrapper {
  position: relative;
  display: inline-block;
}
.part-img-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  background: var(--color-danger);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  cursor: pointer;
  padding: 0;
}

/* ===== Mobile: Hamburger Button ===== */
.hamburger {
  display: none;
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  border-radius: 6px;
  line-height: 40px;
  text-align: center;
  z-index: 10;
}
.hamburger:hover { background: rgba(255,255,255,0.1); }

.sidebar-overlay { display: none; }

/* ===== Mobile Responsive: 768px ===== */
@media (max-width: 768px) {
  .hamburger { display: flex; align-items: center; justify-content: center; }

  .app-header {
    padding: 12px 16px 12px 52px;
    font-size: 17px;
    position: relative;
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  .layout { position: relative; display: block; }

  /* Sidebar slide-in */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    min-width: 0;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
  }
  body.sidebar--open .sidebar { transform: translateX(0); }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  body.sidebar--open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  /* Main content */
  .main { padding: 0 12px 16px; }

  .content-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 12px;
  }
  .content-header h1 { font-size: 18px; }
  .content-header__actions { flex-wrap: wrap; width: 100%; }

  /* Filter bar */
  .filter-bar { padding: 10px 12px; gap: 8px; }
  .filter-bar__row { flex-direction: column; gap: 8px; }
  .filter-bar__row span { align-self: center; font-size: 13px; }
  .filter-bar__search,
  .filter-bar__select,
  .filter-bar__date { width: 100%; min-width: 0; }

  /* Stats */
  .stats { gap: 10px; }
  .stat-card { min-width: 100%; flex: none; }
  .stat-card-group { min-width: 100%; flex: none; flex-direction: row; gap: 10px; }
  .stat-card-group .stat-card { flex: 1; min-width: 0; }
  .model-stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* Table */
  .data-table { font-size: 13px; }
  .data-table th,
  .data-table td { padding: 8px 10px; }

  /* Pagination */
  .pagination { flex-wrap: wrap; gap: 4px; font-size: 12px; padding: 14px 0; }
  .pagination button { padding: 5px 10px; font-size: 13px; }
  .pagination select { font-size: 12px; }

  /* Form grid */
  .form-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Detail grid */
  .detail-grid { grid-template-columns: 1fr; gap: 8px 16px; }

  /* Modal */
  .modal-overlay { align-items: flex-end; }
  .modal {
    width: 100vw;
    max-width: none;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
  }
  .modal--small { max-width: none; }
  .modal__header { padding: 14px 16px; }
  .modal__header h2 { font-size: 16px; }
  .modal__body { padding: 14px 16px; }
  .modal__footer { padding: 12px 16px 16px; flex-wrap: wrap; }

  /* Price overlay on battery-compartment (has inline align-items:flex-start) */
  #priceOverlay { align-items: flex-end !important; padding-top: 0 !important; }

  /* Login */
  .login-card { width: 90vw; max-width: 380px; padding: 24px 20px; }

  /* Dismantle */
  .parts-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-detail__body { flex-direction: column; gap: 12px; }

  /* Users modal */
  .user-modal-overlay { align-items: flex-end !important; }
  .user-modal { width: 100vw !important; max-width: none !important; border-radius: 16px 16px 0 0 !important; padding: 20px 16px !important; }
  .user-modal__title { font-size: 16px !important; margin-bottom: 16px !important; }
  .user-modal__actions { flex-wrap: wrap; }
}

/* ===== Mobile Responsive: 480px ===== */
@media (max-width: 480px) {
  .app-header { font-size: 15px; padding: 10px 12px 10px 46px; }

  .main { padding: 0 6px 10px; }

  .content-header { padding: 10px 8px; }
  .content-header h1 { font-size: 16px; }

  .filter-bar { padding: 8px; }

  .data-table { font-size: 12px; }
  .data-table th,
  .data-table td { padding: 6px 8px; }

  .stat-card { padding: 12px; }
  .stat-card__value { font-size: 22px; }
  .stat-card__label { font-size: 12px; }

  .btn { padding: 6px 14px; font-size: 13px; }
  .btn--sm { padding: 3px 10px; font-size: 12px; }

  .pagination { font-size: 11px; gap: 2px; }
  .pagination button { padding: 4px 8px; font-size: 12px; }

  .modal { max-height: 92vh; }
  .modal__body { padding: 12px 14px; }
  .modal__footer { padding: 10px 14px 14px; }
  .modal__footer .btn { flex: 1; }

  .login-card { width: 94vw; padding: 20px 16px; }

  .form-grid { gap: 10px; }
  .form-group input,
  .form-group select,
  .form-group textarea { padding: 7px 10px; font-size: 13px; }

  .parts-grid { grid-template-columns: 1fr 1fr; gap: 8px; }

  .detail-section-title { font-size: 13px; }
  .detail-item__value { font-size: 14px; }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .sidebar { transition: none; }
  .sidebar-overlay { transition: none; }
}

/* ===== Touch Device :active States ===== */
@media (hover: none) {
  .btn:active { filter: brightness(0.85); }
  .btn--primary:active { background: var(--color-primary-hover); }
  .btn--danger:active { background: var(--color-danger-hover); }
  .sidebar__item:active { background: rgba(255,255,255,0.1); }
  .pagination button:not(:disabled):active { background: #e2e8f0; }
  .img-thumb:hover { transform: none; }
  .part-img-thumb:hover { border-color: var(--color-border); }
}

/* ===== Dashboard ===== */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 0 32px 16px; }
.dashboard-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px 20px; }
.dashboard-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: var(--color-text); display: flex; align-items: center; gap: 10px; }
.dashboard-month-input { font-size: 13px; font-weight: 400; padding: 4px 8px; border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-surface); color: var(--color-text); font-family: var(--font); }
.dashboard-card canvas { max-height: 280px; }

/* Financial breakdown */
.finance-section { margin-bottom: 14px; }
.finance-section:last-child { margin-bottom: 0; }
.finance-section__title { font-size: 13px; font-weight: 600; color: var(--color-text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }

/* Distributions collapsible toggle */
.dist-toggle {
  font-size: 13px; font-weight: 600; color: var(--color-text-muted); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.5px;
  cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 4px;
  transition: color var(--transition);
  padding: 4px 0;
}
.dist-toggle:hover { color: var(--color-text); }
.dist-toggle__arrow { font-size: 10px; display: inline-block; transition: transform 150ms ease; }
.dist-collapsible { overflow: hidden; }
.dist-collapsible.hidden { display: none; }

/* Ranking / Battery toggle */
.ranking-toggle {
  font-size: 13px; font-weight: 500; color: var(--color-primary);
  cursor: pointer; user-select: none; padding: 6px 0; margin-top: 4px;
  display: flex; align-items: center; gap: 4px;
}
.ranking-toggle:hover { color: var(--color-primary-hover); }
.ranking-toggle .dist-toggle__arrow { font-size: 10px; }
.finance-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 14px; }
.finance-row + .finance-row { border-top: 1px solid #f1f5f9; }
.finance-label { color: var(--color-text-muted); }
.finance-value { font-weight: 600; }
.finance-bar { height: 6px; border-radius: 3px; background: #e2e8f0; margin: 4px 0 8px; overflow: hidden; }
.finance-bar__fill { height: 100%; border-radius: 3px; transition: width 300ms ease; }
.finance-bar__fill--paid { background: #10b981; }
.finance-bar__fill--confirmed { background: #3b82f6; }

/* Ranking table */
.ranking-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.ranking-table th { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--color-border); color: var(--color-text-muted); font-weight: 500; font-size: 12px; }
.ranking-table td { padding: 5px 8px; border-bottom: 1px solid #f1f5f9; }
.ranking-table tr:hover td { background: #f8fafc; }
.rank-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-size: 12px; font-weight: 600; color: #fff; background: #94a3b8; }
.rank-num--top { background: var(--color-primary); }

/* Inline dist table */
.dist-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.dist-table td { padding: 4px 8px; border-bottom: 1px solid #f1f5f9; }

/* Mobile responsive */
@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr; margin: 0 12px 12px; }
  .dashboard-card { padding: 12px 14px; }
}

/* ===== Remark expand ===== */
.remark-toggle { font-size: 12px; color: var(--color-primary); white-space: nowrap; cursor: pointer; }
.remark-toggle:hover { text-decoration: underline; }

/* ===== Batch Select Checkbox Column ===== */
.th-checkbox { width: 40px; text-align: center; padding: 8px 8px; }
.td-checkbox { width: 40px; text-align: center; padding: 8px 8px; }
.td-checkbox input[type="checkbox"],
.th-checkbox input[type="checkbox"] {
  width: 16px; height: 16px; cursor: pointer;
  accent-color: var(--color-primary);
}

/* ===== Contextual Batch Toolbar (below content-header) ===== */
.batch-action-bar {
  margin: 0 32px 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 12px 20px;
  display: flex; flex-direction: column; align-items: center;
  animation: batchBarSlideDown 200ms ease;
}
.batch-action-bar.hidden { display: none; }
.batch-action-bar__main {
  display: flex; align-items: center; gap: 20px;
  width: 100%;
}
.batch-action-bar__count { font-size: 14px; font-weight: 600; color: #1e40af; white-space: nowrap; }
.batch-action-bar__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-wrap: wrap; }
#batchExtraActions { display: flex; gap: 6px; }

/* Batch action inline form */
.batch-action-bar__form {
  display: flex; align-items: center; gap: 8px;
  width: 100%; margin-top: 8px;
  padding-top: 8px; border-top: 1px dashed #bfdbfe;
}
.batch-action-bar__form.hidden { display: none; }
#batchActionFormContent { flex: 1; }
.batch-action-select, .batch-action-input {
  padding: 4px 8px; font-size: 13px;
  border: 1px solid var(--color-border); border-radius: 4px;
  background: #fff; color: var(--color-text);
  max-width: 220px; width: 100%;
}

/* Toast notification */
.batch-toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 300;
  background: #10b981; color: #fff;
  padding: 10px 24px; border-radius: 6px; font-size: 14px; font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: batchToastIn 200ms ease;
  pointer-events: none;
}
.batch-toast--error { background: #ef4444; }
.batch-toast.hidden { display: none; }

@keyframes batchBarSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes batchToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (max-width: 768px) {
  .batch-action-bar { margin: 0 12px 12px; padding: 10px 12px; }
  .batch-action-bar__main { flex-direction: column; gap: 10px; }
  .batch-action-bar__actions { margin-left: 0; width: 100%; justify-content: flex-end; }
  .batch-action-bar__count { font-size: 13px; }
  .batch-action-bar__form { flex-wrap: wrap; }
  .batch-action-select, .batch-action-input { max-width: 100%; }
}

/* ===== Vehicle Entry: OCR section ===== */
.ocr-section {
  margin: 0 0 16px;
  display: flex;
  gap: 8px;
}

.scan-bar {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
  background: linear-gradient(135deg, #e8f0fe, #d4e4ff);
  border: 1px dashed #2b7de9;
  border-radius: 8px;
  gap: 6px;
  cursor: pointer;
  transition: background 150ms;
}
.scan-bar:hover { background: linear-gradient(135deg, #d4e4ff, #bdd4ff); }

.scan-icon { font-size: 18px; }

.scan-text {
  font-size: 13px;
  color: #2b7de9;
  font-weight: 500;
}

.scan-loading {
  text-align: center;
  font-size: 12px;
  color: #999;
  padding: 8px;
}

/* ===== Vehicle Entry: Section ===== */
.section {
  margin: 0 0 16px;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #f0f0f0;
}

.section-header__icon { font-size: 16px; }

.section-header__title {
  font-size: 14px;
  font-weight: 600;
  color: #475569;
}

/* ===== Vehicle Entry: Formula note ===== */
.formula-note {
  padding: 8px 16px;
  margin: 0;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  font-size: 12px;
  color: #92400e;
  text-align: center;
}

/* ===== Vehicle Entry: Estimate field ===== */
.estimate-field-value {
  padding: 8px 0;
  font-size: 20px;
  font-weight: 700;
  color: #b45309;
}

/* ===== Vehicle Entry: Form rows & half groups ===== */
.form-row { display: flex; }

.form-group--half {
  flex: 1;
  min-width: 0;
}

.form-group--half:first-child {
  border-right: 1px solid #f0f0f0;
}

/* ===== Vehicle Entry: Combobox dropdown ===== */
.cb-toggle {
  font-size: 12px;
  color: #2b7de9;
  padding: 2px 0 0;
  text-align: right;
  cursor: pointer;
  user-select: none;
}
.cb-toggle:hover { color: #1d4ed8; }

.cb-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
}

.cb-item {
  padding: 12px 16px;
  font-size: 14px;
  color: #333;
  border-bottom: 1px solid #f5f5f5;
  cursor: pointer;
  transition: background 100ms;
}
.cb-item:last-child { border-bottom: none; }
.cb-item:hover { background: #f1f5f9; }

.cb-item--active {
  color: #2b7de9;
  background: #e8f0fe;
  font-weight: 500;
}

/* ===== Utility ===== */
.hidden { display: none !important; }
