:root {
  --bg: #f5f6f8;
}

body {
  background: var(--bg);
}

.auth-body {
  background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.auth-wrap {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  padding: 24px 16px;
}

.auth-card {
  background: #fff;
  border-radius: 14px;
  padding: 32px 28px;
  box-shadow: 0 20px 45px rgba(2, 6, 23, .35);
}

.auth-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: #1e3a8a;
  color: #fff;
  font-size: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.card {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.card-header {
  background: #fff;
  border-bottom: 1px solid #eef0f3;
  font-weight: 600;
}

.stat-card {
  border-radius: 10px;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid #e5e7eb;
  height: 100%;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}

a.stat-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .08);
  transform: translateY(-1px);
}

.stat-card .num {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
}

.stat-card .lbl {
  color: #6b7280;
  font-size: 13px;
}

.table > :not(caption) > * > * {
  padding: 0.6rem 0.65rem;
}

.table thead th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #6b7280;
  background: #f9fafb;
  white-space: nowrap;
}

.badge-sev {
  font-size: 11px;
  font-weight: 600;
}

.plate {
  font-weight: 700;
  letter-spacing: .02em;
}

/* Biển số trong danh sách tích chọn phân công xe.
   Cỡ nhỏ hơn để nhìn được nhiều dòng cùng lúc trong ô cuộn. */
.plate-nho {
  font-size: .8rem;
  letter-spacing: 0;
}

/* Ô nhập số km: to, rõ, dễ bấm bằng ngón tay */
.km-input {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .02em;
  text-align: right;
  padding: 8px 12px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.text-mini {
  font-size: 12px;
  color: #6b7280;
}

/* =====================================================================
   Giao diện điện thoại
   Bảng nhiều cột chuyển thành thẻ xếp dọc để không phải cuộn ngang.
   Nhãn cột lấy từ thuộc tính data-label của từng ô.
   ===================================================================== */
@media (max-width: 767.98px) {
  body { font-size: 15px; }

  .stat-card { padding: 14px 16px; }
  .stat-card .num { font-size: 24px; }
  .stat-card .lbl { font-size: 12px; }

  .table-responsive { overflow-x: visible; }

  .table-stack thead { display: none; }

  .table-stack,
  .table-stack tbody,
  .table-stack tr,
  .table-stack td {
    display: block;
    width: 100%;
  }

  .table-stack tr {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin: 0 0 10px;
    padding: 10px 12px;
    background: #fff;
  }

  .table-stack tr:last-child { margin-bottom: 0; }

  .table-stack td {
    border: 0 !important;
    padding: 3px 0 !important;
    min-width: 0 !important;
    text-align: left !important;
    white-space: normal !important;
  }

  .table-stack td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #6b7280;
    font-weight: 600;
    margin-bottom: 1px;
  }

  /* Ô không có nhãn: nút thao tác, ô tiêu đề */
  .table-stack td:not([data-label])::before,
  .table-stack td[data-label=""]::before { content: none; }

  /* Ô đầu tiên đóng vai trò tiêu đề của thẻ */
  .table-stack td.cell-head {
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid #f1f3f5 !important;
    padding-bottom: 8px !important;
    margin-bottom: 6px;
  }

  .table-stack td.cell-actions {
    border-top: 1px solid #f1f3f5 !important;
    margin-top: 6px;
    padding-top: 8px !important;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .table-stack td.cell-actions .btn { flex: 1 1 auto; }
  .table-stack td.cell-actions form { display: inline-flex; flex: 1 1 auto; }
  .table-stack td.cell-actions form .btn { width: 100%; }

  /* Thẻ rỗng khi bảng không có dữ liệu */
  .table-stack td[colspan] { text-align: center !important; }
  .table-stack td[colspan]::before { content: none; }

  /* Biểu mẫu và nút bấm */
  .card-body { padding: 14px; }
  .btn { min-height: 38px; }
  .form-control, .form-select { font-size: 16px; }   /* tránh iOS tự phóng to khi gõ */

  h1.h4 { font-size: 20px; }

  /* Khối tải ảnh */
  .att-thumb { width: calc(50% - 4px) !important; }
}

@media (max-width: 576px) {
  .stat-card .num { font-size: 22px; }
}

/* ---------------------------------------------------------------------
   Mời cài ứng dụng điện thoại
   Che kín màn hình để lái xe chú ý, nhưng vẫn chừa lối bỏ qua bên dưới.
   --------------------------------------------------------------------- */
.moi-cai-app {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  overflow-y: auto;
}

/* display:flex ở trên sẽ đè lên thuộc tính hidden của HTML,
   nên phải khai riêng thì lúc bỏ qua mới thật sự ẩn đi. */
.moi-cai-app[hidden] {
  display: none !important;
}

.moi-cai-app-hop {
  width: 100%;
  max-width: 380px;
  text-align: center;
}

/* Biểu tượng ứng dụng, vẽ bằng CSS nên không phải tải thêm ảnh */
.app-icon {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  background: #2563EB;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  box-shadow: 0 6px 18px rgba(37, 99, 235, .35);
}
