:root {
  --primary-color: #0b2545;
  --accent-color: #0284c7;
  --bg-color: #f1f5f9;
  --sidebar-width: 240px;
  --radius: 12px;
  --font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --base-font-size: 14px;
  --cell-padding: 11px 12px;
  --card-padding: 20px;
  --card-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
}

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  background-color: var(--bg-color);
  color: #1e293b;
  font-size: var(--base-font-size);
  line-height: 1.45;
}

body.density-compact {
  --cell-padding: 7px 9px;
  --card-padding: 14px 16px;
}

body.density-spacious {
  --cell-padding: 15px 16px;
  --card-padding: 26px;
}

/* TOPBAR */
.topbar {
  background: var(--primary-color);
  color: #ffffff;
  min-height: 64px;
  padding: 6px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
}

.topbar.header-gradient {
  background: linear-gradient(90deg, var(--primary-color) 0%, var(--accent-color) 100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-logo {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid #38bdf8;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  color: #38bdf8;
  overflow: hidden;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-title {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.3px;
}

.brand-sub {
  font-weight: 600;
  font-size: 12px;
  color: #93c5fd;
}

.topbar-center-info {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12px;
  color: #e2e8f0;
  min-width: 0;
}

.info-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.info-pill i { color: #38bdf8; }
.info-pill strong { color: #ffffff; font-weight: 600; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  flex-shrink: 0;
}

.btn-customizer-toggle {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-customizer-toggle:hover { background: rgba(255, 255, 255, 0.28); }

.badge-live {
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.badge-live i { font-size: 8px; }

.user-profile {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 8px;
  white-space: nowrap;
  transition: background 0.2s;
}

.user-profile:hover { background: rgba(255, 255, 255, 0.14); }

/* LAYOUT CHÍNH */
.layout {
  display: flex;
  width: 100%;
  min-height: calc(100vh - 64px);
}

.sidebar {
  width: var(--sidebar-width);
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  padding: 16px 10px;
  flex-shrink: 0;
  transition: all 0.2s;
}

.sidebar.dark-sidebar {
  background: #0f172a;
  border-right-color: #1e293b;
}

.sidebar.dark-sidebar .sidebar-group-label { color: #64748b; }
.sidebar.dark-sidebar .nav-item { color: #cbd5e1; }
.sidebar.dark-sidebar .nav-item:hover { background: #1e293b; color: #ffffff; }
.sidebar.dark-sidebar .nav-item.active {
  background: var(--accent-color);
  color: #ffffff;
  border-left: 4px solid #ffffff;
}

.sidebar-group-label {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.7px;
  padding: 0 10px 8px;
}

.sidebar-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 8px 6px;
}

.sidebar.dark-sidebar .sidebar-divider { background: #1e293b; }

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: #475569;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 13.5px;
  transition: all 0.2s;
}

.nav-item i { width: 18px; text-align: center; font-size: 14px; }
.nav-item:hover { background: #f1f5f9; color: var(--primary-color); }

.nav-item.active {
  background: #e0f2fe;
  color: var(--primary-color);
  font-weight: 700;
  border-left: 4px solid var(--primary-color);
}

.pill-active {
  margin-left: auto;
  background: #10b981;
  color: #fff;
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 12px;
}

.nav-item:not(.active) .pill-active { display: none; }

/* MAIN CONTENT */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 18px 20px;
}

body.layout-boxed .main-content {
  max-width: 1380px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid #cbd5e1;
}

.page-header h1 {
  font-size: 19px;
  color: var(--primary-color);
  font-weight: 800;
}

.page-subtitle {
  font-size: 12.5px;
  color: #64748b;
  margin-top: 2px;
}

.greeting {
  text-align: right;
  font-size: 13px;
  white-space: nowrap;
}

.greeting strong { display: block; color: var(--primary-color); }
.greeting span { color: #64748b; font-size: 12px; }

.tab-section { display: none; }
.tab-section.active { display: block; }

/* KPI CARDS */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpi-card {
  background: #ffffff;
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--card-shadow);
  border: 1px solid #e2e8f0;
  min-width: 0;
}

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.kpi-icon.blue { background: #e0f2fe; color: var(--accent-color); }
.kpi-icon.navy { background: #e2e8f0; color: var(--primary-color); }
.kpi-icon.green { background: #dcfce7; color: #16a34a; }
.kpi-icon.amber { background: #fef3c7; color: #d97706; }
.kpi-icon.purple { background: #f3e8ff; color: #7e22ce; }

.kpi-info { display: flex; flex-direction: column; min-width: 0; }
.kpi-label { font-size: 12px; color: #64748b; font-weight: 500; }
.kpi-value { font-size: 17px; font-weight: 800; color: #0f172a; margin-top: 2px; }

/* CARDS */
.card {
  background: #ffffff;
  border-radius: var(--radius);
  padding: var(--card-padding);
  margin-bottom: 18px;
  box-shadow: var(--card-shadow);
  border: 1px solid #e2e8f0;
  min-width: 0;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.card-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* TIMELINE */
.timeline-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: center;
  background: #f8fafc;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  gap: 12px;
}

.timeline-loc { font-weight: 700; color: var(--primary-color); font-size: 13.5px; }
.timeline-loc small { display: block; font-weight: 400; color: #64748b; font-size: 11.5px; }
.timeline-bars { display: flex; flex-wrap: wrap; gap: 6px; }

.shift-pill {
  background: var(--primary-color);
  color: #ffffff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.shift-pill span.time {
  background: #38bdf8;
  color: #0b2545;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 11px;
}

/* TABLES */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
  text-align: left;
  padding: var(--cell-padding);
  border-bottom: 2px solid #e2e8f0;
}

.data-table td {
  padding: var(--cell-padding);
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  word-break: break-word;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f8fafc; }

.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

.total-row td {
  background: #f1f5f9;
  font-size: 14px;
  color: var(--primary-color);
  border-top: 2px solid #cbd5e1;
}

.status-badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  display: inline-block;
  white-space: nowrap;
}

.status-ok { background: #dcfce7; color: #15803d; }
.status-late { background: #fee2e2; color: #b91c1c; }
.status-off { background: #fef3c7; color: #b45309; }

/* BUTTONS & INPUTS */
.btn {
  padding: 8px 14px;
  border: none;
  border-radius: calc(var(--radius) * 0.75);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn:hover { opacity: 0.92; }
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn-primary { background: var(--primary-color); color: #fff; }
.btn-success { background: #16a34a; color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-outline { background: #fff; border: 1px solid #cbd5e1; color: #334155; }

.form-input {
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: calc(var(--radius) * 0.75);
  font-size: 13px;
  outline: none;
  background: #fff;
  min-width: 0;
  width: 100%;
}

.form-input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.header-actions .form-input {
  width: auto;
  min-width: 190px;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  background: #f8fafc;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.date-filter-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 12.5px;
  font-weight: 600;
}

.date-filter-box input[type="date"] {
  width: auto;
  padding: 5px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

.schedule-history-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 12px;
  font-size: 12px;
  color: #475569;
}

.date-chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.date-chip.active {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
}

.table-input {
  width: 72px;
  padding: 5px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12.5px;
  text-align: center;
}

.formula-box {
  background: #eff6ff;
  border-left: 4px solid var(--accent-color);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 12.5px;
  color: #1e3a8a;
  border-radius: 6px;
}

.hint-text { font-size: 12.5px; color: #64748b; }

/* BÁO CÁO */
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.report-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-top: 4px solid var(--primary-color);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.report-box h3 { color: var(--primary-color); font-size: 15px; display: flex; align-items: center; gap: 7px; }
.report-box .addr { font-size: 12px; color: #64748b; padding-bottom: 6px; border-bottom: 1px dashed #cbd5e1; }

.report-stats {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  background: #ffffff;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.on-duty-list-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
}

.on-duty-staff-list { list-style: none; display: flex; flex-direction: column; gap: 5px; }

.on-duty-staff-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #16a34a;
  padding: 6px 9px;
  border-radius: 6px;
  font-size: 12.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.on-duty-staff-item .staff-name { font-weight: 700; color: #0f172a; }
.on-duty-staff-item .staff-shift {
  background: #dcfce7;
  color: #15803d;
  font-weight: 600;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ADMIN */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.logo-upload-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius);
}

.logo-preview-circle {
  width: 100px;
  height: 100px;
  border-radius: 16px;
  background: var(--primary-color);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  overflow: hidden;
  border: 3px solid var(--accent-color);
}

.logo-preview-circle img { width: 100%; height: 100%; object-fit: cover; }

/* CUSTOMIZER DRAWER */
.customizer-drawer {
  position: fixed;
  top: 64px;
  right: -350px;
  width: 340px;
  max-width: 100vw;
  height: calc(100vh - 64px);
  background: #ffffff;
  border-left: 1px solid #cbd5e1;
  box-shadow: -6px 0 24px rgba(0, 0, 0, 0.14);
  z-index: 150;
  display: flex;
  flex-direction: column;
  transition: right 0.28s ease;
}

.customizer-drawer.open { right: 0; }

.customizer-header {
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.customizer-tag { font-size: 10.5px; color: #64748b; text-transform: uppercase; font-weight: 700; }
.customizer-header h3 { font-size: 15px; color: var(--primary-color); }
.close-customizer { background: none; border: none; font-size: 22px; color: #64748b; cursor: pointer; }

.customizer-actions-top {
  padding: 10px 16px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
}

.customizer-body { flex: 1; overflow-y: auto; }
.acc-item { border-bottom: 1px solid #e2e8f0; }

.acc-header {
  width: 100%;
  padding: 12px 16px;
  background: #ffffff;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  font-weight: 700;
  color: #1e293b;
  cursor: pointer;
  text-align: left;
}

.acc-header:hover { background: #f8fafc; }

.acc-panel {
  display: none;
  padding: 10px 16px 16px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
}

.acc-item.open .acc-panel { display: block; }

.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.preset-card-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  text-align: left;
}

.preset-card-btn:hover { border-color: var(--accent-color); background: #f0f9ff; }
.preset-card-btn .swatch { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }

.color-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 500;
}

.color-row input[type="color"] {
  width: 38px;
  height: 26px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
}

/* MODAL */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.modal.show { display: flex; }

.modal-content {
  background: #fff;
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 { color: var(--primary-color); font-size: 16px; }
.close-btn { font-size: 22px; cursor: pointer; color: #64748b; }

.form-group { margin-bottom: 12px; display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12.5px; font-weight: 600; color: #334155; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #0f172a;
  color: #fff;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateY(15px);
  pointer-events: none;
  transition: all 0.25s;
  z-index: 300;
}

.toast.show { opacity: 1; transform: translateY(0); }

/* SHIELD ICONS */
.shield-icon {
  width: 1.05em;
  height: 1.05em;
  display: inline-block;
  vertical-align: -0.15em;
  fill: currentColor;
  flex-shrink: 0;
}

.brand-logo .shield-icon {
  width: 22px;
  height: 22px;
}

.logo-preview-circle .shield-icon {
  width: 48px;
  height: 48px;
}

.kpi-icon .shield-icon {
  width: 20px;
  height: 20px;
}

.schedule-empty-box {
  padding: 26px 16px;
  text-align: center;
  color: #64748b;
  background: #f8fafc;
  border-radius: 8px;
}

.schedule-empty-box strong {
  display: block;
  color: #334155;
  font-size: 14px;
  margin-bottom: 4px;
}

/* Thu phí */
.billing-tabs{display:flex;gap:8px;flex-wrap:wrap;margin:4px 0 20px}.billing-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.billing-summary{margin-top:18px;padding:18px;border:1px solid #dbe3ee;border-radius:12px;background:#f8fafc}.billing-summary table{width:100%;border-collapse:collapse}.billing-summary th,.billing-summary td{padding:9px;border-bottom:1px solid #e2e8f0;text-align:left}.billing-summary td:last-child,.billing-summary th:last-child{text-align:right}.billing-total{font-size:20px;font-weight:800;color:#0b2545}@media(max-width:700px){.billing-grid{grid-template-columns:1fr}}

/* V4.2.4: keep admin configuration cards aligned at the top */
#tab-admin.tab-section.active {
  display: block;
  margin-top: 0;
  padding-top: 0;
}

#tab-admin .admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  align-items: start;
  align-content: start;
  gap: 16px;
  margin-top: 0;
}

#tab-admin .admin-grid > .card {
  align-self: start;
  margin-top: 0;
  min-width: 0;
}

@media (max-width: 900px) {
  #tab-admin .admin-grid { grid-template-columns: 1fr; }
}

/* Clear hierarchy for billing dates */
.billing-date-help { display:block; margin-top:5px; color:#64748b; font-size:12px; line-height:1.45; }
.billing-date-group { padding:14px; margin-bottom:14px; border:1px solid #dbe3ee; border-radius:10px; background:#f8fafc; }
.billing-date-group h3 { margin:0 0 5px; font-size:15px; color:#0f2744; }
.billing-date-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
@media(max-width:700px){ .billing-date-grid{grid-template-columns:1fr;} }

/* HỒ SƠ NHÂN SỰ MỞ RỘNG */
.employee-data-table { min-width: 1220px; table-layout: fixed; font-size: 12px; }
.employee-data-table th, .employee-data-table td { padding: 8px 7px; }
/* Percentages sum to 100%; CCCD is compact enough for a standard ID number. */
.employee-data-table th:nth-child(1) { width: 6%; }
.employee-data-table th:nth-child(2) { width: 13%; }
.employee-data-table th:nth-child(3) { width: 9%; }
.employee-data-table th:nth-child(4) { width: 9%; }
.employee-data-table th:nth-child(5) { width: 8%; }
.employee-data-table th:nth-child(6) { width: 9%; }
.employee-data-table th:nth-child(7) { width: 12%; }
.employee-data-table th:nth-child(8) { width: 8%; }
.employee-data-table th:nth-child(9) { width: 12%; }
.employee-data-table th:nth-child(10) { width: 7%; }
.employee-data-table th:nth-child(11) { width: 7%; }
.employee-data-table .emp-code-cell, .employee-data-table .emp-actions-cell { white-space: nowrap; }
.employee-data-table .emp-name-cell { font-weight: 600; }
.employee-data-table .emp-address-cell { white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
.employee-data-table .emp-actions-cell .btn { padding: 5px 8px; margin: 1px; font-size: 11px; }
#emp-modal .modal-content { max-width: 680px; max-height: calc(100vh - 28px); overflow-y: auto; }
.form-section-title { margin: 8px 0 12px; padding: 8px 10px; border-left: 3px solid var(--accent-color); background: #f1f5f9; color: var(--primary-color); font-size: 11px; font-weight: 800; letter-spacing: .35px; }
#emp-form .form-group { min-width: 0; }
#emp-form textarea.form-input { min-height: 62px; resize: vertical; }
.payslip-modal-content { max-width: 850px; max-height: calc(100vh - 28px); overflow-y: auto; }
.payslip-paper { background: #fff; border: 1px solid #dbe3ed; border-radius: 8px; padding: 28px; color: #172033; }
.payslip-company { text-align: center; color: #0b2545; font-weight: 800; font-size: 17px; }
.payslip-company-sub { text-align: center; color: #64748b; font-size: 11px; margin: 5px 0 22px; }
.payslip-paper h2 { text-align: center; font-size: 21px; margin: 0 0 7px; color: #0f172a; }
.payslip-period { text-align: center; color: #475569; margin-bottom: 22px; font-size: 13px; }
.payslip-employee-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin-bottom: 20px; font-size: 12px; }
.payslip-detail-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.payslip-detail-table th, .payslip-detail-table td { border: 1px solid #cbd5e1; padding: 10px 9px; text-align: left; }
.payslip-detail-table th:last-child, .payslip-detail-table td:last-child { text-align: right; white-space: nowrap; }
.payslip-detail-table thead th { background: #eff6ff; color: #1e3a8a; }
.payslip-detail-table tfoot th { background: #eaf7ee; color: #166534; font-size: 14px; }
.payslip-deduction { color: #dc2626; }
.payslip-note { margin-top: 16px; color: #64748b; font-size: 11px; }
.payslip-signatures { display: flex; justify-content: space-between; margin: 48px 10px 8px; text-align: center; font-size: 12px; font-weight: 700; }
.payslip-signatures div { width: 40%; }
.payslip-actions { position: sticky; bottom: -20px; background: #fff; }
@media (max-width: 640px) {
  #emp-modal .modal-content, .payslip-modal-content { padding: 14px; }
  #emp-form .form-row, .payslip-employee-grid { grid-template-columns: 1fr; gap: 0; }
  .payslip-paper { padding: 14px; }
  .payslip-detail-table { font-size: 10px; }
  .payslip-detail-table th, .payslip-detail-table td { padding: 7px 5px; }
}

.payroll-data-table { min-width: 1160px; }
.payroll-data-table th:last-child, .payroll-data-table td:last-child { min-width: 112px; text-align: center; }

/* Advanced invoice template designer */
.designer-intro,.designer-toolbar,.designer-import,.designer-section-head,.designer-editor-actions,.designer-bottom>div:first-child{display:flex;align-items:center;justify-content:space-between;gap:14px}.designer-intro{margin:8px 0 18px}.designer-intro h3{margin:0 0 5px;color:#8f1e29}.designer-chip{display:inline-flex;align-items:center;padding:6px 11px;border-radius:20px;background:#f8e9eb;color:#8f1e29;font-size:12px;font-weight:700;white-space:nowrap}.designer-toolbar{align-items:end;margin-bottom:14px}.designer-toolbar>.form-group{flex:1;max-width:420px;margin:0}.designer-actions,.designer-editor-actions{display:flex;gap:8px;flex-wrap:wrap}.designer-import{padding:14px 16px;margin:12px 0 18px;border:1px solid #dce3eb;border-radius:10px;background:#f9fbfd;flex-wrap:wrap}.designer-import p{margin:4px 0 0}.designer-import-controls{min-width:280px;flex:1}.designer-import-controls input{max-width:100%}.designer-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(340px,1fr);gap:16px;align-items:stretch}.designer-editor,.designer-preview{border:1px solid #dce3eb;border-radius:12px;padding:14px;min-width:0;background:#fff}.designer-section-head{margin-bottom:12px}.designer-section-head>div{display:flex;gap:6px;flex-wrap:wrap}.designer-code{min-height:520px;font-family:Consolas,monospace;font-size:12px;line-height:1.5;white-space:pre;tab-size:2}.designer-iframe{width:100%;height:700px;border:1px solid #dce3eb;border-radius:8px;background:#e9edf2}.designer-editor-actions{justify-content:flex-end;margin-top:10px}.designer-bottom{margin-top:18px;padding:14px;border:1px solid #dce3eb;border-radius:12px}.template-library{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px}.template-item{border:1px solid #dce3eb;border-radius:9px;padding:10px 12px;min-width:180px;background:#fff}.template-item strong{display:block;margin-bottom:7px}.template-item button{margin:3px 4px 0 0}.designer-bottom .page-subtitle{margin:4px 0 0}@media(max-width:900px){.designer-layout{grid-template-columns:1fr}.designer-iframe{height:560px}.designer-toolbar{align-items:stretch;flex-direction:column}.designer-actions{justify-content:flex-start}.designer-code{min-height:360px}}

/* Ca trực trên trang chủ: hiển thị nhẹ, không nền đen / không bôi đen chữ */
.shift-pill { background: transparent !important; color: var(--primary-color) !important; padding: 3px 0 !important; border: 0 !important; user-select: text; }
.shift-pill span.time { background: #e0f2fe !important; color: #075985 !important; }
.shift-pill, .shift-pill * { -webkit-user-select: text; user-select: text; }


/* BẢNG CHẤM CÔNG THEO NGÀY - bố cục dạng Excel */
.attendance-month-card { overflow: hidden; }
.attendance-toolbar { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.attendance-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.attendance-actions label { font-weight:700; white-space:nowrap; }
.attendance-actions input[type="month"] { min-width:155px; }
.attendance-summary { display:flex; gap:12px; flex-wrap:wrap; padding:12px 16px; background:#f8fafc; border-top:1px solid #e2e8f0; border-bottom:1px solid #e2e8f0; }
.attendance-summary span { padding:5px 10px; border:1px solid #dbe3ed; border-radius:7px; background:#fff; color:#334155; font-size:13px; }
.attendance-grid-wrap { width:100%; overflow:auto; max-height:72vh; border:1px solid #cbd5e1; }
.attendance-grid { border-collapse:separate; border-spacing:0; min-width:max-content; width:max-content; font-size:12px; }
.attendance-grid th, .attendance-grid td { border-right:1px solid #475569; border-bottom:1px solid #475569; padding:0; text-align:center; height:31px; white-space:nowrap; }
.attendance-grid thead th { position:sticky; top:0; z-index:5; background:#fff500; color:#111827; font-weight:800; padding:5px 4px; min-width:36px; }
.attendance-grid .att-day-head { min-width:34px; }
.attendance-grid .att-sticky-col, .attendance-grid .att-sticky-name, .attendance-grid .att-sticky-unit { position:sticky; z-index:4; background:#fff; }
.attendance-grid thead .att-sticky-col, .attendance-grid thead .att-sticky-name, .attendance-grid thead .att-sticky-unit { z-index:8; background:#fff500; }
.attendance-grid .att-stt { left:0; min-width:42px; width:42px; }
.attendance-grid .att-sticky-name { left:42px; min-width:170px; width:170px; text-align:left; padding:4px 8px; }
.attendance-grid .att-sticky-name small { display:block; color:#64748b; font-size:10px; font-weight:400; }
.attendance-grid .att-sticky-unit { left:212px; min-width:135px; width:135px; text-align:left; padding:4px 7px; }
.attendance-grid tbody tr:nth-child(even) td { background:#f8fafc; }
.attendance-grid tbody tr:nth-child(even) .att-sticky-col,
.attendance-grid tbody tr:nth-child(even) .att-sticky-name,
.attendance-grid tbody tr:nth-child(even) .att-sticky-unit { background:#f8fafc; }
.attendance-grid td input { font:inherit; color:#0f172a; border:0; outline:0; background:transparent; width:100%; min-width:0; height:30px; text-align:center; padding:3px 2px; }
.attendance-grid td input:focus { background:#e0f2fe; box-shadow:inset 0 0 0 2px #0284c7; }
.attendance-grid td .att-day-input { width:34px; min-width:34px; }
.attendance-grid td .att-day-input.is-leave { color:#dc2626; font-weight:700; background:#fff1f2; }
.attendance-grid .att-total-col { min-width:82px; }
.attendance-grid .att-calc { padding:4px 7px; font-weight:700; background:#fffdf0; }
.attendance-grid tbody tr:nth-child(even) .att-calc { background:#fff9db; }
.attendance-grid .att-note-col { min-width:120px; }
.attendance-grid .att-note-input { min-width:118px; text-align:left; padding:3px 6px; }
.attendance-grid .att-meta-input { min-width:82px; width:82px; }
.attendance-grid .att-money-input { min-width:100px; width:100px; text-align:right; padding-right:7px; }
.attendance-grid .att-empty { padding:24px; text-align:center; color:#64748b; }
.attendance-footnote { padding:12px 15px; color:#64748b; font-size:12px; line-height:1.6; }
@media (max-width: 760px) {
  .attendance-toolbar { align-items:flex-start; }
  .attendance-actions { width:100%; }
  .attendance-grid-wrap { max-height:65vh; }
}

/* Excel import / payroll data completeness */
.attendance-grid .att-advance-col { min-width:100px; }
.salary-missing { color:#b45309; font-size:11px; font-weight:700; }
.excel-cash-card { margin-top:14px; padding:16px; }
.cash-import-note { display:flex; flex-direction:column; gap:4px; margin-bottom:12px; }
.cash-import-note span { color:#64748b; font-size:12px; }
.cash-import-grid { display:grid; grid-template-columns:repeat(3,minmax(160px,1fr)); gap:12px; }
.cash-import-grid > div { display:flex; flex-direction:column; gap:6px; background:#f8fafc; border:1px solid #e2e8f0; border-radius:10px; padding:12px; }
.cash-import-grid small { color:#64748b; }
.cash-import-grid b { font-size:18px; color:#0f172a; }
@media(max-width:700px){.cash-import-grid{grid-template-columns:1fr;}}

.billing-row-notes{border:1px solid var(--border-color,#d5dde8);border-radius:10px;padding:10px;background:rgba(100,116,139,.04)}.billing-row-notes .form-group label{font-size:12px;font-weight:600}.billing-row-notes input{width:100%;}

/* Khóa bảo mật Tiền Giang HR */
.security-lock-screen{position:fixed;inset:0;z-index:99999;display:flex;align-items:center;justify-content:center;padding:20px;background:linear-gradient(135deg,#071629,#123b63 60%,#0b2545)}
.security-lock-card{width:min(420px,100%);padding:34px;background:#fff;border-radius:18px;box-shadow:0 24px 70px #0006;text-align:center}
.security-lock-card h1{margin:10px 0 4px;color:#0b2545;font-size:23px}.security-lock-card p{margin:0 0 24px;color:#64748b}.security-lock-card label{display:block;text-align:left;margin:0 0 8px;font-weight:600}.security-lock-card .form-input{width:100%;margin-bottom:14px}.security-lock-card .btn{width:100%;justify-content:center}.security-lock-icon{font-size:42px}.security-error{min-height:20px;color:#b91c1c;font-size:13px;margin-bottom:8px}.security-reset-area{border-top:1px solid #e2e8f0;margin-top:22px;padding-top:18px}.security-reset-area .btn{margin-top:4px}
