:root {
  --accent: #e8451f;
  --ink: #17191d;
  --ink-soft: #3f4148;
  --gray: #5b5d57;
  --gray-light: #75776f;
  --bg: #f2f2f0;
  --surface: #ffffff;
  --border: #d5d6d1;
  --border-soft: #e6e7e2;

  /* chữ phụ trên nền tối (modal/drawer head) — tách riêng khỏi --gray-light
     vì biến đó đã tối hoá cho nền sáng, dùng trên nền tối sẽ gần như vô
     hình (tương phản < 2:1) */
  --side-text-faint: #9fa199;

  --blue: #2563c9;
  --blue-soft: #e4edfb;
  --green: #1f7a43;
  --green-soft: #e7f4ec;
  --amber: #b07610;
  --amber-soft: #f7edda;
  --red: #c0331b;
  --red-soft: #fbe7e3;
  --violet: #6d3fd1;
  --violet-soft: #eee7fb;

  --radius: 6px;
  --shadow: 0 1px 2px rgba(23,25,29,0.06), 0 6px 18px rgba(23,25,29,0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Archivo", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
}
.mono { font-family: "IBM Plex Mono", monospace; }

/* ───────────────────────── app shell ───────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

/* ───────────────────────── sidebar ───────────────────────── */
.sidebar {
  width: 236px; flex: 0 0 236px;
  background: var(--surface); color: var(--ink);
  border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.sidebar-top { padding: 22px 20px 20px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 36px; height: 36px; flex: 0 0 36px;
  background: var(--accent); color: white;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; letter-spacing: 0.02em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 16px; font-weight: 800; letter-spacing: 0.01em; color: var(--ink); }
.brand-text span {
  font-size: 12.5px; letter-spacing: 0.04em; font-weight: 600;
  color: var(--gray-light); text-transform: uppercase; margin-top: 2px;
}
.brand-stripe {
  height: 6px; margin-top: 18px; opacity: 0.85;
  background: repeating-linear-gradient(-45deg, var(--accent) 0 9px, var(--ink) 9px 18px);
}

/* flex:1 + min-height:0 để nav là vùng CUỘN RIÊNG khi danh sách menu dài hơn
   chiều cao sidebar (100vh) — logo (.sidebar-top) và chân trang (.sidebar-foot,
   có nút Đăng xuất) luôn cố định, không bị đẩy khuất/cuộn theo (xem bug góc
   dưới-trái: sidebar cao cố định 100vh + overflow:visible mặc định làm nav
   tràn ra ngoài khung, kéo dài chiều cao cả trang → sticky bị tách sớm, lộ
   nền trắng phía dưới trước khi cuộn hết trang). */
.sidebar nav { display: flex; flex-direction: column; padding: 6px 12px; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
/* Không bọc khung/viền quanh từng nhóm (từng thử — khung bó hẹp bề ngang vốn
   đã ít của sidebar 236px, khiến tên danh mục tiếng Việt dài dễ bị tràn/kẹt
   chữ). Phân biệt tiêu đề danh mục với mục con chỉ bằng màu/độ đậm chữ + thụt
   lề — không cần khung riêng. */
.nav-group { display: flex; flex-direction: column; margin-bottom: 16px; }
.nav-group:last-child { margin-bottom: 0; }
.nav-group-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink); font-weight: 800; padding: 6px 12px 7px;
}
.nav-group-label::before {
  content: ""; width: 6px; height: 6px; flex: 0 0 6px; border-radius: 2px;
  background: var(--accent);
}
.nav-group-items { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left; border: none; cursor: pointer;
  padding: 10px 12px 10px 22px; border-radius: 6px;
  font-family: inherit; font-size: 15px; font-weight: 500; line-height: 1.3;
  transition: background 0.15s; background: transparent; color: var(--gray);
}
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.active { background: rgba(232,69,31,0.1); color: var(--accent); font-weight: 700; }
.nav-item .bar {
  position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 6px;
  background: transparent;
}
.nav-item.active .bar { background: var(--accent); }
.nav-item .idx {
  font-family: "IBM Plex Mono", monospace; font-size: 11.5px; letter-spacing: 0.06em;
  color: var(--gray-light); font-weight: 600;
}
.nav-item.active .idx { color: var(--accent); }
/* min-width:0 là bắt buộc — flex item mặc định min-width:auto (co lại tối đa
   bằng độ rộng nội dung), khiến label không co/xuống dòng được khi hẹp chỗ mà
   TRÀN ra ngoài .nav-item thay vì wrap, gây hiện tượng chữ bị "kẹt"/mất chữ
   như báo cáo — nhất là các tên dài "Công nợ & Hóa đơn", "Báo cáo lợi nhuận". */
.nav-item .label { flex: 1; min-width: 0; white-space: normal; word-break: break-word; }
.nav-item .count {
  font-family: "IBM Plex Mono", monospace; font-size: 12px; padding: 1px 6px; border-radius: 6px;
  background: var(--bg); color: var(--gray);
  flex: 0 0 auto; white-space: nowrap;
}
.nav-item.active .count { background: rgba(232,69,31,0.15); color: var(--accent); }

.sidebar-foot { margin-top: auto; padding: 16px 20px 20px; border-top: 1px solid var(--border-soft); }
.sidebar-user { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border-soft); }
.sidebar-user-name { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.sidebar-user-title {
  font-size: 12.5px; color: var(--gray-light);
  margin-top: 2px; margin-bottom: 8px;
}
.sidebar-logout {
  background: none; border: 1px solid var(--border); color: var(--ink-soft); border-radius: 8px;
  font-size: 12.5px; font-weight: 600; padding: 6px 10px; cursor: pointer; transition: background 0.15s;
}
.sidebar-logout:hover { background: var(--bg); color: var(--ink); }
.sidebar-guide-link {
  display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); text-decoration: none;
  margin-bottom: 14px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; text-align: center;
  transition: background 0.15s;
}
.sidebar-guide-link:hover { background: var(--bg); color: var(--ink); }
.gps-status {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; letter-spacing: 0.03em; font-weight: 600;
  text-transform: uppercase; color: var(--gray-light);
}
.gps-status .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 3px rgba(31,122,67,0.18);
  animation: pnl-pulse 2.4s ease-in-out infinite;
}
@keyframes pnl-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.sidebar-clock {
  font-family: "IBM Plex Mono", monospace; font-size: 12px; letter-spacing: 0.06em;
  color: var(--gray-light); margin-top: 9px;
}

