/* style.css — mobile-first, chu to nut to, tieng Viet */
:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #e3e8ef;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 16px; padding-bottom: 48px; }
header.appbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--primary); color: #fff;
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow);
}
header.appbar .title { font-weight: 700; font-size: 18px; }
header.appbar .sub { font-size: 13px; opacity: .9; }
header.appbar button { background: rgba(255,255,255,.18); color:#fff; border:none; }

/* Logo thuong hieu */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { height: 36px; width: 36px; object-fit: contain; background: #fff; border-radius: 9px; padding: 3px; flex: 0 0 auto; }
.login-logo { display: block; width: 230px; max-width: 72%; margin: 4px auto 14px; }

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin: 14px 0;
}
h1 { font-size: 22px; margin: .2em 0; }
h2 { font-size: 18px; margin: .4em 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.big-date { font-size: 26px; font-weight: 800; text-align: center; margin: 4px 0; }
.weekday { text-align: center; color: var(--muted); font-size: 16px; }

/* Nut bam */
button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--line);
  background: #fff; color: var(--ink); border-radius: 10px;
  padding: 12px 16px; font-weight: 600;
}
button:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-block { width: 100%; }
.btn-lg { padding: 18px; font-size: 19px; }
button:disabled { opacity: .55; cursor: not-allowed; }

/* Nut to CO AN / KHONG AN */
.toggle-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.toggle-btn {
  padding: 22px 12px; border-radius: 14px; font-size: 20px; font-weight: 800;
  border: 2px solid var(--line); background: #fff; color: var(--ink);
}
.toggle-btn.eat.active { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.toggle-btn.skip.active { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.toggle-btn .ic { display:block; font-size: 28px; margin-bottom: 4px; }

/* Badge trang thai */
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.badge.open { background: var(--green-bg); color: var(--green); }
.badge.closed { background: var(--red-bg); color: var(--red); }
.badge.off { background: var(--amber-bg); color: var(--amber); }

.total-box { text-align: center; padding: 8px; }
.total-num { font-size: 44px; font-weight: 900; color: var(--primary); line-height: 1; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 700; }

label { display: block; font-weight: 600; margin: 10px 0 4px; }
input, select {
  width: 100%; font: inherit; padding: 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink);
}
.pin-input { letter-spacing: 8px; text-align: center; font-size: 24px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 0 0 auto; }
.grow { flex: 1 1 auto; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 12px 18px; border-radius: 10px;
  box-shadow: var(--shadow); z-index: 100; max-width: 90%;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: .96; }
.toast.err { background: #b91c1c; }

.saved-tag { color: var(--green); font-weight: 700; }
.hide { display: none !important; }

/* Bang */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { border: 1px solid var(--line); padding: 6px 8px; text-align: center; white-space: nowrap; }
th { background: #f1f5f9; position: sticky; top: 0; }
td.name, th.name { text-align: left; position: sticky; left: 0; background: #fff; z-index: 2; }
th.name { z-index: 3; }
td.off { background: #f8fafc; color: #cbd5e1; }
.th-dow { font-size: 11px; font-weight: 600; color: var(--muted); }
.th-day { font-size: 15px; font-weight: 800; }
th.off .th-dow, th.off .th-day { color: var(--red); opacity: .8; }
td.eat { background: var(--green-bg); cursor: pointer; font-weight: 700; color: var(--green); }
td.clickable { cursor: pointer; }
td.clickable-pay { cursor: pointer; }
td.clickable-pay:hover { background: #eff6ff; }
.pos { color: var(--green); font-weight: 700; }
.neg { color: var(--red); font-weight: 700; }
.right { text-align: right; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Tab dang luoi (trang quan tri): can doi, deu hang */
.tabs-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 560px) { .tabs-grid { grid-template-columns: repeat(3, 1fr); } }
.tabs-grid button { width: 100%; text-align: center; white-space: nowrap; padding: 14px 8px; }

ul.list { list-style: none; padding: 0; margin: 0; }
ul.list li { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
ul.list li:last-child { border-bottom: none; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #eef2ff; color: var(--primary); font-weight: 700; }
.pill.admin { background: #fef3c7; color: var(--amber); }

/* Lich thang cua nhan vien */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 2px 0; }
.cal .cell {
  aspect-ratio: 1 / 1; border-radius: 10px; border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; background: #fff; position: relative;
}
.cal .cell.empty { border: none; background: transparent; }
.cal .cell .num { line-height: 1; }
.cal .cell .mk { font-size: 13px; line-height: 1; margin-top: 2px; }
.cal .cell.eat { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.cal .cell.off { background: #f1f5f9; color: #cbd5e1; }
.cal .cell.today { box-shadow: 0 0 0 2px var(--primary) inset; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line); display: inline-block; }
.legend .sw.eat { background: var(--green-bg); border-color: var(--green); }
.legend .sw.off { background: #f1f5f9; }

.linklike { background: none; border: none; color: var(--primary); padding: 0; font-weight: 700; text-decoration: underline; }
.footer-note { text-align: center; color: var(--muted); font-size: 13px; margin-top: 18px; }
.copybox {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; margin: 0 0 6px; white-space: pre-wrap; word-break: break-word;
  font-size: 14px; font-family: inherit; color: var(--ink); max-height: 220px; overflow: auto;
}
