/* ════════════════════════════════════════════════════════════════════
   CCNVBV — Hệ thống thiết kế "Hồ sơ nghiệp vụ"
   Govtech / institutional · navy sâu · slate · system-ui · light-mode
   Drop-in: nhắm đúng class hiện có, không đổi cấu trúc 4 vùng.
   ════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Navy chủ đạo ─────────────────────────────────────── */
  --navy-900: #0c1a36;
  --navy-800: #11213f;
  --navy-700: #16306b;
  --navy-600: #1e40af;
  --navy-500: #2747c4;
  --color-primary: #1e40af;
  --color-primary-hover: #16306b;
  --color-primary-press: #11213f;
  --color-primary-soft: #eef3ff;
  --color-primary-tint: #dde6fb;
  --color-primary-ring: rgba(30, 64, 175, 0.20);

  /* ── Slate trung tính ─────────────────────────────────── */
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-150: #eef2f7;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* ── Vai trò ──────────────────────────────────────────── */
  --color-bg: #eef2f7;
  --color-surface: #ffffff;
  --color-surface-alt: #f8fafc;
  --color-hover: #f1f5f9;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;
  --color-text: #1e293b;
  --color-heading: #0f172a;
  --color-muted: #64748b;
  --color-faint: #94a3b8;

  --color-success: #15803d;
  --color-success-bg: #dcfce7;
  --color-success-bd: #bbf7d0;
  --color-warning: #b45309;
  --color-warning-bg: #fef3c7;
  --color-warning-bd: #fde68a;
  --color-danger: #b91c1c;
  --color-danger-bg: #fee2e2;
  --color-danger-bd: #fecaca;
  --color-info: #1d4ed8;
  --color-info-bg: #dbeafe;
  --color-info-bd: #bfdbfe;

  /* ── Type ─────────────────────────────────────────────── */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: "SFMono-Regular", "Segoe UI Mono", "Roboto Mono", ui-monospace, Menlo, Consolas, monospace;
  --font-size-base: 14px;
  --font-size-table: 13px;
  --font-size-small: 12px;

  /* ── Hình học ─────────────────────────────────────────── */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;
  --border-radius: 6px;

  /* ── Bóng đổ (tinh tế) ────────────────────────────────── */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-pop: 0 8px 24px rgba(15, 23, 42, 0.12);
  --shadow-modal: 0 24px 60px rgba(12, 26, 54, 0.28);

  /* ── Layout (giữ nguyên toán học) ─────────────────────── */
  --header-height: 56px;
  --sidebar-width: 240px;
  --sidebar-collapsed: 60px;
  --footer-height: 36px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding-bottom: var(--footer-height);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

/* số liệu căn đều — CCCD, ngày, mã */
.mono,
.tabular,
.data-table .col-cccd,
.data-table .col-date,
.data-table .col-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.mono { font-family: var(--font-mono); letter-spacing: 0.01em; }

/* icon mặc định (line-icon SVG dùng <use>) */
.ico { width: 1.05em; height: 1.05em; display: inline-block; vertical-align: -0.15em; fill: none; stroke: currentColor; }

/* ── Form controls cơ sở ──────────────────────────────────── */
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  padding: 8px 11px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  line-height: 1.4;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
input { min-height: 38px; }
select { min-height: 38px; cursor: pointer; }
textarea { resize: vertical; min-height: 64px; }

input::placeholder,
textarea::placeholder { color: var(--color-faint); }

input:hover:not(:disabled):not([readonly]),
select:hover:not(:disabled),
textarea:hover:not(:disabled):not([readonly]) { border-color: var(--slate-400); }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-ring);
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  border: 1px solid var(--slate-400);
  border-radius: 3px;
  cursor: pointer;
  accent-color: var(--color-primary);
  flex-shrink: 0;
  box-shadow: none;
}
input[type="radio"] {
  width: auto;
  min-height: auto;
  accent-color: var(--color-primary);
  cursor: pointer;
}

input[readonly],
textarea[readonly] {
  background: var(--color-surface-alt);
  color: var(--color-muted);
  border-color: var(--color-border);
  cursor: default;
  opacity: 1;
}
input:disabled,
select:disabled,
textarea:disabled,
.combobox-input:disabled {
  background: var(--slate-100);
  color: var(--color-faint);
  border-color: var(--color-border);
  cursor: not-allowed;
  opacity: 1;
}