/* ───────────────────────── main / header ───────────────────────── */
main.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(242,242,240,0.86); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 18px 30px; display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.topbar .eyebrow {
  font-size: 13px; letter-spacing: 0.05em; font-weight: 600;
  text-transform: uppercase; color: var(--gray); margin-bottom: 5px;
}
.topbar h1 { margin: 0; font-size: 31px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.topbar-heading { min-width: 0; }

/* nút mở menu (chỉ hiện ở màn hình hẹp — xem media query cuối file) */
.nav-toggle {
  display: none; flex: 0 0 auto; width: 40px; height: 40px;
  align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  font-size: 20px; line-height: 1; color: var(--ink);
}
.nav-toggle:hover { background: var(--bg); }
.sidebar-backdrop { display: none; }

main.pane { padding: 26px 30px 60px; flex: 1; }
.tab-panel { display: none; animation: pnl-fade 0.2s ease; }
.tab-panel.active { display: block; }
@keyframes pnl-fade { from { opacity: 0; } to { opacity: 1; } }

/* ───────────────────────── buttons ───────────────────────── */
button { font-family: inherit; cursor: pointer; }
button:focus-visible, .nav-item:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}
.btn-solid {
  background: var(--ink); color: #fff; border: none; padding: 9px 15px;
  border-radius: 6px; font-size: 14.5px; font-weight: 600; transition: opacity 0.15s;
}
.btn-solid:hover { opacity: 0.85; }
.btn-primary {
  background: var(--accent); color: #fff; border: none; padding: 11px 18px;
  border-radius: 6px; font-size: 15px; font-weight: 700; letter-spacing: 0.01em;
  box-shadow: 0 2px 8px rgba(232,69,31,0.27);
}
.btn-primary:hover { opacity: 0.9; }
.btn-ghost {
  background: #fff; color: var(--ink-soft); border: 1px solid var(--border);
  padding: 9px 15px; border-radius: 6px; font-size: 14.5px; font-weight: 600;
}
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: #fff; color: var(--red); border: 1px solid #f0c4bb; padding: 9px 15px; border-radius: 6px; font-size: 14.5px; font-weight: 600; }
.btn-danger:hover { background: var(--red-soft); }
.btn-mini { background: transparent; color: var(--gray); border: 1px solid var(--border); padding: 4px 10px; font-size: 14.5px; border-radius: 6px; }
.btn-mini:hover { background: var(--bg); color: var(--ink); }

