/* Nhận diện IK: Passion Red #EF4630 · Golden Beige #F9F4DF · xám #232323→#F2F2F2 */
:root {
  --red: #EF4630; --red-d: #C8371F; --beige: #F9F4DF; --ink: #232323; --ink-2: #5E5A50; --line: #E6E1CC;
  --bg: #FBF9F1; --card: #FFFFFF; --ket: #B42318; --ket-bg: #FEF0EE; --xong: #1E7A46; --xong-bg: #E8F5EC; --muted-bg: #F2F2F2;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --beige: #2A2721; --ink: #F2EFE6; --ink-2: #ADA796; --line: #3A372F; --bg: #191815; --card: #22201C;
    --ket: #FF8A7A; --ket-bg: #3A1F1B; --xong: #6FD39A; --xong-bg: #1B3326; --muted-bg: #2C2A25; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--red-d); }
.muted { color: var(--ink-2); }
.sm { font-size: 13px; }
.nowrap { white-space: nowrap; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--card); border-bottom: 3px solid var(--red); position: sticky; top: 0; z-index: 2; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; letter-spacing: .01em; }
.me { display: flex; align-items: center; gap: 10px; font-size: 14px; flex-wrap: wrap; justify-content: flex-end; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 16px 48px; }
.head h1 { font-size: 24px; margin: 4px 0 2px; letter-spacing: -.01em; }
.head p { margin: 0 0 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 16px 0 8px; color: var(--ink-2); }

.alert { background: var(--ket-bg); color: var(--ket); border: 1px solid color-mix(in srgb, var(--ket) 30%, transparent); border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 14px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; min-height: 36px; }
.tabs button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tabs .n { font-size: 12px; opacity: .7; font-variant-numeric: tabular-nums; }

.tbl-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
.tbl { width: 100%; min-width: 720px; border-collapse: collapse; table-layout: fixed; }
.tbl col.c-id { width: 48px; } .tbl col.c-khach { width: 34%; } .tbl col.c-han { width: 130px; }
.tbl col.c-buoc { width: auto; } .tbl col.c-cho { width: 150px; } .tbl col.c-tu { width: 80px; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--beige); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tr.ket td:first-child { box-shadow: inset 3px 0 0 var(--ket); }
.tbl .id a { font-variant-numeric: tabular-nums; font-weight: 600; text-decoration: none; }
.khach { font-weight: 600; }
.ket-ly-do { color: var(--ket); margin: 4px 0 0; }
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: 12px; padding: 24px; text-align: center; color: var(--ink-2); }

.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--muted-bg); color: var(--ink); white-space: nowrap; }
.tag-ket { background: var(--ket-bg); color: var(--ket); }
.tag-xong { background: var(--xong-bg); color: var(--xong); }
.tag-dung { background: var(--muted-bg); color: var(--ink-2); text-decoration: line-through; }
.tag-ban { background: var(--beige); color: var(--ink); }
.steps { display: flex; gap: 3px; margin-top: 6px; max-width: 160px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps i.done { background: color-mix(in srgb, var(--red) 45%, var(--line)); }
.steps i.now { background: var(--red); }

.back { display: inline-block; margin-bottom: 6px; text-decoration: none; font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.card.status.is-ket { border-color: var(--ket); }
.card.status .steps { max-width: none; margin: 10px 0; }
.grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 820px) { .grid { grid-template-columns: 1fr; } }
/* Điện thoại: mỗi phiếu một thẻ thay cho dòng bảng */
@media (max-width: 720px) {
  .tbl { min-width: 0; table-layout: auto; }
  .tbl colgroup, .tbl thead { display: none; }
  .tbl tbody, .tbl tbody tr { display: block; }
  .tbl tbody tr { display: grid; grid-template-columns: 40px 1fr auto; gap: 4px 10px; padding: 12px; border-bottom: 1px solid var(--line); }
  .tbl tbody tr:last-child { border-bottom: 0; }
  .tbl td { padding: 0; border: 0; }
  .tbl tr.ket td:first-child { box-shadow: none; }
  .tbl tr.ket { box-shadow: inset 3px 0 0 var(--ket); }
  .tbl td:nth-child(1) { grid-column: 1; grid-row: 1 / span 4; }
  .tbl td:nth-child(2) { grid-column: 2 / 4; grid-row: 1; }
  .tbl td:nth-child(3) { grid-column: 2; grid-row: 2; }
  .tbl td:nth-child(6) { grid-column: 3; grid-row: 2; text-align: right; }
  .tbl td:nth-child(4) { grid-column: 2 / 4; grid-row: 3; }
  .tbl td:nth-child(5) { grid-column: 2 / 4; grid-row: 4; font-size: 13px; }
  .tbl td:nth-child(3)::before { content: "Hạn nộp "; color: var(--ink-2); font-size: 13px; }
  .tbl td:nth-child(5)::before { content: "Chờ: "; color: var(--ink-2); }
  .steps { max-width: none; }
}
.dl { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 6px 12px; margin: 0; }
.dl dt { color: var(--ink-2); font-size: 13px; }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.moc { list-style: none; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.moc li { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; background: var(--muted-bg); font-size: 13px; }
.moc li.co { background: var(--beige); }
.files, .log { list-style: none; padding: 0; margin: 0; }
.files li, .log li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.log li { justify-content: flex-start; }
.files li:last-child, .log li:last-child { border-bottom: 0; }

/* Trang đăng nhập */
body.auth { display: flex; flex-direction: column; min-height: 100vh; align-items: center; justify-content: center; padding: 20px 16px; background: var(--beige); }
.auth-card { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--red); border-radius: 16px; padding: 28px; max-width: 400px; width: 100%; }
.auth-card h1 { font-size: 22px; margin: 18px 0 6px; }
.auth-card p { color: var(--ink-2); margin: 0 0 18px; }
.auth-foot { color: var(--ink-2); font-size: 12px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 44px; background: var(--red-d); color: #fff; border: 0; border-radius: 10px; padding: 10px 14px; font: 600 15px/1.2 inherit; text-decoration: none; cursor: pointer; margin-top: 10px; }
.btn:hover { background: #B02F1A; }
.btn:focus-visible, .tabs button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--red) 45%, transparent); outline-offset: 2px; }
.btn.alt { background: var(--card); color: var(--ink); border: 1px solid var(--line); justify-content: flex-start; }
.btn.alt:hover { background: var(--beige); }
.ms { display: grid; grid-template-columns: 7px 7px; gap: 2px; }
.ms i { width: 7px; height: 7px; background: #fff; }