label {
  display: block;
  margin: 0 0 6px;
  font-weight: 600;
  font-size: var(--font-size-base);
  color: var(--color-heading);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 8px 15px;
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease, transform 60ms ease;
}
.btn:active { transform: scale(0.985); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.btn-primary:active { background: var(--color-primary-press); }

.btn-default {
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  color: var(--color-primary);
}
.btn-default:hover { background: var(--color-primary-soft); border-color: var(--color-primary); }

.btn-warning {
  background: var(--color-surface);
  border: 1px solid var(--color-warning-bd);
  color: var(--color-warning);
}
.btn-warning:hover { background: var(--color-warning-bg); border-color: var(--color-warning); }

.btn-danger {
  background: var(--color-surface);
  border: 1px solid var(--color-danger-bd);
  color: var(--color-danger);
}
.btn-danger:hover { background: var(--color-danger-bg); border-color: var(--color-danger); }

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--color-muted);
  font-weight: 600;
}
.btn-ghost:hover { background: var(--color-hover); color: var(--color-heading); }

.btn:disabled,
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}
.icon-btn { width: 40px; padding: 0; gap: 0; }
.btn-sm { min-height: 30px; padding: 4px 11px; font-size: var(--font-size-table); }

.full-width { width: 100%; }
.hidden { display: none !important; }

/* bulk: mờ khi chưa chọn dòng (giữ logic JS .active) */
.bulk-btn { opacity: 0.45; pointer-events: none; }
.bulk-btn.active { opacity: 1; pointer-events: auto; }
.btn-guard { opacity: 0.45; cursor: not-allowed; }

/* loading spinner trong nút */
@keyframes btn-spin { to { transform: rotate(360deg); } }
.btn-loading { opacity: 0.78; pointer-events: none; cursor: not-allowed; }
.btn-loading::after {
  content: '';
  width: 12px; height: 12px;
  margin-left: 2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.55s linear infinite;
}

/* ── Badges (pill pastel) ─────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: var(--font-size-small);
  font-weight: 700;
  line-height: 1.5;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-success { background: var(--color-success-bg); color: var(--color-success); border-color: var(--color-success-bd); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); border-color: var(--color-warning-bd); }
.badge-danger  { background: var(--color-danger-bg);  color: var(--color-danger);  border-color: var(--color-danger-bd); }
.badge-info    { background: var(--color-info-bg);    color: var(--color-info);    border-color: var(--color-info-bd); }
.badge-neutral { background: var(--slate-100);        color: var(--slate-600);     border-color: var(--slate-200); }

/* ════════════════════════════════════════════════════════════
   VÙNG 1 — HEADER (navy, sticky)
   ════════════════════════════════════════════════════════════ */
#v1 {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--header-height);
  padding: 0 18px;
  background: var(--navy-800);
  color: #fff;
  border-bottom: 1px solid var(--navy-900);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, var(--shadow-sm);
}
#v1 #sidebar-toggle {
  color: #c7d2e8;
  background: transparent;
  border: 1px solid transparent;
  font-size: 18px;
}
#v1 #sidebar-toggle:hover { background: rgba(255, 255, 255, 0.10); color: #fff; }

.app-logo,
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.app-logo img { display: block; }

.app-title {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-user {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #cdd8ec;
  white-space: nowrap;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

#header-search { width: min(360px, 35vw); }
#header-search input,
#v1 input[type="search"] {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}
#header-search input::placeholder { color: #aab8d4; }
#header-search input:focus {
  background: rgba(255, 255, 255, 0.16);
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.14);
}

/* ════════════════════════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════════════════════════ */
#layout {
  display: flex;
  min-height: calc(100vh - var(--header-height) - var(--footer-height));
}

/* ════════════════════════════════════════════════════════════
   VÙNG 2 — SIDEBAR
   ════════════════════════════════════════════════════════════ */
#v2-sidebar {
  position: sticky;
  top: var(--header-height);
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height) - var(--footer-height));
  overflow: hidden auto;
  flex: 0 0 var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  scrollbar-width: thin;
  transition: width 160ms ease, flex-basis 160ms ease;
}
body.sidebar-collapsed #v2-sidebar,
#v2-sidebar.sidebar-collapsed {
  width: var(--sidebar-collapsed);
  flex-basis: var(--sidebar-collapsed);
  overflow: visible;
}

.sidebar-primary,
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 40px;
  padding: 9px 16px;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--slate-700);
  font: inherit;
  font-size: var(--font-size-base);
  font-weight: 500;
  position: relative;
  cursor: pointer;
}

.sidebar-primary {
  margin: 14px 12px 6px;
  width: calc(100% - 24px);
  justify-content: center;
  border-radius: var(--radius);
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  min-height: 44px;
  box-shadow: var(--shadow-sm);
  transition: width 160ms ease, margin 160ms ease, padding 160ms ease, background 120ms ease;
}
.sidebar-primary:hover { background: var(--color-primary-hover); }

.sidebar-link .icon,
.sidebar-primary .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  flex: 0 0 22px;
  color: var(--slate-400);
}
.sidebar-link .icon svg,
.sidebar-primary .icon svg { width: 19px; height: 19px; display: block; }
.sidebar-primary .icon { color: rgba(255, 255, 255, 0.9); }
/* emoji fallback nếu chưa thay SVG */
.sidebar-link .icon { font-size: 17px; font-style: normal; }

.sidebar-link .label,
.sidebar-primary .label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  max-width: 200px;
  opacity: 1;
  transition: max-width 0.25s ease, opacity 0.15s ease;
}

.sidebar-link b {
  min-width: 22px;
  border-radius: 999px;
  background: var(--slate-100);
  color: var(--slate-600);
  padding: 1px 7px;
  text-align: center;
  font-size: var(--font-size-small);
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  max-width: 50px;
  opacity: 1;
  transition: max-width 0.2s ease, opacity 0.15s ease, padding 0.2s ease, min-width 0.2s ease, background 120ms ease, color 120ms ease;
}

.sidebar-group {
  padding: 7px 0;
  margin: 0 0;
  border-top: 1px solid var(--color-border);
}
.sidebar-group:first-of-type { border-top: 0; }

.sidebar-link:hover { background: var(--color-hover); color: var(--color-heading); }
.sidebar-link:hover .icon { color: var(--slate-500); }

.sidebar-link.active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: 700;
}
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--color-primary);
}
.sidebar-link.active .icon { color: var(--color-primary); }
.sidebar-link.active b { background: var(--color-primary-tint); color: var(--color-primary); }

/* collapsed */
body.sidebar-collapsed #v2-sidebar .label,
#v2-sidebar.sidebar-collapsed .label,
body.sidebar-collapsed #v2-sidebar b,
#v2-sidebar.sidebar-collapsed b {
  max-width: 0;
  opacity: 0;
  padding: 0;
  min-width: 0;
}
body.sidebar-collapsed #v2-sidebar .sidebar-link,
#v2-sidebar.sidebar-collapsed .sidebar-link {
  padding: 9px 19px;
  justify-content: center;
}
body.sidebar-collapsed #v2-sidebar .sidebar-primary,
#v2-sidebar.sidebar-collapsed .sidebar-primary {
  margin: 14px auto 6px;
  width: 44px;
  padding: 9px 10px;
}

/* ════════════════════════════════════════════════════════════
   VÙNG 3 — CONTENT
   ════════════════════════════════════════════════════════════ */
#v3-content {
  flex: 1;
  min-width: 0;
  padding: 18px 20px;
}
#toolbar { min-height: 40px; margin-bottom: 14px; }
#content-body { min-height: 240px; }

.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.page-toolbar h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--color-heading);
  letter-spacing: -0.01em;
}
.page-toolbar p { margin: 3px 0 0; color: var(--color-muted); font-size: 13px; }

.sticky-toolbar {
  position: sticky;
  top: var(--header-height);
  z-index: 12;
  background: var(--color-bg);
  padding: 10px 0 12px;
  margin: -2px 0 2px;
  border-bottom: 1px solid var(--color-border);
}
.toolbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Panel / card ─────────────────────────────────────────── */
.panel {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* ── Bảng dữ liệu ─────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-table);
}
.data-table th,
.data-table td {
  border-bottom: 1px solid var(--color-border);
  padding: 10px 14px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--color-surface-alt);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
  border-bottom: 1px solid var(--color-border-strong);
}
.data-table tbody tr { transition: background 100ms ease; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--color-hover); }
.data-table tbody tr.is-selected,
.data-table tbody tr:has(.row-check:checked) { background: var(--color-primary-soft); }
.data-table td strong { color: var(--color-heading); font-weight: 600; }