/* ───────────────────────── KPI strip ───────────────────────── */
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 14px; margin-bottom: 26px; }
.kpi-card {
  position: relative; background: #fff; border: 1px solid var(--border);
  border-top: 3px solid var(--ink); border-radius: 8px; padding: 16px 18px; overflow: hidden;
  transition: background 0.15s, border-color 0.15s;
}
/* 2 mức nổi bật để liếc là biết nặng nhẹ: hot = hổ phách (việc tồn/cần xử lý),
   kpi-error = đỏ (lỗi/hỏng thật sự) — trước đây dùng chung 1 màu accent nên
   không phân biệt được mức độ nghiêm trọng giữa các kpi. */
.kpi-card.hot { border-top-color: var(--amber); background: var(--amber-soft); }
.kpi-card.kpi-error { border-top-color: var(--red); background: var(--red-soft); }
.kpi-card::after {
  content: ""; position: absolute; top: 0; right: 0; width: 14px; height: 14px;
  border-top: 2px solid var(--border); border-right: 2px solid var(--border);
}
.kpi-card.hot::after { border-color: rgba(176,118,16,0.25); }
.kpi-card.kpi-error::after { border-color: rgba(192,51,27,0.25); }
.kpi-label {
  font-size: 13px; letter-spacing: 0.03em; font-weight: 600;
  text-transform: uppercase; color: var(--gray);
}
.kpi-card.hot .kpi-label { color: var(--amber); }
.kpi-card.kpi-error .kpi-label { color: var(--red); }
.kpi-value {
  font-family: "IBM Plex Mono", monospace; font-weight: 600; font-size: 30px;
  letter-spacing: -0.01em; margin: 8px 0 3px; color: var(--ink);
}
.kpi-card.hot .kpi-value { color: var(--amber); }
.kpi-card.kpi-error .kpi-value { color: var(--red); }
.kpi-sub { font-size: 13px; color: var(--gray); }
.kpi-card.hot .kpi-sub { color: #8a6208; }
.kpi-card.kpi-error .kpi-sub { color: #96291a; }

/* ───────────────────────── toolbar (tìm kiếm + lọc + nhập/xuất) ───────────────────────── */
.trip-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.search-input {
  flex: 1 1 260px; max-width: 360px;
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  padding: 9px 13px; font-family: inherit; font-size: 14.5px; color: var(--ink);
}
.search-input:focus { outline: none; border-color: var(--accent); }
.month-input {
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 11px; font-family: "IBM Plex Mono", monospace; font-size: 14px; color: var(--ink);
}
.month-input:focus { outline: none; border-color: var(--accent); }
.trip-toolbar .trip-filters, .trip-toolbar .btn-mini, .trip-toolbar .btn-ghost { margin-bottom: 0; }

/* ───────────────────────── filter tabs (filterbar.js — dùng chung mọi thẻ) ───────────────────────── */
.filterbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filterbar-daterange { display: inline-flex; align-items: center; gap: 6px; }
.filterbar-daterange-label { font-size: 12.5px; color: var(--gray-light); white-space: nowrap; }
.filterbar-daterange-sep { color: var(--gray-light); }
.filterbar-date {
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  padding: 7px 9px; font-family: "IBM Plex Mono", monospace; font-size: 13px; color: var(--ink);
}
.filterbar-date:focus { outline: none; border-color: var(--accent); }
.trip-filters { display: inline-flex; gap: 3px; background: #e2e2de; padding: 3px; border-radius: 6px; border: 1px solid var(--border); margin-bottom: 18px; }
.filter-btn {
  display: inline-flex; align-items: center; gap: 7px; border: none; cursor: pointer;
  font-family: inherit; font-size: 14.5px; font-weight: 600; padding: 7px 13px; border-radius: 6px;
  transition: all 0.15s; background: transparent; color: var(--gray);
}
.filter-btn .cnt {
  font-family: "IBM Plex Mono", monospace; font-size: 11.5px; padding: 1px 5px; border-radius: 6px;
  background: transparent; color: var(--gray-light);
}
.filter-btn.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.filter-btn.active .cnt { background: var(--bg); color: var(--gray); }

/* ───────────────────────── trip cards ───────────────────────── */
.trips-list { display: flex; flex-direction: column; gap: 14px; }
.trip-card { display: flex; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.trip-card.status-hoan_thanh { opacity: 0.92; }
.trip-stripe { width: 4px; flex: 0 0 4px; border-radius: 8px 0 0 8px; }
.trip-body { flex: 1; min-width: 0; padding: 20px 24px; }

.trip-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.trip-head-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.trip-ma { font-family: "IBM Plex Mono", monospace; font-size: 17px; font-weight: 600; letter-spacing: 0.01em; }
.trip-type-badge {
  font-family: "IBM Plex Mono", monospace; font-size: 11.5px; font-weight: 700; letter-spacing: 0.1em;
  padding: 3px 8px; border-radius: 6px; background: var(--ink); color: #fff;
}
.trip-type-badge.nhap { background: var(--ink-soft); }
.trip-status-badge { font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em; padding: 3px 9px; border-radius: 6px; }
.trip-edo-warn {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: "IBM Plex Mono", monospace; font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em;
  padding: 3px 8px; background: var(--red-soft); color: var(--red); border-radius: 6px;
}
.trip-deadline { text-align: right; }
.trip-deadline .lbl { font-size: 12.5px; letter-spacing: 0.03em; font-weight: 600; text-transform: uppercase; color: var(--gray); }
.trip-deadline .val { font-family: "IBM Plex Mono", monospace; font-size: 15px; font-weight: 600; margin-top: 2px; }
.trip-deadline .val.warn { color: var(--red); }
td.warn { color: var(--red); font-weight: 600; }

.trip-meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 22px; margin-top: 16px; }
.trip-meta-grid .k {
  font-size: 12.5px; letter-spacing: 0.03em; font-weight: 600; text-transform: uppercase;
  color: var(--gray-light); margin-bottom: 4px;
}
.trip-meta-grid .v { font-weight: 600; font-size: 15.5px; }
.trip-meta-grid .v.mono { font-family: "IBM Plex Mono", monospace; font-weight: 500; font-size: 15px; }
.trip-meta-grid .route { display: flex; align-items: center; gap: 7px; font-size: 15px; }
.trip-meta-grid .route .arrow { color: var(--accent); }

/* stepper */
.trip-stepper { margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--border-soft); display: flex; align-items: flex-start; }
.step { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.step-line-row { display: flex; align-items: center; width: 100%; }
.step-bar { height: 2px; flex: 1; background: var(--border); }
.step-bar.first, .step-bar.last { background: transparent; }
.step-bar.filled { background: var(--ink); }
.step-dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; box-sizing: border-box; background: #fff; border: 2px solid var(--border); }
.step-dot.done { background: var(--ink); border-color: var(--ink); }
.step-dot.current { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232,69,31,0.13); }
.step-label {
  font-size: 12px; text-align: center; line-height: 1.25;
  color: var(--gray-light); font-weight: 500;
}
.step-label.done { color: var(--ink-soft); font-weight: 600; }
.step-label.current { color: var(--accent); font-weight: 700; }

/* actions */
.trip-actions { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border-soft); display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.trip-actions .edo-note { font-size: 14.5px; color: var(--red); font-weight: 600; margin-right: 4px; }
.trip-actions select {
  background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
  font-family: inherit; font-size: 14.5px; color: var(--ink); min-width: 130px;
}

/* ô chọn có tìm kiếm (phân công tài xế/xe/rơ móc) */
.combo { position: relative; min-width: 160px; flex: 1 1 160px; max-width: 220px; }
.combo-input {
  width: 100%; background: #fff; border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; font-family: inherit; font-size: 14.5px; color: var(--ink);
}
.combo-input:focus { outline: none; border-color: var(--accent); }
.combo-list {
  display: none; position: absolute; top: calc(100% + 2px); left: 0; right: 0; z-index: 60;
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  max-height: 190px; overflow-y: auto; box-shadow: 0 6px 18px rgba(23,25,29,0.12);
}
.combo-list.open { display: block; }
.combo-item { padding: 8px 11px; font-size: 14px; cursor: pointer; }
.combo-item:hover { background: var(--bg); }
.combo-item-empty { padding: 8px 11px; font-size: 13px; color: var(--gray-light); }
.trip-done-badge {
  display: inline-flex; align-items: center; gap: 7px; font-family: "IBM Plex Mono", monospace;
  font-weight: 600; font-size: 15px; color: var(--green); background: var(--green-soft); padding: 7px 12px; border-radius: 6px;
}
.trip-done-km { font-family: "IBM Plex Mono", monospace; font-size: 14px; color: var(--gray); }

/* ───────────────────────── panels (catalog) ───────────────────────── */
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; padding: 15px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 14.5px; font-weight: 700; letter-spacing: 0.01em;
  color: var(--ink-soft);
}
.panel-head .cnt { color: var(--gray); font-weight: 500; text-transform: none; letter-spacing: 0.06em; }
.bulk-toolbar { display: flex; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--border-soft); background: var(--bg); }
.bulk-toolbar .btn-mini { text-decoration: none; display: inline-block; }
.panel form { display: flex; gap: 7px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); }
.panel form input {
  flex: 1; min-width: 90px; background: #fff; border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; font-family: inherit; font-size: 15px; color: var(--ink);
}

/* ───────────────────────── tables ───────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
thead { background: var(--border-soft); }
th {
  text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 700; letter-spacing: 0.01em;
  text-transform: uppercase; color: var(--gray);
}
th.r { text-align: right; }
td { padding: 11px 16px; border-bottom: 1px solid var(--border-soft); }
td.mono { font-family: "IBM Plex Mono", monospace; }
td.r { text-align: right; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) td { background: rgba(23,25,29,0.018); }
tbody tr:hover td { background: var(--bg); }
.table-scroll { overflow-x: auto; }

.trailer-badge {
  font-family: "IBM Plex Mono", monospace; font-size: 12px; font-weight: 600; padding: 3px 9px;
  border-radius: 6px; background: var(--bg); color: var(--ink-soft);
}

/* ───────────────────────── ghi chú họp ───────────────────────── */
.note-form-panel { margin-bottom: 20px; }
.note-form { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.note-form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.note-form-row select, .note-form-row input {
  background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
  font-family: inherit; font-size: 14.5px; color: var(--ink);
}
.note-type-select { flex: 0 0 160px; }
.note-form-row input { flex: 1; min-width: 140px; }
.note-form textarea {
  width: 100%; background: #fff; border: 1px solid var(--border); border-radius: 6px;
  padding: 10px 12px; font-family: inherit; font-size: 15px; color: var(--ink); resize: vertical;
}
.note-form textarea:focus, .note-form-row select:focus, .note-form-row input:focus { outline: none; border-color: var(--accent); }
.note-form button { align-self: flex-start; }

.notes-list { padding: 4px 0; }
.note-date-group { padding: 10px 20px 4px; }
.note-date-group .date-label {
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em;
  text-transform: uppercase; color: var(--gray); background: var(--bg); display: inline-block; padding: 3px 10px; border-radius: 8px;
}
.note-item {
  display: flex; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border-soft);
}
.note-item:last-child { border-bottom: none; }
.note-item-bar { width: 3px; flex: 0 0 3px; border-radius: 6px; }
.note-item-body { flex: 1; min-width: 0; }
.note-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.note-item-title { font-weight: 700; font-size: 15px; }
.note-item-type {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em;
  padding: 2px 8px; border-radius: 8px; text-transform: uppercase;
}
.note-item-time { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--gray-light); margin-left: auto; }
.note-item-content { color: var(--ink-soft); font-size: 15px; white-space: pre-wrap; line-height: 1.6; }
.note-item-author { font-size: 12.5px; color: var(--gray-light); margin-top: 6px; }

