/* App Tài xế PHT — chữ to, nút to, tương phản cao để đọc được ngoài nắng. */
:root {
  --navy: #0c2338;
  --navy-2: #163a5c;
  --bg: #eef2f6;
  --card: #ffffff;
  --ink: #0f1b2a;
  --ink-2: #3d4b5c;
  --ink-3: #64748b;
  --line: #d5dde6;
  --green: #0a7d3b;
  --green-bg: #e3f5ea;
  --yellow-bg: #fff4c2;
  --yellow-ink: #6b4e00;
  --red: #b42318;
  --red-bg: #fde8e6;
  --blue: #1d4ed8;
  --blue-bg: #e5edff;
  --money: #0a7d3b;
  --radius: 16px;
  --nav-h: 62px;
  font-size: 16px;
}
html.big { font-size: 19px; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.boot { padding: 40vh 16px 0; text-align: center; color: var(--ink-3); }

/* ---------- Khung chung ---------- */
.screen { min-height: 100vh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); }
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--navy); color: #fff;
  padding: calc(6px + env(safe-area-inset-top)) 12px 8px;
}
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hello { font-size: 0.75rem; opacity: 0.8; line-height: 1.1; }
.who { font-size: 1.05rem; font-weight: 800; line-height: 1.2; }
.icon-btn {
  min-width: 44px; min-height: 44px; border-radius: 12px; border: 0;
  background: rgba(255,255,255,0.12); color: #fff; font-size: 1.15rem;
}
.month-bar {
  display: grid; grid-template-columns: 52px 1fr 52px; align-items: center;
  margin-top: 6px; background: rgba(255,255,255,0.1); border-radius: 12px;
}
.month-bar button {
  min-height: 44px; border: 0; background: transparent; color: #fff; font-size: 1.3rem; font-weight: 700;
}
.month-bar button:disabled { opacity: 0.25; }
.month-label { text-align: center; font-size: 1.05rem; font-weight: 800; letter-spacing: 0.02em; white-space: nowrap; }
@media (max-width: 360px) { .month-label { font-size: 1.05rem; } .month-bar { grid-template-columns: 52px 1fr 52px; } .sum-item .val { font-size: 1.1rem; } }
.content { padding: 12px 12px; max-width: 640px; margin: 0 auto; }

/* ---------- Thẻ ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(15,27,42,0.06); }
.banner { border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 0.95rem; font-weight: 700; display: flex; gap: 10px; align-items: flex-start; }
.banner small { display: block; font-weight: 500; margin-top: 2px; }
.banner.ok { background: var(--green-bg); color: var(--green); }
.banner.wait { background: var(--yellow-bg); color: var(--yellow-ink); }
.banner.off { background: var(--red-bg); color: var(--red); }
.banner .b-ico { font-size: 1.15rem; line-height: 1.2; }

.sum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sum-item .lbl { color: var(--ink-3); font-size: 0.85rem; }
.sum-item .val { font-size: 1.25rem; font-weight: 800; }
.sum-total { margin-top: 12px; padding-top: 12px; border-top: 2px dashed var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 8px; }
.sum-total .lbl { font-weight: 700; }
.sum-total .val { font-size: 1.5rem; font-weight: 900; color: var(--money); white-space: nowrap; margin-left: auto; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 56px; border-radius: 14px; border: 0;
  font-weight: 800; font-size: 1.05rem; padding: 0 16px;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-ghost { background: #fff; color: var(--navy); border: 2px solid var(--navy); }
.btn-warn { background: #fff; color: var(--red); border: 2px solid var(--red); }
.btn:disabled { opacity: 0.55; }
.btn-row { display: grid; gap: 10px; }

/* ---------- Sổ nhật ký (giống bảng trên web: xanh lá, 11 cột) ---------- */
.trip-warn { background: var(--yellow-bg); color: var(--yellow-ink); border-radius: 10px; padding: 8px 10px; font-weight: 700; font-size: 0.92rem; }
.jr-title { background: #6f9f3a; color: #fff; font-weight: 900; text-align: center; padding: 7px 8px; font-size: 0.95rem; border-radius: 12px 12px 0 0; line-height: 1.3; }
.jr-sum { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: 0.9rem; }
.jr-sum td { border: 1px solid #7f8a78; padding: 6px 8px; }
.jr-sum .lbl { background: #eef6e8; font-weight: 800; }
.jr-sum .val { background: #fff200; font-weight: 900; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.jr-sum .tot .lbl { background: #6f9f3a; color: #fff; }
.jr-sum .tot .val { background: #ffd966; color: #980000; font-size: 1.05rem; }
.jr-hint { color: var(--ink-2); font-size: 0.8rem; margin-bottom: 6px; line-height: 1.35; }
.jr-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: #fff; border: 1px solid #7f8a78; border-radius: 8px; }
.jr-table { border-collapse: separate; border-spacing: 0; font-family: Arial, sans-serif; font-size: 13px; table-layout: fixed; width: 860px; }
html.big .jr-table { font-size: 15px; width: 980px; }
.jr-table th, .jr-table td { border-right: 1px solid #7f8a78; border-bottom: 1px solid #7f8a78; padding: 4px 5px; vertical-align: middle; line-height: 1.3; overflow-wrap: anywhere; }
.jr-table thead th { background: #8dc641; font-weight: 900; text-align: center; font-size: 11px; line-height: 1.2; }
.jr-table tbody tr:nth-child(odd) td { background: #fff; }
.jr-table tbody tr:nth-child(even) td { background: #eef6e8; }
.jr-table tbody tr { cursor: pointer; }
.jr-table tbody tr:active td { background: #ffe9a8; }
.jr-table tbody tr.miss td { background: #fff4c2; }
.jr-table thead .c-day { background: #8dc641; }
.jr-table .c-day { position: sticky; left: 0; z-index: 1; white-space: nowrap; font-weight: 800; box-shadow: 2px 0 0 #7f8a78; }
.jr-table tfoot td { background: #ffd966; font-weight: 900; color: #980000; }
.jr-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.jr-table .center { text-align: center; }
.jr-table .b { font-weight: 800; }
.jr-table .no-rate { color: var(--red); font-weight: 800; white-space: nowrap; }

/* ---------- Phiếu lương ---------- */
.net { text-align: center; padding: 20px 16px; }
.net .lbl { color: var(--ink-3); font-weight: 700; letter-spacing: 0.04em; }
.net .val { font-size: clamp(1.7rem, 9vw, 2.3rem); font-weight: 900; color: var(--money); line-height: 1.15; margin-top: 4px; white-space: nowrap; }
.net .unit { font-size: 1.1rem; font-weight: 700; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.fact { background: var(--bg); border-radius: 12px; padding: 10px; }
.fact .lbl { font-size: 0.8rem; color: var(--ink-3); }
.fact .val { font-weight: 800; font-size: 1.15rem; }

.section-title { font-weight: 900; font-size: 1.05rem; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 0 6px; }
.section-title .t-plus { color: var(--money); }
.section-title .t-minus { color: var(--red); }
.line-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line-item:last-child { border-bottom: 0; }
.line-item .li-lbl { font-weight: 600; }
.line-item .li-val { font-weight: 800; white-space: nowrap; }
.line-item.sub { padding: 6px 0 6px 18px; color: var(--ink-2); font-size: 0.92rem; border-bottom: 0; }
.line-item.sub .li-lbl, .line-item.sub .li-val { font-weight: 500; }
.line-item.zero .li-lbl, .line-item.zero .li-val { color: var(--ink-3); font-weight: 500; }
.loan-box { background: var(--red-bg); color: var(--red); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.loan-box b { font-size: 1.15rem; }

/* ---------- Trống / lỗi ---------- */
.empty { text-align: center; padding: 28px 12px; color: var(--ink-2); }
.empty .e-ico { font-size: 2.6rem; }
.empty h3 { margin: 8px 0 4px; color: var(--ink); }
.skeleton { height: 96px; border-radius: var(--radius); margin-bottom: 12px; background: linear-gradient(90deg, #e3e9ef 25%, #f2f5f8 50%, #e3e9ef 75%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Thanh điều hướng dưới ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 10px rgba(15,27,42,0.06);
}
.nav button {
  position: relative; border: 0; background: transparent; min-height: var(--nav-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-3); font-weight: 800; font-size: 0.85rem;
}
.nav button .n-ico { font-size: 1.4rem; line-height: 1; }
.nav button.active { color: var(--navy); }
.nav button.active::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 4px; border-radius: 0 0 4px 4px; background: var(--navy); }
.badge-dot { position: absolute; top: 12px; right: calc(50% - 22px); min-width: 20px; height: 20px; border-radius: 10px; background: var(--red); color: #fff; font-size: 0.75rem; display: flex; align-items: center; justify-content: center; padding: 0 5px; }

/* ---------- Đăng nhập ---------- */
.login { min-height: 100vh; background: var(--navy); color: #fff; padding: calc(32px + env(safe-area-inset-top)) 16px 32px; }
.login-inner { max-width: 440px; margin: 0 auto; }
.login-logo { width: 84px; height: 84px; border-radius: 22px; display: block; margin: 0 auto 12px; background: #fff; }
.login h1 { text-align: center; margin: 0 0 4px; font-size: 1.6rem; }
.login .sub { text-align: center; opacity: 0.85; margin-bottom: 24px; }
.login .panel { background: #fff; color: var(--ink); border-radius: 20px; padding: 20px 16px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 800; margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; min-height: 60px; border-radius: 14px; border: 2px solid var(--line);
  padding: 12px 14px; font-size: 1.3rem; background: #fff;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(12,35,56,0.15); }
.field textarea { font-size: 1.05rem; min-height: 96px; resize: vertical; }
.pin-input { letter-spacing: 0.5em; text-align: center; }
.form-error { background: var(--red-bg); color: var(--red); border-radius: 12px; padding: 10px 12px; font-weight: 700; margin-bottom: 14px; }
.hint { color: var(--ink-3); font-size: 0.9rem; margin-top: 14px; text-align: center; }
.login .hint { color: rgba(255,255,255,0.8); }

/* ---------- Tôi ---------- */
.profile { display: flex; gap: 14px; align-items: center; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 900; flex: 0 0 auto; }
.profile .p-name { font-weight: 900; font-size: 1.2rem; }
.profile .p-sub { color: var(--ink-3); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg button { min-height: 56px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-weight: 800; }
.seg button.on { border-color: var(--navy); background: var(--navy); color: #fff; }
.rep { border: 2px solid var(--line); border-radius: 14px; padding: 12px; margin-top: 10px; }
.rep-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-weight: 800; }
.chip { border-radius: 999px; padding: 2px 10px; font-size: 0.85rem; font-weight: 800; white-space: nowrap; }
.chip.moi { background: #eceff3; color: var(--ink-2); }
.chip.dang_xu_ly { background: var(--blue-bg); color: var(--blue); }
.chip.da_xu_ly { background: var(--green-bg); color: var(--green); }
.rep-reply { margin-top: 8px; background: var(--green-bg); color: #064e25; border-radius: 10px; padding: 8px 10px; }
.rep-meta { color: var(--ink-3); font-size: 0.88rem; margin-top: 4px; }
.steps { margin: 6px 0 0; padding-left: 22px; }
.steps li { margin-bottom: 4px; }

/* ---------- Bảng trượt (Báo sai, Đổi PIN) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(8,18,30,0.55); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  background: #fff; border-radius: 22px 22px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
}
.sheet h2 { margin: 0 0 4px; font-size: 1.3rem; }
.sheet .s-sub { color: var(--ink-2); margin-bottom: 14px; }
.choice { display: grid; gap: 10px; margin-bottom: 16px; }
.choice button { min-height: 60px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-weight: 800; text-align: left; padding: 0 16px; font-size: 1.05rem; }
.choice button.on { border-color: var(--red); background: var(--red-bg); color: var(--red); }
.photos { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.photo { position: relative; width: 92px; height: 92px; border-radius: 12px; overflow: hidden; background: var(--bg); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo button { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(0,0,0,0.65); color: #fff; font-size: 1rem; }
.add-photo { text-align: center; width: 92px; height: 92px; border-radius: 12px; border: 2px dashed var(--ink-3); background: #fff; color: var(--ink-2); font-weight: 800; font-size: 0.85rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.add-photo span { font-size: 1.6rem; }

/* ---------- Thông báo nhanh ---------- */
#toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px);
  z-index: 30; max-width: 600px; margin: 0 auto;
  background: var(--ink); color: #fff; border-radius: 14px; padding: 14px 16px; font-weight: 700; text-align: center;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
#toast.err { background: var(--red); }
#toast.ok { background: var(--green); }

.demo-flag { background: #7c3aed; color: #fff; text-align: center; font-weight: 800; padding: 4px; font-size: 0.85rem; }
.offline-note { background: var(--yellow-bg); color: var(--yellow-ink); border-radius: 12px; padding: 10px 12px; font-weight: 700; margin-bottom: 14px; font-size: 0.92rem; }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } .day-head .chev { transition: none; } }

/* Màn hình rộng / xoay ngang: bảng Nhật ký dùng hết chiều rộng; xoay ngang thì thu gọn thanh trên/dưới */
@media (min-width: 700px) { .content.wide { max-width: 1200px; } }
@media (orientation: landscape) and (max-height: 520px) {
  :root { --nav-h: 54px; }
  .topbar { position: static; padding-top: calc(6px + env(safe-area-inset-top)); padding-bottom: 8px; }
  .hello { display: none; }
  .month-bar { margin-top: 6px; }
  .month-bar button { min-height: 44px; }
  .nav button { flex-direction: row; gap: 8px; }
  .nav button .n-ico { font-size: 1.3rem; }
  .badge-dot { top: 4px; right: auto; left: calc(50% + 18px); }
}

/* ---------- Văn phòng "Xem như tài xế" ---------- */
.link-btn { display: block; margin: 18px auto 0; background: transparent; border: 0; color: #fff; text-decoration: underline; font-weight: 700; min-height: 48px; padding: 0 12px; }
.staff-bar { background: #7c3aed; color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px; font-size: 0.9rem; }
.staff-bar button { background: #fff; color: #5b21b6; border: 0; border-radius: 10px; min-height: 40px; padding: 0 12px; font-weight: 800; white-space: nowrap; }
.pick-item { display: flex; flex-direction: column; align-items: flex-start; width: 100%; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 12px 16px; margin-bottom: 10px; min-height: 64px; text-align: left; }
.pick-item .pk-name { font-weight: 900; font-size: 1.1rem; }
.pick-item .pk-sub { color: var(--ink-3); font-size: 0.9rem; }
