/* =========================================================
   Dashboard tiến độ NAS — nền trắng, layered depth
   ========================================================= */
:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --border: #E5E7EB;
  --border-soft: #F1F2F4;
  --heading: #111827;
  --text: #374151;
  --muted: #6B7280;
  --subtle: #9CA3AF;
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-soft: #EFF6FF;
  --ring: rgba(37, 99, 235, 0.18);

  --st-pending-bg: #F3F4F6;   --st-pending-fg: #4B5563;   --st-pending-dot: #9CA3AF;
  --st-uploading-bg: #EFF6FF; --st-uploading-fg: #1D4ED8; --st-uploading-dot: #3B82F6;
  --st-pushed-bg: #ECFDF3;    --st-pushed-fg: #047857;    --st-pushed-dot: #10B981;
  --st-verified-bg: #F5F3FF;  --st-verified-fg: #6D28D9;  --st-verified-dot: #8B5CF6;
  --st-error-bg: #FEF2F2;     --st-error-fg: #B91C1C;     --st-error-dot: #EF4444;

  --ty-TBCN: #B45309;  --ty-TBCN-bg: #FFFBEB;  --ty-TBCN-bd: #FDE68A;
  --ty-TBCQ: #0E7490;  --ty-TBCQ-bg: #ECFEFF;  --ty-TBCQ-bd: #A5F3FC;
  --ty-DDKCN: #BE185D; --ty-DDKCN-bg: #FDF2F8; --ty-DDKCN-bd: #FBCFE8;
  --ty-KHAC: #4B5563;  --ty-KHAC-bg: #F9FAFB;  --ty-KHAC-bd: #E5E7EB;

  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 8px rgba(16, 24, 40, 0.04), 0 12px 24px rgba(16, 24, 40, 0.06);
  --shadow-pop: 0 4px 8px rgba(16, 24, 40, 0.06), 0 16px 32px rgba(16, 24, 40, 0.10), 0 32px 64px rgba(16, 24, 40, 0.10);
  --shadow-btn: 0 1px 2px rgba(16, 24, 40, 0.10), 0 2px 6px rgba(37, 99, 235, 0.22);
  --shadow-btn-hover: 0 2px 4px rgba(16, 24, 40, 0.10), 0 6px 14px rgba(37, 99, 235, 0.28);

  --r-card: 16px;
  --r-control: 12px;
  --gap-section: 32px;
  --pad-card: 24px;
  --row-h: 52px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t: 180ms var(--ease);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
h1, h2, h3 { margin: 0; color: var(--heading); }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; flex: none; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.t-right { text-align: right; }
.t-center { text-align: center; }
[hidden] { display: none !important; }

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 40px 32px 64px;
  display: flex;
  flex-direction: column;
  gap: var(--gap-section);
}

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: var(--pad-card);
}
.card h2 { font-size: 14px; font-weight: 600; letter-spacing: -0.005em; }

/* ---------- Header ---------- */
.header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 8px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.eyebrow svg { width: 16px; height: 16px; }
.eyebrow code {
  text-transform: none;
  letter-spacing: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 8px;
}
.header__meta {
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
}
.header__meta strong { color: var(--text); font-weight: 600; }
.header__meta .sep { color: var(--subtle); }
.meta-item { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.header__actions { display: flex; gap: 12px; }

.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--st-pushed-dot);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}
.live-dot.is-scanning { background: var(--st-uploading-dot); box-shadow: 0 0 0 3px rgba(59, 130, 246, .18); animation: pulse 1.2s ease-in-out infinite; }
.live-dot.is-error { background: var(--st-error-dot); box-shadow: 0 0 0 3px rgba(239, 68, 68, .15); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--r-control);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--t), box-shadow var(--t), background-color var(--t), border-color var(--t), color var(--t);
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn--primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-btn); }
.btn--primary:hover:not(:disabled) { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-btn-hover); }
.btn--primary:active:not(:disabled) { transform: translateY(0); }
.btn--secondary { background: #fff; color: var(--heading); border-color: var(--border); box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.btn--secondary:hover:not(:disabled) { border-color: #D1D5DB; transform: translateY(-1px); box-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 10px rgba(16, 24, 40, .06); }
.btn--ghost { background: transparent; color: var(--muted); }
.btn--ghost:hover { background: #F9FAFB; color: var(--heading); }
.btn--sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn--icon { width: 36px; height: 36px; padding: 0; }
.btn.is-loading svg { animation: spin .8s linear infinite; }

/* ---------- Alert ---------- */
.alert {
  border: 1px solid #FECACA;
  color: var(--st-error-fg);
  background: #fff;
  border-radius: var(--r-card);
  padding: 14px 20px;
  box-shadow: var(--shadow-card);
  font-weight: 500;
}

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}
.stat { display: flex; flex-direction: column; gap: 12px; }
.stat__head { display: flex; align-items: center; gap: 12px; }
.stat__head h2 { color: var(--muted); }
.stat__icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
}
.stat__icon--blue { background: var(--primary-soft); color: var(--primary); }
.stat__icon--green { background: var(--st-pushed-bg); color: var(--st-pushed-fg); }
.stat__icon--purple { background: var(--st-verified-bg); color: var(--st-verified-fg); }
.stat__icon--red { background: var(--st-error-bg); color: var(--st-error-fg); }
.stat__value { font-size: 34px; font-weight: 700; color: var(--heading); letter-spacing: -0.02em; line-height: 1.1; }
.stat__sub { color: var(--muted); font-size: 13px; }