/* ───────────────────────── modal biên bản ───────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(23,25,29,0.5); animation: pnl-fade 0.18s ease; }
.modal-panel {
  position: relative; width: 620px; max-width: 100%; max-height: 86vh; background: #f6f6f4;
  border-radius: 6px; box-shadow: 0 24px 64px rgba(23,25,29,0.35); display: flex; flex-direction: column; overflow: hidden;
}
.modal-panel.wide { width: 980px; }
.modal-head {
  padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center;
  justify-content: space-between; background: var(--ink); color: #fff;
}
.modal-head .eyebrow { font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--side-text-faint); }
.modal-head .title { font-size: 18px; font-weight: 800; margin-top: 3px; }
.bienban-textarea {
  flex: 1; margin: 20px 24px; padding: 16px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; font-family: "IBM Plex Mono", monospace; font-size: 13.5px; line-height: 1.7; color: var(--ink);
  resize: none; min-height: 340px;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 0 24px 22px; }
#ocr-review-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
#ocr-danhmuc-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.ocr-field-row { display: flex; gap: 8px; margin-bottom: 6px; align-items: center; }
.ocr-field-row input[type="text"], .ocr-field-row input:not([type]) { flex: 1; }
.ocr-field-row label { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--gray-light); white-space: nowrap; }

/* ───────────────────────── OCR: dropzone + ảnh thu nhỏ + review 2 cột ───────────────────────── */
.ocr-dropzone {
  display: flex; align-items: center; justify-content: center; text-align: center;
  border: 1px dashed var(--border); border-radius: 6px; background: #fff;
  padding: 14px 16px; cursor: pointer; transition: border-color 0.15s, background 0.15s; min-height: 20px;
}
.ocr-dropzone:hover { border-color: var(--gray-light); }
.ocr-dropzone.drag { border-color: var(--accent); background: var(--red-soft); }
.ocr-file-preview-empty { font-size: 14px; color: var(--gray-light); }
.ocr-file-preview-set { display: flex; align-items: center; gap: 10px; }
.ocr-file-preview-set img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.ocr-file-preview-set .ocr-file-icon {
  width: 40px; height: 40px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg);
  display: flex; align-items: center; justify-content: center; font-size: 18px; flex: 0 0 40px;
}
.ocr-file-preview-set .name { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.ocr-file-clear {
  background: transparent; border: none; color: var(--gray); font-size: 13px; text-decoration: underline;
  cursor: pointer; padding: 2px 4px; margin-left: 4px;
}
.ocr-file-clear:hover { color: var(--red); }

.ocr-thumb-cell { width: 46px; }
.ocr-thumb { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; border: 1px solid var(--border); display: block; }
.ocr-thumb-placeholder {
  width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg);
  display: flex; align-items: center; justify-content: center; font-size: 15px; color: var(--gray-light);
}
tbody tr.ocr-row-clickable { cursor: pointer; }

