/* ======================================================================
   style.css — token + class DÙNG CHUNG của KhachSanView.
   Copy nguyên văn từ LichXeApp (static/login.html, static/quan-ly-xe.html
   và static/lich-xe.html — gốc từ docs/design-reference/style-tile.html).
   Mọi trang trong static/ đều <link> file này thay vì lặp lại <style>
   (cải tiến nhỏ so với bản xe cũ để dễ bảo trì).
   Font Be Vietnam Pro được import qua <link> Google Fonts ở từng trang.
   ====================================================================== */

/* ---------- :root — copy nguyên văn từ style-tile.html ---------- */
:root{
  --surface:#f7f8fa; --panel:#ffffff; --panel-alt:#f1f4f8;
  --border:#e4e8ee; --border-strong:#cdd4de;
  --text:#10151f; --text-muted:#667085; --text-faint:#98a2b3;
  --accent:#2563eb; --accent-hover:#1d4ed8; --accent-soft:#eaf1ff; --accent-ring:rgba(37,99,235,.32);
  --success:#16a34a; --success-soft:#eefdf3;
  --danger:#dc2626; --danger-soft:#fef1f1;
  --warning:#d97706; --warning-soft:#fff8ec;
  --radius-sm:8px; --radius-md:12px; --radius-lg:18px; --radius-full:999px;
  --shadow-sm:0 1px 2px rgba(16,21,31,.05);
  --shadow-md:0 8px 24px rgba(16,21,31,.08), 0 2px 6px rgba(16,21,31,.04);
  --shadow-lg:0 20px 48px rgba(16,21,31,.16), 0 6px 16px rgba(16,21,31,.06);
  --shadow-focus:0 0 0 4px var(--accent-ring);
  --ease:cubic-bezier(.16,1,.3,1);
  --dur-1:120ms; --dur-2:200ms; --dur-3:340ms;
  --font:'Be Vietnam Pro', ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Reset + nền chung (layout từng trang tự xử lý riêng) ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;                 /* tuyệt đối không cuộn ngang toàn trang */
  overscroll-behavior-y: none;      /* không "rubber-band" kéo cả trang trên iOS/Android */
  -webkit-tap-highlight-color: transparent;  /* bỏ ô xám nhấp nháy khi chạm */
}
/* Control: bỏ delay 300ms + double-tap-zoom, không hiện menu long-press */
button, .btn, .p-nav, .lv-nav, .p-pill, .p-card, .lv-bar,
.menu-item, .sheet, .td-don, [role="button"], [role="menuitem"] {
  touch-action: manipulation;
  -webkit-touch-callout: none;
}
a.btn { text-decoration: none; }

/* ---------- Thanh tiêu đề trang — copy nguyên văn từ quan-ly-xe.html ---------- */
.thanh-tren {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.thanh-tren h1 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.thanh-tren .hanh-dong { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Nút răng cưa (cài đặt) — nằm CUỐI hàng Thống kê/Lịch sử/Tìm đơn,
   margin-left:auto để luôn dồn sát mép phải kể cả khi hàng nút wrap ---------- */
.menu-cai-dat { position: relative; display: inline-flex; margin-left: auto; }
.btn-rang-cua { padding: 10px 12px; }
.btn-rang-cua svg { width: 18px; height: 18px; display: block; transition: transform var(--dur-3) var(--ease); }
.menu-cai-dat.mo .btn-rang-cua { background: var(--panel-alt); border-color: var(--border-strong); }
.menu-cai-dat.mo .btn-rang-cua svg { transform: rotate(90deg); }
.menu-cai-dat-list {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 200;
  min-width: 194px; max-width: calc(100vw - 24px); padding: 6px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 2px;
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.98); transform-origin: top right;
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease), visibility var(--dur-2);
}
.menu-cai-dat.mo .menu-cai-dat-list { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.menu-cai-dat-list .menu-item {
  appearance: none; border: 0; background: none; cursor: pointer;
  font-family: var(--font); font-size: 13px; font-weight: 600; color: var(--text);
  text-align: left; text-decoration: none; white-space: nowrap;
  padding: 9px 10px; border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 8px;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.menu-cai-dat-list .menu-item:hover { background: var(--panel-alt); }
.menu-cai-dat-list .menu-item.muc-nguy { color: var(--danger); }
.menu-cai-dat-list .menu-item.muc-nguy:hover { background: var(--danger-soft); }

/* ---------- Nút — copy nguyên văn từ style-tile.html mục "3. Nút bấm" ---------- */
.btn{
  appearance:none;border:1px solid var(--border);background:var(--panel);color:var(--text);
  font-family:var(--font);font-size:13.5px;font-weight:600;padding:10px 18px;border-radius:var(--radius-md);
  cursor:pointer;display:inline-flex;align-items:center;gap:8px;
  transition:transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.btn:hover{transform:translateY(-1px);box-shadow:var(--shadow-md);}
.btn:active{transform:translateY(0);box-shadow:none;}
.btn-primary{background:var(--accent);border-color:var(--accent);color:#fff;}
.btn-primary:hover{background:var(--accent-hover);border-color:var(--accent-hover);}
.btn-secondary{background:var(--panel);color:var(--text);}
.btn-secondary:hover{background:var(--panel-alt);}
.btn-danger{background:var(--danger);border-color:var(--danger);color:#fff;}
.btn-danger:hover{background:#b91c1c;border-color:#b91c1c;}
.btn-small { padding: 4px 10px; font-size: 12px; border-radius: var(--radius-sm); }

/* ---------- Ô nhập — copy nguyên văn từ style-tile.html mục "4. Ô nhập liệu" ---------- */
.field{display:flex;flex-direction:column;gap:6px;width:220px;}
.field label{font-size:12.5px;font-weight:600;color:var(--text-muted);}
.field input{
  font-family:var(--font);font-size:14px;padding:10px 12px;border-radius:var(--radius-sm);
  border:1.5px solid var(--border);background:var(--panel);color:var(--text);
  transition:border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.field input:focus{outline:none;border-color:var(--accent);box-shadow:var(--shadow-focus);}
.field.has-error input{border-color:var(--danger);}
.field.has-error input:focus{box-shadow:0 0 0 4px rgba(220,38,38,.15);}

/* ---------- Thẻ card — copy nguyên văn từ login.html (dùng cho trang đăng nhập) ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-md);
}
.card h1 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 4px; }
.card .sub { color: var(--text-muted); font-size: 13px; margin-bottom: 22px; }
.card .field { width: 100%; margin-bottom: 14px; }
.card .btn-primary { width: 100%; }

/* ---------- Dòng báo lỗi — copy nguyên văn từ login.html ---------- */
.loi {
  display: none;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}


/* ======================================================================
   LỊCH PHÒNG — #portraitView (agenda dọc, ≤480px) + #landscapeView
   (lưới ngang, >480px) + bottom sheet + toast.
   Copy nguyên văn style/token từ LichXeApp/static/lich-xe.html, chỉ đổi:
   - Ngưỡng hiển thị: ≤480px = dọc, >480px = ngang (bản xe còn dùng
     max-height+orientation cho điện thoại xoay ngang vì có Gantt desktop;
     bản này KHÔNG có Gantt nên chia thuần theo chiều rộng).
   - Lưới ngang: lưới nền .lv-cell (đường kẻ ngày) + mỗi đơn 1 viên thuốc
     .lv-bar (bo tròn, màu MAU_PHONG[id%6]) — xem chi tiết trong @media bên dưới.
   ====================================================================== */

#portraitView { display: none; }
#landscapeView { display: none; }
/* Con trỏ chuột có thể kéo để cuộn ngang (chỉ thêm cho chuột; cảm ứng thật vẫn vuốt như cũ) */
.p-daystrip, .lv-scroll { cursor: grab; user-select: none; }

/* ---------- Bottom sheet (chung: ẩn khi chưa mở, không phụ thuộc màn hình) ---------- */
.sheet-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.42);
  backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none; transition: opacity var(--dur-2) var(--ease); z-index: 250;
}
.sheet-overlay.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--panel); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg);
  padding: 10px 22px 30px; transform: translateY(100%);
  transition: transform var(--dur-3) var(--ease); max-height: 72%; overflow-y: auto; z-index: 260;
}
.sheet-overlay.is-open .sheet { transform: translateY(0); }
.sheet-handle { width: 34px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 2px auto 12px; }
.sheet h3 { font-size: 15px; font-weight: 700; margin: 0 0 3px; }
.sheet .s-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.sheet-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.sheet-row:last-of-type { border-bottom: none; }
.sheet-row span:first-child { color: var(--text-muted); }
.sheet-row span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ======================================================================
   AGENDA DỌC (màn hình ≤480px) — copy nguyên văn lich-xe.html, chỉ đổi
   ngữ cảnh: .p-card free ghi "Trống cả đêm" (bản xe "Trống cả ngày").
   .p-topbar có 4 phần: nút "◀ Tháng trước" | nút "📍 Hôm nay" | tên tháng
   (chữ, không phải nút) | nút "Tháng sau ▶" — dạng ô vuông bo góc nhỏ.
   ====================================================================== */
@media (max-width: 480px) {
  #landscapeView { display: none; }
  #portraitView { display: flex; flex-direction: column; }

  .p-topbar { padding: 10px 16px 0; }
  .p-topbar .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
  .p-topbar .dong {
    display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
    overflow-x: auto; /* phòng máy siêu hẹp — ưu tiên đủ chỗ 1 hàng, cuộn ngang nếu bất khả kháng */
  }
  /* Nút đổi tháng / Hôm nay — dạng ô vuông bo góc nhỏ (token --radius-md/--border/--shadow-sm) */
  .p-topbar .p-nav {
    appearance: none; border: 1px solid var(--border); background: var(--panel); color: var(--text);
    border-radius: var(--radius-md); padding: 7px 8px;
    font-family: var(--font); font-size: 12px; font-weight: 600; line-height: 1;
    display: inline-flex; align-items: center; gap: 3px;
    cursor: pointer; box-shadow: var(--shadow-sm); white-space: nowrap;
    transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
  }
  .p-topbar .p-nav:hover { background: var(--panel-alt); }
  /* Tên tháng hiện tại — chữ in đậm, không phải nút */
  .p-topbar .p-thang {
    font-size: 15px; font-weight: 800; color: var(--text); letter-spacing: -.01em; white-space: nowrap;
  }

  .p-daystrip { display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: none; padding: 10px 16px 4px; scrollbar-width: none; position: sticky; top: 0; background: var(--surface); z-index: 20; }
  .p-daystrip::-webkit-scrollbar { display: none; }
  .p-pill { flex-shrink: 0; width: 44px; height: 54px; border-radius: 14px; border: 1px solid var(--border); background: var(--panel); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--text-muted); cursor: pointer; transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
  .p-pill .n { font-size: 14px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
  .p-pill.is-sel { background: var(--accent); border-color: var(--accent); color: #fff; }
  .p-pill.is-sel .n { color: #fff; }
  .p-pill.is-today:not(.is-sel) { border-color: var(--accent); color: var(--accent); }
  .p-pill.is-today:not(.is-sel) .n { color: var(--accent); }

  .p-list { display: flex; flex-direction: column; gap: 12px; padding: 12px 16px 120px; }
  .p-card { background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow-sm); cursor: pointer; }
  .p-card.free { border-left-color: var(--success); }
  .p-card.ngung { border-left-color: var(--border-strong); opacity: .55; cursor: default; }
  .p-card .p-head { display: flex; align-items: baseline; gap: 6px; }
  .p-card .name { font-size: 14px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
  .p-card .plate { font-size: 11px; font-weight: 600; color: var(--text-faint); }
  .p-card .plate:not(:empty)::before { content: "·"; margin-right: 5px; color: var(--text-faint); font-weight: 400; }
  .p-card .badge { float: right; font-size: 10.5px; font-weight: 700; padding: 4px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-hover); }
  .p-card.free .badge { background: var(--success-soft); color: var(--success); }
  /* Tên khách — dòng nội dung chính của thẻ đã đặt */
  .p-card .detail { font-size: 13.5px; font-weight: 600; color: var(--text); margin-top: 10px; }
  /* Khoảng đêm ở — thông tin phụ, số căn chỉnh đều */
  .p-card .sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
  /* Dòng tổng kết: số đêm (mờ) bên trái · giá tiền (đậm) dồn phải, ngăn bằng vạch nhạt */
  .p-card .p-meta { display: flex; align-items: baseline; gap: 8px; margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--border); }
  .p-card .p-nights { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
  .p-card .p-price { margin-left: auto; font-size: 12.5px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
}

/* ======================================================================
   LƯỚI NGANG (màn hình >480px — gồm điện thoại xoay ngang, tablet, máy
   tính). Copy cấu trúc .lv-* từ lich-xe.html (cột phòng ghim trái sticky,
   header ngày cuối tuần/hôm nay). CHỈ XEM — mỗi đơn là 1 VIÊN THUỐC .lv-bar
   bo tròn (màu MAU_PHONG[phong_id % 6] qua color-mix), đè lên lưới nền
   .lv-cell (đường kẻ ngày + nền cuối tuần/hôm nay, không tô màu đơn lên ô).
   ====================================================================== */
@media (min-width: 481px) {
  #portraitView { display: none; }
  #landscapeView { display: flex; flex-direction: column; }

  .lv-topbar { background: var(--panel); padding: 6px calc(12px + env(safe-area-inset-left, 0px)) 4px calc(12px + env(safe-area-inset-right, 0px)); border-bottom: 1px solid var(--border); flex-shrink: 0; }
  .lv-topbar h2 { font-size: 14px; font-weight: 700; margin: 0; }
  .lv-topbar .dong { display: flex; align-items: center; gap: 10px; }
  .lv-nav {
    appearance: none; border: 1px solid var(--border); background: var(--panel); color: var(--text-muted);
    width: 26px; height: 26px; border-radius: var(--radius-sm); display: flex;
    align-items: center; justify-content: center; cursor: pointer;
    transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
  }
  .lv-nav:hover { background: var(--panel-alt); color: var(--text); }
  /* Nút "Hôm nay" ở lịch ngang — có chữ nên rộng theo nội dung, không bó 26x26 */
  .lv-nav.lv-homnay { width: auto; height: 26px; padding: 0 12px; gap: 4px; font-size: 11px; font-weight: 600; color: var(--text); }

  .lv-body { flex: 1; position: relative; overflow-y: auto; overflow-x: hidden; padding: 8px calc(12px + env(safe-area-inset-left, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) calc(12px + env(safe-area-inset-right, 0px)); }
  /* overscroll-behavior:none + BỎ -webkit-overflow-scrolling:touch — chặn cuộn dội
     (rubber-band iOS) quá 2 đầu làm lộ khoảng trắng; dừng cứng ở mép lưới */
  .lv-scroll { overflow-x: auto; overscroll-behavior: none; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
  .lv-grid { width: max-content; min-width: 100%; }  /* min-width:100% để lưới ít cột vẫn phủ kín, không hở phải */
  .lv-head { display: flex; background: var(--panel-alt); border-bottom: 1px solid var(--border); }
  .lv-head-label { width: 78px; flex-shrink: 0; position: sticky; left: 0; z-index: 3; background: var(--panel); border-right: 1px solid var(--border); box-shadow: 3px 0 6px -3px rgba(16,21,31,.14); }
  .lv-head-day { width: 76px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 4px 0; font-size: 9px; font-weight: 600; color: var(--text-faint); border-right: 1px solid var(--border); }
  .lv-head-day .d { font-size: 12px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
  .lv-head-day.weekend { background: var(--warning-soft); }
  .lv-head-day.today { background: var(--accent); }
  .lv-head-day.today span, .lv-head-day.today .d { color: #fff; }

  /* Hàng phòng cao hơn (43px) để đủ chỗ 2 dòng chữ trong viên thuốc */
  .lv-row { display: flex; height: 43px; border-bottom: 1px solid var(--border); }
  .lv-row:last-child { border-bottom: none; }
  .lv-row:nth-child(even) { background: rgba(241,244,248,.5); }
  .lv-row-label { width: 78px; flex-shrink: 0; position: sticky; left: 0; z-index: 2; display: flex; align-items: center; justify-content: center; padding: 0 6px; border-right: 1px solid var(--border); background: var(--panel); box-shadow: 3px 0 6px -3px rgba(16,21,31,.14); }
  .lv-row-label .n { font-size: 15.5px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: .3px; line-height: 1; }
  .lv-row-label .p { display: none; }  /* số phòng đã gộp vào tên — không hiển thị dòng phụ */
  .lv-row.is-off .lv-row-label { opacity: .5; }

  /* Track: nền vạch dọc phân cách ngày; các ô .lv-cell nền trong suốt (không
     tô màu đơn — màu do .lv-bar phía trên đảm nhiệm) */
  .lv-track { position: relative; display: flex; overflow: hidden; background-image: repeating-linear-gradient(to right, var(--border) 0 1px, transparent 1px 76px); }
  .lv-cell { width: 76px; flex-shrink: 0; border-right: 1px solid var(--border); background: transparent; cursor: default; }
  .lv-cell.weekend { background: var(--warning-soft); }
  .lv-cell.today { box-shadow: inset 0 0 0 1px var(--accent); }

  /* Viên thuốc 1 đơn — bo tròn đều 2 đầu, lùi vào 4px mỗi mép so với ô ngày */
  .lv-bar {
    position: absolute; top: 6px; height: 31px;
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--vcolor, var(--accent)) 80%, transparent);
    border-left: 2.5px solid var(--vcolor, var(--accent));
    cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.18);
    display: flex; flex-direction: column; justify-content: center;
    padding: 0 8px; overflow: hidden;
    color: #fff; font-size: 10.5px; line-height: 1.25;
    white-space: nowrap;
    transition: background var(--dur-1) var(--ease);
  }
  .lv-bar:hover { background: var(--vcolor, var(--accent)); }
  .lv-bar .lv-bar-ten { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
  .lv-bar .badge-coc { font-size: 9.5px; opacity: .9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Bọc lưới + thẻ thông tin: mốc để thẻ neo đúng vạch kẻ cuối cùng */
  .lv-scrollwrap { position: relative; }
}

/* ======================================================================
   ĐIỆN THOẠI XOAY NGANG — lịch phòng CỐ ĐỊNH 1 màn hình: chỉ cuộn NGANG để
   xem hết tháng, KHÔNG cuộn dọc cả trang. Các màn phụ (Thống kê / Lịch sử /
   Tìm đơn) là overlay position:fixed nên KHÔNG bị ảnh hưởng — vẫn cuộn nội bộ.
   Chỉ áp cho màn thấp (điện thoại ngang), tablet/desktop giữ layout thường.
   ====================================================================== */
@media (min-width: 481px) and (orientation: landscape) and (max-height: 600px) {
  html, body { height: 100vh; height: 100dvh; overflow: hidden; }  /* dvh: khớp vùng thấy thật kể cả khi thanh địa chỉ Safari còn hiện */
  body { display: flex; flex-direction: column; padding-top: calc(6px + env(safe-area-inset-top, 0px)); padding-bottom: 0; }
  .thanh-tren { flex-shrink: 0; margin-bottom: 6px; }
  #trangThaiLoi, #dangTai { flex-shrink: 0; }
  #landscapeView { flex: 1; min-height: 0; }
  .lv-body { flex: 1; min-height: 0; overflow-y: hidden; padding-bottom: 6px; }
}

/* Thẻ thông tin đơn của lưới ngang — bấm viên thuốc .lv-bar thì hiện, neo mép
   dưới NGANG HÀNG với vạch kẻ cuối cùng của lưới (copy nguyên văn từ lich-xe.html) */
#lvQuickInfo {
  position: absolute;
  left: 50%;
  width: min(380px, calc(100% - 24px));
  transform: translateX(-50%);
  bottom: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 12px 14px;
  z-index: 60;
  display: none;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
}
#lvQuickInfo .lvqi-head { display: flex; align-items: center; gap: 6px; font-weight: 700; }
#lvQuickInfo .lvqi-row { display: flex; align-items: flex-start; gap: 6px; margin-top: 5px; color: var(--text-muted); }
#lvQuickInfo .lvqi-row svg { flex-shrink: 0; margin-top: 2px; }
#lvQuickInfo .lvqi-gio { color: var(--text); font-variant-numeric: tabular-nums; }
#lvQuickInfo a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* ---------- Toast (thông tin nhanh) — copy nguyên văn từ lich-xe.html ---------- */
#toastWrap { position: fixed; left: 18px; right: 18px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 400; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--success); box-shadow: var(--shadow-md); border-radius: var(--radius-md); padding: 10px 13px; font-size: 12.5px; font-weight: 500; white-space: pre-line; transform: translateY(10px); opacity: 0; transition: transform var(--dur-2) var(--ease), opacity var(--dur-2) var(--ease); }
.toast.is-in { transform: translateY(0); opacity: 1; }
.toast-icon { color: var(--success); display: flex; flex-shrink: 0; }

/* ======================================================================
   MODAL THÊM / SỬA ĐƠN (#overlay/#modal) + MODAL XÁC NHẬN HỦY ĐƠN.
   Copy nguyên văn từ LichXeApp/static/lich-xe.html (KHÔNG có phần
   .thoigian-segments/.btn-chi-tiet vì bản phòng không dùng).
   ====================================================================== */
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 25, 35, .45);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 100;
  padding: 40px 16px;
  overflow-y: auto; /* cho phép cuộn cả overlay khi modal cao hơn màn hình */
  overflow-x: hidden;            /* form cứng — không cho vuốt/xê dịch ngang */
  overscroll-behavior: contain;
  touch-action: pan-y pinch-zoom;           /* chạm chỉ cuộn dọc, khoá pan ngang (tối ưu iOS) */
  -webkit-overflow-scrolling: touch;
}
#overlay.mo { display: flex; }
#modal {
  background: var(--panel);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 80px);
  max-height: calc(100dvh - 80px);   /* dvh: trừ thanh địa chỉ Safari động, không bị cắt */
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;   /* giữ nội dung trong bo góc, chặn tràn ngang */
}
#modal header {
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
  flex-shrink: 0;
}
#modal header h2 { font-size: 15px; }
#modal form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.modal-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;            /* form cứng — chỉ cuộn dọc */
  overscroll-behavior: contain;
  touch-action: pan-y pinch-zoom;
  padding: 16px 18px;
  -webkit-overflow-scrolling: touch;
}
.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); /* minmax(0,..) chặn ô nhập đẩy cột rộng ra */
  gap: 12px;
}
.form-grid .full { grid-column: 1 / -1; }
/* Field bên trong form modal giãn hết chiều rộng cột (override width:220px mặc
   định của .field ở trang đăng nhập — chỉ áp dụng cho field NẰM TRONG .form-grid) */
.form-grid .field { width: 100%; min-width: 0; }
.form-grid .field input, .form-grid .field select { min-width: 0; max-width: 100%; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.field input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 16px; /* >= 16px để Safari/iOS không tự phóng to khi bấm vào ô */
  font-family: var(--font);
  color: var(--text);
  background: var(--panel);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); }
/* iOS Safari mặc định căn GIỮA nội dung của <input type="date"> — ép căn trái
   cho thẳng hàng với các ô nhập khác. -webkit-appearance:none để bỏ style hệ điều
   hành làm nội dung bị dồn giữa; vẫn giữ chiều cao/padding chung như input thường */
.field input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  text-align: left;
  min-height: 44px; /* bằng chiều cao input text (16px + padding) — tránh ô date thấp hơn */
}
.field input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.field input[type="date"]::-webkit-datetime-edit { text-align: left; padding: 0; }
/* select hình thức thanh toán — phong cách y hệt .field input (bản xe không có select) */
.field select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 16px;
  font-family: var(--font);
  color: var(--text);
  background: var(--panel);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.field select:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); }
#modal .actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  padding: 12px 18px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
/* Khối Tổng tiền nổi bật trong form */
.tong-tien-box {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tong-tien-box .ttb-trai { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tong-tien-box .ttb-nhan { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.tong-tien-box .ttb-ct { font-size: 11.5px; font-weight: 500; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tong-tien-box .ttb-so { font-size: 24px; font-weight: 800; color: var(--accent-hover); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Dòng báo lỗi trong modal — copy .thong-bao từ quan-ly-phong.html */
.thong-bao {
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  min-height: 0;
}

/* Màn hình hẹp (≤480px): form thêm/sửa đơn xếp 1 CỘT — mỗi trường 1 dòng,
   không chia 2 cột bị tràn ngang (y hệt bản xe gốc trong @media max-width:480px) */
@media (max-width: 480px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Modal xác nhận / thông báo — copy từ lich-xe.html mục 6 ---------- */
.modal-overlay{
  position:fixed;inset:0;background:rgba(15,23,42,.45);backdrop-filter:blur(8px);
  display:flex;align-items:center;justify-content:center;padding:20px;
  opacity:0;pointer-events:none;transition:opacity var(--dur-2) var(--ease);z-index:300;
}
.modal-overlay.is-open{opacity:1;pointer-events:auto;}
.modal-panel{
  background:var(--panel);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);
  max-width:380px;width:100%;padding:28px;
  transform:translateY(12px) scale(.97);opacity:0;
  transition:transform var(--dur-3) var(--ease), opacity var(--dur-2) var(--ease);
}
.modal-overlay.is-open .modal-panel{transform:translateY(0) scale(1);opacity:1;}
.modal-icon{width:44px;height:44px;border-radius:var(--radius-full);background:var(--danger-soft);color:var(--danger);display:flex;align-items:center;justify-content:center;margin-bottom:14px;}
.modal-panel h3{font-size:16.5px;font-weight:700;margin:0 0 8px;}
.modal-panel p{font-size:13.5px;color:var(--text-muted);margin:0 0 22px;line-height:1.5;white-space:pre-line;}
.modal-panel p b{color:var(--text);font-weight:600;}
.modal-actions{display:flex;gap:10px;justify-content:flex-end;}

/* Nút trong bottom sheet (Sửa/Hủy đơn) — copy từ lich-xe.html */
.sheet .s-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.sheet .s-actions .btn { flex: 1; justify-content: center; }

/* Nút đang xử lý — spinner + khoá chống bấm trùng khi gọi API (copy từ lich-xe.html) */
.btn-spinner {
  display: inline-block; width: 13px; height: 13px; margin-right: 6px;
  vertical-align: -2px; border: 2px solid currentColor;
  border-right-color: transparent; border-radius: 50%; opacity: .85;
  animation: btnSpin .6s linear infinite;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }
.btn:disabled, button:disabled { opacity: .7; cursor: default; pointer-events: none; }

/* ======================================================================
   MODAL THỐNG KÊ DOANH THU (#overlayThongKe/#modalThongKe/.tk-*) + skeleton
   loading. Copy nguyên văn từ LichXeApp/static/lich-xe.html (giữ màu/kích
   thước), không có phần .thoigian-segments vì bản này dùng <input type="date">.
   ====================================================================== */
#overlayThongKe {
  position: fixed; inset: 0; background: rgba(20, 25, 35, .45); display: none;
  align-items: flex-start; justify-content: center; z-index: 200; padding: 40px 16px;
  -webkit-overflow-scrolling: touch;
}
#overlayThongKe.mo { display: flex; }
#modalThongKe {
  background: var(--panel); border-radius: var(--radius-lg); width: 100%; max-width: 720px;
  box-shadow: var(--shadow-lg); max-height: 90vh; max-height: 90dvh; overflow-y: auto;
}
#modalThongKe header {
  border-bottom: 1px solid var(--border); padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between;
}
#modalThongKe header h2 { font-size: 15px; }

/* Xu hướng doanh thu + Xếp hạng phòng */
.tk-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tk-tabs .btn.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tk-tong-ky { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; margin: 6px 0 12px; }
.tk-tong-ky .tk-tong-so { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.tk-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: var(--radius-full); }
.tk-chip.up { background: var(--success-soft); color: var(--success); }
.tk-chip.down { background: var(--danger-soft); color: var(--danger); }
.tk-chip-note { font-size: 12px; color: var(--text-muted); }
.tk-bieu-do-tren { overflow-x: auto; max-width: 100%; }
.tk-bieu-do-tren svg { display: block; }
.tk-bieu-do-tren .tk-empty { color: var(--text-muted); font-size: 13px; padding: 18px 4px; }
.tk-rank { margin: 4px 0 18px; }
.tk-rank-hang { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.tk-rank-ten { font-weight: 600; font-size: 13.5px; color: var(--text); }
.tk-rank-ten .tk-rank-bien { color: var(--text-faint); font-weight: 400; font-size: 11.5px; }
.tk-rank-ten.nhat { font-weight: 700; }
.tk-rank-tien { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
.tk-rank-track { height: 12px; background: var(--panel-alt); border-radius: var(--radius-full); overflow: hidden; }
.tk-rank-bar { height: 100%; border-radius: var(--radius-full); min-width: 2px; }

/* Skeleton loading — copy từ style-tile.html mục 8 (dùng khi đang tải thống kê) */
.fake-list{display:flex;flex-direction:column;gap:10px;}
.fake-row{display:flex;align-items:center;gap:12px;padding:12px 14px;background:var(--panel);border:1px solid var(--border);border-radius:var(--radius-md);}
.fake-row .info{flex:1;}
.skeleton-line{height:13px;border-radius:6px;background:linear-gradient(90deg, var(--panel-alt) 25%, #e9edf3 50%, var(--panel-alt) 75%);background-size:200% 100%;animation:shimmer 1.5s ease-in-out infinite;}
.skeleton-avatar{width:36px;height:36px;border-radius:var(--radius-sm);flex-shrink:0;background:linear-gradient(90deg, var(--panel-alt) 25%, #e9edf3 50%, var(--panel-alt) 75%);background-size:200% 100%;animation:shimmer 1.5s ease-in-out infinite;}
@keyframes shimmer{0%{background-position:200% 0;}100%{background-position:-200% 0;}}

/* Mobile — modal thống kê gọn lại (copy bản xe) */
@media (max-width: 480px) {
  #overlayThongKe { padding: 12px 10px; }
  #modalThongKe header h2 { font-size: 14px; }
}

/* ======================================================================
   MODAL LỊCH SỬ THAO TÁC + TÌM ĐƠN + XEM ĐƠN ĐÃ HỦY — copy nguyên văn từ
   LichXeApp/static/lich-xe.html (giữ màu/kích thước). KHÔNG có
   .thoigian-segments vì bản này dùng <input type="date">; BỎ .td-gioi-han
   (backend không giới hạn kết quả tìm đơn).
   ====================================================================== */
#overlayLichSu {
  position: fixed; inset: 0; background: rgba(20, 25, 35, .45); display: none;
  align-items: flex-start; justify-content: center; z-index: 200; padding: 40px 16px;
}
#overlayLichSu.mo { display: flex; }
#modalLichSu {
  background: var(--panel); border-radius: var(--radius-lg); width: 100%; max-width: 720px;
  box-shadow: var(--shadow-lg);
}
#modalLichSu header {
  border-bottom: 1px solid var(--border); padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between;
}
#modalLichSu header h2 { font-size: 15px; }
#danhSachLichSu { max-height: 60vh; max-height: 60dvh; overflow-y: auto; padding: 16px 18px; }

#overlayTimDon {
  position: fixed; inset: 0; background: rgba(20, 25, 35, .45); display: none;
  align-items: flex-start; justify-content: center; z-index: 200; padding: 40px 16px;
  overflow-x: hidden; overscroll-behavior: contain; touch-action: pan-y pinch-zoom;
  -webkit-overflow-scrolling: touch;
}
#overlayTimDon.mo { display: flex; }
#modalTimDon {
  background: var(--panel); border-radius: var(--radius-lg); width: 100%; max-width: 720px;
  box-shadow: var(--shadow-lg); max-height: 90vh; max-height: 90dvh;
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; touch-action: pan-y pinch-zoom;
}
#modalTimDon header {
  border-bottom: 1px solid var(--border); padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between;
}
#modalTimDon header h2 { font-size: 15px; }
#modalTimDon .td-body { padding: 16px 18px; }
#modalTimDon select {
  width: 100%; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 16px; font-family: var(--font); color: var(--text);
  background: var(--panel); transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
#modalTimDon select:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); }
.td-don {
  border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px;
  margin-bottom: 10px; cursor: pointer; background: var(--panel); box-shadow: var(--shadow-sm);
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.td-don:hover { background: var(--panel-alt); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.td-don .td-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.td-don .td-badge { font-size: 10.5px; font-weight: 700; padding: 4px 9px; border-radius: var(--radius-full); white-space: nowrap; }
.td-don .td-badge.ok { background: var(--success-soft); color: var(--success); }
.td-don .td-badge.huy { background: var(--danger-soft); color: var(--danger); }
.td-don .td-badge.khac { background: var(--panel-alt); color: var(--text-muted); }
.td-don .td-gio { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.td-don .td-khach { font-size: 14px; font-weight: 700; }
.td-don .td-sdt { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.td-don .td-xe { font-size: 12.5px; }
.td-don .td-bien { color: var(--text-faint); }
.td-don .td-tong { font-size: 13px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

#overlayXemDonHuy {
  position: fixed; inset: 0; background: rgba(20, 25, 35, .45); display: none;
  align-items: flex-start; justify-content: center; z-index: 200; padding: 40px 16px;
  -webkit-overflow-scrolling: touch;
}
#overlayXemDonHuy.mo { display: flex; }
#modalXemDonHuy {
  background: var(--panel); border-radius: var(--radius-lg); width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg); max-height: 90vh; max-height: 90dvh; overflow-y: auto;
}
#modalXemDonHuy header {
  border-bottom: 1px solid var(--border); padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between;
}
#modalXemDonHuy header h2 { font-size: 15px; }
#modalXemDonHuy .xd-body { padding: 16px 18px; }
#modalXemDonHuy .xd-badge {
  display: inline-block; font-size: 10.5px; font-weight: 700; padding: 4px 10px;
  border-radius: var(--radius-full); background: var(--danger-soft); color: var(--danger);
  margin-bottom: 12px;
}
#modalXemDonHuy .xd-row {
  display: flex; justify-content: space-between; gap: 12px; padding: 7px 0;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
#modalXemDonHuy .xd-row:last-of-type { border-bottom: none; }
#modalXemDonHuy .xd-row .xd-nhan { color: var(--text-muted); flex-shrink: 0; }
#modalXemDonHuy .xd-row .xd-gtri { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
#modalXemDonHuy .xd-nut { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
#modalXemDonHuy .xd-nut .btn { flex: 1; justify-content: center; }

/* Mobile — 3 modal gọn lại (copy bản xe) */
@media (max-width: 480px) {
  #overlayLichSu { padding: 12px 10px; }
  #modalLichSu header h2 { font-size: 14px; }
  #overlayTimDon { padding: 12px 10px; }
  #modalTimDon header h2 { font-size: 14px; }
  #overlayXemDonHuy { padding: 12px 10px; }
  #modalXemDonHuy header h2 { font-size: 14px; }
  #modalXemDonHuy .xd-nut { flex-direction: column; }
}