.col-name { width: 200px; max-width: 260px; white-space: normal; word-break: break-word; }
.data-table td:nth-child(3),
.data-table th:nth-child(3) { white-space: normal; }
.col-check { width: 40px; text-align: center; padding: 0 8px; vertical-align: middle; }

.table-thumb,
.thumb-placeholder {
  display: block;
  width: 40px;
  height: 50px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--slate-100);
  border: 1px solid var(--color-border);
}
.thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-400);
}
.thumb-placeholder svg { width: 22px; height: 22px; }

.row-warn { background: var(--color-warning-bg) !important; }
.row-warn:hover { background: #fdeec3 !important; }
.sub-row-warn { font-size: 12px; color: var(--color-warning); margin-top: 3px; font-weight: 500; }

/* phân trang */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}
.page-btns { display: flex; gap: 4px; }
.page-btns .btn-sm { min-width: 30px; }
.page-active { background: var(--color-primary) !important; color: #fff !important; }
.page-ellipsis { padding: 4px 8px; color: var(--color-muted); }
.page-info, .table-footer { font-size: 12px; color: var(--color-muted); }
.table-footer { padding: 12px 14px; border-top: 1px solid var(--color-border); }

/* ── Trạng thái rỗng ──────────────────────────────────────── */
.empty-state {
  padding: 56px 32px;
  text-align: center;
  color: var(--color-muted);
}
.empty-state .empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--slate-100);
  color: var(--slate-400);
}
.empty-state .empty-icon svg { width: 26px; height: 26px; }
.empty-state h2 { margin: 0 0 6px; font-size: 15px; color: var(--color-heading); }
.empty-state p { margin: 0; color: var(--color-muted); font-size: 13px; }

/* ════════════════════════════════════════════════════════════
   FORMS — Chi tiết
   ════════════════════════════════════════════════════════════ */
.form-grid {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 22px;
  padding: 22px;
}
.fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
}

.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field label { margin: 0; }
.full-span, .full-span { grid-column: 1 / -1; }

.required { color: var(--color-danger); font-weight: 700; }

.field-hint {
  font-size: 12.5px;
  color: var(--color-muted);
  line-height: 1.4;
}

.field-error {
  min-height: 0;
  color: var(--color-danger);
  font-size: 12.5px;
  line-height: 1.35;
  font-weight: 500;
}
.field-error:empty { display: none; }

.has-error input,
.has-error select,
.has-error textarea {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12);
}

.radio-row {
  display: flex;
  gap: 20px;
  min-height: 38px;
  align-items: center;
}
.radio-row label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-weight: 500;
  cursor: pointer;
}

/* cột ảnh thẻ */
.photo-column {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 10px;
}
.photo-box {
  display: grid;
  place-items: center;
  width: 130px;
  height: 170px;
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--slate-50);
  color: var(--color-muted);
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.photo-box:hover { border-color: var(--color-primary); background: var(--color-primary-soft); }
.photo-box img { width: 100%; height: 100%; object-fit: cover; }
.photo-standards { text-align: center; font-size: 12px; color: var(--color-muted); line-height: 1.55; }
.photo-standards span { display: block; }
.photo-upload { width: 130px; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* nhóm địa chỉ / fieldset */
.address-group {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 14px 16px 16px;
  margin: 0;
  background: var(--color-surface);
}
.address-group legend,
fieldset legend {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-muted);
  padding: 0 8px;
}

/* warn slots (mềm) */
.warn-slot { display: flex; flex-direction: column; gap: 3px; }
.warn-slot-text:empty { display: none; }
.warn-slot-text {
  font-size: 12.5px;
  color: var(--color-warning);
  font-weight: 600;
  line-height: 1.4;
}

.inline-warning {
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning-bd);
  border-radius: var(--radius);
  padding: 9px 13px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--color-warning);
}
.warn-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; }
.warn-checkbox { width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }

/* banners */
.banner-warning {
  margin-bottom: 14px;
  border: 1px solid var(--color-warning-bd);
  border-left: 3px solid var(--color-warning);
  border-radius: var(--radius);
  background: var(--color-warning-bg);
  color: var(--color-warning);
  padding: 11px 14px;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 500;
}
.banner-info {
  margin-bottom: 14px;
  border: 1px solid var(--color-info-bd);
  border-left: 3px solid var(--color-info);
  border-radius: var(--radius);
  background: var(--color-info-bg);
  color: var(--navy-700);
  padding: 11px 14px;
  font-size: 13px;
  line-height: 1.55;
}
.ds-instruction-banner { margin: 14px 16px 0; }

@media (max-width: 880px) {
  .form-grid, .fields-grid { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════
   COMBOBOX
   ════════════════════════════════════════════════════════════ */
.combobox-wrapper { position: relative; }
.combobox-input {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  font-size: var(--font-size-base);
  background: var(--color-surface);
  cursor: text;
  min-height: 38px;
}
.combobox-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-ring);
}
.combobox-input:disabled { background: var(--slate-100); cursor: not-allowed; color: var(--color-faint); }
.combobox-dropdown {
  position: absolute;
  z-index: 200;
  top: 100%; left: 0; right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  max-height: 220px;
  overflow-y: auto;
  margin-top: 4px;
  padding: 4px;
}
.combobox-dropdown.hidden { display: none; }
.combobox-option { padding: 8px 11px; font-size: var(--font-size-base); cursor: pointer; border-radius: var(--radius-sm); }
.combobox-option:hover, .combobox-option.active { background: var(--color-primary-soft); }
.combobox-option.selected { background: var(--color-primary-tint); font-weight: 600; }
.combobox-empty { color: var(--color-muted); cursor: default; font-style: italic; }

/* ════════════════════════════════════════════════════════════
   VÙNG 4 — FOOTER
   ════════════════════════════════════════════════════════════ */
#v4 {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--color-surface-alt);
  color: var(--color-text);
  border-top: 1px solid var(--color-border);
  font-size: var(--font-size-small);
}
#footer-bar {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 18px;
  min-height: var(--footer-height);
}
#footer-log { flex: 1; display: grid; gap: 3px; }
#footer-toggle {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-muted);
  font-size: 11px;
  padding: 2px 5px;
  line-height: 1;
}
#footer-toggle:hover { color: var(--color-heading); }
.log-success { color: var(--color-success); }
.log-error { color: var(--color-danger); }
.log-warn { color: var(--color-warning); }

/* ════════════════════════════════════════════════════════════
   TOOLTIP (JS-driven)
   ════════════════════════════════════════════════════════════ */
#global-tooltip {
  position: fixed;
  z-index: 9999;
  background: var(--slate-900);
  color: #fff;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.5;
  max-width: 260px;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  box-shadow: var(--shadow-pop);
}
#global-tooltip.visible { opacity: 1; }

/* ════════════════════════════════════════════════════════════
   MODAL & DIALOG
   ════════════════════════════════════════════════════════════ */
.modal,
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(12, 26, 54, 0.50);
  backdrop-filter: blur(2px);
}
.modal-panel,
.modal-box {
  width: min(460px, 100%);
  max-width: 480px;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: 24px;
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--color-border);
}
.modal-panel h2,
.modal-box h3 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-heading);
}
.modal-panel p,
.modal-box p { margin: 0 0 8px; font-size: 13.5px; line-height: 1.55; color: var(--color-text); }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.modal-result { min-height: 20px; color: var(--color-muted); }

/* crop modal */
.crop-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(12, 26, 54, 0.62);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.crop-modal-overlay.hidden { display: none; }
.crop-modal-box {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 22px;
  width: min(600px, 95vw);
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--shadow-modal);
}
.crop-modal-header { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.crop-modal-header strong { font-size: 15px; color: var(--color-heading); }
.crop-hint { font-size: 12px; color: var(--color-muted); }
.crop-container { max-height: 60vh; overflow: hidden; background: #000; border-radius: var(--radius); }
.crop-container img { display: block; max-width: 100%; }
.crop-modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ════════════════════════════════════════════════════════════
   ĐĂNG NHẬP (full-screen)
   ════════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(30, 64, 175, 0.10), transparent 60%),
    linear-gradient(160deg, #f8fafc 0%, #eef2f7 55%, #e6edf7 100%);
}
.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-panel {
  width: min(440px, 100%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: 32px;
  box-shadow: var(--shadow-modal);
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; }
.login-brand h1 { margin: 0; font-size: 16px; color: var(--color-heading); }
.login-brand p { margin: 4px 0 0; color: var(--color-muted); font-size: 13px; }
.password-row { display: flex; gap: 8px; }
.check-row { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check-row input { width: auto; min-height: auto; }
.login-form .btn { margin-top: 14px; }

.alert { border-radius: var(--radius); padding: 11px 13px; font-size: 13px; }
.alert-error { background: var(--color-danger-bg); color: var(--color-danger); border: 1px solid var(--color-danger-bd); }

/* ════════════════════════════════════════════════════════════
   LAYOUT RIÊNG THEO TEMPLATE
   (gộp từ <style> nội tuyến cũ của detail.html / list.html
    → các template không cần <style> riêng nữa)
   ════════════════════════════════════════════════════════════ */

/* ── Chi tiết CC (detail.html) ── */
.cc-form-body { display: flex; flex-direction: column; gap: 16px; max-width: 880px; padding: 22px; }
.cty-field { max-width: 480px; }
.cc-personal-row { display: flex; gap: 22px; align-items: flex-start; }
.cc-personal-row .photo-column { flex-shrink: 0; width: 130px; }
.personal-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.personal-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.address-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 12px; }
.other-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.other-fields .full-span { grid-column: 1 / -1; }
.photo-upload-footer { padding-top: 4px; }
.photo-upload-footer .photo-upload { width: auto; min-width: 120px; }
.address-hint {
  font-size: 12.5px; color: var(--color-muted); line-height: 1.4;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-warning);
  border-radius: var(--radius-sm);
  padding: 8px 12px; margin-bottom: 10px;
}

/* CCCD warn slot (cứng/mềm) */
#cccd-warn-slot { display: flex; flex-direction: column; gap: 4px; }
#cccd-warn-text:empty { display: none; }
#cccd-warn-text { font-size: 12.5px; color: var(--color-warning); font-weight: 600; line-height: 1.4; }
#cccd-warn-confirm { display: none; align-items: center; gap: 8px; font-size: 12.5px; color: var(--color-text); cursor: pointer; }
#cccd-warn-confirm.active { display: flex; }
#cccd-warn-check { width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; accent-color: var(--color-warning); }

@media (max-width: 880px) {
  .cc-personal-row, .personal-row-2, .address-row-2, .other-fields { grid-template-columns: 1fr; }
  .cc-personal-row { flex-direction: column; align-items: stretch; }
  .cc-personal-row .photo-column { width: 100%; }
}

/* ── Bảng danh sách (list.html) — bề rộng cột ── */
.col-num    { width: 44px;  text-align: center; }
.col-img    { width: 60px; }
.col-date   { width: 110px; }
.col-gender { width: 78px; }
.col-cccd   { width: 140px; }
.col-action { width: 120px; white-space: nowrap; text-align: right; }
.col-action .btn-sm { padding: 4px 9px; }

/* ════════════════════════════════════════════════════════════
   COMPONENTS BỔ SUNG (toàn bộ màn hình còn lại)
   ════════════════════════════════════════════════════════════ */

/* ── Brand mark (login/register) ── */
.brand-mark {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  background: var(--color-primary);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.02em;
}

/* ── Password field + nút con mắt ── */
.password-row { display: flex; gap: 8px; align-items: stretch; }
.password-row input { flex: 1; }
.pw-toggle {
  flex: 0 0 auto;
  width: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-muted);
  cursor: pointer;
  padding: 0;
}
.pw-toggle:hover { background: var(--color-hover); color: var(--color-heading); }
.pw-toggle svg { width: 18px; height: 18px; }

/* ── Header tóm tắt cho màn hỗn hợp (Chi tiết DS / Đợt) — sticky ── */
.detail-head {
  position: sticky;
  top: calc(var(--header-height) + 60px);
  z-index: 8;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.detail-head h2 {
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--color-heading);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px 28px; font-size: 13px; color: var(--color-muted); }
.detail-meta b { color: var(--color-heading); font-weight: 600; }

/* ── Info list (read-only: Tài khoản Xem, header tóm tắt) ── */
.info-list {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 0;
}
.info-row {
  display: contents;
}
.info-row > dt {
  padding: 11px 0;
  font-weight: 600;
  color: var(--color-muted);
  font-size: 13px;
  border-bottom: 1px solid var(--color-border);
}
.info-row > dd {
  margin: 0;
  padding: 11px 0;
  color: var(--color-heading);
  font-size: 14px;
  border-bottom: 1px solid var(--color-border);
}
.info-row:last-child > dt, .info-row:last-child > dd { border-bottom: 0; }
.form-section { padding: 22px; }
.form-section.narrow { max-width: 520px; }
.section-divider {
  margin: 22px 0 18px;
  border: 0;
  border-top: 1px solid var(--color-border);
}
.section-title {
  font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--color-muted);
  margin: 0 0 14px;
}

/* ── Thông báo ── */
.noti-list { display: flex; flex-direction: column; }
.noti-item {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 100ms ease;
}
.noti-item:last-child { border-bottom: 0; }
.noti-item:hover { background: var(--color-hover); }
.noti-item.unread { background: var(--color-primary-soft); }
.noti-item.unread:hover { background: var(--color-primary-tint); }
.noti-dot {
  flex: 0 0 auto;
  width: 9px; height: 9px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--color-border-strong);
}
.noti-item.unread .noti-dot { background: var(--color-primary); }
.noti-body { flex: 1; min-width: 0; }
.noti-text { font-size: 13.5px; color: var(--color-text); line-height: 1.45; }
.noti-item.unread .noti-text { font-weight: 600; color: var(--color-heading); }
.noti-time { flex: 0 0 auto; font-size: 12px; color: var(--color-muted); white-space: nowrap; padding-top: 1px; }

/* ── Thanh tìm kiếm ── */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.search-bar .search-input-wrap { position: relative; flex: 1; }
.search-bar .search-input-wrap svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--color-faint); pointer-events: none;
}
.search-bar .search-input-wrap input { padding-left: 40px; }
.search-bar select { width: auto; min-width: 170px; flex: 0 0 auto; }

/* ── Toast ── */
.toast-wrap {
  position: fixed;
  right: 20px;
  bottom: calc(var(--footer-height) + 16px);
  z-index: 9998;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 260px; max-width: 380px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  box-shadow: var(--shadow-pop);
  font-size: 13px;
  color: var(--color-text);
}
.toast.success { border-left-color: var(--color-success); }
.toast.error { border-left-color: var(--color-danger); }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast.success svg { color: var(--color-success); }
.toast.error svg { color: var(--color-danger); }

/* ── Hộp lộ mật khẩu (tạo TK / cấp lại MK) ── */
.password-reveal {
  display: flex; align-items: center; gap: 10px;
  background: var(--slate-50);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 6px 0 4px;
}
.password-reveal code {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-heading);
}

/* ════════════════════════════════════════════════════════════
   SKELETON LOADING (shimmer)
   ════════════════════════════════════════════════════════════ */
@keyframes skel-shimmer {
  0%   { background-position: -360px 0; }
  100% { background-position: 360px 0; }
}
.skeleton,
.skel-line,
.skel-thumb,
.skel-badge,
.skel-btn {
  background: linear-gradient(90deg,
    var(--slate-150) 25%,
    var(--slate-100) 37%,
    var(--slate-150) 63%);
  background-size: 720px 100%;
  animation: skel-shimmer 1.25s ease-in-out infinite;
  border-radius: var(--radius-sm);
  display: inline-block;
}
@media (prefers-reduced-motion: reduce) {
  .skeleton, .skel-line, .skel-thumb, .skel-badge, .skel-btn { animation: none; }
}
.skel-line { height: 12px; width: 100%; }
.skel-line.sm { height: 10px; }
.skel-line.w-40 { width: 40%; }
.skel-line.w-60 { width: 60%; }
.skel-line.w-80 { width: 80%; }
.skel-thumb { width: 40px; height: 50px; border-radius: var(--radius-sm); }
.skel-badge { height: 22px; width: 70px; border-radius: 999px; }
.skel-btn { height: 26px; width: 54px; }

/* hàng skeleton trong bảng — dùng đúng .data-table */
.data-table tbody tr.skel-row td { vertical-align: middle; }
.data-table tbody tr.skel-row:hover { background: transparent; }

/* ════════════════════════════════════════════════════════════
   RESPONSIVE (tối thiểu — desktop-only)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 760px) {
  #header-search { display: none; }
  #v2-sidebar { width: var(--sidebar-collapsed); flex-basis: var(--sidebar-collapsed); }
  #v3-content { padding: 12px; }
}