.ocr-review-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 760px) {
  .ocr-review-grid { grid-template-columns: minmax(320px, 460px) 1fr; align-items: start; }
  .ocr-review-media { position: sticky; top: 0; }
}
.ocr-review-media img { cursor: zoom-in; }
.ocr-review-zoom-link {
  display: inline-block; margin-top: 8px; font-size: 12.5px; color: var(--gray); text-decoration: underline;
}
.ocr-review-zoom-link:hover { color: var(--ink-soft); }
.ocr-review-meta {
  display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--gray);
  margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px dashed var(--border-soft);
}
.ocr-review-meta b { color: var(--ink-soft); }
.ocr-field-label { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.ocr-field-required { color: var(--red); font-weight: 700; }
.ocr-field-desc { flex-basis: 100%; font-size: 11.5px; color: var(--gray-light); font-weight: 400; }

.ocr-plan-link {
  margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px dashed var(--border-soft);
}
.ocr-plan-results { position: relative; }
.ocr-plan-result-row {
  padding: 7px 10px; font-size: 13px; cursor: pointer; border: 1px solid var(--border); border-top: none;
  background: #fff;
}
.ocr-plan-result-row:first-child { border-top: 1px solid var(--border); border-radius: 8px 8px 0 0; }
.ocr-plan-result-row:last-child { border-radius: 0 0 8px 8px; }
.ocr-plan-result-row:hover { background: var(--bg); }
.ocr-plan-result-sub { color: var(--gray-light); margin-left: 6px; }
.ocr-plan-result-empty { padding: 7px 10px; font-size: 12.5px; color: var(--gray-light); }

/* ───────────────────────── GPS map (Leaflet/OpenStreetMap thật) ───────────────────────── */
.gps-map-wrap {
  height: 340px; border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; margin-bottom: 20px;
}
#gps-map { height: 100%; width: 100%; background: var(--bg); font-family: "Archivo", sans-serif; }
.gps-marker { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.gps-marker-dot { width: 15px; height: 15px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
.gps-marker-label {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; font-weight: 700; white-space: nowrap;
  background: var(--ink); color: #fff; padding: 2px 7px; border-radius: 6px;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.gps-popup { font-family: "Archivo", sans-serif; font-size: 13px; line-height: 1.6; }
.gps-popup b { font-family: "IBM Plex Mono", monospace; }
.gps-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }
#list-gps a { color: var(--blue); font-weight: 600; text-decoration: none; font-family: "IBM Plex Mono", monospace; font-size: 14px; }
#list-gps a:hover { text-decoration: underline; }

.hint { font-size: 14px; color: var(--gray-light); }

/* ───────────────────────── drawer (tạo hành trình) ───────────────────────── */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 80; display: none; justify-content: flex-end;
}
.drawer-overlay.open { display: flex; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(23,25,29,0.42); animation: pnl-fade 0.18s ease; }
.drawer-panel {
  position: relative; width: 440px; max-width: 100%; height: 100%; background: #f6f6f4;
  box-shadow: -16px 0 40px rgba(23,25,29,0.2); display: flex; flex-direction: column;
  animation: pnl-drawer-in 0.24s cubic-bezier(0.2,0.8,0.2,1);
}
@keyframes pnl-drawer-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-head {
  padding: 22px 26px; border-bottom: 1px solid var(--border); display: flex; align-items: center;
  justify-content: space-between; background: var(--ink); color: #fff;
}
.drawer-head .eyebrow { font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--side-text-faint); }
.drawer-head .title { font-size: 22px; font-weight: 800; margin-top: 3px; }
.drawer-close {
  background: transparent; border: 1px solid #3a3d43; color: #c9cac6; width: 34px; height: 34px;
  border-radius: 6px; cursor: pointer; font-size: 18.5px; line-height: 1;
}
.drawer-form { flex: 1; overflow-y: auto; padding: 22px 26px; display: flex; flex-direction: column; gap: 15px; }
.drawer-form label {
  display: block; font-size: 13.5px; font-weight: 700; letter-spacing: 0.01em; text-transform: uppercase;
  color: var(--gray);
}
.drawer-form input, .drawer-form select {
  width: 100%; background: #fff; border: 1px solid var(--border); border-radius: 6px;
  padding: 9px 11px; margin-top: 6px; font-family: "Archivo", sans-serif; font-size: 15px; color: var(--ink);
}
.drawer-form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.drawer-checkbox {
  display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; font-weight: 500; color: var(--ink-soft);
  background: var(--border-soft); padding: 12px 14px; border-radius: 6px; border: 1px solid var(--border);
}
.drawer-checkbox input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); }
.drawer-actions { display: flex; gap: 10px; margin-top: 6px; }

