/* Tiep nhan Luu dong — mobile first (Pages / online) */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: #f1f5f9; color: #0f172a;
  font-family: -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; }
.wrap { max-width: 520px; margin: 0 auto; padding: 0.75rem 0.75rem 2.5rem; }

/* ── Modal user ── */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,0.55); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal.hidden { display: none !important; }
.modal-card { background: #fff; border-radius: 16px; padding: 1.1rem 1.15rem 1.2rem;
  width: 100%; max-width: 420px; box-shadow: 0 16px 40px rgba(0,0,0,0.35); }
.modal-title { font-size: 1.2rem; font-weight: 800; color: #0f172a; }
.modal-sub { font-size: 0.8rem; color: #64748b; margin: 0.35rem 0 0.85rem; }
.lbl { display: block; font-size: 0.78rem; font-weight: 700; color: #334155; margin-bottom: 0.3rem; }
.btn-user-save { width: 100%; margin-top: 1rem; border: none; border-radius: 12px;
  padding: 0.95rem; background: linear-gradient(180deg, #16a34a, #15803d); color: #fff;
  font-size: 1.05rem; font-weight: 800; cursor: pointer; }
.btn-user-save:active { transform: scale(0.98); }
.modal-hint { font-size: 0.72rem; color: #94a3b8; margin: 0.7rem 0 0; line-height: 1.45; }

/* ── Header ── */
.hd { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem;
  background: linear-gradient(135deg, #0284c7, #0369a1); color: #fff;
  border-radius: 12px; padding: 0.85rem 1rem; margin-bottom: 0.75rem; }
.hd-title { font-size: 1.15rem; font-weight: 800; }
.hd-sub { font-size: 0.72rem; opacity: 0.92; margin-top: 2px; }
.hd-right { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; }
.badge-off { font-size: 0.62rem; background: rgba(255,255,255,0.2);
  border-radius: 999px; padding: 4px 8px; font-weight: 700; white-space: nowrap; }
.badge-on { background: #dc2626; }
.btn-change-user { border: 1px solid rgba(255,255,255,0.45); background: rgba(255,255,255,0.12);
  color: #fff; border-radius: 8px; width: 32px; height: 28px; font-size: 1rem; font-weight: 700;
  cursor: pointer; line-height: 1; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-bottom: 0.75rem; }
.stat-card { background: #fff; border-radius: 10px; padding: 0.6rem 0.4rem; text-align: center;
  border: 1px solid #e2e8f0; }
.stat-label { font-size: 0.6rem; font-weight: 700; color: #64748b; letter-spacing: 0.4px; }
.stat-num { font-size: 1.7rem; font-weight: 800; line-height: 1.15; }
.stat-sub { font-size: 0.66rem; color: #94a3b8; }
.c-blue { color: #0284c7; } .c-gray { color: #64748b; } .c-teal { color: #0d9488; }

.btn-scan { width: 100%; border: none; border-radius: 14px; padding: 1.1rem;
  background: linear-gradient(180deg, #16a34a, #15803d); color: #fff; font-size: 1.25rem;
  font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  box-shadow: 0 4px 14px rgba(22,163,74,0.35); cursor: pointer; margin-bottom: 0.6rem; }
.btn-scan:active { transform: scale(0.98); }
.btn-scan span { letter-spacing: 0.5px; }

.paste-row { margin-bottom: 0.6rem; }
.inp { width: 100%; border: 1px solid #cbd5e1; border-radius: 10px; padding: 0.65rem 0.75rem;
  font-size: 0.95rem; background: #fff; }
.inp:focus { outline: 2px solid #0284c7; border-color: transparent; }

.scan-status { border-radius: 10px; padding: 0.6rem 0.8rem; font-size: 0.88rem; font-weight: 600;
  margin-bottom: 0.6rem; }
.scan-ok { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.scan-err { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.scan-busy { background: #e0f2fe; color: #075985; border: 1px solid #7dd3fc; }
.hidden { display: none !important; }

.last-card { background: #fffbeb; border: 1px solid #f59e0b; border-radius: 10px;
  padding: 0.6rem 0.8rem; margin-bottom: 0.6rem; font-size: 0.85rem; }
.last-card .lc-name { font-weight: 800; font-size: 0.98rem; }
.last-card .lc-meta { color: #92400e; font-size: 0.78rem; margin-top: 2px; }
.last-card button { margin-top: 0.4rem; border: 1px solid #fca5a5; background: #fff; color: #b91c1c;
  border-radius: 8px; padding: 0.3rem 0.7rem; font-size: 0.78rem; font-weight: 700; }

.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 0.75rem 0.85rem; margin-bottom: 0.75rem; }
.card-title { font-size: 0.86rem; font-weight: 800; margin-bottom: 0.5rem; color: #0f172a; }

.date-row { display: flex; gap: 0.4rem; align-items: center; }
.date-row .inp { flex: 1; }
.btn-mini { border: 1px solid #cbd5e1; background: #f8fafc; border-radius: 8px;
  padding: 0.55rem 0.7rem; font-size: 0.78rem; font-weight: 700; color: #334155; cursor: pointer; }
.btn-warn { border-color: #fca5a5; color: #b91c1c; background: #fef2f2; }
.btn-export { width: 100%; border: none; border-radius: 10px; padding: 0.75rem;
  background: #0284c7; color: #fff; font-size: 0.95rem; font-weight: 800; cursor: pointer; }
.btn-export:active { transform: scale(0.99); }
.day-count { font-size: 0.78rem; color: #64748b; margin-top: 0.4rem; }
.export-hint { font-size: 0.7rem; color: #94a3b8; margin: 0.45rem 0 0; line-height: 1.45; }
.row-btns { margin-top: 0.55rem; display: flex; gap: 0.4rem; flex-wrap: wrap; }

.list-wrap { overflow-x: auto; }
.list-tbl { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.list-tbl th { background: #f1f5f9; color: #64748b; font-size: 0.66rem; text-align: left;
  padding: 0.4rem 0.35rem; border-bottom: 1px solid #e2e8f0; }
.list-tbl td { padding: 0.45rem 0.35rem; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.list-tbl .t-name { font-weight: 700; }
.list-tbl .t-sub { color: #94a3b8; font-size: 0.7rem; }
.btn-del { border: none; background: #fee2e2; color: #b91c1c; border-radius: 6px;
  padding: 0.25rem 0.45rem; font-size: 0.72rem; font-weight: 700; cursor: pointer; }
.empty-row { color: #94a3b8; text-align: center; padding: 1rem 0; font-size: 0.82rem; }

.week-tbl { display: flex; flex-direction: column; gap: 0.3rem; }
.week-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; }
.week-row .w-date { width: 82px; color: #475569; font-weight: 600; }
.week-row .w-bar { flex: 1; height: 12px; background: #f1f5f9; border-radius: 6px; overflow: hidden; }
.week-row .w-fill { height: 100%; background: #0284c7; border-radius: 6px; }
.week-row .w-num { width: 56px; text-align: right; font-weight: 800; color: #0f172a; }

.ft { text-align: center; color: #94a3b8; font-size: 0.68rem; line-height: 1.5; margin-top: 1rem; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #0f172a; color: #fff; border-radius: 10px; padding: 0.6rem 1.1rem;
  font-size: 0.85rem; font-weight: 700; z-index: 99; max-width: 92%; text-align: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25); }
.toast-ok { background: #15803d; }
.toast-err { background: #b91c1c; }

.warn-banner { border-radius: 10px; padding: 0.6rem 0.8rem; font-size: 0.82rem; font-weight: 600;
  margin-bottom: 0.6rem; background: #e0f2fe; color: #075985; border: 1px solid #7dd3fc; }
.warn-banner.warn-err { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.warn-banner.warn-warn { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }
