/* ===========================================================================
   Easy Chấm Công — System Admin
   Design system: minimalist, Vercel/Apple-style. Light slate bg, white cards,
   ultra-soft shadows, thin borders, generous whitespace, rounded-xl.
   =========================================================================== */
:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.12);
  --text: #18181b;
  --text-2: #3f3f46;
  --muted: #71717a;
  --muted-2: #a1a1aa;
  --primary: #18181b;
  --primary-contrast: #ffffff;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --green: #16a34a;
  --green-soft: #f0fdf4;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --amber: #d97706;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-pop: 0 12px 32px rgba(15, 23, 42, 0.12);
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 76px;
  --header-h: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
button { font: inherit; cursor: pointer; }
svg { display: block; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  background: #f4f4f5;
  padding: 1px 6px;
  border-radius: 6px;
}

/* ---------- Login ---------- */
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(1200px 500px at 50% -10%, #eef2ff 0%, transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  display: grid; place-items: center;
  margin-bottom: 4px;
}
.login-card h1 { margin: 0; font-size: 1.35rem; letter-spacing: -0.02em; }
.login-card .subtitle { margin: -10px 0 6px; color: var(--muted); font-size: 0.92rem; }
.login-card label { display: flex; flex-direction: column; gap: 7px; font-size: 0.82rem; color: var(--muted); font-weight: 500; }
input, select {
  font: inherit;
  color: var(--text);
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.btn-primary {
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--primary-contrast);
  padding: 11px 16px;
  font-weight: 600;
  transition: opacity 0.15s, transform 0.05s;
}
.btn-primary:hover { opacity: 0.88; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
.error { color: var(--red); font-size: 0.88rem; margin: 0; }

/* ---------- App layout ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.28s var(--ease);
}
.layout.collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 6px;
  overflow: hidden;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 16px;
  white-space: nowrap;
}
.brand-mark {
  width: 32px; height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  display: grid; place-items: center;
}
.brand-name { font-weight: 700; letter-spacing: -0.02em; font-size: 1.02rem; }
.brand-name small { display: block; font-weight: 500; font-size: 0.7rem; color: var(--muted); letter-spacing: 0; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  font-weight: 600;
  padding: 14px 12px 6px;
  white-space: nowrap;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text-2);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  width: 100%;
  text-align: left;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav-item svg { flex: 0 0 18px; color: var(--muted); transition: color 0.15s; }
.nav-item:hover { background: #f4f4f5; color: var(--text); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item.active svg { color: #fff; }
.nav-spacer { flex: 1; }

.collapse-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  font-size: 0.88rem;
}
.collapse-btn:hover { background: #f4f4f5; color: var(--text); }
.collapse-btn svg { transition: transform 0.28s var(--ease); }

/* Collapsed: ẩn chữ, chỉ còn icon căn giữa */
.collapsed .brand-name,
.collapsed .nav-label,
.collapsed .nav-item span,
.collapsed .collapse-btn span { display: none; }
.collapsed .nav-item,
.collapsed .collapse-btn { justify-content: center; padding: 10px; }
.collapsed .brand { justify-content: center; padding-left: 0; padding-right: 0; }
.collapsed .collapse-btn svg { transform: rotate(180deg); }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: rgba(248, 250, 252, 0.8);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.page-title { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.01em; }
.topbar-spacer { flex: 1; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 7px 11px;
  width: 280px;
  max-width: 36vw;
  color: var(--muted);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.search-box input { border: none; padding: 0; background: transparent; flex: 1; font-size: 0.9rem; }
.search-box input:focus { box-shadow: none; }

.icon-btn {
  position: relative;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--border-strong);
  background: #fff;
  border-radius: 10px;
  color: var(--text-2);
  transition: background 0.15s;
}
.icon-btn:hover { background: #f4f4f5; }
.icon-btn .badge-dot {
  position: absolute; top: 8px; right: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); border: 2px solid #fff;
}

/* Avatar + dropdown */
.avatar-wrap { position: relative; }
.avatar-btn {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--border-strong);
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
  transition: background 0.15s;
}
.avatar-btn:hover { background: #f4f4f5; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #2563eb);
  color: #fff; display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 700;
}
.avatar-name { font-size: 0.85rem; font-weight: 600; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dropdown {
  position: absolute;
  right: 0; top: calc(100% + 10px);
  width: 240px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  padding: 8px;
  transform-origin: top right;
  animation: pop 0.16s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(-4px); } to { opacity: 1; transform: none; } }
.dropdown-head { padding: 10px 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown-head .n { font-weight: 650; font-size: 0.9rem; }
.dropdown-head .e { color: var(--muted); font-size: 0.8rem; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; border: none; background: transparent;
  padding: 9px 10px; border-radius: 9px;
  font-size: 0.88rem; color: var(--text-2); text-align: left;
}
.dropdown-item:hover { background: rgba(15, 23, 42, 0.05); }
.dropdown-item.danger { color: var(--red); }

/* ---------- Content ---------- */
.content { padding: 28px 24px 48px; max-width: 1280px; width: 100%; margin: 0 auto; }
.view { display: flex; flex-direction: column; gap: 22px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { margin: 0; font-size: 1rem; font-weight: 650; letter-spacing: -0.01em; }
.card-head .sub { color: var(--muted); font-size: 0.82rem; }

/* ---------- KPI cards ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.kpi-ico {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.kpi-ico.green { background: var(--green-soft); color: var(--green); }
.kpi-ico.amber { background: #fffbeb; color: var(--amber); }
.kpi-ico.zinc { background: #f4f4f5; color: var(--text); }
.kpi-value { font-size: 1.7rem; font-weight: 720; letter-spacing: -0.02em; line-height: 1; }
.kpi-foot { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; }
.trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-weight: 650; padding: 2px 7px; border-radius: 999px;
}
.trend.up { color: var(--green); background: var(--green-soft); }
.trend.down { color: var(--red); background: var(--red-soft); }
.trend.flat { color: var(--muted); background: #f4f4f5; }
.kpi-foot .cap { color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 0.95rem; }
.status-pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

/* ---------- Dashboard row 2 ---------- */
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* Line chart */
.chart-box { width: 100%; }
.chart-svg { width: 100%; height: 260px; overflow: visible; }
.chart-legend { display: flex; gap: 16px; font-size: 0.8rem; color: var(--muted); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.chart-tip {
  position: fixed;
  pointer-events: none;
  background: var(--primary); color: #fff;
  font-size: 0.76rem; padding: 6px 9px; border-radius: 8px;
  box-shadow: var(--shadow-pop); z-index: 60; opacity: 0;
  transform: translate(-50%, -120%); transition: opacity 0.1s; white-space: nowrap;
}
.chart-tip b { font-weight: 700; }

/* Mini bar charts */
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 44px; align-items: center; gap: 10px; font-size: 0.84rem; }
.bar-track { height: 8px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width 0.5s var(--ease); }
.bar-row .v { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Telemetry "Hôm nay" ---------- */
.tele-today { display: flex; flex-direction: column; gap: 6px; }
.tele-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.tele-row:last-of-type { border-bottom: none; }
.tele-ico { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tele-ico.green { background: var(--green-soft); color: var(--green); }
.tele-ico.amber { background: #fffbeb; color: var(--amber); }
.tele-val { font-size: 1.5rem; font-weight: 720; letter-spacing: -0.02em; line-height: 1.1; }
.tele-lbl { font-size: 0.8rem; color: var(--muted); }
.tele-foot { margin-top: 10px; font-size: 0.78rem; color: var(--muted); }

/* ---------- Recent activity ---------- */
.activity { display: flex; flex-direction: column; }
.act-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.act-item:last-child { border-bottom: none; }
.act-ico {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 9px;
  display: grid; place-items: center; background: #f4f4f5; color: var(--text-2);
}
.act-ico.signup { background: var(--accent-soft); color: var(--accent); }
.act-ico.login { background: var(--green-soft); color: var(--green); }
.act-ico.org { background: #fffbeb; color: var(--amber); }
.act-ico.attendance { background: #f5f3ff; color: #7c3aed; }
.act-body { min-width: 0; flex: 1; }
.act-text { font-size: 0.86rem; font-weight: 500; }
.act-sub { font-size: 0.76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-time { font-size: 0.74rem; color: var(--muted-2); white-space: nowrap; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th {
  text-align: left; font-weight: 600; font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
  padding: 0 14px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: #fafafa; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-strong { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 0.78rem; }
.row-link { background: none; border: none; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; font: inherit; }
.row-link:hover { text-decoration: underline; }

.role-tag { display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.02em; }
.role-admin { background: #f5f3ff; color: #7c3aed; }
.role-manager { background: var(--accent-soft); color: var(--accent); }
.role-employee { background: #f4f4f5; color: var(--muted); }

.dot-on, .dot-off { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; }
.dot-on { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.dot-off { background: var(--muted-2); }

/* Toolbar / search / pager */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border-strong); background: #fff; color: var(--text-2);
  padding: 7px 13px; border-radius: 999px; font-size: 0.84rem; font-weight: 500;
  display: inline-flex; align-items: center; gap: 7px; transition: all 0.15s;
}
.chip:hover { background: #f4f4f5; }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip .count { font-size: 0.74rem; opacity: 0.7; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 14px; }
.btn-ghost {
  border: 1px solid var(--border-strong); background: #fff; color: var(--text-2);
  padding: 7px 13px; border-radius: 9px; font-size: 0.85rem; font-weight: 500;
}
.btn-ghost:hover { background: #f4f4f5; }
.btn-ghost:disabled { opacity: 0.45; cursor: default; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(2px); }
.modal-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
  width: 100%; max-width: 640px; max-height: 86vh; overflow: auto; padding: 22px;
  animation: pop 0.18s var(--ease);
}
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 6px 0 16px; }
.kv { display: flex; flex-direction: column; gap: 2px; padding: 11px 13px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.kv .k { color: var(--muted); font-size: 0.74rem; }
.kv .v { font-weight: 600; font-size: 0.92rem; word-break: break-word; }
.modal-card h4 { margin: 16px 0 8px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.json-view {
  background: #0f172a; color: #e2e8f0; border-radius: var(--radius-sm);
  padding: 16px; overflow: auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem; line-height: 1.55; max-height: 50vh; white-space: pre; margin: 0;
}
.json-view .jk { color: #93c5fd; }
.json-view .js { color: #86efac; }
.json-view .jn { color: #fca5a5; }
.json-view .jb { color: #c4b5fd; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff; padding: 11px 18px; border-radius: 11px;
  box-shadow: var(--shadow-pop); z-index: 90; font-size: 0.88rem;
}
.toast.err { background: var(--red); }

.empty { text-align: center; color: var(--muted); padding: 28px; font-size: 0.9rem; }

/* ---------- Bottom tab bar (mobile) ---------- */
.bottom-nav {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 70;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
}
.bn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 7px 4px 5px;
  border-radius: 12px;
  font-size: 0.66rem;
  font-weight: 600;
  transition: color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.bn-item svg { stroke-width: 2; transition: transform 0.18s var(--ease); }
.bn-item.active { color: var(--accent); }
.bn-item.active svg { transform: translateY(-1px); }
.bn-item:active { background: #f4f4f5; }

/* ---------- Mobile ---------- */
.scrim { display: none; }
@media (max-width: 1024px) { .grid-2-1 { grid-template-columns: 1fr; } .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

@media (max-width: 760px) {
  /* Bỏ sidebar, dùng bottom-nav */
  .layout, .layout.collapsed { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  #menu-btn { display: none !important; }
  .bottom-nav { display: grid; }

  .topbar { gap: 10px; padding: 0 14px; }
  .page-title { font-size: 1.1rem; font-weight: 700; }
  .search-box { display: none; }
  .avatar-name { display: none; }

  /* Chừa chỗ cho bottom-nav + thoáng hơn */
  .content { padding: 16px 14px calc(86px + env(safe-area-inset-bottom)); }
  .view { gap: 16px; }
  .card { padding: 16px; border-radius: var(--radius); }
  .card-head { margin-bottom: 14px; flex-wrap: wrap; }
  /* Ô tìm kiếm trong card (Users/Data) đầy chiều ngang */
  .card-head .search-box { display: flex; width: 100% !important; max-width: none; }

  .kpi { padding: 15px; gap: 9px; }
  .kpi-value { font-size: 1.5rem; }

  .chart-svg { height: 210px; }
  .bar-row { grid-template-columns: 78px 1fr 40px; gap: 8px; font-size: 0.8rem; }

  /* Modal full-width hơn, kv 1 cột */
  .modal { padding: 0; place-items: end stretch; }
  .modal-card {
    max-width: none; max-height: 92vh; border-radius: 20px 20px 0 0;
    padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
    animation: sheet 0.24s var(--ease);
  }
  .kv-grid { grid-template-columns: 1fr; }
  /* Toast nổi trên bottom-nav */
  .toast { bottom: calc(82px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100vw - 32px); }
}
@keyframes sheet { from { transform: translateY(100%); } to { transform: none; } }

/* ---------- Bảng → thẻ xếp dọc trên điện thoại ---------- */
@media (max-width: 640px) {
  .table-card thead { display: none; }
  .table-card, .table-card tbody { display: block; }
  .table-card tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 10px;
    background: #fff;
    box-shadow: var(--shadow-sm);
  }
  .table-card tr:hover { background: #fff; }
  .table-card td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 6px 0;
    border: none;
    white-space: normal;
    text-align: right;
  }
  .table-card td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    text-align: left;
    white-space: nowrap;
  }
  /* Ô đầu (tên + email) làm tiêu đề thẻ, không nhãn */
  .table-card td:first-child {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    gap: 2px;
    padding-bottom: 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
  }
  .table-card td:first-child::before { display: none; }
  .table-card td:first-child .row-link { font-size: 0.98rem; }
  .table-card td.num { font-size: 0.92rem; }
  .table-card td.cell-emails { flex-direction: column; align-items: stretch; text-align: left; }
  .table-card td.cell-emails code { display: inline-block; margin: 2px 4px 2px 0; }
  .pager { justify-content: space-between; }
}