/* ---------- Progress ---------- */
.progress-card { display: flex; flex-direction: column; gap: 16px; }
.progress-card__head { display: flex; align-items: baseline; justify-content: space-between; }
.progress-card__sub { font-weight: 500; font-size: 13px; margin-left: 4px; }
.progress-card__pct { font-size: 22px; font-weight: 700; color: var(--heading); letter-spacing: -0.01em; }
.progress {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #F3F4F6;
  gap: 2px;
}
.progress__seg { height: 100%; transition: width 400ms var(--ease); }
.progress__seg:first-child { border-radius: 999px 0 0 999px; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 13px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.legend strong { color: var(--heading); font-weight: 600; }
.legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- Controls ---------- */
.control {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  color: var(--heading);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.control::placeholder { color: var(--subtle); }
.control:hover { border-color: #D1D5DB; }
.control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
select.control {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  cursor: pointer;
}
textarea.control { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.control--sm { height: 34px; border-radius: 10px; font-size: 13px; }
input[type="date"].control { min-width: 0; }

.input-icon { position: relative; display: block; }
.input-icon svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--subtle); width: 16px; height: 16px; pointer-events: none; }
.input-icon .control { padding-left: 36px; }
.input-icon--sm svg { left: 10px; width: 14px; height: 14px; }
.input-icon--sm .control { padding-left: 30px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }

/* ---------- Filters ---------- */
.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}
.field--search { grid-column: span 3; }
.field--dates { grid-column: span 2; }
.field--reset { grid-column: -2 / -1; justify-self: end; }
.date-range { display: flex; align-items: center; gap: 8px; }
.date-range__sep { color: var(--subtle); }

/* ---------- Type tag ---------- */
.type-tag {
  display: inline-flex; align-items: center;
  height: 24px; padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--ty-KHAC-bd);
  background: var(--ty-KHAC-bg);
  color: var(--ty-KHAC);
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  white-space: nowrap;
}
.type-tag--TBCN { color: var(--ty-TBCN); background: var(--ty-TBCN-bg); border-color: var(--ty-TBCN-bd); }
.type-tag--TBCQ { color: var(--ty-TBCQ); background: var(--ty-TBCQ-bg); border-color: var(--ty-TBCQ-bd); }
.type-tag--DDKCN { color: var(--ty-DDKCN); background: var(--ty-DDKCN-bg); border-color: var(--ty-DDKCN-bd); }

/* ---------- Table ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-card__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px var(--pad-card);
  border-bottom: 1px solid var(--border);
}
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 1180px; }
.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  height: 44px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
  background: #fff;
}
.table th:first-child, .table td:first-child { padding-left: var(--pad-card); }
.table th:last-child, .table td:last-child { padding-right: var(--pad-card); }
.table th[data-sort] { cursor: pointer; transition: color var(--t); }
.table th[data-sort]:hover { color: var(--heading); }
.table th[data-sort]::after {
  content: "";
  display: inline-block;
  width: 12px; height: 12px;
  margin-left: 6px;
  vertical-align: -1px;
  opacity: .35;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m8 9 4-4 4 4M8 15l4 4 4-4' fill='none' stroke='%236B7280' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.table th.sort-asc, .table th.sort-desc { color: var(--primary); }
.table th.sort-asc::after { opacity: 1; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 14 5-5 5 5' fill='none' stroke='%232563EB' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.table th.sort-desc::after { opacity: 1; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%232563EB' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.table th.t-right { text-align: right; }
.table th.t-center { text-align: center; }

.table td {
  height: var(--row-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  white-space: nowrap;
}
.table tbody tr { cursor: pointer; transition: background-color 150ms var(--ease); }
.table tbody tr:hover { background: #FAFBFF; }
.table tbody tr.is-active { background: var(--primary-soft); }
.table tbody tr:last-child td { border-bottom: none; }
.col-stt { width: 64px; color: var(--subtle); }
td.col-stt { color: var(--subtle); }
.pkg-name { display: flex; flex-direction: column; line-height: 1.35; min-width: 220px; max-width: 300px; white-space: normal; }
.pkg-name strong { overflow-wrap: anywhere; }
.pkg-name .code { color: var(--muted); font-weight: 500; margin-right: 6px; font-variant-numeric: tabular-nums; }
.branch-cell { color: var(--text); font-weight: 500; }
.pkg-name strong { color: var(--heading); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.pkg-name small { color: var(--subtle); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.cell-note { width: 18%; min-width: 180px; }
.note-input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t), background-color var(--t);
}
.note-input::placeholder { color: #C4C8CF; }
.note-input:hover { border-color: var(--border); background: #fff; }
.note-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); background: #fff; }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--pending { background: var(--st-pending-bg); color: var(--st-pending-fg); }
.badge--pending::before { background: var(--st-pending-dot); }
.badge--uploading { background: var(--st-uploading-bg); color: var(--st-uploading-fg); }
.badge--uploading::before { background: var(--st-uploading-dot); animation: pulse 1.2s ease-in-out infinite; }
.badge--pushed { background: var(--st-pushed-bg); color: var(--st-pushed-fg); }
.badge--pushed::before { background: var(--st-pushed-dot); }
.badge--verified { background: var(--st-verified-bg); color: var(--st-verified-fg); }
.badge--verified::before { background: var(--st-verified-dot); }
.badge--error { background: var(--st-error-bg); color: var(--st-error-fg); }
.badge--error::before { background: var(--st-error-dot); }
.badge .manual { font-weight: 500; opacity: .7; }

/* ---------- Checkbox ---------- */
.check {
  appearance: none;
  width: 20px; height: 20px;
  margin: 0;
  border: 1.5px solid #D1D5DB;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  vertical-align: middle;
  transition: background-color var(--t), border-color var(--t), box-shadow var(--t), transform 120ms var(--ease);
}
.check::after {
  content: "";
  width: 12px; height: 12px;
  transform: scale(0);
  transition: transform 150ms var(--ease);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.check:hover { border-color: var(--primary); }
.check:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.check:checked { background: var(--primary); border-color: var(--primary); box-shadow: 0 1px 2px rgba(37, 99, 235, .3); }
.check:checked::after { transform: scale(1); }
.check:active { transform: scale(.92); }
.check:disabled { opacity: .5; cursor: progress; }
.check-row { display: inline-flex; align-items: center; gap: 10px; height: 40px; cursor: pointer; color: var(--text); }
.check-cell { display: inline-flex; padding: 8px; margin: -8px; border-radius: 8px; }

/* ---------- Mobile list ---------- */
.mobile-list { display: none; }

/* ---------- Empty ---------- */
.empty { padding: 56px 24px; text-align: center; color: var(--muted); }
.empty svg { width: 40px; height: 40px; color: #D1D5DB; }
.empty p { margin: 12px 0 0; }

/* ---------- Pager ---------- */
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px var(--pad-card);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.pager__nav { display: flex; gap: 4px; align-items: center; }
.page-btn {
  min-width: 36px; height: 36px; padding: 0 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background-color var(--t), border-color var(--t), color var(--t);
}
.page-btn:hover:not(:disabled):not(.is-current) { background: #F9FAFB; border-color: var(--border); }
.page-btn.is-current { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.page-btn:disabled { color: #D1D5DB; cursor: default; }
.page-gap { color: var(--subtle); padding: 0 4px; }

/* ---------- Drawer ---------- */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(17, 24, 39, 0.18);
  backdrop-filter: blur(2px);
  z-index: 40;
  animation: fade 180ms var(--ease);
}
.drawer {
  position: fixed; top: 12px; right: 12px; bottom: 12px;
  width: min(560px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-pop);
  z-index: 50;
  display: flex; flex-direction: column;
  transform: translateX(calc(100% + 24px));
  transition: transform 260ms var(--ease);
}
.drawer.is-open { transform: translateX(0); }
.drawer__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--border);
}
.drawer__title-wrap { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.drawer__head h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; word-break: break-all; }
.drawer__body { overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 32px; }
.drawer__section { display: flex; flex-direction: column; gap: 16px; }
.drawer__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.drawer__actions { display: flex; justify-content: flex-end; }
.hint { margin: -4px 0 0; font-size: 13px; color: var(--muted); }
.hint:empty { display: none; }

.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.meta-grid > div { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.meta-grid dt { font-size: 12px; color: var(--muted); font-weight: 500; }
.meta-grid dd { margin: 2px 0 0; color: var(--heading); font-weight: 600; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.files-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.files-head h3 { font-size: 14px; font-weight: 600; }
.files-head .input-icon { width: 200px; }
.files { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.file-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 16px; align-items: center;
  height: 44px; padding: 0 14px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.file-row:last-child { border-bottom: none; }
.file-row__path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--heading); display: flex; align-items: center; gap: 8px; }
.file-row__path svg { width: 16px; height: 16px; color: var(--subtle); }
.file-row__size, .file-row__time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.file-row.is-temp .file-row__path { color: var(--st-uploading-fg); }
.file-row.is-zero .file-row__size { color: var(--st-error-fg); font-weight: 600; }
.files__note { padding: 12px 14px; font-size: 13px; color: var(--muted); text-align: center; }

.skeleton { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #F3F4F6, #F9FAFB, #F3F4F6); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }

/* ---------- Tooltip & toast ---------- */
.tooltip {
  position: fixed;
  z-index: 70;
  pointer-events: none;
  background: #111827;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(16, 24, 40, .18);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #111827; color: #fff;
  padding: 10px 16px; border-radius: 12px;
  font-weight: 500; font-size: 13px;
  box-shadow: var(--shadow-pop);
  animation: toast-in 200ms var(--ease);
}
.toast--error { background: var(--st-error-fg); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes shimmer { to { background-position: -200% 0; } }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .field--search { grid-column: span 4; }
  .field--dates { grid-column: span 3; }
}

@media (max-width: 760px) {
  .page { padding: 24px 16px 48px; gap: 24px; }
  .header { align-items: stretch; }
  .header h1 { font-size: 24px; }
  .header__meta { flex-direction: column; align-items: flex-start; gap: 2px; }
  .header__meta .sep { display: none; }
  #nextRefresh { padding-left: 16px; font-size: 13px; }
  .header__actions { width: 100%; }
  .header__actions .btn { flex: 1; }
  .stats { gap: 12px; }
  .stat { padding: 16px; gap: 8px; }
  .stat__value { font-size: 26px; }
  .stat__head { gap: 8px; }
  .stat__head h2 { font-size: 13px; }
  .stat__icon { width: 30px; height: 30px; }
  .card { padding: 20px; }
  .filters { grid-template-columns: 1fr 1fr; gap: 12px; }
  .field--search, .field--dates, .field--reset { grid-column: span 2; }
  .field--reset { grid-column: span 2; justify-self: stretch; }
  .field--reset .btn { width: 100%; }
  .table-card { padding: 0; }
  .table-card__head { padding: 16px 20px; }

  /* Bảng -> danh sách thẻ */
  .table-wrap { display: none; }
  .mobile-list { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
  .m-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 8px rgba(16, 24, 40, .03);
    display: flex; flex-direction: column; gap: 12px;
    cursor: pointer;
    transition: border-color var(--t), box-shadow var(--t);
  }
  .m-card:active { border-color: var(--primary); }
  .m-card__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
  .m-card__name { min-width: 0; }
  .m-card__name strong { display: block; color: var(--heading); font-weight: 600; word-break: break-all; }
  .m-card__name small { display: block; color: var(--subtle); font-size: 12px; word-break: break-all; }
  .m-card__tags { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
  .m-card__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; font-size: 13px; }
  .m-card__stats span { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
  .m-card__stats b { font-weight: 600; color: var(--heading); font-variant-numeric: tabular-nums; }
  .m-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border-soft); padding-top: 12px; }
  .m-card__note { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-card .check-row { height: auto; font-size: 13px; font-weight: 500; }

  .pager { justify-content: center; }
  .pager__info { width: 100%; text-align: center; }
  .drawer { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 88vh; transform: translateY(calc(100% + 16px)); }
  .drawer.is-open { transform: translateY(0); }
  .drawer__row { grid-template-columns: 1fr; }
  .files-head { flex-direction: column; align-items: stretch; }
  .files-head .input-icon { width: 100%; }
  .file-row { grid-template-columns: minmax(0, 1fr) auto; }
  .file-row__time { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
