:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #16202b;
  --muted: #64748b;
  --line: #dde3ea;
  --brand: #0f4c81;
  --brand-ink: #ffffff;
  --green: #17924b;
  --green-bg: #d9ecd9;
  --yellow: #b7791f;
  --yellow-bg: #ffe699;
  --red: #c0392b;
  --red-bg: #f5a6a6;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 32, 48, .09), 0 6px 18px rgba(16, 32, 48, .05);
}

* { box-sizing: border-box; }
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: 16px; line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

header.app {
  position: sticky; top: 0; z-index: 20;
  background: var(--brand); color: var(--brand-ink);
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
header.app h1 { font-size: 17px; margin: 0; font-weight: 650; flex: 1; }
header.app a, header.app button.link {
  color: #cfe3f5; text-decoration: none; font-size: 14px; background: none; border: 0; cursor: pointer;
}
.who { font-size: 12.5px; opacity: .9; }

main { max-width: 1100px; margin: 0 auto; padding: 14px; }
.grid { display: grid; gap: 12px; }
@media (min-width: 760px) { .grid.two { grid-template-columns: 1fr 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.card h2 { margin: 0 0 10px; font-size: 15px; letter-spacing: .01em; }
.card h2 .sub { font-weight: 400; color: var(--muted); font-size: 13px; }

label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; padding: 11px 12px; font-size: 16px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #a9c8e6; border-color: var(--brand); }

button {
  font-family: inherit; font-size: 15px; font-weight: 600; padding: 12px 16px;
  border-radius: 10px; border: 1px solid transparent; background: var(--brand); color: #fff;
  cursor: pointer; min-height: 46px;
}
button:disabled { opacity: .5; cursor: not-allowed; }
button.ghost { background: #fff; color: var(--brand); border-color: var(--line); }
button.warn { background: var(--yellow); }
button.danger { background: var(--red); }
button.ok { background: var(--green); }
button.big { width: 100%; font-size: 17px; min-height: 56px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
.row.tight > * { flex: 0 0 auto; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
tr.sel { background: #eaf3fb; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: #eef2f6; color: var(--muted); white-space: nowrap;
}
.tag.xanh { background: var(--green-bg); color: #14532d; }
.tag.vang { background: var(--yellow-bg); color: #7c4a03; }
.tag.do   { background: var(--red-bg); color: #7f1d1d; }
.tag.on   { background: #dbeafe; color: #1e3a8a; }
.tag.done { background: var(--green-bg); color: #14532d; }

.msg { padding: 10px 12px; border-radius: 10px; margin: 10px 0; font-size: 14px; }
.msg.err { background: #fdecec; color: #8c1d18; border: 1px solid #f3c0bd; }
.msg.ok  { background: #e7f5ec; color: #14532d; border: 1px solid #b6e0c5; }
.muted { color: var(--muted); font-size: 13px; }
.big-id { font-size: 20px; font-weight: 700; letter-spacing: .02em; }

#reader, .scanbox { width: 100%; max-width: 420px; margin: 0 auto; border-radius: 12px; overflow: hidden; background: #000; }
.scanbox video { width: 100%; display: block; }

.applist { display: grid; gap: 10px; }
.applist a {
  display: block; padding: 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
}
.applist a strong { display: block; font-size: 16px; }
.applist a span { color: var(--muted); font-size: 13px; }
.applist a.off { opacity: .45; pointer-events: none; }

.lsx-img { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid #fff6; border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }
