/* OPPO Thanh Hóa – Báo cáo cuối ngày */
:root {
  --g: #00875a;          /* xanh OPPO */
  --g-600: #006f4a;
  --g-700: #00563a;
  --g-50: #e8f6ef;
  --g-100: #cdeedd;
  --navy: #0b2a3c;       /* xanh đậm */
  --navy-2: #163d55;
  --ink: #13222c;
  --muted: #5d6f7a;
  --line: #dfe6ea;
  --bg: #f3f6f5;
  --card: #ffffff;
  --red: #d92d20;
  --red-50: #fdecea;
  --amber: #b45309;
  --amber-50: #fff6e0;
  --blue: #1d6fd6;
  --blue-50: #e9f1fd;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(11,42,60,.06), 0 4px 16px rgba(11,42,60,.06);
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; }
a { color: var(--g); }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tnum { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }

/* ---------- App bar ---------- */
.appbar { background: linear-gradient(135deg, var(--g-700), var(--g) 60%, #19a874); color: #fff; padding: 14px 16px 18px; }
.appbar .brand { display: flex; align-items: center; gap: 12px; max-width: 1200px; margin: 0 auto; }
.appbar .logo { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.16); display: grid; place-items: center; flex: none; }
.appbar h1 { font-size: 17px; margin: 0; letter-spacing: .2px; }
.appbar .sub { font-size: 12.5px; opacity: .85; }
.appbar .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.appbar .chip-btn { background: rgba(255,255,255,.16); color: #fff; border: 0; padding: 7px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; }
.appbar .chip-btn:hover { background: rgba(255,255,255,.26); }

.wrap { max-width: 560px; margin: 0 auto; padding: 0 12px 120px; }
.wrap.wide { max-width: 1200px; padding-bottom: 40px; }
.lift { margin-top: -10px; }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-top: 12px; }
.card h2 { font-size: 15px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.card h2 .tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--g-50); color: var(--g-700); }
.section-title { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--g-700); font-size: 13px; letter-spacing: .6px; text-transform: uppercase; margin: 4px 0 12px; }
.section-title::before, .section-title::after { content: ""; height: 1px; background: var(--g-100); flex: 1; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 12px; padding: 11px 16px; font-weight: 600; cursor: pointer; min-height: 44px; transition: transform .05s, background .15s; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--g); color: #fff; }
.btn-primary:hover { background: var(--g-600); }
.btn-dark { background: var(--navy); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--g); color: var(--g-700); }
.btn-soft { background: var(--g-50); color: var(--g-700); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { min-height: 34px; padding: 6px 12px; border-radius: 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-lg { min-height: 54px; font-size: 16px; border-radius: 14px; }
.link-btn { background: none; border: 0; color: var(--g); font-weight: 600; cursor: pointer; padding: 4px; }

/* ---------- Form ---------- */
label.lbl { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 0 0 6px; }
.field { margin-bottom: 14px; }
.input, select.input, textarea.input { width: 100%; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 11px 12px; min-height: 46px; outline: none; transition: border .15s, box-shadow .15s; }
.input:focus { border-color: var(--g); box-shadow: 0 0 0 3px rgba(0,135,90,.15); }
.input.err { border-color: var(--red); background: var(--red-50); }
.input.warn { border-color: #f0a830; }
.input[readonly] { background: #f7f9f8; color: var(--muted); }
.input.num { text-align: right; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.errtxt { font-size: 12.5px; color: var(--red); margin-top: 4px; font-weight: 500; }

/* Metric block (Hôm nay | Lũy kế) */
.metric { padding: 12px 0 14px; border-bottom: 1px dashed var(--line); }
.metric:last-child { border-bottom: 0; }
.metric .mhead { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.metric .mname { font-weight: 700; font-size: 15px; }
.metric .unit { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--g-50); color: var(--g-700); }
.metric .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.metric .pair .sub { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; display: flex; justify-content: space-between; }
.lk-box { position: relative; }
.lk-box .input { color: var(--muted); font-weight: 500; }
.lk-box .input.edited { color: var(--amber); font-weight: 700; border-color: #f0a830; background: var(--amber-50); }
.lk-edit { position: absolute; right: 8px; top: -22px; font-size: 11.5px; }
.prog { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 12.5px; }
.bar { flex: 1; height: 7px; border-radius: 99px; background: #e9eeec; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--g); transition: width .3s; }
.bar.low > i { background: #e5484d; } .bar.mid > i { background: #f5a524; }
.pct { font-weight: 700; min-width: 44px; text-align: right; }
.need { font-size: 12px; color: var(--muted); margin-top: 4px; }

.mini-grid { display: grid; grid-template-columns: 1fr 72px 72px; gap: 6px 10px; align-items: center; }
.mini-grid .hd { font-size: 11px; color: var(--muted); font-weight: 600; text-align: right; }
.mini-grid .hd:first-child { text-align: left; }
.mini-grid .nm { font-weight: 600; }
.mini-grid .input { min-height: 42px; padding: 8px 10px; font-size: 16px; text-align: right; }
.mini-grid .val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Segmented */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg button { border: 1.5px solid var(--line); background: #fff; border-radius: 12px; min-height: 50px; font-weight: 700; cursor: pointer; }
.seg button.on { background: var(--g); border-color: var(--g); color: #fff; }
.seg button.on.off-day { background: var(--navy-2); border-color: var(--navy-2); }

/* Sticky bottom */
.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); z-index: 20; }
.bottom-bar .in { max-width: 560px; margin: 0 auto; display: flex; gap: 10px; }

/* Identity pill */
.who { display: flex; gap: 12px; align-items: center; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--g-50); color: var(--g-700); display: grid; place-items: center; font-weight: 800; flex: none; }
.who b { display: block; font-size: 15px; }

/* Date strip */
.dates { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.dates::-webkit-scrollbar { display: none; }
.dchip { flex: none; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 6px 10px; text-align: center; cursor: pointer; min-width: 64px; }
.dchip .d1 { font-size: 11px; color: var(--muted); }
.dchip .d2 { font-weight: 700; }
.dchip .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-left: 4px; background: #c9d2d6; }
.dchip.on { border-color: var(--g); background: var(--g-50); }
.dot.dung_gio { background: var(--g) !important; } .dot.tre { background: #f5a524 !important; } .dot.tre_bu { background: #e5484d !important; } .dot.nghi { background: var(--navy-2) !important; }

.deadline { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--g-50); color: var(--g-700); font-size: 13px; font-weight: 600; margin-top: 10px; }
.deadline.late { background: var(--amber-50); color: var(--amber); }
.deadline.bu { background: var(--red-50); color: var(--red); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.b-ok { background: var(--g-50); color: var(--g-700); }
.b-late { background: var(--amber-50); color: var(--amber); }
.b-bu { background: var(--red-50); color: var(--red); }
.b-off { background: #e7edf2; color: var(--navy-2); }
.b-miss { background: #f1f1f1; color: #6b6b6b; }
.b-pend { background: var(--blue-50); color: var(--blue); }

/* Success card */
.done { background: linear-gradient(160deg, #f1fbf6, #fff); border: 1.5px solid var(--g-100); }
.done .tick { width: 46px; height: 46px; border-radius: 50%; background: var(--g); color: #fff; display: grid; place-items: center; flex: none; }
.done h3 { margin: 0; color: var(--g-700); font-size: 17px; }
.today-line { margin-top: 12px; padding: 10px 12px; background: var(--g-50); border-radius: 10px; font-weight: 600; font-size: 13.5px; color: var(--g-700); }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.kpi { border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; background: #fff; }
.kpi .k1 { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.kpi .k2 { font-size: 20px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .k3 { font-size: 11px; color: var(--muted); }

.zalo { background: var(--navy); color: #e8f3ee; border-radius: 12px; padding: 14px; font-family: var(--font); font-variant-numeric: tabular-nums; font-size: 13px; white-space: pre-wrap; line-height: 1.55; overflow-x: auto; }

/* Modal / sheet */
.overlay { position: fixed; inset: 0; background: rgba(11,42,60,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
@media (min-width: 700px) { .overlay { align-items: center; } }
.sheet { background: #fff; width: 100%; max-width: 560px; max-height: 88vh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; animation: up .2s; }
@media (min-width: 700px) { .sheet { border-radius: 18px; } .sheet.lg { max-width: 860px; } }
.sheet .sh-h { padding: 16px 18px 8px; display: flex; align-items: center; gap: 10px; }
.sheet .sh-h h3 { margin: 0; font-size: 17px; flex: 1; }
.sheet .sh-b { padding: 6px 18px 12px; overflow-y: auto; }
.sheet .sh-f { padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; gap: 10px; border-top: 1px solid var(--line); }
.sheet .sh-f .btn { flex: 1; }
.x-btn { background: #f1f4f3; border: 0; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 18px; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.warn-list { margin: 0; padding: 0; list-style: none; }
.warn-list li { padding: 10px 12px; border-radius: 10px; background: var(--amber-50); color: #7a4100; margin-bottom: 8px; font-weight: 500; }

/* Picker */
.pick-search { position: sticky; top: 0; background: #fff; padding-bottom: 8px; }
.pick-list { list-style: none; margin: 0; padding: 0; }
.pick-list li { padding: 13px 12px; border-bottom: 1px solid #eef2f0; cursor: pointer; border-radius: 10px; }
.pick-list li:hover, .pick-list li.on { background: var(--g-50); }
.pick-list li .s { font-size: 12px; color: var(--muted); }
.pick-list li.special { color: var(--g-700); font-weight: 700; }
.picker-btn { width: 100%; text-align: left; display: flex; align-items: center; justify-content: space-between; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 11px 12px; min-height: 48px; cursor: pointer; }
.picker-btn.empty span { color: var(--muted); }
.picker-btn::after { content: "▾"; color: var(--muted); margin-left: 8px; }
.picker-btn:disabled { background: #f6f8f7; cursor: not-allowed; }

/* PIN */
.pin-wrap { display: flex; gap: 10px; justify-content: center; margin: 10px 0; }
.pin-input { letter-spacing: 12px; text-align: center; font-size: 26px; font-weight: 800; max-width: 230px; margin: 0 auto; display: block; }

/* Toast */
#toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 440px); }
.toast { padding: 12px 14px; border-radius: 12px; color: #fff; font-weight: 600; box-shadow: var(--shadow); animation: up .2s; font-size: 14px; }
.toast.ok { background: var(--g-600); } .toast.err { background: var(--red); } .toast.info { background: var(--navy-2); } .toast.warn { background: #b86e00; }

.empty-state { text-align: center; color: var(--muted); padding: 30px 10px; }
.loader { width: 28px; height: 28px; border: 3px solid var(--g-100); border-top-color: var(--g); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Landing ---------- */
.landing { max-width: 560px; margin: 0 auto; padding: 18px 14px 40px; }
.tile { display: flex; gap: 14px; align-items: center; padding: 18px; border-radius: 18px; color: #fff; text-decoration: none; margin-top: 14px; box-shadow: var(--shadow); min-height: 110px; position: relative; overflow: hidden; }
.tile.pg { background: linear-gradient(135deg, var(--g-700), var(--g) 55%, #2bbf86); }
.tile.mg { background: linear-gradient(135deg, var(--navy), var(--navy-2)); }
.tile .ti { width: 56px; height: 56px; border-radius: 16px; background: rgba(255,255,255,.15); display: grid; place-items: center; flex: none; }
.tile b { font-size: 18px; display: block; }
.tile span { opacity: .85; font-size: 13px; }

/* ---------- Manager (desktop) ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; max-width: 1200px; margin: 12px auto 0; padding: 0 12px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; border-radius: 10px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.on { background: #fff; color: var(--g-700); box-shadow: var(--shadow); }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.filters .input { min-height: 40px; padding: 8px 10px; font-size: 14px; }
.filters label.lbl { margin-bottom: 4px; font-size: 11.5px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.stat { background: #fff; border-radius: 14px; padding: 14px; box-shadow: var(--shadow); border-left: 4px solid var(--g); }
.stat.navy { border-left-color: var(--navy-2); } .stat.amber { border-left-color: #f5a524; } .stat.red { border-left-color: #e5484d; } .stat.grey { border-left-color: #b5c0c6; }
.stat .s1 { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat .s2 { font-size: 24px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .s3 { font-size: 12px; color: var(--muted); margin-top: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 980px) { .grid2 { grid-template-columns: 1.6fr 1fr; } }
.tbl-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { background: #f6f9f8; text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); padding: 9px 10px; white-space: nowrap; position: sticky; top: 0; cursor: default; }
.tbl th.sort { cursor: pointer; } .tbl th.sort:hover { color: var(--g-700); }
.tbl td { padding: 9px 10px; border-top: 1px solid #eef2f0; white-space: nowrap; }
.tbl tr:hover td { background: #fafcfb; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.click { cursor: pointer; }
.tbl tfoot td { font-weight: 800; background: #f6f9f8; }
.rank { width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; background: #eef2f0; font-weight: 800; font-size: 12px; }
.rank.r1 { background: #ffe9a8; } .rank.r2 { background: #e6ebef; } .rank.r3 { background: #f6d7bd; }
.pctcell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.pctcell .bar { height: 6px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.chart-box { position: relative; height: 300px; }
.delta-up { color: var(--g-700); font-weight: 700; } .delta-down { color: var(--red); font-weight: 700; }
.diff-old { color: var(--red); text-decoration: line-through; } .diff-new { color: var(--g-700); font-weight: 700; }
.auth-card { max-width: 420px; margin: 30px auto; }

@media print {
  .appbar .actions, .tabs, .no-print, .bottom-bar, #toasts { display: none !important; }
  body { background: #fff; }
  .card, .stat { box-shadow: none; border: 1px solid #ddd; }
}