/* ───────────────────────── trang đăng nhập ───────────────────────── */
.login-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: var(--ink);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 32px 28px 28px;
}
.login-brand { margin-bottom: 26px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-submit { width: 100%; margin-top: 4px; padding: 12px; font-size: 15.5px; }
.login-error {
  font-size: 14px; font-weight: 600; color: var(--red); background: var(--red-soft);
  padding: 9px 12px; border-radius: 6px;
}

/* ───────────────────────── toast ───────────────────────── */
#toast { position: fixed; bottom: 22px; right: 22px; z-index: 120; display: flex; flex-direction: column; gap: 10px; }
.toast-item {
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 6px; font-size: 15px; font-weight: 500;
  box-shadow: 0 8px 28px rgba(0,0,0,0.25); max-width: 360px; animation: pnl-slide-in 0.2s ease;
  border-left: 3px solid var(--accent);
}
@keyframes pnl-slide-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.toast-item.error { border-left-color: var(--red); background: var(--red); }

/* ───────────────────────── mobile / tablet ───────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 100;
    width: 264px; flex-basis: 264px; height: 100vh;
    transform: translateX(-100%); transition: transform 0.22s ease;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 48px rgba(0,0,0,0.45); }
  .sidebar-backdrop.show {
    display: block; position: fixed; inset: 0; z-index: 90;
    background: rgba(23,25,29,0.45); animation: pnl-fade 0.18s ease;
  }
  .nav-toggle { display: inline-flex; }

  .topbar { padding: 11px 14px; align-items: center; gap: 10px; }
  .topbar h1 { font-size: 21px; }
  .topbar .eyebrow { font-size: 11.5px; margin-bottom: 2px; }
  #btn-open-drawer { padding: 9px 13px; font-size: 14px; }

  main.pane { padding: 16px 13px 46px; }
  .kpi-strip { grid-template-columns: repeat(auto-fit, minmax(142px, 1fr)); gap: 10px; margin-bottom: 18px; }
  .kpi-value { font-size: 24px; }
  .catalog-grid { grid-template-columns: 1fr; gap: 14px; }

  .trip-body { padding: 16px 14px; }
  .trip-meta-grid { grid-template-columns: 1fr 1fr; gap: 12px 16px; }
  .trip-stepper { overflow-x: auto; padding-bottom: 6px; }
  .trip-ma { font-size: 15.5px; }

  /* combobox / select giãn hết chiều ngang cho dễ bấm */
  .combo, .combo-input { max-width: none; }
  .trip-actions .btn-solid, .trip-actions .btn-ghost { flex: 1 1 auto; }

  /* panel/drawer/modal chiếm trọn bề ngang */
  .drawer-panel { width: 100%; }
  .modal-panel, .modal-panel.wide { width: 100%; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn-ghost, .modal-actions .btn-solid, .modal-actions .btn-primary { flex: 1 1 auto; }
  .bienban-textarea { margin: 14px; min-height: 260px; }

  /* bảng chưa bọc .table-scroll vẫn cuộn ngang được */
  .panel > table { display: block; overflow-x: auto; }

  /* toast trải ngang, không tràn màn hình */
  #toast { left: 12px; right: 12px; bottom: 12px; }
  .toast-item { max-width: none; }

  /* iOS tự phóng to khi focus input có font < 16px — ép 16px (chỉ trên mobile) */
  input, select, textarea,
  .search-input, .month-input, .combo-input,
  .drawer-form input, .drawer-form select,
  .note-form-row input, .note-form-row select, .note-form textarea,
  .panel form input, .trip-actions select { font-size: 16px !important; }
}

@media (max-width: 480px) {
  .trip-meta-grid { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 19px; }
  .filter-btn { padding: 7px 10px; font-size: 14px; }
}

/* ── Bảng điều khiển (Tổng quan theo vai trò) ── */
.kpi-card.dash-jump { cursor: pointer; transition: border-color 0.15s, transform 0.1s; }
.kpi-card.dash-jump:hover { transform: translateY(-1px); }
.kpi-card.dash-jump:not(.hot):not(.kpi-error):hover { border-top-color: var(--accent); }
.dash-viewall { margin-left: auto; font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--accent); text-decoration: none; }
.dash-viewall:hover { text-decoration: underline; }
.dash-list { display: flex; flex-direction: column; }
.dash-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.dash-row:last-child { border-bottom: 0; }
.dash-row span:first-child { color: var(--ink); }
.dash-row span.mono { color: var(--gray); white-space: nowrap; }
.dash-row .trip-status-badge { white-space: nowrap; flex: 0 0 auto; }
