:root {
  --ink: #0d1b2a;
  --muted: #64748b;
  --line: #e2e8f0;
  --panel: #ffffff;
  --canvas: #f0fdfa;
  --nav: #011627;
  --nav-soft: #023047;
  --blue: #0a9396;
  --green: #2ec4b6;
  --red: #d92d20;
  --amber: #b7791f;
  --violet: #00b4d8;
  --radius: 12px;
  --radius-lg: 24px;
  --shadow-sm: 0 2px 8px rgba(10, 147, 150, 0.10);
  --shadow: 0 8px 32px rgba(10, 147, 150, 0.15);
  --shadow-lg: 0 24px 64px rgba(2, 48, 71, 0.20);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  display: grid;
  grid-template-columns: 264px 1fr;
  color: var(--ink);
  background: var(--canvas, #f5f7fa);
  font-family: "Quicksand", Arial, sans-serif;
}

body.modal-open {
  overflow: hidden;
}

/* Keep dialogs above the left menu on desktop */
body.modal-open .sidebar {
  z-index: 0 !important;
}

body.modal-open .modal {
  z-index: 10000 !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  overflow: hidden;
  background: #ecfffb;
  color: var(--nav-soft);
  border-right: 1px solid rgba(0, 98, 92, 0.14);
}

.sidebar::before { display: none; }

.brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(0, 98, 92, 0.16);
}

.brand-logo {
  width: 74px;
  height: 74px;
  object-fit: contain;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  padding: 8px;
  box-shadow: 0 16px 34px rgba(0, 98, 92, 0.16), inset 0 0 0 1px rgba(0, 98, 92, 0.08);
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 3px;
  color: #34605d;
  font-size: 13px;
}

.nav {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 6px;
  margin-top: 24px;
}

.nav button {
  order: 10;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius);
  color: #073b3a;
  background: rgba(255, 255, 255, 0.12);
  text-align: left;
  cursor: pointer;
  font-weight: 700;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.nav button[data-view="dashboard"] {
  order: 0;
}

.nav button[data-view="org"] {
  order: 1;
}

.nav button:hover,
.nav button.active {
  background: rgba(255, 255, 255, 0.62);
  color: var(--nav);
  box-shadow: inset 4px 0 0 var(--blue), 0 10px 24px rgba(0, 98, 92, 0.12);
  transform: translateX(2px);
}

.shell {
  min-width: 0;
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--nav-soft);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  font-weight: 800;
}

.user-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.role-picker {
  display: grid;
  gap: 5px;
  min-width: 150px;
  color: var(--muted);
  font-size: 12px;
}

.role-picker select {
  min-height: 38px;
  padding: 7px 10px;
}

.user-chip,
.metric,
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: none;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.view-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* View header & content - used by nightShift tab */
.view-header {
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.view-header h1 {
  margin: 0;
  color: var(--nav-soft);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0;
}

.view-content {
  display: grid;
  gap: 18px;
}

/* Hidden by default, shown via JS for hr_admin / hr_staff / director */
.eval-hr-only {
  display: none !important;
}
.eval-hr-visible .eval-hr-only {
  display: inline-flex !important;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-wide {
  grid-column: span 2;
}

.employee-home {
  display: grid;
  gap: 16px;
}

.employee-hero {
  display: flex;
  align-items: center;
  min-height: 136px;
  padding: 22px;
  border: 1px solid rgba(10, 147, 150, 0.18);
  border-radius: var(--radius-lg);
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(240, 253, 250, 0.96), rgba(255, 255, 255, 0.96)),
    radial-gradient(circle at right top, rgba(46, 196, 182, 0.28), transparent 38%);
  box-shadow: var(--shadow-sm);
}

.employee-hero h2 {
  margin: 0 0 8px;
  color: var(--nav-soft);
  font-size: 24px;
}

.employee-hero span {
  color: var(--muted);
  font-weight: 600;
}

.employee-action-menu {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.employee-action-menu button {
  position: relative;
  display: grid;
  gap: 5px;
  min-height: 104px;
  padding: 16px 16px 16px 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.employee-action-menu button::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 22px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--green));
  box-shadow: 0 0 0 5px rgba(10, 147, 150, 0.10);
}

.employee-action-menu button:hover {
  border-color: rgba(10, 147, 150, 0.32);
  transform: translateY(-1px);
}

.employee-action-menu strong {
  color: var(--nav-soft);
  font-size: 15px;
}

.employee-action-menu span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.employee-summary-panel {
  box-shadow: var(--shadow-sm);
}

.employee-notice-list {
  display: grid;
  gap: 10px;
  padding: 14px 18px 18px;
}

.employee-notice {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  background: #fff;
}

.employee-notice.ok {
  border-left-color: var(--green);
  background: #f7fffc;
}

.employee-notice.warn {
  border-left-color: var(--amber);
  background: #fffaf1;
}

.employee-notice.bad {
  border-left-color: var(--red);
  background: #fff7f5;
}

.employee-notice.info {
  border-left-color: var(--violet);
}

.employee-notice span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.employee-notice strong {
  color: var(--nav-soft);
  font-size: 14px;
}

.employee-notice p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.org-directory {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  padding: 14px;
}

.org-card {
  display: grid;
  gap: 14px;
  min-height: 186px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.org-card:nth-child(even) {
  background: #f7fffc;
}

.org-card.lead {
  border-color: rgba(10, 147, 150, 0.34);
  background:
    linear-gradient(135deg, rgba(240, 253, 250, 0.96), rgba(255, 255, 255, 0.98)),
    radial-gradient(circle at right top, rgba(46, 196, 182, 0.18), transparent 42%);
}

.org-card h3 {
  margin: 8px 0 4px;
  color: var(--nav-soft);
  font-size: 18px;
}

.org-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.org-card dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.org-card dl div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.org-card dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.org-card dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-weight: 700;
}

.org-directory.org-tree {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.org-unit {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
}

.org-unit-head {
  display: grid;
  gap: 4px;
}

.org-unit-head span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.org-unit-head h3 {
  margin: 0;
  color: var(--nav-soft);
  font-size: 20px;
}

.org-unit-head p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.org-manager-name {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 0 !important;
  font-size: 15px;
  font-weight: 700;
  color: var(--nav-soft) !important;
}

.org-manager-label {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 20px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.org-member-count {
  margin: 1px 0 0 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--muted) !important;
}

.org-board {
  background: linear-gradient(135deg, rgba(240, 253, 250, 0.96), rgba(255, 255, 255, 0.98));
}

.org-division {
  background: rgba(248, 250, 252, 0.96);
}

.org-unit-children {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.org-member-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.org-member-list .org-card {
  min-height: auto;
  box-shadow: none;
}

.org-name-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.org-name-list li {
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.org-name-list li.manager {
  border-color: rgba(255, 209, 102, 0.36);
  background: rgba(255, 209, 102, 0.12);
}

.org-star {
  display: inline-block;
  margin-right: 7px;
  color: #fbbf24;
}

.org-member-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.org-member-pager span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.org-member-pager button {
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 9px;
  font-size: 12px;
}

.org-member-pager button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.metric {
  width: 100%;
  min-height: 104px;
  padding: 16px;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  text-align: left;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.metric strong {
  display: block;
  margin-top: 12px;
  color: var(--nav-soft);
  font-size: clamp(22px, 2.3vw, 30px);
  font-weight: 800;
  line-height: 1.08;
  white-space: nowrap;
}

.metric:hover {
  border-color: rgba(10, 147, 150, 0.36);
  background: #f8fffc;
  transform: translateY(-1px);
}

.metric-wide strong {
  padding-right: 42px;
}

.salary-eye {
  position: absolute;
  right: 12px;
  bottom: 14px;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--nav-soft);
  font-size: 16px;
  cursor: pointer;
}

.metric:nth-child(2) strong {
  color: var(--green);
}

.metric:nth-child(3) strong {
  color: var(--amber);
}

.metric:nth-child(5) strong {
  color: var(--violet);
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.director-dashboard {
  width: 100%;
}

.director-dashboard .metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.director-dashboard .metric {
  min-height: 110px;
  padding: 22px 24px;
}

.director-dashboard .metric strong {
  margin-top: 14px;
  font-size: 34px;
}

.director-dashboard .grid.two {
  grid-template-columns: 1fr;
  align-items: start;
}

.director-dashboard #pendingPanel {
  grid-column: 1;
  grid-row: 2;
}

.director-dashboard #directorQueuePanel {
  grid-column: 1;
  grid-row: 1;
}

.director-dashboard #urgentPanel {
  display: none !important;
}

.director-dashboard .permission-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.director-dashboard .dashboard-task {
  min-height: 74px;
}

.director-dashboard #pendingLeaves {
  max-height: min(50vh, 460px);
  overflow: auto;
  padding-right: 4px;
}

@media (max-width: 1050px) {
  .director-dashboard .metrics,
  .director-dashboard .grid.two {
    grid-template-columns: 1fr;
  }

  .director-dashboard #pendingPanel,
  .director-dashboard #directorQueuePanel,
  .director-dashboard #urgentPanel {
    grid-column: auto;
    grid-row: auto;
  }
}

.grid.form-table {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  align-items: start;
}

#employees .grid.form-table {
  grid-template-columns: minmax(0, 1fr);
}

#attendance .grid.form-table,
#payroll .grid.form-table {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
}

body[data-role="employee"] #attendance .grid.form-table {
  grid-template-columns: minmax(300px, 0.75fr) minmax(460px, 1.25fr);
}

.payroll-workflow {
  grid-column: 1 / -1;
}

.payroll-actions {
  display: grid;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--canvas);
}

.payroll-actions.standalone {
  margin-bottom: 14px;
  border: 1px solid rgba(10, 147, 150, 0.18);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.payroll-action-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(10, 147, 150, 0.16);
  border-radius: var(--radius);
  background: #ffffff;
}

.payroll-action-card strong,
.payroll-action-card span {
  display: block;
}

.payroll-action-card span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.payroll-action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.paid-holiday-preview {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px dashed rgba(0, 188, 212, 0.34);
  border-radius: 8px;
  background: rgba(0, 188, 212, 0.08);
  color: var(--muted);
  font-size: 13px;
}

.paid-holiday-preview span {
  display: block;
}

.wifi-card-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.wifi-card-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.employee-wifi-card {
  align-self: start;
}

#attendance .table-wrap,
#payroll .table-wrap,
#employees .table-wrap,
#leave .table-wrap {
  min-height: 0;
}

.panel {
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(240, 253, 250, 0.78), rgba(255, 255, 255, 0.96));
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

.employee-panel-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.form {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.form .panel-head {
  margin: 0 -18px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(1, 22, 39, 0.46);
}

.modal-card {
  width: min(880px, 100%);
  max-height: min(90vh, 920px);
  overflow: auto;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}

  .employee-entry-card {
    width: min(1120px, calc(100vw - 44px));
    max-height: calc(100vh - 44px);
  }

.modal-form {
  padding-top: 0;
}

.employee-entry-card .modal-form {
  gap: 12px;
}

.employee-entry-card .panel-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: none;
}

.form-section-title {
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 10px;
  color: var(--nav-soft);
  background: #f6fffc;
  font-size: 13px;
  font-weight: 900;
}

.form-actions-sticky {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  padding: 12px 0 0;
  background: linear-gradient(180deg, rgba(255,255,255,0), #fff 35%);
}

.form-actions-sticky .primary {
  width: min(260px, 100%);
}

.icon-close {
  min-height: 34px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--nav-soft);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  font-weight: 400;
}

textarea {
  resize: vertical;
  min-height: 88px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 4px solid rgba(10, 147, 150, 0.10);
  border-color: var(--blue);
}

.row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.checks {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.checks input {
  width: 16px;
  min-height: 16px;
}

.primary,
.ghost,
.danger {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  padding: 9px 15px;
  cursor: pointer;
  font-weight: 800;
}

.primary {
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: #fff;
  box-shadow: 0 8px 18px rgba(10, 147, 150, 0.18);
}

.as-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 999px;
  padding: 9px 13px;
  text-decoration: none;
  font-weight: 800;
}

.ghost {
  background: var(--canvas);
  color: var(--blue);
}

.danger {
  background: #fff0ee;
  color: var(--red);
}

.hint {
  border: 1px dashed rgba(10, 147, 150, 0.32);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--muted);
  background: var(--canvas);
  font-size: 13px;
  line-height: 1.45;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

th {
  color: var(--nav-soft);
  background: var(--canvas);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

td.actions {
  min-width: 150px;
}

td.actions .ghost,
td.actions .danger {
  margin: 2px 4px 2px 0;
  white-space: nowrap;
}

/* Form actions container - used in nightShift and other forms */
.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
  margin-top: 8px;
}

#leave .table-wrap {
  overflow: visible;
}

#leaveTable,
#leaveTable thead,
#leaveTable tbody,
#leaveTable tr,
#leaveTable td {
  display: block;
}

#leaveTable thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

#leaveTable tbody {
  display: grid;
  gap: 10px;
  padding: 12px;
}

#leaveTable tr {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(170px, 1.25fr) minmax(92px, 0.58fr) minmax(112px, auto);
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

#leaveTable tbody tr:nth-child(even) {
  background: #f7fffc;
}

#leaveTable td {
  min-width: 0;
  padding: 0;
  border-bottom: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: normal;
}

#leaveTable td span:not(.badge) {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

#leaveTable td[data-label="Số ngày"] {
  font-weight: 800;
}

#leaveTable td[data-label="Ghi chú"] {
  grid-column: 1 / -1;
  padding-top: 8px;
  border-top: 1px dashed rgba(10, 147, 150, 0.18);
  color: var(--text);
}

#leaveTable td.actions {
  min-width: 0;
  justify-self: end;
}

#leaveTable .badge {
  max-width: 100%;
  white-space: normal;
}

body[data-role="employee"] #leaveTable tr {
  grid-template-columns: minmax(98px, 0.9fr) minmax(96px, 0.82fr) minmax(48px, 0.32fr) minmax(76px, 0.58fr) minmax(130px, 1.2fr) minmax(78px, auto);
}

body[data-role="employee"] #leaveTable td[data-label="Lý do / phản hồi"] {
  color: var(--text);
}

body[data-role="manager"] #leaveTable tr {
  grid-template-columns: minmax(0, 1.35fr) minmax(92px, 0.82fr) minmax(54px, 0.38fr) minmax(82px, 0.62fr);
  align-items: start;
}

body[data-role="manager"] #leaveTable td[data-label="Lý do / phản hồi"] {
  grid-column: 1 / 4;
  color: var(--text);
}

body[data-role="manager"] #leaveTable td.actions {
  grid-column: 4;
  justify-self: end;
  align-self: end;
}

body[data-role="manager"] #leaveTable td.actions .ghost,
body[data-role="manager"] #leaveTable td.actions .danger {
  min-height: 34px;
  padding: 7px 11px;
}

body[data-role="manager"] #overtimeTable th,
body[data-role="manager"] #overtimeTable td {
  padding: 10px 12px;
  font-size: 13px;
}

body[data-role="manager"] #overtimeTable th:nth-child(1),
body[data-role="manager"] #overtimeTable td:nth-child(1) {
  width: 92px;
}

body[data-role="manager"] #overtimeTable th:nth-child(2),
body[data-role="manager"] #overtimeTable td:nth-child(2) {
  width: 92px;
}

body[data-role="manager"] #overtimeTable th:nth-child(3),
body[data-role="manager"] #overtimeTable td:nth-child(3) {
  width: 54px;
}

body[data-role="manager"] #overtimeTable th:nth-child(5),
body[data-role="manager"] #overtimeTable td:nth-child(5) {
  width: 132px;
}

.review-cell {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}

.review-cell > span:not(.badge) {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.review-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.review-actions .ghost,
.review-actions .danger {
  min-height: 32px;
  padding: 6px 10px;
}

#employees .table-wrap {
  /* overflow: visible; Removed to fix scrolling overlap bug */
}

.employee-directory {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.employee-record {
  display: grid;
  grid-template-columns: minmax(170px, 0.55fr) minmax(0, 1.45fr) minmax(92px, auto);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 1px 0 rgba(2, 48, 71, 0.02);
}

.employee-record:nth-child(even) {
  background: #f7fffc;
}

.employee-record:nth-child(odd) {
  background: #ffffff;
}

.employee-record.empty {
  display: grid;
  gap: 5px;
  color: var(--muted);
}

.employee-identity,
.employee-info-grid,
.employee-actions {
  min-width: 0;
}

.employee-identity {
  display: grid;
  align-content: start;
  gap: 4px;
}

.employee-identity strong {
  font-size: 15px;
}

.employee-identity span:not(.employee-code) {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.employee-code {
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--canvas);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.employee-info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 14px;
}

.employee-kv {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.employee-kv small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.employee-kv b,
.employee-action-block b {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.employee-actions {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(210px, 1fr) minmax(150px, 0.8fr);
  gap: 8px;
  overflow: hidden;
}

.employee-actions.compact {
  display: flex;
  justify-content: flex-end;
  grid-template-columns: none;
}

.employee-actions.compact .ghost {
  min-width: 86px;
}

.employee-action-block {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  padding-top: 10px;
  border-top: 1px dashed rgba(10, 147, 150, 0.22);
  overflow-wrap: anywhere;
}

.employee-action-block .ghost,
.employee-action-block .danger,
.employee-action-block .inline-select {
  width: min(100%, 280px);
  min-width: 0;
  margin-top: 3px;
  padding-left: 8px;
  padding-right: 8px;
}

.employee-action-block .inline-select {
  width: min(100%, 220px);
}

.employee-action-block .ghost,
.employee-action-block .danger {
  white-space: normal;
}

.employee-action-block .badge {
  width: fit-content;
  max-width: 100%;
  white-space: normal;
}

.employee-detail-card {
  width: min(1040px, 100%);
}

.employee-detail-panel {
  padding-top: 0;
}

.employee-detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px 0;
  border-top: 1px solid var(--line);
}

.employee-detail-tabs button {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.employee-detail-tabs button.active {
  border-color: rgba(10, 147, 150, 0.38);
  background: var(--canvas);
  color: var(--teal);
}

.employee-detail-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.employee-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.detail-kv {
  min-height: 68px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfffd;
}

.detail-section {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.detail-section h3 {
  margin: 0;
  font-size: 15px;
  color: var(--nav-soft);
}

.detail-section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.payroll-detail-card {
  width: min(980px, 100%);
}

.payroll-detail-body {
  display: grid;
  gap: 12px;
}

.payroll-detail-summary .detail-kv strong {
  font-size: 18px;
}

.payroll-inline-field {
  display: grid;
  gap: 4px;
  min-width: 110px;
  margin-bottom: 6px;
}

.payroll-inline-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.payroll-inline-field input,
.payroll-inline-reason {
  width: 100%;
  min-height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(4, 8, 22, 0.72);
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
}

.payroll-inline-actions {
  display: grid;
  gap: 8px;
  min-width: 150px;
}

.payroll-inline-actions .small {
  min-height: 34px;
  padding: 8px 10px;
}

.payroll-detail-edit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.payroll-detail-edit-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-top: 12px;
  align-items: end;
}

.payroll-detail-edit-actions .payroll-inline-reason {
  min-height: 44px;
}

.payroll-warning-section {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
}

.payroll-warning-section ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  line-height: 1.55;
}

.skill-tags,
.employee-settings-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.employee-settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.attendance-mini-list {
  display: grid;
  gap: 8px;
}

.employee-detail-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.employee-detail-toolbar label {
  width: min(100%, 240px);
}

.attendance-mini-list article {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) minmax(120px, auto);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfffd;
}

.attendance-mini-list strong {
  color: var(--nav-soft);
}

.attendance-mini-list span {
  min-width: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.attendance-mini-list em {
  color: var(--ink);
  font-style: normal;
  text-align: right;
}

#employeeTable.employee-card-table,
#employeeTable.employee-card-table thead,
#employeeTable.employee-card-table tbody,
#employeeTable.employee-card-table tr,
#employeeTable.employee-card-table td {
  display: block;
}

#employeeTable.employee-card-table thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

#employeeTable.employee-card-table tbody {
  display: grid;
  gap: 10px;
  padding: 12px;
}

#employeeTable.employee-card-table tr {
  display: grid;
  grid-template-columns: minmax(74px, 0.48fr) minmax(150px, 1.3fr) minmax(110px, 0.9fr) minmax(118px, 0.95fr) minmax(150px, 1.1fr) minmax(94px, 0.65fr);
  align-items: start;
  gap: 10px 14px;
  padding: 12px;
  border: 1px solid #e2eee9;
  border-radius: var(--radius);
  background: #fff;
}

#employeeTable.employee-card-table td {
  min-width: 0;
  padding: 0;
  border-bottom: 0;
  line-height: 1.35;
  overflow-wrap: normal;
  word-break: normal;
}

#employeeTable.employee-card-table td::before {
  content: attr(data-label);
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

#employeeTable.employee-card-table td span:not(.badge) {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

#employeeTable.employee-card-table td[data-label="Mã"] {
  font-weight: 800;
}

#employeeTable.employee-card-table td[data-label="Tài khoản"],
#employeeTable.employee-card-table td[data-label="Đổi trạng thái"],
#employeeTable.employee-card-table td[data-label="Thiết bị WiFi"] {
  padding-top: 8px;
  border-top: 1px dashed #d7e8e2;
}

#employeeTable.employee-card-table .badge {
  max-width: 100%;
  white-space: normal;
}

#employeeTable.employee-card-table .ghost,
#employeeTable.employee-card-table .danger,
#employeeTable.employee-card-table .inline-select {
  width: min(100%, 264px);
  margin-top: 6px;
}

#employeeTable.employee-card-table td[data-label="Tài khoản"] .ghost,
#employeeTable.employee-card-table td[data-label="Đổi trạng thái"] .inline-select {
  width: 100%;
}

#employeeTable.employee-card-table td[data-label="Thiết bị WiFi"] .ghost {
  width: auto;
  min-width: 112px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475467;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.ok {
  background: var(--canvas);
  color: var(--blue);
}

.badge.warn {
  background: #fff7e6;
  color: #946200;
}

.badge.bad {
  background: #fff0ee;
  color: var(--red);
}

.badge.contract {
  background: rgba(0, 180, 216, 0.11);
  color: #02759a;
}

.search {
  max-width: 280px;
}

.inline-select {
  min-width: 150px;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid #bdd8cf;
  border-radius: var(--radius);
  background: #fff;
}

.list {
  display: grid;
  gap: 10px;
  padding: 14px 18px 18px;
}

.contract-list {
  display: grid;
  gap: 14px;
  padding: 16px 18px 20px;
}

.contract-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.contract-card:nth-child(even) {
  background: #f7fffc;
}

.contract-card.empty {
  color: var(--muted);
}

.contract-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.contract-card-head h3 {
  margin: 8px 0 4px;
  font-size: 18px;
}

.contract-card-head p {
  margin: 0;
  color: var(--muted);
}

.contract-status-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.contract-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.contract-summary-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
}

.contract-summary-actions span {
  color: var(--muted);
  font-size: 13px;
}

.contract-detail-card {
  width: min(1080px, calc(100vw - 32px));
  max-width: min(1080px, calc(100vw - 32px));
}

.contract-detail-body {
  display: grid;
  gap: 14px;
}

.contract-meta span,
.contract-clause-grid span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfffd;
}

.contract-meta b,
.contract-clause-grid b {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.contract-document {
  max-height: 520px;
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  line-height: 1.65;
}

.contract-allowance-table {
  width: 100%;
  margin: 10px 0 12px;
  border-collapse: collapse;
}

.contract-allowance-table th,
.contract-allowance-table td {
  padding: 9px 10px;
  border: 1px solid var(--line);
  text-align: left;
}

.contract-allowance-table th {
  background: var(--canvas);
  color: var(--ink);
}

.contract-allowance-table td:last-child,
.contract-allowance-table th:last-child {
  text-align: right;
}

.contract-document-title {
  text-align: center;
}

.contract-document-title h3 {
  margin: 0 0 4px;
  letter-spacing: 0;
}

.contract-clause-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.contract-signatures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
  text-align: center;
}

.contract-signatures span {
  display: grid;
  gap: 8px;
  min-height: 92px;
  align-content: start;
  padding-top: 12px;
  border-top: 1px dashed #bdd8cf;
}

.contract-signatures small {
  color: var(--muted);
}

.list-item {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
}

.action-list-item:hover {
  border-color: rgba(10, 147, 150, 0.36);
  background: #f8fffc;
  transform: translateY(-1px);
}

.list-item strong {
  font-size: 14px;
}

.list-item span {
  color: var(--muted);
  font-size: 13px;
}

.compact .list-item {
  padding: 10px;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 18px 18px;
}

.permission-card {
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfffd;
  text-align: left;
}

.dashboard-task {
  width: 100%;
}

.dashboard-task:hover {
  border-color: rgba(10, 147, 150, 0.36);
  background: #f2fffb;
  transform: translateY(-1px);
}

.safety-panel {
  margin-bottom: 20px;
}

.safety-risk-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.safety-risk {
  display: grid;
  gap: 7px;
  min-height: 118px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.32);
}

.safety-risk strong {
  color: #f8fafc;
}

.safety-risk span,
.safety-risk small {
  color: rgba(226, 232, 240, 0.78);
  line-height: 1.45;
}

.risk-severity {
  justify-self: start;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.safety-risk.critical {
  border-color: rgba(248, 113, 113, 0.55);
  background: rgba(127, 29, 29, 0.3);
}

.safety-risk.critical .risk-severity {
  color: #fee2e2;
  background: rgba(220, 38, 38, 0.38);
}

.safety-risk.high {
  border-color: rgba(251, 146, 60, 0.55);
  background: rgba(124, 45, 18, 0.26);
}

.safety-risk.high .risk-severity {
  color: #ffedd5;
  background: rgba(234, 88, 12, 0.34);
}

.safety-risk.medium .risk-severity {
  color: #fef9c3;
  background: rgba(161, 98, 7, 0.34);
}

.safety-risk.low .risk-severity {
  color: #ccfbf1;
  background: rgba(13, 148, 136, 0.32);
}

.alert-item {
  border-color: #ffe2b8;
  background: #fffaf1;
}

.alert-item.high {
  border-color: #ffc9c4;
  background: #fff5f3;
}

.permission-card strong,
.permission-card span {
  display: block;
}

.permission-card strong {
  margin-bottom: 7px;
  font-size: 14px;
}

.permission-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

[hidden] {
  display: none !important;
}

#toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 44px));
  padding: 12px 14px;
  border-radius: var(--radius);
  color: #fff;
  background: #172033;
  box-shadow: 0 18px 42px rgba(23, 32, 51, 0.24);
  opacity: 0;
  transform: translateY(12px);
  transition: 180ms ease;
  pointer-events: none;
}

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

@media (max-width: 1100px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(4, 1fr);
  }

  .metrics,
  .employee-action-menu,
  .grid.two,
  #attendance .grid.form-table,
  #payroll .grid.form-table,
  body[data-role="employee"] #attendance .grid.form-table,
  .grid.form-table {
    grid-template-columns: 1fr 1fr;
  }

  .employee-record {
    grid-template-columns: minmax(180px, 0.6fr) minmax(0, 1.4fr) minmax(92px, auto);
  }

  .employee-actions {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .employee-actions.compact {
    grid-template-columns: none;
  }

  .employee-detail-grid,
  .employee-settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .employee-action-block {
    padding-left: 0;
    border-top: 1px dashed #d7e8e2;
    border-left: 0;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 18px;
  }

  .sidebar {
    padding: 16px;
  }

  .brand {
    padding-bottom: 14px;
  }

  .brand-logo {
    width: 58px;
    height: 58px;
  }

  .nav {
    gap: 8px;
    margin-top: 14px;
  }

  .nav button {
    min-height: 38px;
    padding: 8px 10px;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .user-tools {
    width: 100%;
    justify-content: stretch;
  }

  .employee-panel-tools {
    width: 100%;
    justify-content: stretch;
  }

  .employee-panel-tools .search,
  .employee-panel-tools .primary {
    width: 100%;
    max-width: none;
  }

  .role-picker,
  .user-chip {
    width: 100%;
  }

  .nav,
  .metrics,
  .employee-action-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .payroll-action-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid.two,
  #attendance .grid.form-table,
  #payroll .grid.form-table,
  body[data-role="employee"] #attendance .grid.form-table,
  .grid.form-table,
  .row,
  .attendance-mini-list article,
  .permission-grid,
  .contract-meta,
  .contract-clause-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }

  #leaveTable tr {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr) minmax(0, 0.85fr);
  }

  #employeeTable.employee-card-table tr {
    grid-template-columns: minmax(72px, 0.5fr) minmax(0, 1.4fr) minmax(0, 1fr);
  }

  .employee-record {
    grid-template-columns: 1fr;
  }

  .employee-info-grid {
    grid-template-columns: 1fr 1fr;
  }

  .employee-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .employee-actions.compact {
    justify-content: flex-start;
  }

  .employee-detail-grid,
  .employee-settings-grid {
    grid-template-columns: 1fr;
  }

  .contract-card-head,
  .contract-summary-actions,
  .contract-signatures {
    grid-template-columns: 1fr;
    align-items: flex-start;
    flex-direction: column;
  }

  .contract-status-stack {
    justify-content: flex-start;
  }

  #leaveTable td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
  }

  #leaveTable td.actions {
    justify-self: start;
  }
}

/* Final override: compact leave approval cards in narrow panels */
body[data-role="manager"] #leaveTable tr,
body[data-role="hr_admin"] #leaveTable tr,
body[data-role="hr_staff"] #leaveTable tr,
body[data-role="director"] #leaveTable tr {
  grid-template-columns: minmax(150px, 0.9fr) minmax(180px, 1.1fr) !important;
  align-items: start !important;
  gap: 10px 18px !important;
}

body[data-role="manager"] #leaveTable td[data-label="Nghỉ phép"],
body[data-role="hr_admin"] #leaveTable td[data-label="Nghỉ phép"],
body[data-role="hr_staff"] #leaveTable td[data-label="Nghỉ phép"],
body[data-role="director"] #leaveTable td[data-label="Nghỉ phép"],
body[data-role="manager"] #leaveTable td[data-label="Thời gian"],
body[data-role="hr_admin"] #leaveTable td[data-label="Thời gian"],
body[data-role="hr_staff"] #leaveTable td[data-label="Thời gian"],
body[data-role="director"] #leaveTable td[data-label="Thời gian"] {
  grid-column: 2 !important;
  grid-row: 1 !important;
  padding-right: 96px !important;
}

body[data-role="manager"] #leaveTable td[data-label="Trạng thái"],
body[data-role="hr_admin"] #leaveTable td[data-label="Trạng thái"],
body[data-role="hr_staff"] #leaveTable td[data-label="Trạng thái"],
body[data-role="director"] #leaveTable td[data-label="Trạng thái"] {
  grid-column: 2 !important;
  grid-row: 1 !important;
  justify-self: end !important;
  align-self: start !important;
}

body[data-role="manager"] #leaveTable td[data-label="Trạng thái"] .badge,
body[data-role="hr_admin"] #leaveTable td[data-label="Trạng thái"] .badge,
body[data-role="hr_staff"] #leaveTable td[data-label="Trạng thái"] .badge,
body[data-role="director"] #leaveTable td[data-label="Trạng thái"] .badge {
  max-width: 88px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body[data-role="manager"] #leaveTable td[data-label="Số ngày"],
body[data-role="hr_admin"] #leaveTable td[data-label="Số ngày"],
body[data-role="hr_staff"] #leaveTable td[data-label="Số ngày"],
body[data-role="director"] #leaveTable td[data-label="Số ngày"] {
  grid-column: 2 !important;
}

body[data-role="manager"] #leaveTable td[data-label="Lý do / phản hồi"],
body[data-role="hr_admin"] #leaveTable td[data-label="Lý do / phản hồi"],
body[data-role="hr_staff"] #leaveTable td[data-label="Lý do / phản hồi"],
body[data-role="director"] #leaveTable td[data-label="Lý do / phản hồi"],
body[data-role="manager"] #leaveTable td[data-label="Ghi chú"],
body[data-role="hr_admin"] #leaveTable td[data-label="Ghi chú"],
body[data-role="hr_staff"] #leaveTable td[data-label="Ghi chú"],
body[data-role="director"] #leaveTable td[data-label="Ghi chú"] {
  grid-column: 1 / -1 !important;
  grid-row: auto !important;
}

body[data-role="manager"] #leaveTable td.actions,
body[data-role="hr_admin"] #leaveTable td.actions,
body[data-role="hr_staff"] #leaveTable td.actions,
body[data-role="director"] #leaveTable td.actions {
  grid-column: 1 / -1 !important;
  justify-self: start !important;
}

body[data-role="manager"] #leaveTable td.actions:empty,
body[data-role="hr_admin"] #leaveTable td.actions:empty,
body[data-role="hr_staff"] #leaveTable td.actions:empty,
body[data-role="director"] #leaveTable td.actions:empty {
  display: none !important;
}

@media (max-width: 620px) {
  body[data-role="manager"] #leaveTable tr,
  body[data-role="hr_admin"] #leaveTable tr,
  body[data-role="hr_staff"] #leaveTable tr,
  body[data-role="director"] #leaveTable tr {
    grid-template-columns: 1fr !important;
  }

  body[data-role="manager"] #leaveTable td[data-label="Nghỉ phép"],
  body[data-role="hr_admin"] #leaveTable td[data-label="Nghỉ phép"],
  body[data-role="hr_staff"] #leaveTable td[data-label="Nghỉ phép"],
  body[data-role="director"] #leaveTable td[data-label="Nghỉ phép"],
  body[data-role="manager"] #leaveTable td[data-label="Thời gian"],
  body[data-role="hr_admin"] #leaveTable td[data-label="Thời gian"],
  body[data-role="hr_staff"] #leaveTable td[data-label="Thời gian"],
  body[data-role="director"] #leaveTable td[data-label="Thời gian"],
  body[data-role="manager"] #leaveTable td[data-label="Trạng thái"],
  body[data-role="hr_admin"] #leaveTable td[data-label="Trạng thái"],
  body[data-role="hr_staff"] #leaveTable td[data-label="Trạng thái"],
  body[data-role="director"] #leaveTable td[data-label="Trạng thái"],
  body[data-role="manager"] #leaveTable td[data-label="Số ngày"],
  body[data-role="hr_admin"] #leaveTable td[data-label="Số ngày"],
  body[data-role="hr_staff"] #leaveTable td[data-label="Số ngày"],
  body[data-role="director"] #leaveTable td[data-label="Số ngày"] {
    grid-column: auto !important;
    grid-row: auto !important;
    justify-self: start !important;
    padding-right: 0 !important;
  }
}

/* Align quick action icons cleanly */
.employee-action-menu button {
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 4px;
  min-height: 96px;
  padding: 16px !important;
}

.employee-action-menu button::before {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: center;
  justify-self: center;
  display: grid;
  place-items: center;
  width: 32px !important;
  height: 32px !important;
  margin: 0 !important;
  border-radius: 10px !important;
  line-height: 1;
  font-size: 15px;
}

.employee-action-menu strong,
.employee-action-menu span {
  grid-column: 2;
  min-width: 0;
}

.employee-action-menu strong {
  align-self: end;
}

.employee-action-menu span {
  align-self: start;
}

@media (max-width: 520px) {
  .employee-action-menu button {
    grid-template-columns: 32px minmax(0, 1fr);
    min-height: 86px;
    padding: 14px !important;
  }
}

/* Refined SVG icon system */
:root {
  --i-dashboard: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2300d4ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7' rx='2'/%3E%3Crect x='14' y='3' width='7' height='7' rx='2'/%3E%3Crect x='14' y='14' width='7' height='7' rx='2'/%3E%3Crect x='3' y='14' width='7' height='7' rx='2'/%3E%3C/svg%3E");
  --i-users: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2300d4ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9.5' cy='7' r='4'/%3E%3Cpath d='M22 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
  --i-file: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2300d4ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 2v6h6'/%3E%3Cpath d='M8 13h8'/%3E%3Cpath d='M8 17h5'/%3E%3C/svg%3E");
  --i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2300e5a0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  --i-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2300d4ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
  --i-moon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2300d4ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E");
  --i-wallet: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2300d4ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 7V6a2 2 0 0 0-2-2H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6'/%3E%3Cpath d='M17 13h.01'/%3E%3C/svg%3E");
  --i-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2300d4ff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14'/%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E");
  --i-book: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2300d4ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19.5A2.5 2.5 0 0 1 6.5 17H20'/%3E%3Cpath d='M4 4.5A2.5 2.5 0 0 1 6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5z'/%3E%3C/svg%3E");
  --i-mail: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2300d4ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='m3 7 9 6 9-6'/%3E%3C/svg%3E");
  --i-org: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2300d4ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='2' width='6' height='6' rx='1.5'/%3E%3Crect x='3' y='16' width='6' height='6' rx='1.5'/%3E%3Crect x='15' y='16' width='6' height='6' rx='1.5'/%3E%3Cpath d='M12 8v4'/%3E%3Cpath d='M6 16v-2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v2'/%3E%3C/svg%3E");
  --i-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2300d4ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  --i-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23ff8fa3' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18'/%3E%3Cpath d='m6 6 12 12'/%3E%3C/svg%3E");
  --i-refresh: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2300d4ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 0 1-15 6.7L3 16'/%3E%3Cpath d='M3 16h6v6'/%3E%3Cpath d='M3 12a9 9 0 0 1 15-6.7L21 8'/%3E%3Cpath d='M21 8h-6V2'/%3E%3C/svg%3E");
  --i-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2300d4ff' stroke-width='2.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7'/%3E%3Cpath d='M8 7h9v9'/%3E%3C/svg%3E");
}

.nav button::before {
  content: "" !important;
  border: 1px solid rgba(0, 212, 255, 0.18);
  background-color: rgba(0, 212, 255, 0.08);
  background-image: var(--icon, var(--i-dashboard));
  background-repeat: no-repeat;
  background-position: center;
  background-size: 15px 15px;
  color: inherit;
  font-size: 0;
}

.nav button[data-view="dashboard"] { --icon: var(--i-dashboard); }
.nav button[data-view="employees"] { --icon: var(--i-users); }
.nav button[data-view="contracts"] { --icon: var(--i-file); }
.nav button[data-view="leave"] { --icon: var(--i-check); }
.nav button[data-view="attendance"] { --icon: var(--i-clock); }
.nav button[data-view="nightShift"] { --icon: var(--i-moon); }
.nav button[data-view="attendanceLogs"] { --icon: var(--i-file); }
.nav button[data-view="payroll"] { --icon: var(--i-wallet); }
.nav button[data-view="recruitment"] { --icon: var(--i-plus); }
.nav button[data-view="training"] { --icon: var(--i-book); }
.nav button[data-view="comms"] { --icon: var(--i-mail); }
.nav button[data-view="org"] { --icon: var(--i-org); }

.primary::before,
.ghost::before,
.danger::before,
.as-link::before {
  content: "" !important;
  width: 16px;
  height: 16px;
  background-image: var(--button-icon, var(--i-arrow));
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
  font-size: 0;
}

.primary { --button-icon: var(--i-check); }
.ghost { --button-icon: var(--i-arrow); }
.danger { --button-icon: var(--i-x); }
.as-link { --button-icon: var(--i-arrow); }

#openEmployeeModal.primary,
[data-contract-create],
[data-quick-view="attendance"] {
  --button-icon: var(--i-plus);
}

[data-employee-detail],
[data-contract-detail],
#editEmployeeDetail {
  --button-icon: var(--i-search);
}

[data-password-reset],
[data-device-reset],
[data-payroll-action="resend"] {
  --button-icon: var(--i-refresh);
}

.employee-action-menu button::before {
  content: "" !important;
  background-color: rgba(0, 212, 255, 0.10) !important;
  background-image: var(--quick-icon, var(--i-arrow));
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;
  box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.22), 0 10px 24px rgba(0, 212, 255, 0.10) !important;
  font-size: 0;
}

.employee-action-menu button[data-quick-url] { --quick-icon: var(--i-clock); }
.employee-action-menu button[data-quick-view="leave"] { --quick-icon: var(--i-check); }
.employee-action-menu button[data-quick-view="attendance"] { --quick-icon: var(--i-plus); }
.employee-action-menu button[data-quick-view="comms"] { --quick-icon: var(--i-mail); }

/* User preference: remove icons from all buttons */
button::before,
.primary::before,
.ghost::before,
.danger::before,
.as-link::before,
.nav button::before,
.employee-action-menu button::before {
  content: none !important;
  display: none !important;
  background-image: none !important;
}

.nav button,
.primary,
.ghost,
.danger,
.as-link {
  gap: 0 !important;
}

.nav button {
  justify-content: flex-start;
  padding-left: 14px !important;
}

.employee-action-menu button {
  grid-template-columns: minmax(0, 1fr) !important;
  min-height: 88px;
  padding: 16px !important;
}

.employee-action-menu strong,
.employee-action-menu span {
  grid-column: 1 !important;
}

.salary-eye::before,
.salary-eye::after {
  display: block !important;
  content: "" !important;
}

/* Legacy menu icon block disabled; final SVG override is defined at the end. */
.nav button::before {
  display: inline-flex !important;
  content: var(--menu-icon, "•") !important;
  align-items: center;
  justify-content: center;
  width: 18px;
  min-width: 18px;
  height: 18px;
  border: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
  color: currentColor;
  font-size: 14px;
  line-height: 1;
  opacity: 0.9;
}

.nav button {
  gap: 10px !important;
  padding-left: 12px !important;
}

.nav button[data-view="dashboard"] { --menu-icon: "▦"; }
.nav button[data-view="employees"] { --menu-icon: "◉"; }
.nav button[data-view="contracts"] { --menu-icon: "□"; }
.nav button[data-view="leave"] { --menu-icon: "✓"; }
.nav button[data-view="attendance"] { --menu-icon: "⏱"; }
.nav button[data-view="nightShift"] { --menu-icon: "🌙"; }
.nav button[data-view="payroll"] { --menu-icon: "$"; }
.nav button[data-view="recruitment"] { --menu-icon: "+"; }
.nav button[data-view="training"] { --menu-icon: "▣"; }
.nav button[data-view="comms"] { --menu-icon: "✉"; }
.nav button[data-view="org"] { --menu-icon: "◇"; }

/* Visible date/month/time picker icons on dark inputs */
input[type="date"],
input[type="month"],
input[type="time"] {
  padding-right: 40px !important;
  color: #fff !important;
  color-scheme: dark !important;
  background-color: rgba(7, 10, 22, 0.72) !important;
  background-repeat: no-repeat !important;
  background-position: right 13px center !important;
  background-size: 16px 16px !important;
}

input[type="date"],
input[type="month"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23f8fbff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4'/%3E%3Cpath d='M8 2v4'/%3E%3Cpath d='M3 10h18'/%3E%3C/svg%3E") !important;
}

input[data-date-display="true"] {
  cursor: pointer;
  padding-right: 40px !important;
  background-repeat: no-repeat !important;
  background-position: right 13px center !important;
  background-size: 16px 16px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23f8fbff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4'/%3E%3Cpath d='M8 2v4'/%3E%3Cpath d='M3 10h18'/%3E%3C/svg%3E") !important;
}

input[type="time"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23f8fbff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E") !important;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  width: 28px !important;
  height: 28px !important;
  margin-right: -4px !important;
  filter: invert(1) brightness(1.35) saturate(0.9) !important;
  opacity: 0.95 !important;
  cursor: pointer !important;
}

.table-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.table-pager .ghost {
  min-height: 32px;
  padding: 6px 12px;
}

.table-pager .ghost:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

.overtime-review-panel {
  grid-column: 1 / -1;
}

.contract-file-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 12px 0;
}

.page-tabs {
  display: inline-flex;
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(20, 22, 42, 0.72);
}

.page-tabs button {
  min-height: 36px;
  border: 0;
  border-radius: 9px;
  padding: 8px 14px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.page-tabs button.active {
  color: #06111e;
  background: linear-gradient(135deg, var(--blue), var(--green));
}

#comms .grid.form-table {
  grid-template-columns: minmax(0, 1fr);
}

.comms-page-panel {
  display: none !important;
}

.comms-page-panel.active-comms-panel {
  display: grid !important;
}

/* Dashboard card top gradient accent */
#dashboard .metric,
#dashboard .panel,
#dashboard .permission-card,
#dashboard .list-item {
  position: relative;
  overflow: hidden;
}

#dashboard .metric::after,
#dashboard .panel::before,
#dashboard .permission-card::before,
#dashboard .list-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #00d4ff 0%, #00e5a0 48%, #a78bfa 100%);
  opacity: 0.9;
  pointer-events: none;
}

#dashboard .metric::before {
  display: none;
}

#dashboard .panel-head {
  position: relative;
  z-index: 1;
}

@media (max-width: 620px) {
  .review-cell {
    grid-template-columns: 1fr;
  }

  .review-actions,
  .contract-file-row {
    justify-content: flex-start;
  }

  .table-pager {
    justify-content: space-between;
    padding: 10px 12px;
  }
}

/* Keep leave approval status readable inside narrow dashboard columns */
body[data-role="manager"] #leaveTable tr,
body[data-role="hr_admin"] #leaveTable tr,
body[data-role="director"] #leaveTable tr {
  grid-template-columns: minmax(128px, 1.05fr) minmax(140px, 1fr) minmax(82px, max-content) minmax(88px, max-content);
  gap: 10px;
}

body[data-role="manager"] #leaveTable tr:has(td.actions:empty),
body[data-role="hr_admin"] #leaveTable tr:has(td.actions:empty),
body[data-role="director"] #leaveTable tr:has(td.actions:empty) {
  grid-template-columns: minmax(128px, 1.05fr) minmax(140px, 1fr) minmax(82px, max-content);
}

body[data-role="manager"] #leaveTable td[data-label="Trạng thái"],
body[data-role="hr_admin"] #leaveTable td[data-label="Trạng thái"],
body[data-role="director"] #leaveTable td[data-label="Trạng thái"] {
  justify-self: start;
}

body[data-role="manager"] #leaveTable td[data-label="Trạng thái"] .badge,
body[data-role="hr_admin"] #leaveTable td[data-label="Trạng thái"] .badge,
body[data-role="director"] #leaveTable td[data-label="Trạng thái"] .badge {
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Compact modern controls and symbols */
.nav button,
.primary,
.ghost,
.danger,
.badge,
.as-link,
.salary-eye,
.modal__close,
.employee-detail-tabs button,
.bottom-nav__item,
.topbar-menu-btn {
  -webkit-tap-highlight-color: transparent;
}

.nav button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 9px 11px;
  font-size: 13px;
}

.nav button::before {
  content: "";
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 7px;
  color: currentColor;
  background: rgba(255, 255, 255, 0.035);
  font-size: 12px;
  line-height: 1;
}

.nav button[data-view="dashboard"]::before { content: "⌂"; }
.nav button[data-view="employees"]::before { content: "◎"; }
.nav button[data-view="contracts"]::before { content: "□"; }
.nav button[data-view="leave"]::before { content: "✓"; }
.nav button[data-view="attendance"]::before { content: "◷"; }
.nav button[data-view="payroll"]::before { content: "$"; }
.nav button[data-view="recruitment"]::before { content: "+"; }
.nav button[data-view="training"]::before { content: "▦"; }
.nav button[data-view="comms"]::before { content: "✉"; }
.nav button[data-view="org"]::before { content: "◇"; }

.nav button:hover::before,
.nav button.active::before {
  border-color: rgba(0, 212, 255, 0.34);
  background: rgba(0, 212, 255, 0.12);
  box-shadow: 0 0 18px rgba(0, 212, 255, 0.12);
}

.primary,
.ghost,
.danger,
.as-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border-radius: 9px;
  padding: 8px 13px;
  font-size: 13px;
  line-height: 1.2;
}

.primary::before,
.ghost::before,
.danger::before,
.as-link::before {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.primary::before { content: "↗"; }
.ghost::before { content: "›"; }
.danger::before { content: "×"; }
.as-link::before { content: "↗"; }

button[type="submit"].primary::before,
form .primary[type="submit"]::before,
.form-actions-sticky .primary::before {
  content: "✓";
}

#openEmployeeModal.primary::before,
[data-contract-create]::before {
  content: "+";
}

#logoutBtn.badge::before {
  content: "↵";
}

[data-employee-detail]::before,
[data-contract-detail]::before {
  content: "⌕";
}

[data-leave-action="approve"]::before,
[data-overtime-action="approve"]::before,
[data-payroll-action="confirm"]::before,
[data-payroll-action="approve"]::before {
  content: "✓";
}

[data-leave-action="reject"]::before,
[data-overtime-action="reject"]::before,
[data-payroll-action="reject"]::before,
[data-payroll-action="complain"]::before,
[data-leave-action="cancel"]::before {
  content: "×";
}

[data-alert-action="resolve"]::before {
  content: "✓";
}

[data-password-reset]::before,
[data-device-reset]::before,
[data-payroll-action="resend"]::before {
  content: "↻";
}

[data-overtime-action="submit-director"]::before {
  content: "↑";
}

.icon-close,
#closeEmployeeModal,
#closeEmployeeDetail,
#closeContractDetail {
  min-width: 38px;
  padding-inline: 10px;
}

.icon-close::before,
#closeEmployeeModal::before,
#closeEmployeeDetail::before,
#closeContractDetail::before {
  content: "×";
}

.badge {
  gap: 6px;
  min-height: 22px;
  border-radius: 7px;
  padding: 4px 7px;
  font-size: 11px;
}

.user-chip {
  min-height: 36px;
  border-radius: 10px;
}

.dot {
  box-shadow: 0 0 0 4px rgba(0, 229, 160, 0.10);
}

.salary-eye {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 0;
  text-indent: -999px;
  overflow: hidden;
}

.salary-eye::before {
  content: "";
  width: 16px;
  height: 10px;
  border: 1.8px solid currentColor;
  border-radius: 999px / 720px;
}

.salary-eye::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.employee-action-menu button {
  padding-left: 16px;
}

.employee-action-menu button::before {
  position: static;
  width: 26px;
  height: 26px;
  margin-bottom: 2px;
  border-radius: 9px;
  background: rgba(0, 212, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.22);
}

.employee-action-menu button[data-quick-url]::before {
  content: "◷";
}

.employee-action-menu button[data-quick-view="leave"]::before {
  content: "✓";
}

.employee-action-menu button[data-quick-view="attendance"]::before {
  content: "+";
}

.employee-action-menu button[data-quick-view="comms"]::before {
  content: "✉";
}

.employee-record,
.employee-record:nth-child(odd),
.employee-record:nth-child(even),
#employeeTable.employee-card-table tr,
#employeeTable.employee-card-table tbody tr:nth-child(odd),
#employeeTable.employee-card-table tbody tr:nth-child(even) {
  border-color: var(--line);
  background: rgba(20, 22, 42, 0.88);
  color: #fff;
}

.employee-record:nth-child(even),
#employeeTable.employee-card-table tbody tr:nth-child(even) {
  background: rgba(0, 212, 255, 0.075);
}

.employee-record:hover,
#employeeTable.employee-card-table tbody tr:hover {
  border-color: rgba(0, 212, 255, 0.32);
  background: rgba(26, 34, 58, 0.96);
}

.employee-record *,
#employeeTable.employee-card-table td {
  color: inherit;
}

.employee-identity span:not(.employee-code),
.employee-kv small,
.employee-kv b,
#employeeTable.employee-card-table td::before,
#employeeTable.employee-card-table td span:not(.badge) {
  color: var(--muted);
}

.employee-identity strong,
.employee-kv,
.employee-kv b + *,
#employeeTable.employee-card-table td[data-label] {
  color: rgba(248, 251, 255, 0.9);
}

td.actions .ghost,
td.actions .danger,
.review-actions .ghost,
.review-actions .danger,
.employee-actions.compact .ghost {
  min-height: 34px;
  padding: 7px 10px;
}

@media (max-width: 760px) {
  .nav button {
    min-height: 38px;
    padding: 8px 10px;
  }

  .primary,
  .ghost,
  .danger,
  .as-link {
    min-height: 40px;
  }
}

/* Leave approval rows: use the full available width */
body[data-role="manager"] #leaveTable tr,
body[data-role="hr_admin"] #leaveTable tr,
body[data-role="director"] #leaveTable tr {
  grid-template-columns: minmax(180px, 1.25fr) minmax(190px, 1.15fr) minmax(112px, 0.62fr) minmax(130px, auto);
  align-items: center;
  gap: 14px 18px;
}

body[data-role="manager"] #leaveTable td[data-label="Trạng thái"],
body[data-role="hr_admin"] #leaveTable td[data-label="Trạng thái"],
body[data-role="director"] #leaveTable td[data-label="Trạng thái"] {
  justify-self: end;
}

body[data-role="manager"] #leaveTable td[data-label="Lý do / phản hồi"],
body[data-role="hr_admin"] #leaveTable td[data-label="Lý do / phản hồi"],
body[data-role="director"] #leaveTable td[data-label="Lý do / phản hồi"],
body[data-role="manager"] #leaveTable td[data-label="Ghi chú"],
body[data-role="hr_admin"] #leaveTable td[data-label="Ghi chú"],
body[data-role="director"] #leaveTable td[data-label="Ghi chú"] {
  grid-column: 1 / -1;
  padding-top: 10px;
}

body[data-role="manager"] #leaveTable td.actions,
body[data-role="hr_admin"] #leaveTable td.actions,
body[data-role="director"] #leaveTable td.actions {
  justify-self: end;
}

body[data-role="manager"] #leaveTable tr:has(td.actions:empty),
body[data-role="hr_admin"] #leaveTable tr:has(td.actions:empty),
body[data-role="director"] #leaveTable tr:has(td.actions:empty) {
  grid-template-columns: minmax(180px, 1.25fr) minmax(190px, 1.2fr) minmax(120px, auto);
}

body[data-role="manager"] #leaveTable tr:has(td.actions:empty) td[data-label="Trạng thái"],
body[data-role="hr_admin"] #leaveTable tr:has(td.actions:empty) td[data-label="Trạng thái"],
body[data-role="director"] #leaveTable tr:has(td.actions:empty) td[data-label="Trạng thái"] {
  grid-column: 3;
  justify-self: end;
}

body[data-role="manager"] #leaveTable tr:has(td.actions:empty) td.actions,
body[data-role="hr_admin"] #leaveTable tr:has(td.actions:empty) td.actions,
body[data-role="director"] #leaveTable tr:has(td.actions:empty) td.actions {
  display: none;
}

@media (max-width: 760px) {
  body[data-role="manager"] #leaveTable tr,
  body[data-role="hr_admin"] #leaveTable tr,
  body[data-role="director"] #leaveTable tr,
  body[data-role="manager"] #leaveTable tr:has(td.actions:empty),
  body[data-role="hr_admin"] #leaveTable tr:has(td.actions:empty),
  body[data-role="director"] #leaveTable tr:has(td.actions:empty) {
    grid-template-columns: 1fr;
  }

  body[data-role="manager"] #leaveTable tr:has(td.actions:empty) td[data-label="Trạng thái"],
  body[data-role="hr_admin"] #leaveTable tr:has(td.actions:empty) td[data-label="Trạng thái"],
  body[data-role="director"] #leaveTable tr:has(td.actions:empty) td[data-label="Trạng thái"] {
    grid-column: auto;
    justify-self: start;
  }
}

@media (max-width: 520px) {
  .metrics {
    grid-template-columns: 1fr;
  }

  .metric-wide {
    grid-column: auto;
  }

  .employee-action-menu {
    grid-template-columns: 1fr;
  }

  .employee-info-grid,
  .employee-actions {
    grid-template-columns: 1fr;
  }

  .employee-record {
    grid-template-columns: 1fr;
  }

  .employee-actions {
    grid-column: auto;
  }

  .employee-actions.compact {
    display: flex;
  }

  #employeeTable.employee-card-table tr {
    grid-template-columns: 1fr 1fr;
  }

  #employeeTable.employee-card-table td:nth-child(2),
  #employeeTable.employee-card-table td[data-label="Lịch/ca"],
  #employeeTable.employee-card-table td[data-label="Tài khoản"],
  #employeeTable.employee-card-table td[data-label="Đổi trạng thái"],
  #employeeTable.employee-card-table td[data-label="Thiết bị WiFi"] {
    grid-column: 1 / -1;
  }

  #leaveTable tr {
    grid-template-columns: 1fr 1fr;
  }

  #leaveTable td.actions {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  #leaveTable td.actions .ghost,
  #leaveTable td.actions .danger {
    width: 100%;
  }

  .attendance-mini-list em {
    text-align: left;
  }
}

/* iHRM dark responsive layout refresh */
:root {
  --ink: #f8fbff;
  --muted: rgba(248, 251, 255, 0.64);
  --line: rgba(255, 255, 255, 0.08);
  --panel: rgba(20, 22, 42, 0.92);
  --canvas: #0b1020;
  --nav: #f8fbff;
  --nav-soft: #f8fbff;
  --blue: #00d4ff;
  --green: #00e5a0;
  --red: #ff5f7e;
  --amber: #ffd166;
  --violet: #a78bfa;
  --teal: #00d4ff;
  --text: rgba(248, 251, 255, 0.82);
  --radius: 10px;
  --radius-lg: 18px;
  --shadow-sm: 0 12px 34px rgba(0, 0, 0, 0.22);
  --shadow: 0 18px 54px rgba(0, 0, 0, 0.34);
  --shadow-lg: 0 28px 90px rgba(0, 0, 0, 0.55);
}

body {
  grid-template-columns: 252px minmax(0, 1fr);
  background: #f5f7fa;
  color: var(--ink);
}

body::before { display: none; }

body::after { display: none; }

.sidebar,
.shell {
  position: relative;
  z-index: 1;
}


.sidebar {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 22px 14px;
  background:
    linear-gradient(180deg, rgba(21, 24, 47, 0.98), rgba(13, 16, 32, 0.98)),
    radial-gradient(circle at top left, rgba(0, 212, 255, 0.2), transparent 42%);
  border-right: 1px solid var(--line);
  box-shadow: 16px 0 50px rgba(0, 0, 0, 0.28);
}

.sidebar::before {
  display: none;
}

.brand {
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 8px 22px;
  text-align: center;
  border-bottom-color: var(--line);
}

.brand-logo {
  width: 176px;
  height: 78px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 16px;
  box-shadow: inset 0 0 0 1px var(--line), 0 12px 30px rgba(0, 0, 0, 0.20);
}

.brand strong {
  color: #fff;
  font-size: 18px;
  line-height: 1.15;
}

.brand div {
  display: grid;
  gap: 4px;
  justify-items: center;
}

.brand span,
.panel-head span,
.employee-hero span,
.employee-action-menu span,
.employee-notice p,
.org-card p,
.org-card dt,
.metric span,
.payroll-action-card span,
.wifi-card-body p,
.hint,
.list-item span,
.permission-card span,
.employee-identity span:not(.employee-code),
.employee-kv small,
.detail-section p,
.attendance-mini-list span,
.contract-card-head p,
.contract-summary-actions span,
.contract-meta b,
.contract-clause-grid b,
.employee-bar span {
  color: var(--muted);
}

.nav {
  gap: 5px;
  margin-top: 18px;
}

.nav button {
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(248, 251, 255, 0.68);
  background: transparent;
  font-weight: 700;
}

.nav button:hover,
.nav button.active {
  color: #fff;
  background: rgba(0, 212, 255, 0.10);
  box-shadow: inset 3px 0 0 var(--blue);
  transform: none;
}

.shell {
  width: min(100%, 1440px);
  padding: 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: -24px -24px 22px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 13, 27, 0.78);
  backdrop-filter: none;
}

.eyebrow {
  color: var(--blue);
  letter-spacing: 0.08em;
}

h1 {
  color: #fff;
  font-size: 26px;
}

h2,
.employee-hero h2,
.employee-action-menu strong,
.employee-notice strong,
.org-card h3,
.metric strong,
.list-item strong,
.permission-card strong,
.detail-section h3,
.attendance-mini-list strong,
.contract-card-head h3,
label {
  color: #fff;
}

.user-chip,
.metric,
.panel,
.employee-action-menu button,
.employee-notice,
.org-card,
.contract-card,
.list-item,
.permission-card,
.detail-kv,
.detail-section,
.attendance-mini-list article,
.payroll-action-card,
.contract-meta span,
.contract-clause-grid span,
.guard,
.status-message {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.panel,
.metric,
.employee-action-menu button,
.employee-notice,
.org-card,
.contract-card,
.list-item,
.permission-card,
.detail-kv,
.detail-section,
.payroll-action-card {
  backdrop-filter: none;
}

.panel {
  border-radius: 12px;
}

.panel-head {
  min-height: 60px;
  border-bottom-color: var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018));
}

.metrics {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

.metric {
  min-height: 112px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(0, 212, 255, 0.10), rgba(167, 139, 250, 0.035)),
    var(--panel);
}

.metric::before {
  height: 2px;
  background: linear-gradient(90deg, var(--blue), var(--green), var(--violet));
}

.metric:hover,
.employee-action-menu button:hover,
.action-list-item:hover,
.dashboard-task:hover {
  border-color: rgba(0, 212, 255, 0.34);
  background: rgba(26, 30, 56, 0.96);
  transform: translateY(-1px);
}

.employee-hero {
  min-height: 142px;
  border-color: rgba(0, 212, 255, 0.22);
  background:
    radial-gradient(circle at 82% 18%, rgba(0, 229, 160, 0.16), transparent 34%),
    linear-gradient(135deg, rgba(0, 212, 255, 0.16), rgba(167, 139, 250, 0.08)),
    var(--panel);
  box-shadow: var(--shadow);
}

.employee-action-menu {
  gap: 12px;
}

.employee-action-menu button {
  min-height: 112px;
  border-radius: 12px;
  background: rgba(20, 22, 42, 0.84);
}

.employee-action-menu button::before {
  background: linear-gradient(135deg, var(--blue), var(--green));
  box-shadow: 0 0 0 5px rgba(0, 212, 255, 0.10), 0 0 18px rgba(0, 212, 255, 0.25);
}

.employee-notice.ok,
.org-card:nth-child(even),
.contract-card:nth-child(even),
#leaveTable tbody tr:nth-child(even),
.employee-record:nth-child(even) {
  background: rgba(0, 229, 160, 0.055);
}

.employee-notice.warn,
.alert-item {
  background: rgba(255, 209, 102, 0.08);
  border-color: rgba(255, 209, 102, 0.22);
}

.employee-notice.bad,
.alert-item.high {
  background: rgba(255, 95, 126, 0.08);
  border-color: rgba(255, 95, 126, 0.24);
}

.org-card.lead,
.payroll-actions.standalone {
  border-color: rgba(0, 212, 255, 0.26);
  background:
    linear-gradient(135deg, rgba(0, 212, 255, 0.10), rgba(0, 229, 160, 0.04)),
    var(--panel);
}

.org-directory.org-tree {
  padding: 14px;
}

.org-unit {
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.018)),
    var(--panel);
  box-shadow: var(--shadow-sm);
  backdrop-filter: none;
}

.org-board {
  border-color: rgba(255, 209, 102, 0.64);
  background:
    radial-gradient(circle at 92% 12%, rgba(255, 209, 102, 0.28), transparent 28%),
    linear-gradient(135deg, rgba(255, 209, 102, 0.20), rgba(0, 212, 255, 0.07) 52%, rgba(0, 229, 160, 0.06)),
    var(--panel);
  box-shadow: 0 20px 48px rgba(255, 209, 102, 0.13), var(--shadow-sm);
}

.org-board > .org-unit-head span {
  color: #ffd166;
}

.org-board > .org-unit-head h3 {
  color: #fff7d6;
}

.org-board > .org-unit-head p {
  color: rgba(255, 247, 214, 0.72);
}

.org-board > .org-name-list li {
  border-color: rgba(255, 209, 102, 0.50);
  background: rgba(255, 209, 102, 0.13);
}

.org-department {
  background: rgba(20, 22, 42, 0.84);
}

.org-unit-head h3 {
  color: #fff;
}

.org-unit-head p {
  color: var(--muted);
}

.org-unit-head span {
  color: var(--blue);
}

.org-unit-children,
.org-member-list {
  min-width: 0;
}

.org-member-list .org-card {
  min-height: 0;
  background: linear-gradient(180deg, #ffffff, #f4fbfb) !important;
  color: #10233f !important;
  border-color: rgba(20, 152, 173, 0.18) !important;
}

.org-name-list li {
  border-color: rgba(20, 152, 173, 0.20) !important;
  background: linear-gradient(180deg, #ffffff, #f0fbfb) !important;
  color: #10233f !important;
}

.org-name-list li.manager {
  border-color: rgba(14, 130, 100, 0.28) !important;
  background: rgba(20, 200, 160, 0.09) !important;
  color: #0f6f7d !important;
}

.form {
  gap: 13px;
}

.form-section-title {
  border-color: rgba(0, 212, 255, 0.18);
  border-left-color: var(--blue);
  color: #fff;
  background: rgba(0, 212, 255, 0.08);
}

input,
select,
textarea,
.inline-select {
  border-color: var(--line);
  color: #fff;
  background: rgba(7, 10, 22, 0.72);
  color-scheme: dark;
}

input[type="date"],
input[type="month"],
input[type="time"] {
  color-scheme: dark;
}

input[data-date-display="true"] {
  cursor: pointer;
  padding-right: 40px;
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 16px 16px;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  width: 28px;
  height: 28px;
  margin-right: -4px;
  filter: invert(1) brightness(1.35) saturate(0.9);
  opacity: 0.86;
  cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

input::placeholder,
textarea::placeholder {
  color: rgba(248, 251, 255, 0.34);
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(0, 212, 255, 0.13);
  border-color: rgba(0, 212, 255, 0.72);
}

select option {
  background: #11162b;
  color: #fff;
}

.primary,
.ghost,
.danger,
.as-link {
  border-radius: 999px;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.primary {
  background: linear-gradient(135deg, #00a6ff, #00e5a0);
  color: #05111f;
  box-shadow: 0 12px 24px rgba(0, 212, 255, 0.22);
}

.ghost {
  border: 1px solid rgba(0, 212, 255, 0.24);
  background: rgba(0, 212, 255, 0.08);
  color: var(--blue);
}

.danger {
  border: 1px solid rgba(255, 95, 126, 0.24);
  background: rgba(255, 95, 126, 0.10);
  color: #ff9bad;
}

.primary:hover,
.ghost:hover,
.danger:hover {
  transform: translateY(-1px);
}

.badge {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 251, 255, 0.74);
}

.badge.ok {
  background: rgba(0, 229, 160, 0.14);
  color: var(--green);
}

.badge.warn {
  background: rgba(255, 209, 102, 0.14);
  color: var(--amber);
}

.badge.bad {
  background: rgba(255, 95, 126, 0.14);
  color: #ff8fa3;
}

.badge.contract {
  background: rgba(0, 212, 255, 0.14);
  color: var(--blue);
}

.hint,
.payroll-actions {
  border-color: rgba(0, 212, 255, 0.18);
  background: rgba(0, 212, 255, 0.07);
}

th {
  border-bottom-color: var(--line);
  color: rgba(248, 251, 255, 0.66);
  background: rgba(255, 255, 255, 0.045);
}

td {
  border-bottom-color: var(--line);
  color: rgba(248, 251, 255, 0.84);
}

#leaveTable tr,
#employeeTable.employee-card-table tr,
.employee-record {
  border-color: var(--line);
  background: rgba(20, 22, 42, 0.84);
}

#leaveTable td[data-label="Ghi chú"],
body[data-role="manager"] #leaveTable td[data-label="Lý do / phản hồi"],
.employee-action-block,
#employeeTable.employee-card-table td[data-label="Tài khoản"],
#employeeTable.employee-card-table td[data-label="Đổi trạng thái"],
#employeeTable.employee-card-table td[data-label="Thiết bị WiFi"] {
  border-color: rgba(255, 255, 255, 0.09);
}

.employee-code {
  background: rgba(0, 212, 255, 0.12);
  color: var(--blue);
}

.employee-detail-tabs {
  border-top-color: var(--line);
}

.employee-detail-tabs button {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.employee-detail-tabs button.active {
  border-color: rgba(0, 212, 255, 0.32);
  background: rgba(0, 212, 255, 0.11);
  color: var(--blue);
}

.modal {
  background: rgba(2, 6, 18, 0.72);
  backdrop-filter: none;
}

.modal-card {
  border: 1px solid var(--line);
  background: #101429;
}

.employee-entry-card .panel-head {
  background: linear-gradient(180deg, rgba(18, 22, 42, 0.98), rgba(18, 22, 42, 0.92));
}

.form-actions-sticky {
  background: linear-gradient(180deg, rgba(255,255,255,0), #fff 35%) !important;
}

.contract-document,
.contract-allowance-table th,
.contract-allowance-table td {
  border-color: var(--line);
  background: rgba(7, 10, 22, 0.62);
}

.contract-signatures span {
  border-top-color: rgba(255, 255, 255, 0.16);
}

.salary-eye {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

#toast {
  color: #06111e;
  background: linear-gradient(135deg, var(--blue), var(--green));
  box-shadow: 0 18px 42px rgba(0, 212, 255, 0.20);
}

@media (max-width: 1100px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    padding: 16px;
  }

  .brand {
    padding-bottom: 14px;
  }

  .nav {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav button {
    white-space: nowrap;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 16px;
  }

  .topbar {
    margin: -16px -16px 18px;
    padding: 14px 16px;
  }

  .sidebar {
    padding: 14px;
  }

  .brand-logo {
    width: 48px;
    height: 48px;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics,
  .employee-action-menu {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 96px;
  }

  h1 {
    font-size: 22px;
  }

  .modal {
    padding: 10px;
    place-items: end center;
  }

  .modal-card,
  .employee-entry-card,
  .contract-detail-card {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 20px);
    border-radius: 16px 16px 0 0;
  }
}

/* Mobile app shell inspired by the compact iHRM mockup */
@media (max-width: 760px) {
  :root {
    --mobile-bg: #070713;
    --mobile-surface: rgba(18, 15, 42, 0.94);
    --mobile-surface-2: rgba(24, 20, 56, 0.94);
    --mobile-border: rgba(255, 255, 255, 0.08);
    --mobile-accent: #6d5cff;
    --mobile-cyan: #16d9ff;
    --mobile-pink: #f044ff;
  }

  html,
  body {
    min-height: 100%;
    background: var(--mobile-bg);
  }

  body {
    display: block;
    padding: 0 0 calc(78px + env(safe-area-inset-bottom));
    color: #fff;
    background:
      radial-gradient(circle at 18% 8%, rgba(109, 92, 255, 0.24), transparent 30%),
      radial-gradient(circle at 85% 16%, rgba(22, 217, 255, 0.16), transparent 32%),
      linear-gradient(180deg, #080817 0%, #090719 52%, #061320 100%);
  }

  body::before,
  body::after {
    opacity: 0.46;
  }

  .shell {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 72px 12px 18px;
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 900;
    height: auto;
    padding: 7px max(8px, env(safe-area-inset-left)) calc(7px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-right));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-width: 1px 0 0;
    background: rgba(8, 8, 22, 0.92);
    box-shadow: 0 -18px 38px rgba(0, 0, 0, 0.42);
    backdrop-filter: none;
  }

  .brand {
    display: none;
  }

  .nav {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(64px, 1fr);
    grid-template-columns: none;
    gap: 5px;
    margin: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav button {
    display: grid;
    place-items: center;
    gap: 3px;
    min-width: 64px;
    min-height: 54px;
    padding: 6px 4px;
    border-radius: 13px;
    color: rgba(255, 255, 255, 0.54);
    background: transparent;
    box-shadow: none;
    font-size: 10px;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
  }

  .nav button::before {
    display: grid;
    place-items: center;
    width: 26px;
    height: 22px;
    margin: 0;
    border-radius: 10px;
    color: currentColor;
    font-size: 16px;
    font-weight: 900;
    line-height: 1;
    background: transparent;
    opacity: 1;
    transform: none;
  }

  .nav button:hover,
  .nav button.active {
    color: #fff;
    background: rgba(109, 92, 255, 0.18);
    box-shadow: none;
    transform: none;
  }

  .nav button.active::before {
    color: #050511;
    background: linear-gradient(135deg, #6d5cff, #16d9ff);
    box-shadow: 0 0 18px rgba(109, 92, 255, 0.44);
  }

  .topbar {
    position: fixed;
    top: 0;
    left: 50%;
    z-index: 850;
    width: min(100%, 520px);
    min-height: 64px;
    margin: 0;
    padding: 11px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(8, 8, 22, 0.82);
    backdrop-filter: none;
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

  .topbar > div:first-child {
    min-width: 0;
    padding-left: 42px;
    position: relative;
  }

  .topbar > div:first-child::before {
    content: "HR";
    position: absolute;
    left: 0;
    top: 50%;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    background: linear-gradient(135deg, #2534ff, #00d4ff);
    transform: translateY(-50%);
    box-shadow: 0 10px 24px rgba(37, 52, 255, 0.34);
  }

  .topbar .eyebrow {
    margin: 0 0 2px;
    max-width: 100%;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.54);
    font-size: 9px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0;
    text-transform: none;
  }

  h1,
  #pageTitle {
    max-width: 100%;
    overflow: hidden;
    color: #fff;
    font-size: 15px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .user-tools {
    width: auto;
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .user-chip {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    justify-content: center;
    border: 0;
    color: transparent;
    background: rgba(109, 92, 255, 0.22);
  }

  .user-chip .dot {
    width: 14px;
    height: 14px;
    background:
      radial-gradient(circle at 50% 30%, #fff 0 16%, transparent 17%),
      radial-gradient(circle at 50% 78%, #fff 0 26%, transparent 27%),
      transparent;
  }

  #activeRoleLabel {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  #logoutBtn {
    min-width: 38px;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 11px;
    font-size: 0;
    background: rgba(109, 92, 255, 0.24);
  }

  #logoutBtn::before {
    content: "Exit";
    font-size: 10px;
    color: #fff;
  }

  .view {
    min-width: 0;
  }

  .employee-home,
  #adminDashboard,
  .grid,
  .grid.two,
  .grid.form-table {
    gap: 11px;
  }

  .employee-hero {
    min-height: 122px;
    padding: 15px;
    border-radius: 16px;
    border-color: rgba(109, 92, 255, 0.22);
    background:
      radial-gradient(circle at 88% 18%, rgba(109, 92, 255, 0.44), transparent 34%),
      linear-gradient(145deg, rgba(23, 19, 57, 0.98), rgba(15, 13, 38, 0.98));
  }

  .employee-hero .eyebrow {
    color: rgba(255, 255, 255, 0.48);
    font-size: 10px;
    letter-spacing: 0;
    text-transform: none;
  }

  .employee-hero h2 {
    max-width: 70%;
    color: #6ddcff;
    font-size: 22px;
    line-height: 1.12;
  }

  .employee-hero span {
    display: block;
    max-width: 78%;
    color: rgba(255, 255, 255, 0.76);
    font-size: 12px;
    line-height: 1.45;
  }

  .employee-action-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .employee-action-menu button {
    min-height: 86px;
    padding: 13px 12px;
    border-radius: 14px;
    background: linear-gradient(160deg, rgba(26, 22, 64, 0.98), rgba(14, 13, 35, 0.96));
  }

  .employee-action-menu button::before {
    left: auto;
    right: 12px;
    top: 12px;
    width: 7px;
    height: 7px;
    box-shadow: 0 0 12px rgba(22, 217, 255, 0.65);
  }

  .employee-action-menu strong {
    padding-right: 12px;
    font-size: 13px;
  }

  .employee-action-menu span {
    font-size: 11px;
    line-height: 1.35;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 11px;
  }

  .metric,
  .metric-wide {
    grid-column: auto;
  }

  .metric {
    min-height: 116px;
    padding: 13px 12px 32px;
    border-radius: 14px;
    background:
      radial-gradient(circle at 90% 12%, rgba(22, 217, 255, 0.20), transparent 24%),
      linear-gradient(160deg, rgba(25, 21, 63, 0.98), rgba(12, 11, 32, 0.98));
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
  }

  .metric::before {
    inset: auto 12px 12px;
    width: calc(100% - 24px);
    height: 25px;
    border-radius: 50%;
    background: none;
    border-bottom: 2px solid var(--mobile-cyan);
    border-right: 2px solid transparent;
    transform: skewX(-22deg);
    opacity: 0.88;
  }

  .metric::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 11px;
    height: 16px;
    border-radius: 50%;
    border-bottom: 2px solid rgba(22, 217, 255, 0.34);
    transform: skewX(18deg) translateY(-4px);
  }

  .metric:nth-child(2)::before,
  .metric:nth-child(2)::after,
  .metric:nth-child(4)::before,
  .metric:nth-child(4)::after {
    border-bottom-color: var(--mobile-pink);
  }

  .metric span {
    display: block;
    min-height: 24px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 10px;
    line-height: 1.25;
  }

  .metric strong {
    margin-top: 7px;
    color: #fff;
    font-size: clamp(18px, 6vw, 24px);
    line-height: 1.05;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .metric:nth-child(2) strong,
  .metric:nth-child(4) strong {
    color: var(--mobile-pink);
  }

  .metric:nth-child(3) strong {
    color: #fff;
  }

  .salary-eye {
    right: 10px;
    bottom: 9px;
    width: 26px;
    height: 26px;
    border-radius: 9px;
    font-size: 12px;
  }

  .panel {
    border-radius: 14px;
    background: var(--mobile-surface);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
  }

  .panel-head {
    min-height: 48px;
    padding: 13px 14px;
    flex-direction: row;
    align-items: center;
    border-bottom-color: rgba(255, 255, 255, 0.07);
  }

  .panel-head h2 {
    font-size: 14px;
    line-height: 1.25;
  }

  .panel-head span {
    font-size: 10px;
  }

  .permission-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .permission-card,
  .list-item,
  .employee-notice,
  .org-unit,
  .org-card,
  .contract-card,
  .payroll-action-card {
    border-radius: 12px;
    background: var(--mobile-surface-2);
  }

  .form {
    padding: 0 12px 14px;
  }

  .form .panel-head {
    margin: 0 -12px;
  }

  .row,
  .grid.two,
  .org-unit-children,
  .org-member-list,
  #attendance .grid.form-table,
  #payroll .grid.form-table,
  body[data-role="employee"] #attendance .grid.form-table,
  .grid.form-table {
    grid-template-columns: 1fr;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    border-radius: 11px;
    font-size: 14px;
  }

  .primary,
  .ghost,
  .danger,
  .as-link {
    min-height: 42px;
    border-radius: 12px;
  }

  .table-wrap {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  th,
  td {
    padding: 10px 11px;
    font-size: 12px;
  }

  .modal {
    z-index: 1200;
    padding: 8px;
  }

  #toast {
    left: 12px;
    right: 12px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    width: auto;
    min-width: 0;
    transform: translateY(18px);
  }

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

@media (max-width: 520px) {
  .shell {
    max-width: 390px;
    padding-inline: 10px;
  }

  .topbar {
    max-width: 390px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    min-height: 112px;
    padding: 12px 10px 30px;
  }

  .metric strong {
    font-size: clamp(17px, 6.4vw, 22px);
  }

  .metric span {
    font-size: 9px;
  }

  .permission-grid,
  .employee-action-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-head {
    padding: 12px;
  }

  .panel-head h2 {
    font-size: 13px;
  }

  .employee-panel-tools {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* Final menu icon override: SVG-only, no encoded text glyphs */
.nav button {
  gap: 10px !important;
}

.nav button::before {
  content: "" !important;
  display: inline-grid !important;
  place-items: center !important;
  width: 24px !important;
  min-width: 24px !important;
  height: 24px !important;
  border: 1px solid rgba(0, 212, 255, 0.18) !important;
  border-radius: 8px !important;
  background-color: rgba(0, 212, 255, 0.08) !important;
  background-image: var(--icon, var(--i-dashboard)) !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 16px 16px !important;
  box-shadow: none !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
  opacity: 1 !important;
}

.nav button[data-view="dashboard"] { --icon: var(--i-dashboard); }
.nav button[data-view="employees"] { --icon: var(--i-users); }
.nav button[data-view="contracts"] { --icon: var(--i-file); }
.nav button[data-view="leave"] { --icon: var(--i-check); }
.nav button[data-view="attendance"] { --icon: var(--i-clock); }
.nav button[data-view="attendanceLogs"] { --icon: var(--i-file); }
.nav button[data-view="payroll"] { --icon: var(--i-wallet); }
.nav button[data-view="recruitment"] { --icon: var(--i-plus); }
.nav button[data-view="training"] { --icon: var(--i-book); }
.nav button[data-view="comms"] { --icon: var(--i-mail); }
.nav button[data-view="org"] { --icon: var(--i-org); }

.nav button:hover::before,
.nav button.active::before {
  border-color: rgba(0, 212, 255, 0.42) !important;
  background-color: rgba(0, 212, 255, 0.16) !important;
  background-image: var(--icon, var(--i-dashboard)) !important;
  box-shadow: 0 0 18px rgba(0, 212, 255, 0.16) !important;
}

@media (max-width: 760px) {
  .nav button {
    gap: 3px !important;
  }

  .nav button::before {
    width: 28px !important;
    min-width: 28px !important;
    height: 24px !important;
    border-radius: 10px !important;
    background-size: 17px 17px !important;
  }

  .nav button.active::before {
    border-color: rgba(109, 92, 255, 0.42) !important;
    background-color: rgba(109, 92, 255, 0.28) !important;
    background-image: var(--icon, var(--i-dashboard)) !important;
    box-shadow: 0 0 18px rgba(109, 92, 255, 0.38) !important;
  }
}

/* Employee overtime page: keep request list in the first viewport */
@media (min-width: 761px) {
  body[data-role="manager"] #attendance .grid.form-table {
    grid-template-columns: minmax(380px, 0.72fr) minmax(560px, 1.28fr) !important;
    align-items: start;
  }

  body[data-role="employee"] #attendance .grid.form-table {
    grid-template-columns: minmax(320px, 0.42fr) minmax(0, 1fr) !important;
    align-items: start;
  }

  body[data-role="manager"] #overtimeForm,
  body[data-role="employee"] #overtimeForm {
    order: 1;
    align-self: start;
  }

  body[data-role="hr_admin"] #overtimeForm,
  body[data-role="hr_staff"] #overtimeForm,
  body[data-role="director"] #overtimeForm {
    order: 1;
    align-self: start;
  }

  body[data-role="manager"] #attendance .overtime-review-panel,
  body[data-role="employee"] #attendance .overtime-review-panel,
  body[data-role="hr_admin"] #attendance .overtime-review-panel,
  body[data-role="hr_staff"] #attendance .overtime-review-panel,
  body[data-role="director"] #attendance .overtime-review-panel {
    order: 2;
    grid-column: auto !important;
    min-width: 0;
  }

  body[data-role="manager"] #attendance .overtime-review-panel .table-wrap,
  body[data-role="employee"] #attendance .overtime-review-panel .table-wrap {
    max-height: calc(100vh - 236px);
  }
}

@media (max-width: 760px) {
  body[data-role="employee"] #attendance .grid.form-table {
    grid-template-columns: 1fr !important;
  }

  body[data-role="employee"] #attendance .overtime-review-panel {
    order: 2;
    grid-column: 1 / -1 !important;
  }

  body[data-role="employee"] #overtimeForm {
    order: 1;
  }
}

/* Mobile overtime cards: status and feedback stay visible without horizontal scroll */
@media (max-width: 760px) {
  body[data-role="employee"] #attendance .overtime-review-panel .table-wrap {
    overflow: visible !important;
  }

  body[data-role="employee"] #overtimeTable,
  body[data-role="employee"] #overtimeTable thead,
  body[data-role="employee"] #overtimeTable tbody,
  body[data-role="employee"] #overtimeTable tr,
  body[data-role="employee"] #overtimeTable td {
    display: block;
  }

  body[data-role="employee"] #overtimeTable thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  body[data-role="employee"] #overtimeTable tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  body[data-role="employee"] #overtimeTable tr {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr) minmax(54px, auto);
    gap: 9px 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(20, 22, 42, 0.92);
  }

  body[data-role="employee"] #overtimeTable td {
    min-width: 0;
    padding: 0;
    border: 0;
    color: rgba(248, 251, 255, 0.86);
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  body[data-role="employee"] #overtimeTable td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: rgba(248, 251, 255, 0.46);
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
  }

  body[data-role="employee"] #overtimeTable td:nth-child(4),
  body[data-role="employee"] #overtimeTable td:nth-child(5),
  body[data-role="employee"] #overtimeTable td:nth-child(6) {
    grid-column: 1 / -1;
  }

  body[data-role="employee"] #overtimeTable td:nth-child(5) {
    padding-top: 8px;
    border-top: 1px dashed rgba(255, 255, 255, 0.10);
  }

  body[data-role="employee"] #overtimeTable td:nth-child(5) .badge {
    display: inline-flex;
    max-width: 100%;
    white-space: normal;
  }

  body[data-role="employee"] #overtimeTable td:nth-child(6) {
    color: rgba(248, 251, 255, 0.72);
  }
}

/* Overtime approval cards aligned with leave approval proportions */
#overtimeTable,
#overtimeTable thead,
#overtimeTable tbody,
#overtimeTable tr,
#overtimeTable td {
  display: block;
}

#overtimeTable thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

#overtimeTable tbody {
  display: grid;
  gap: 10px;
  padding: 12px;
}

#overtimeTable tr {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(170px, 1.25fr) minmax(92px, 0.58fr) minmax(112px, auto);
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card-bg, #ffffff);
}

#overtimeTable td {
  min-width: 0;
  padding: 0;
  border-bottom: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

#overtimeTable td span:not(.badge) {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

#overtimeTable td[data-label="Ghi chú"],
#overtimeTable td[data-label="Lý do / phản hồi"],
#overtimeTable td[data-label="Phản hồi"] {
  grid-column: 1 / -1;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.10);
}

/* Night Shift (Trực đêm) tab styles - synchronized with leave/overtime tables */
#nightShift .grid.form-table {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
}

#nightShift .overtime-review-panel {
  grid-column: 1 / -1;
}

#nightShiftTable,
#nightShiftTable thead,
#nightShiftTable tbody,
#nightShiftTable tr,
#nightShiftTable td {
  display: block;
}

#nightShiftTable thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

#nightShiftTable tbody {
  display: grid;
  gap: 10px;
  padding: 12px;
}

#nightShiftTable tr {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(170px, 1.25fr) minmax(92px, 0.58fr) minmax(112px, auto);
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card-bg, #ffffff);
}

#nightShiftTable td {
  min-width: 0;
  padding: 0;
  border-bottom: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
  color: rgba(255, 255, 255, 0.9);
}

#nightShiftTable td span:not(.badge) {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.6);
}

#nightShiftTable td[data-label="Lý do"],
#nightShiftTable td[data-label="Ghi chú"] {
  grid-column: 1 / -1;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.10);
}

#nightShiftTable td.actions {
  min-width: 0;
  justify-self: end;
}

#nightShiftTable .badge {
  max-width: 100%;
  white-space: normal;
}

/* Employee role - compact night shift table */
body[data-role="employee"] #nightShiftTable tr {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr) minmax(54px, auto);
}

body[data-role="employee"] #nightShiftTable td:nth-child(4),
body[data-role="employee"] #nightShiftTable td:nth-child(5),
body[data-role="employee"] #nightShiftTable td:nth-child(6) {
  grid-column: 1 / -1;
}

/* Manager/HR role - wider first column */
body[data-role="manager"] #nightShiftTable tr,
body[data-role="hr_admin"] #nightShiftTable tr,
body[data-role="hr_staff"] #nightShiftTable tr,
body[data-role="director"] #nightShiftTable tr {
  grid-template-columns: minmax(0, 1.25fr) minmax(118px, 0.78fr) minmax(118px, 0.78fr) minmax(118px, auto);
  align-items: start;
}

body[data-role="manager"] #nightShiftTable td,
body[data-role="hr_admin"] #nightShiftTable td,
body[data-role="hr_staff"] #nightShiftTable td,
body[data-role="director"] #nightShiftTable td {
  width: auto !important;
}

body[data-role="manager"] #nightShiftTable td:nth-child(1) span,
body[data-role="hr_admin"] #nightShiftTable td:nth-child(1) span,
body[data-role="hr_staff"] #nightShiftTable td:nth-child(1) span,
body[data-role="director"] #nightShiftTable td:nth-child(1) span {
  display: block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.10);
  color: var(--muted);
}

body[data-role="manager"] #nightShiftTable td:nth-child(3) .badge,
body[data-role="hr_admin"] #nightShiftTable td:nth-child(3) .badge,
body[data-role="hr_staff"] #nightShiftTable td:nth-child(3) .badge,
body[data-role="director"] #nightShiftTable td:nth-child(3) .badge {
  margin-top: 6px;
}

body[data-role="manager"] #nightShiftTable td.actions,
body[data-role="hr_admin"] #nightShiftTable td.actions,
body[data-role="hr_staff"] #nightShiftTable td.actions,
body[data-role="director"] #nightShiftTable td.actions {
  justify-self: end;
}

/* Mobile night shift table - no horizontal scroll, card layout */
@media (max-width: 760px) {
  body[data-role="employee"] #nightShift .grid.form-table {
    grid-template-columns: 1fr !important;
  }

  body[data-role="employee"] #nightShift .overtime-review-panel {
    order: 2;
    grid-column: 1 / -1 !important;
  }

  body[data-role="employee"] #nightShiftForm {
    order: 1;
  }

  body[data-role="employee"] #nightShift .overtime-review-panel .table-wrap {
    max-height: calc(100vh - 236px);
  }

  /* Mobile employee night shift cards */
  body[data-role="employee"] #nightShift .overtime-review-panel .table-wrap {
    overflow: visible !important;
  }

  body[data-role="employee"] #nightShiftTable,
  body[data-role="employee"] #nightShiftTable thead,
  body[data-role="employee"] #nightShiftTable tbody,
  body[data-role="employee"] #nightShiftTable tr,
  body[data-role="employee"] #nightShiftTable td {
    display: block;
  }

  body[data-role="employee"] #nightShiftTable thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  body[data-role="employee"] #nightShiftTable tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  body[data-role="employee"] #nightShiftTable tr {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr) minmax(54px, auto);
    gap: 9px 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(20, 22, 42, 0.92);
  }

  body[data-role="employee"] #nightShiftTable td {
    min-width: 0;
    padding: 0;
    border: 0;
    color: rgba(248, 251, 255, 0.86);
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  body[data-role="employee"] #nightShiftTable td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: rgba(248, 251, 255, 0.46);
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
  }

  body[data-role="employee"] #nightShiftTable td:nth-child(4),
  body[data-role="employee"] #nightShiftTable td:nth-child(5),
  body[data-role="employee"] #nightShiftTable td:nth-child(6) {
    grid-column: 1 / -1;
  }

  body[data-role="employee"] #nightShiftTable td:nth-child(5) {
    padding-top: 8px;
    border-top: 1px dashed rgba(255, 255, 255, 0.10);
  }

  body[data-role="employee"] #nightShiftTable td:nth-child(5) .badge {
    display: inline-flex;
    max-width: 100%;
    white-space: normal;
  }

  body[data-role="employee"] #nightShiftTable td:nth-child(6) {
    color: rgba(248, 251, 255, 0.72);
  }

  /* Mobile manager/HR night shift cards */
  body:not([data-role="employee"]) #nightShiftTable tr {
    grid-template-columns: 1fr 1fr !important;
  }
  body:not([data-role="employee"]) #nightShiftTable td:nth-child(1) {
    grid-column: 1 / -1 !important;
  }
  body:not([data-role="employee"]) #nightShiftTable td.actions,
  body:not([data-role="employee"]) #nightShiftTable td:nth-child(4),
  body:not([data-role="employee"]) #nightShiftTable td:nth-child(5) {
    grid-column: 1 / -1 !important;
    justify-self: stretch !important;
  }
  body:not([data-role="employee"]) #nightShiftTable td.actions {
    text-align: right;
  }
}

/* Light theme overrides for nightShift table */
@media (prefers-color-scheme: light) {
  #nightShiftTable tr,
  #nightShiftTable tbody tr {
    background: #ffffff !important;
    border-color: rgba(20, 152, 173, 0.16) !important;
    box-shadow: 0 10px 24px rgba(25, 93, 112, 0.06) !important;
  }

  #nightShiftTable tbody tr:nth-child(even) {
    background: #f4fbfb !important;
  }

  #nightShiftTable tbody tr:hover {
    background: #eef9f8 !important;
    border-color: rgba(20, 152, 173, 0.34) !important;
  }

  #nightShiftTable td,
  #nightShiftTable td *,
  #nightShiftTable td::before {
    color: #21324a !important;
  }

  #nightShiftTable td span:not(.badge) {
    color: #637083 !important;
  }

  #nightShiftTable td[data-label="Lý do"],
  #nightShiftTable td[data-label="Ghi chú"] {
    border-color: rgba(255, 255, 255, 0.15) !important;
  }

  body[data-role="employee"] #nightShiftTable tr {
    background: rgba(255, 255, 255, 0.96) !important;
    border-color: rgba(20, 152, 173, 0.18) !important;
  }

  body[data-role="employee"] #nightShiftTable td::before {
    color: #6b7c8f !important;
  }
}


#overtimeTable td.actions {
  min-width: 0;
  justify-self: end;
}

#overtimeTable .badge {
  max-width: 100%;
  white-space: normal;
}

body[data-role="employee"] #overtimeTable tr {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr) minmax(54px, auto);
}

body[data-role="employee"] #overtimeTable td:nth-child(4),
body[data-role="employee"] #overtimeTable td:nth-child(5),
body[data-role="employee"] #overtimeTable td:nth-child(6) {
  grid-column: 1 / -1;
}

body[data-role="manager"] #overtimeTable tr {
  grid-template-columns: minmax(0, 1.25fr) minmax(118px, 0.78fr) minmax(118px, 0.78fr) minmax(118px, auto);
  align-items: start;
}

body[data-role="manager"] #overtimeTable td {
  width: auto !important;
}

body[data-role="manager"] #overtimeTable td:nth-child(1) span {
  display: block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.10);
  color: var(--muted);
}

body[data-role="manager"] #overtimeTable td:nth-child(3) .badge {
  margin-top: 6px;
}

body[data-role="manager"] #overtimeTable td.actions {
  justify-self: end;
}

#attendanceLogs #attendanceLogPanel .table-wrap {
  max-height: 58vh;
  overflow: auto;
}

.employee-list-panel .table-wrap,
.contract-list,
#leave .table-wrap,
#attendance .overtime-review-panel .table-wrap,
#payroll .table-wrap,
#recruitment .table-wrap,
#training .table-wrap,
#comms .table-wrap {
  max-height: min(58vh, 560px);
  overflow: auto;
}

.muted-text {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

#attendanceLogPanel,
#deviceRegistryPanel {
  grid-column: 1 / -1;
}

#attendanceLogPanel .table-wrap,
#deviceRegistryPanel .table-wrap {
  max-height: min(62vh, 620px);
  overflow: auto;
}

body[data-role="manager"] #attendanceLogs #attendanceLogPanel {
  order: 1;
  grid-column: 1 / -1;
}

body[data-role="manager"] #attendanceLogs #attendanceForm {
  order: 2;
  grid-column: 1 / -1;
}

#attendanceTable,
#deviceRegistryTable {
  table-layout: fixed;
  min-width: 980px;
}

#attendanceTable th,
#attendanceTable td,
#deviceRegistryTable th,
#deviceRegistryTable td {
  overflow-wrap: anywhere;
  word-break: normal;
}

#attendanceTable th:nth-child(1),
#attendanceTable td:nth-child(1) {
  width: 18%;
}

#attendanceTable th:nth-child(2),
#attendanceTable td:nth-child(2) {
  width: 10%;
}

#attendanceTable th:nth-child(3),
#attendanceTable td:nth-child(3),
#attendanceTable th:nth-child(4),
#attendanceTable td:nth-child(4) {
  width: 8%;
}

#attendanceTable th:nth-child(5),
#attendanceTable td:nth-child(5) {
  width: 12%;
}

#attendanceTable th:nth-child(6),
#attendanceTable td:nth-child(6) {
  width: 18%;
}

#attendanceTable th:nth-child(7),
#attendanceTable td:nth-child(7) {
  width: 12%;
}

#attendanceTable th:nth-child(8),
#attendanceTable td:nth-child(8) {
  width: 12%;
}

#attendanceTable th:nth-child(9),
#attendanceTable td:nth-child(9) {
  width: 12%;
}

.selfie-log-links {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 800;
}

.inline-link {
  color: var(--accent);
  text-decoration: none;
}

.inline-link:hover {
  text-decoration: underline;
}

@media (max-width: 760px) {
  #comms .table-wrap {
    max-height: none !important;
    overflow: visible !important;
  }

  #notificationTable,
  #notificationTable thead,
  #notificationTable tbody,
  #notificationTable tr,
  #notificationTable td {
    display: block;
  }

  #notificationTable thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  #notificationTable tbody {
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  #notificationTable tr {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
  }

  #notificationTable td {
    padding: 0;
    border: 0;
    font-size: 14px;
    line-height: 1.45;
  }

  #notificationTable td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
  }

  #notificationTable td[data-label="Tiêu đề"] {
    color: var(--ink);
    font-size: 16px;
  }
}

#deviceRegistryTable th:nth-child(1),
#deviceRegistryTable td:nth-child(1) {
  width: 24%;
}

#deviceRegistryTable th:nth-child(2),
#deviceRegistryTable td:nth-child(2) {
  width: 13%;
}

#deviceRegistryTable th:nth-child(3),
#deviceRegistryTable td:nth-child(3) {
  width: 27%;
}

#deviceRegistryTable th:nth-child(4),
#deviceRegistryTable td:nth-child(4) {
  width: 20%;
}

#deviceRegistryTable th:nth-child(5),
#deviceRegistryTable td:nth-child(5) {
  width: 16%;
}

@media (min-width: 1101px) {
  body {
    grid-template-columns: 202px minmax(0, 1fr);
  }

  .sidebar {
    padding: 17px 11px;
  }

  .brand {
    gap: 8px;
    padding: 0 8px 18px;
  }

  .brand-logo {
    width: 140px;
    height: 62px;
    padding: 8px 12px;
    border-radius: 9px;
  }

  .brand strong {
    font-size: 15px;
  }

  .brand span {
    font-size: 12px;
  }

  .nav {
    gap: 6px;
    margin-top: 17px;
  }

  .nav button {
    min-height: 40px;
    padding: 9px 11px;
    border-radius: 8px;
    font-size: 13px;
  }

  .shell {
    width: 100%;
    max-width: none;
    padding: 18px 24px 24px;
  }

  .topbar {
    min-height: 70px;
    margin: -18px -24px 18px;
    padding: 14px 24px;
  }

  h1 {
    font-size: 23px;
  }

  .eyebrow {
    margin-bottom: 4px;
    font-size: 10px;
  }

  .employee-list-panel .panel-head {
    min-height: 98px;
    padding: 16px 14px;
  }

  .employee-directory {
    gap: 10px;
    padding: 12px;
  }

  .employee-record {
    grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.45fr) minmax(94px, auto);
    min-height: 60px;
    padding: 11px 12px;
  }
}

@media (min-width: 1101px) {
  #adminDashboard:not(.director-dashboard) {
    width: 100%;
  }

  #adminDashboard:not(.director-dashboard) .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
  }

  #adminDashboard:not(.director-dashboard) .metric {
    min-height: 108px;
    padding: 20px 22px;
  }

  #adminDashboard:not(.director-dashboard) .metric strong {
    margin-top: 12px;
    font-size: 31px;
  }

  #adminDashboard:not(.director-dashboard) .grid.two {
    grid-template-columns: minmax(0, 1.06fr) minmax(380px, 0.94fr);
    align-items: start;
    gap: 18px;
  }

  #adminDashboard:not(.director-dashboard) #pendingPanel {
    grid-column: 1;
  }

  #adminDashboard:not(.director-dashboard) #directorQueuePanel {
    grid-column: 2;
  }

  #adminDashboard:not(.director-dashboard) #directorQueuePanel #pendingLeaves {
    min-height: 74px;
  }

  #adminDashboard:not(.director-dashboard) #urgentPanel {
    grid-column: 1 / -1;
  }

  #adminDashboard:not(.director-dashboard) .permission-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #adminDashboard:not(.director-dashboard) #urgentAlerts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  #adminDashboard:not(.director-dashboard) #urgentAlerts .list-item {
    min-height: 118px;
  }

  #adminDashboard:not(.director-dashboard) #dashboardLeavePager,
#adminDashboard:not(.director-dashboard) #dashboardAlertPager {
    padding: 0 18px 14px;
  }
}

/* Final mobile chrome alignment: logo, actions and bottom menu */
#logoutBtn.badge::before {
  content: "";
  width: 18px;
  height: 18px;
  display: inline-block;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%2316d9ff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpath d='M16 17l5-5-5-5'/%3E%3Cpath d='M21 12H9'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 0 8px rgba(22, 217, 255, 0.42));
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .topbar > div:first-child {
    padding-left: 52px;
  }

  .topbar > div:first-child::before {
    content: "";
    width: 44px;
    height: 44px;
    border: 1px solid rgba(22, 217, 255, 0.26);
    border-radius: 14px;
    background-color: rgba(9, 13, 30, 0.98);
    background-image: url("/mobile-logo.png?v=20260616");
    background-position: center;
    background-size: 82%;
    background-repeat: no-repeat;
    box-shadow: 0 10px 26px rgba(22, 217, 255, 0.25);
  }

  .user-tools {
    align-items: center;
    gap: 7px;
  }

  .user-chip,
  #logoutBtn {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    border-radius: 14px;
  }

  #logoutBtn {
    display: grid;
    place-items: center;
    color: #fff;
  }

  #logoutBtn::before {
    width: 23px;
    height: 23px;
    font-size: 0;
  }

  .sidebar {
    height: calc(82px + env(safe-area-inset-bottom));
    padding: 7px max(8px, env(safe-area-inset-left)) calc(7px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-right));
  }

  .nav {
    height: 100%;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(70px, 1fr);
    align-items: stretch;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
  }

  .nav button {
    min-width: 70px;
    min-height: 66px;
    height: 66px;
    padding: 7px 6px 6px;
    display: grid;
    grid-template-rows: 28px minmax(24px, 1fr);
    place-items: center;
    align-content: center;
    gap: 4px !important;
    border-radius: 14px;
    line-height: 1.12;
    overflow: hidden;
    scroll-snap-align: center;
  }

  .nav button::before {
    width: 30px !important;
    min-width: 30px !important;
    height: 28px !important;
    margin: 0 !important;
  }
}

/* Mobile leave requests: no horizontal scroll, all details visible in-card */
@media (max-width: 760px) {
  #leave .table-wrap {
    max-height: none !important;
    overflow: visible !important;
  }

  #leaveTable {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: auto !important;
  }

  #leaveTable tbody {
    width: 100%;
    padding: 10px !important;
    gap: 10px !important;
  }

  #leaveTable tr,
  body[data-role="employee"] #leaveTable tr,
  body[data-role="manager"] #leaveTable tr,
  body[data-role="hr_admin"] #leaveTable tr,
  body[data-role="hr_staff"] #leaveTable tr,
  body[data-role="director"] #leaveTable tr {
    width: 100% !important;
    box-sizing: border-box !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 12px !important;
    overflow: hidden !important;
  }

  #leaveTable td,
  body[data-role="employee"] #leaveTable td,
  body[data-role="manager"] #leaveTable td,
  body[data-role="hr_admin"] #leaveTable td,
  body[data-role="hr_staff"] #leaveTable td,
  body[data-role="director"] #leaveTable td {
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    grid-column: auto !important;
    grid-row: auto !important;
    justify-self: stretch !important;
    padding-right: 0 !important;
    overflow-wrap: anywhere !important;
  }

  #leaveTable td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 6px;
    color: rgba(248, 251, 255, 0.62);
    font-size: 10px;
    font-weight: 900;
    line-height: 1.15;
    text-transform: uppercase;
  }

  #leaveTable td:nth-child(5),
  #leaveTable td.actions {
    grid-column: 1 / -1 !important;
  }

  #leaveTable td.actions {
    display: grid !important;
    gap: 8px !important;
  }

  #leaveTable td.actions:empty {
    display: none !important;
  }

  #leaveTable td.actions .ghost,
#leaveTable td.actions .danger {
    width: 100% !important;
    margin: 0 !important;
  }
}

/* Mobile payroll: compact salary slips without horizontal scrolling */
@media (max-width: 760px) {
  body[data-role="employee"] #payroll .table-wrap,
  body[data-role="manager"] #payroll .table-wrap {
    max-height: none !important;
    overflow: visible !important;
  }

  body[data-role="employee"] #payrollTable,
  body[data-role="employee"] #payrollTable thead,
  body[data-role="employee"] #payrollTable tbody,
  body[data-role="employee"] #payrollTable tr,
  body[data-role="employee"] #payrollTable td,
  body[data-role="manager"] #payrollTable,
  body[data-role="manager"] #payrollTable thead,
  body[data-role="manager"] #payrollTable tbody,
  body[data-role="manager"] #payrollTable tr,
  body[data-role="manager"] #payrollTable td {
    display: block;
  }

  body[data-role="employee"] #payrollTable,
  body[data-role="manager"] #payrollTable {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: auto !important;
  }

  body[data-role="employee"] #payrollTable thead,
  body[data-role="manager"] #payrollTable thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
  }

  body[data-role="employee"] #payrollTable tbody,
  body[data-role="manager"] #payrollTable tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  body[data-role="employee"] #payrollTable tr,
  body[data-role="manager"] #payrollTable tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 16px;
    background: rgba(12, 13, 35, 0.72);
  }

  body[data-role="employee"] #payrollTable td,
  body[data-role="manager"] #payrollTable td {
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 0 !important;
    border: 0 !important;
    overflow-wrap: anywhere;
  }

  body[data-role="employee"] #payrollTable td::before,
  body[data-role="manager"] #payrollTable td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 5px;
    color: rgba(248, 251, 255, 0.58);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
  }

  body[data-role="employee"] #payrollTable td[data-label="Quy trình"],
  body[data-role="employee"] #payrollTable td[data-label="Thao tác"],
  body[data-role="employee"] #payrollTable td[data-label="Phản hồi"],
  body[data-role="manager"] #payrollTable td[data-label="Quy trình"],
  body[data-role="manager"] #payrollTable td[data-label="Thao tác"],
  body[data-role="manager"] #payrollTable td[data-label="Phản hồi"] {
    grid-column: 1 / -1;
  }

  body[data-role="employee"] #payrollTable td.actions,
  body[data-role="manager"] #payrollTable td.actions {
    display: grid;
    gap: 8px;
  }

  body[data-role="employee"] #payrollTable td.actions .ghost,
  body[data-role="employee"] #payrollTable td.actions .danger,
  body[data-role="manager"] #payrollTable td.actions .ghost,
  body[data-role="manager"] #payrollTable td.actions .danger {
    width: 100%;
    margin: 0;
  }
}

/* Production mobile chrome fix: force visible logo and logout arrow after all legacy rules. */
@media (max-width: 760px) {
  .topbar > div:first-child::before {
    content: "" !important;
    width: 44px !important;
    height: 44px !important;
    display: block !important;
    border: 1px solid rgba(22, 217, 255, 0.36) !important;
    border-radius: 14px !important;
    background-color: rgba(8, 13, 28, 0.98) !important;
    background-image: url("/mobile-logo.png?v=20260616-mobile-logo-logout-v2") !important;
    background-position: center !important;
    background-size: 84% !important;
    background-repeat: no-repeat !important;
    box-shadow: 0 10px 26px rgba(22, 217, 255, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.04) !important;
    opacity: 1 !important;
    filter: none !important;
  }

  #logoutBtn.badge {
    display: grid !important;
    place-items: center !important;
    color: transparent !important;
    font-size: 0 !important;
  }

  #logoutBtn.badge::before {
    content: "" !important;
    width: 24px !important;
    height: 24px !important;
    display: block !important;
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2316d9ff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpath d='M16 17l5-5-5-5'/%3E%3Cpath d='M21 12H9'/%3E%3C/svg%3E") center / contain no-repeat !important;
    filter: drop-shadow(0 0 8px rgba(22, 217, 255, 0.5)) !important;
  }
}

/* Vitalia public website inspired light theme */
:root {
  --ink: #10233f;
  --muted: #637083;
  --line: #d9e8ee;
  --panel: rgba(255, 255, 255, 0.94);
  --canvas: #f4fbfb;
  --nav: #0f3350;
  --nav-soft: #175a72;
  --blue: #1498ad;
  --green: #22c7a9;
  --red: #d94a4a;
  --amber: #c38a18;
  --violet: #29a9c3;
  --teal: #1498ad;
  --text: #21324a;
  --shadow-sm: 0 8px 24px rgba(25, 93, 112, 0.08);
  --shadow: 0 18px 46px rgba(25, 93, 112, 0.12);
  --shadow-lg: 0 28px 70px rgba(25, 93, 112, 0.16);
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 8%, rgba(34, 199, 169, 0.14), transparent 30%),
    radial-gradient(circle at 10% 18%, rgba(20, 152, 173, 0.10), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #f4fbfb 48%, #edf8f8 100%) !important;
}

body::before {
  opacity: 0.46;
  background-image:
    linear-gradient(rgba(20, 152, 173, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 152, 173, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 24% 24%, rgba(34, 199, 169, 0.11), transparent 18%),
    radial-gradient(circle at 80% 18%, rgba(20, 152, 173, 0.10), transparent 16%) !important;
}

body::after {
  opacity: 0.30;
  background:
    conic-gradient(from 145deg at 50% 50%, transparent 0deg, rgba(20, 152, 173, 0.07) 76deg, transparent 145deg, rgba(34, 199, 169, 0.07) 230deg, transparent 320deg),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.72), transparent 48%) !important;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 250, 249, 0.98)),
    radial-gradient(circle at top left, rgba(34, 199, 169, 0.14), transparent 42%) !important;
  border-right-color: rgba(20, 152, 173, 0.14) !important;
  box-shadow: 16px 0 42px rgba(25, 93, 112, 0.08) !important;
}

.brand {
  border-bottom-color: rgba(20, 152, 173, 0.16) !important;
}

.brand-logo {
  background: #ffffff !important;
  box-shadow: inset 0 0 0 1px rgba(20, 152, 173, 0.14), 0 14px 34px rgba(25, 93, 112, 0.11) !important;
}

.brand strong,
h1,
#pageTitle,
.panel h2,
.panel h3,
.card h3,
.employee-hero h2,
.org-card h3,
.modal-card h2 {
  color: #10233f !important;
}

.brand span,
.panel-head span,
.employee-hero span,
.employee-action-menu span,
.employee-notice p,
.org-card p,
.org-card dt,
.metric span,
.payroll-action-card span,
.wifi-card-body p,
.hint,
.list-item span,
.permission-card span,
.employee-identity span:not(.employee-code),
.employee-kv small,
.detail-section p,
.attendance-mini-list span,
.contract-card-head p,
.contract-summary-actions span,
.contract-meta b,
.contract-clause-grid b,
.employee-bar span,
.topbar .eyebrow {
  color: var(--muted) !important;
}

.nav button {
  color: #5d6e81 !important;
}

.nav button:hover,
.nav button.active {
  color: #0f5f70 !important;
  background: rgba(20, 152, 173, 0.10) !important;
  box-shadow: inset 3px 0 0 var(--blue) !important;
}

.shell {
  background: transparent !important;
}

.topbar {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88) !important;
  border-bottom-color: rgba(20, 152, 173, 0.13) !important;
  box-shadow: 0 14px 38px rgba(25, 93, 112, 0.08) !important;
}

.panel,
.metric,
.dashboard-card,
.employee-hero,
.employee-action-menu,
.employee-notice,
.org-card,
.card,
.list-item,
.permission-card,
.modal-card,
.table-wrap,
.detail-section,
.contract-card,
.contract-summary,
.payroll-action-card,
.wifi-card {
  color: var(--text) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(250, 254, 253, 0.95)) !important;
  border-color: rgba(20, 152, 173, 0.14) !important;
  box-shadow: var(--shadow-sm) !important;
}

.panel::before,
.metric::before,
.employee-hero::before,
.card::before {
  background: linear-gradient(90deg, var(--blue), var(--green)) !important;
}

.metric strong,
.stat-number,
.employee-hero strong,
.employee-code,
.amount,
td,
th,
label {
  color: var(--ink) !important;
}

table thead,
.panel-head,
.modal-head {
  background: rgba(239, 250, 249, 0.86) !important;
  border-color: rgba(20, 152, 173, 0.14) !important;
}

table td,
table th {
  border-color: rgba(20, 152, 173, 0.12) !important;
}

input,
select,
textarea {
  color: var(--ink) !important;
  background: #ffffff !important;
  border-color: rgba(20, 152, 173, 0.20) !important;
}

input::placeholder,
textarea::placeholder {
  color: #637083 !important;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(20, 152, 173, 0.72) !important;
  box-shadow: 0 0 0 4px rgba(34, 199, 169, 0.13) !important;
}

.primary,
.login-btn,
.btn-primary {
  color: #ffffff !important;
  background: linear-gradient(135deg, #0f6f7d, #12856f) !important;
  box-shadow: 0 14px 30px rgba(15, 111, 125, 0.22) !important;
}

.ghost,
.secondary,
.badge,
.as-link {
  border-color: rgba(20, 152, 173, 0.22) !important;
  color: #11768a !important;
  background: rgba(255, 255, 255, 0.82) !important;
}

.danger {
  color: #bd3434 !important;
  border-color: rgba(217, 74, 74, 0.24) !important;
  background: #fff7f7 !important;
}

.status,
.pill,
.tag,
.badge-ok {
  background: rgba(34, 199, 169, 0.12) !important;
  color: #0d7f68 !important;
}

.status.warn,
.badge-warn {
  background: rgba(195, 138, 24, 0.14) !important;
  color: #946200 !important;
}

.status.danger,
.badge-danger {
  background: rgba(217, 74, 74, 0.12) !important;
  color: #bd3434 !important;
}

.user-chip {
  color: #244154 !important;
  background: #ffffff !important;
  border-color: rgba(20, 152, 173, 0.18) !important;
}

.user-chip .dot {
  background: var(--green) !important;
}

#logoutBtn.badge::before {
  filter: none !important;
}

@media (max-width: 760px) {
  :root {
    --mobile-bg: #f4fbfb;
    --mobile-surface: rgba(255, 255, 255, 0.95);
    --mobile-surface-2: rgba(250, 254, 253, 0.95);
    --mobile-border: rgba(20, 152, 173, 0.16);
    --mobile-accent: #1498ad;
    --mobile-cyan: #1498ad;
    --mobile-pink: #22c7a9;
  }

  html,
  body {
    background: var(--mobile-bg) !important;
  }

  body {
    color: var(--ink) !important;
    background:
      radial-gradient(circle at 82% 8%, rgba(34, 199, 169, 0.16), transparent 30%),
      linear-gradient(180deg, #ffffff 0%, #f4fbfb 100%) !important;
  }

  .sidebar {
    background: rgba(255, 255, 255, 0.94) !important;
    border-top-color: rgba(20, 152, 173, 0.14) !important;
    box-shadow: 0 -18px 38px rgba(25, 93, 112, 0.10) !important;
  }

  .topbar {
    background: rgba(255, 255, 255, 0.94) !important;
  }

  .topbar > div:first-child::before {
    border-color: rgba(20, 152, 173, 0.26) !important;
    background-color: #ffffff !important;
    box-shadow: 0 10px 26px rgba(20, 152, 173, 0.16), inset 0 0 0 1px rgba(20, 152, 173, 0.10) !important;
  }

  h1,
  #pageTitle {
    color: #10233f !important;
  }

  .nav button {
    color: #6a7a8b !important;
  }

  .nav button:hover,
  .nav button.active {
    color: #0f5f70 !important;
    background: rgba(20, 152, 173, 0.10) !important;
    box-shadow: none !important;
  }

  .nav button.active::before {
    color: #ffffff !important;
    background: linear-gradient(135deg, #0f6f7d, #12856f) !important;
    box-shadow: 0 8px 20px rgba(15, 111, 125, 0.22) !important;
  }

  body[data-role="employee"] #payrollTable tr,
  body[data-role="manager"] #payrollTable tr,
  #leaveTable tr,
  body[data-role="employee"] #leaveTable tr,
  body[data-role="manager"] #leaveTable tr,
  body[data-role="hr_admin"] #leaveTable tr,
  body[data-role="hr_staff"] #leaveTable tr,
  body[data-role="director"] #leaveTable tr {
    color: var(--text) !important;
    background: rgba(255, 255, 255, 0.94) !important;
    border-color: rgba(20, 152, 173, 0.15) !important;
  }

  body[data-role="employee"] #payrollTable td::before,
  body[data-role="manager"] #payrollTable td::before,
  #leaveTable td::before {
    color: #6b7c8f !important;
  }

  #logoutBtn.badge::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%231498ad' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpath d='M16 17l5-5-5-5'/%3E%3Cpath d='M21 12H9'/%3E%3C/svg%3E") !important;
    filter: none !important;
  }
}


/* --- VITALIA LIGHT THEME HARDENING: remove remaining dark surfaces --- */
.brand {
  background: #ffffff !important;
  border-color: rgba(20, 152, 173, 0.18) !important;
  box-shadow: 0 14px 32px rgba(25, 93, 112, 0.08) !important;
}

.brand-logo {
  width: 140px !important;
  max-height: 60px !important;
  object-fit: contain !important;
  opacity: 1 !important;
  filter: none !important;
}

.topbar > div:first-child::before {
  background-image: url("/vitalia_logo_chu-den.png?v=20260618-light-logo") !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 82% auto !important;
  background-color: #ffffff !important;
  opacity: 1 !important;
  filter: none !important;
}

#pageTitle,
h1,
h2,
h3,
.panel-head h2,
.panel h2,
.panel h3,
.card h3,
.employee-hero h2,
.org-card h3,
.org-unit-head h3,
.modal-card h2 {
  color: #11768a !important;
}

.panel,
.card,
.metric,
.table-wrap,
.modal-card,
.dashboard-task,
.employee-action-menu button,
.employee-notice,
.contract-card,
.permission-card,
.payroll-action-card,
.salary-eye,
.detail-section,
.detail-kv,
.guard,
.status-message {
  color: #21324a !important;
  background: linear-gradient(180deg, #ffffff 0%, #fbfffe 100%) !important;
  border-color: rgba(20, 152, 173, 0.18) !important;
  box-shadow: 0 14px 34px rgba(25, 93, 112, 0.08) !important;
}

.org-board,
.org-unit,
.org-card,
.org-card:nth-child(even),
.org-card.lead,
.org-member-list .org-card {
  color: #21324a !important;
  background: linear-gradient(135deg, #ffffff 0%, #f3fbfa 100%) !important;
  border-color: rgba(20, 152, 173, 0.20) !important;
  box-shadow: 0 14px 32px rgba(25, 93, 112, 0.08) !important;
}

.org-board > .org-unit-head span,
.org-card .eyebrow,
.org-unit-head span {
  color: #11768a !important;
}

.org-board > .org-unit-head p,
.org-card p,
.org-card dt,
.org-card dd,
.org-name-list li,
.org-board > .org-name-list li {
  color: #526579 !important;
}

#employeeTable.employee-card-table tr,
#employeeTable.employee-card-table tbody tr,
#employeeTable.employee-card-table tbody tr:nth-child(odd),
#employeeTable.employee-card-table tbody tr:nth-child(even),
.employee-record,
.employee-record:nth-child(odd),
.employee-record:nth-child(even),
#leaveTable tr,
#leaveTable tbody tr,
#leaveTable tbody tr:nth-child(even),
#overtimeTable tr,
#payrollTable tr,
#attendanceTable tr,
#deviceRegistryTable tr {
  color: #21324a !important;
  background: #ffffff !important;
  border-color: rgba(20, 152, 173, 0.16) !important;
  box-shadow: 0 10px 24px rgba(25, 93, 112, 0.06) !important;
}

#employeeTable.employee-card-table tbody tr:nth-child(even),
.employee-record:nth-child(even),
#leaveTable tbody tr:nth-child(even),
#payrollTable tbody tr:nth-child(even),
#attendanceTable tbody tr:nth-child(even),
#deviceRegistryTable tbody tr:nth-child(even) {
  background: #f4fbfb !important;
}

#employeeTable.employee-card-table tbody tr:hover,
.employee-record:hover,
#leaveTable tbody tr:hover,
#payrollTable tbody tr:hover,
#attendanceTable tbody tr:hover,
#deviceRegistryTable tbody tr:hover {
  background: #eef9f8 !important;
  border-color: rgba(20, 152, 173, 0.34) !important;
}

th,
thead th {
  color: #526579 !important;
  background: #eef8f7 !important;
}

td,
td *,
#employeeTable.employee-card-table td,
#employeeTable.employee-card-table td *,
.employee-record *,
.employee-identity strong,
.employee-kv,
.employee-kv b + * {
  color: #21324a;
}

.employee-identity span:not(.employee-code),
.employee-kv small,
#employeeTable.employee-card-table td::before,
#leaveTable td::before,
#payrollTable td::before,
#attendanceTable td::before,
#deviceRegistryTable td::before {
  color: #637083 !important;
}

.employee-code,
.badge,
.status,
.pill,
.tag {
  color: #0f5f70 !important;
  background: rgba(20, 152, 173, 0.11) !important;
  border-color: rgba(20, 152, 173, 0.18) !important;
}

.status.warn,
.badge-warn {
  color: #946200 !important;
  background: rgba(195, 138, 24, 0.15) !important;
}

.status.danger,
.badge-danger {
  color: #bd3434 !important;
  background: rgba(217, 74, 74, 0.12) !important;
}

.metric strong,
.dashboard-task strong,
.employee-action-menu strong,
.employee-notice strong,
.list-item strong {
  color: #10233f !important;
}

.modal {
  background: rgba(16, 35, 63, 0.28) !important;
}

@media (max-width: 760px) {
  .panel,
  .card,
  .metric,
  .table-wrap,
  .modal-card,
  .employee-hero,
  .employee-action-menu button,
  .employee-notice,
  .org-board,
  .org-unit,
  .org-card,
  .employee-record,
  #employeeTable.employee-card-table tr,
  #leaveTable tr,
  #payrollTable tr,
  #attendanceTable tr,
  #deviceRegistryTable tr {
    color: #21324a !important;
    background: rgba(255, 255, 255, 0.96) !important;
    border-color: rgba(20, 152, 173, 0.18) !important;
    box-shadow: 0 12px 28px rgba(25, 93, 112, 0.08) !important;
  }

  .topbar > div:first-child::before {
    width: 56px !important;
    height: 56px !important;
    background-image: url("/vitalia_logo_chu-den.png?v=20260618-light-logo") !important;
    background-size: 84% auto !important;
    background-color: #ffffff !important;
  }

  #pageTitle,
  h1,
  h2,
  h3,
  .panel-head h2,
  .employee-action-menu strong,
  .org-card h3,
  .org-unit-head h3 {
    color: #11768a !important;
  }

  .nav button,
  .nav button span {
    color: #5d6e81 !important;
  }

  .nav button.active {
    color: #0f5f70 !important;
    background: rgba(20, 152, 173, 0.12) !important;
  }
}


/* ============================================================
   LIGHT THEME FINAL FIXES — overrides dark remnants
   ============================================================ */

/* 1. Employee Action Menu buttons (Nhập vai, Nghỉ phép, Tăng ca, Thông báo) */
.employee-action-menu button {
  background: linear-gradient(180deg, #ffffff 0%, #f0fbfa 100%) !important;
  color: #10233f !important;
  border-color: rgba(20, 152, 173, 0.20) !important;
  box-shadow: 0 6px 20px rgba(20, 152, 173, 0.10) !important;
}

.employee-action-menu button:hover {
  background: linear-gradient(135deg, rgba(20, 152, 173, 0.08), rgba(34, 199, 169, 0.06)) !important;
  border-color: rgba(20, 152, 173, 0.35) !important;
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(20, 152, 173, 0.18) !important;
}

.employee-action-menu strong {
  color: #0f5f70 !important;
}

.employee-action-menu span {
  color: #637083 !important;
}

/* 2. Page tabs (Bảng tin nội bộ) */
.page-tabs {
  background: rgba(240, 251, 250, 0.92) !important;
  border-color: rgba(20, 152, 173, 0.20) !important;
}

.page-tabs button {
  color: #637083 !important;
  background: transparent !important;
}

.page-tabs button.active {
  color: #ffffff !important;
  background: linear-gradient(135deg, #1498ad, #22c7a9) !important;
}

/* 3. Wifi checkin summer-badge */
.summer-badge {
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.14), rgba(20, 152, 173, 0.08)) !important;
  border-color: rgba(255, 209, 102, 0.30) !important;
}

.summer-badge strong {
  color: #0f5f70 !important;
}

.summer-badge span {
  color: #b7791f !important;
}

/* 4. Login page logo — remove dark box behind logo */
.login-logo,
.login-card img,
.login-box img,
.login img {
  background: transparent !important;
  box-shadow: none !important;
}

/* 5. Brand logo on sidebar — always transparent bg */
.brand-logo,
.sidebar .brand-logo,
.nav-header .brand-logo {
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
}

/* 6. Heading color on all light pages */
h1, h2, h3,
.panel h2, .panel h3,
.panel-head h2,
.card h3,
.employee-hero h2,
.org-card h3,
.org-unit-head h3,
.modal-card h2,
#pageTitle {
  color: #0f5f70 !important;
}

/* 7. Panel head fix */
.panel-head {
  background: linear-gradient(180deg, rgba(20, 152, 173, 0.04), rgba(255, 255, 255, 0)) !important;
  border-bottom-color: rgba(20, 152, 173, 0.12) !important;
}

/* 8. Employee record alternating rows */
.employee-record:nth-child(even),
#employeeTable.employee-card-table tbody tr:nth-child(even) {
  background: rgba(20, 152, 173, 0.03) !important;
}

/* 9. Org even cards */
.org-card:nth-child(even) {
  background: linear-gradient(135deg, #f3fbfa, #f8fffe) !important;
}

/* 10. Mobile overrides (consistent with desktop) */
@media (max-width: 1024px) {
  .employee-action-menu button {
    background: linear-gradient(180deg, #ffffff 0%, #f0fbfa 100%) !important;
    color: #10233f !important;
    border-color: rgba(20, 152, 173, 0.20) !important;
  }

  .employee-action-menu button:hover {
    background: rgba(20, 152, 173, 0.06) !important;
    border-color: rgba(20, 152, 173, 0.30) !important;
  }

  .employee-action-menu strong {
    color: #0f5f70 !important;
  }

  .employee-action-menu span {
    color: #637083 !important;
  }

  .page-tabs {
    background: rgba(240, 251, 250, 0.92) !important;
    border-color: rgba(20, 152, 173, 0.20) !important;
  }

  .page-tabs button { color: #637083 !important; }
  .page-tabs button.active {
    color: #fff !important;
    background: linear-gradient(135deg, #1498ad, #22c7a9) !important;
  }

  .summer-badge strong { color: #0f5f70 !important; }
  .summer-badge span { color: #b7791f !important; }
  .summer-badge {
    background: linear-gradient(135deg, rgba(255, 209, 102, 0.14), rgba(20, 152, 173, 0.08)) !important;
    border-color: rgba(255, 209, 102, 0.30) !important;
  }

  h1, h2, h3, .panel h2, .panel-head h2, .panel h3, #pageTitle {
    color: #0f5f70 !important;
  }
}
/* ============================================================ */

/* ── LIGHT THEME: input color-scheme + org member dark card fix ── */

/* Fix browser date/month/time pickers showing dark UI */
input[type="date"],
input[type="month"],
input[type="time"],
input,
select,
textarea {
  color-scheme: light !important;
  color: #10233f !important;
  background: #ffffff !important;
  border-color: rgba(20, 152, 173, 0.22) !important;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: none !important;
  opacity: 0.7 !important;
}

input::placeholder, textarea::placeholder {
  color: #7a8fa3 !important;
}

/* Fix org member name cards (dark gray boxes in org chart) */
.org-member-list .org-card,
.org-member-list .org-card:nth-child(odd),
.org-member-list .org-card:nth-child(even) {
  background: linear-gradient(180deg, #ffffff, #f4fbfb) !important;
  color: #10233f !important;
  border-color: rgba(20, 152, 173, 0.18) !important;
  box-shadow: 0 4px 14px rgba(20, 152, 173, 0.07) !important;
}

/* Fix mobile org member cards */
@media (max-width: 1024px) {
  .org-member-list .org-card {
    background: #ffffff !important;
    color: #10233f !important;
    border-color: rgba(20, 152, 173, 0.18) !important;
  }

  input[type="date"],
  input[type="month"],
  input[type="time"],
  input,
  select,
  textarea {
    color-scheme: light !important;
    color: #10233f !important;
    background: #ffffff !important;
    border-color: rgba(20, 152, 173, 0.22) !important;
  }
}
/* ─────────────────────────────────────────────────────── */

/* -- MOBILE TOPBAR: hide img.brand-logo, use ::before icon only -- */
@media (max-width: 760px) {
  .topbar .brand-logo,
  .topbar img.brand-logo {
    display: none !important;
  }

  .topbar > div:first-child {
    padding-left: 56px !important;
  }

  .topbar > div:first-child::before {
    content: "" !important;
    width: 46px !important;
    height: 46px !important;
    border-radius: 12px !important;
    background-color: #ffffff !important;
    background-image: url('/vitalia_logo_chu-den.png') !important;
    background-size: 80% auto !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    border: 1px solid rgba(20, 152, 173, 0.22) !important;
    box-shadow: 0 6px 18px rgba(20, 152, 173, 0.14) !important;
    font-size: 0 !important;
  }
}
/* ----------------------------------------- */

/* ── FIX: Dropdown select option text visible (chữ không bị chìm khi xổ mục chọn) ── */
select {
  color-scheme: light !important;
  color: #10233f !important;
  background: #ffffff !important;
}

select option,
select option:checked,
select option:hover,
select option:focus {
  color-scheme: light !important;
  color: #10233f !important;
  background-color: #ffffff !important;
}

select option:checked {
  background-color: #e6f7f7 !important;
  color: #0f6f7d !important;
}
/* ─────────────────────────────────────────────────────── */

/* ── FIX: Org chart name list & member cards - light theme ── */
.org-name-list li,
.org-name-list li:not(.manager) {
  background: linear-gradient(180deg, #ffffff, #f0fbfb) !important;
  color: #10233f !important;
  border-color: rgba(20, 152, 173, 0.20) !important;
  font-weight: 700 !important;
}

.org-name-list li.manager {
  background: rgba(20, 200, 160, 0.09) !important;
  color: #0f6f7d !important;
  border-color: rgba(14, 130, 100, 0.28) !important;
}

.org-star {
  color: #f59e0b !important;
}

.org-member-list .org-card,
.org-member-list .org-card:nth-child(odd),
.org-member-list .org-card:nth-child(even) {
  background: linear-gradient(180deg, #ffffff, #f4fbfb) !important;
  color: #10233f !important;
  border-color: rgba(20, 152, 173, 0.18) !important;
  box-shadow: 0 4px 14px rgba(20, 152, 173, 0.07) !important;
}

/* Tên nhân viên trong thẻ card sơ đồ tổ chức */
.org-member-list .org-card h3,
.org-member-list .org-card p,
.org-member-list .org-card .eyebrow {
  color: #0f5f70 !important;
}
/* ─────────────────────────────────────────────────────── */

/* ── FIX: form-section-title chữ chìm (dark theme override về white text) ── */
.form-section-title {
  color: #0f6f7d !important;
  background: rgba(20, 200, 180, 0.08) !important;
  border-color: rgba(20, 152, 173, 0.20) !important;
  border-left-color: #0f9aad !important;
}
/* ─────────────────────────────────────────────────────── */

/* ── FIX: Mobile org name list background (tối màu trên mobile) ── */
@media (max-width: 1024px) {
  .org-name-list li,
  .org-name-list li:not(.manager),
  .org-board > .org-name-list li {
    background: #ffffff !important;
    background-image: linear-gradient(180deg, #ffffff, #f4fbfb) !important;
    color: #10233f !important;
    border-color: rgba(20, 152, 173, 0.20) !important;
  }
  .org-name-list li.manager {
    background: rgba(20, 200, 160, 0.09) !important;
    color: #0f6f7d !important;
    border-color: rgba(14, 130, 100, 0.28) !important;
  }
}
/* ─────────────────────────────────────────────────────── */

/* ── FIX: Mobile overtime table for manager/director ── */
@media (max-width: 760px) {
  body:not([data-role="employee"]) #overtimeTable tr {
    grid-template-columns: 1fr 1fr !important;
  }
  body:not([data-role="employee"]) #overtimeTable td:nth-child(1) {
    grid-column: 1 / -1 !important;
  }
  body:not([data-role="employee"]) #overtimeTable td.actions,
  body:not([data-role="employee"]) #overtimeTable td:nth-child(4),
  body:not([data-role="employee"]) #overtimeTable td:nth-child(5) {
    grid-column: 1 / -1 !important;
    justify-self: stretch !important;
  }
  body:not([data-role="employee"]) #overtimeTable td.actions {
    text-align: right;
  }
}
/* ─────────────────────────────────────────────────────── */


/* FIX: .attendance-mini-list strong text faded in light mode */
.attendance-mini-list strong {
  color: var(--nav-soft) !important;
}

/* Chat Widget */
.chat-widget { position: fixed; bottom: 20px; right: 20px; z-index: 9999; font-family: inherit; }
.chat-toggle-btn { background-color: var(--primary); color: #fff; border: none; border-radius: 50%; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0,0,0,0.15); cursor: pointer; position: relative; transition: transform 0.2s ease; }
.chat-toggle-btn:hover { transform: scale(1.05); }
.chat-unread-badge { position: absolute; top: 0; right: 0; background-color: #ef4444; color: #fff; font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 10px; border: 2px solid var(--bg); min-width: 18px; text-align: center; }
.chat-window { position: absolute; bottom: 70px; right: 0; width: 320px; height: 450px; background-color: var(--card-bg); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); }
.chat-header { background-color: var(--primary); color: #fff; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.chat-close-btn { background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; padding: 0; line-height: 1; }
.chat-admin-list { flex: 1; overflow-y: auto; background: var(--bg); }
.chat-list-title { padding: 12px 16px; font-size: 13px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.chat-admin-list ul { list-style: none; padding: 0; margin: 0; }
.chat-admin-list li { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; justify-content: space-between; align-items: center; background: var(--card-bg); transition: background 0.2s; }
.chat-admin-list li:hover { background: var(--bg); }
.chat-admin-list li.unread { font-weight: 600; background: var(--nav-active-bg); }
.chat-thread { display: flex; flex-direction: column; flex: 1; height: 100%; }
.chat-thread-header { padding: 8px 12px; background: var(--bg); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.chat-btn-back { background: none; border: none; color: var(--primary); cursor: pointer; padding: 4px; font-size: 14px; }
.chat-messages { flex: 1; padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.chat-message { max-width: 85%; padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.4; word-wrap: break-word; }
.chat-message.me { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-message.them { align-self: flex-start; background: var(--card-bg); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-time { font-size: 10px; opacity: 0.7; margin-top: 4px; text-align: right; }
.chat-form { display: flex; padding: 12px; border-top: 1px solid var(--border); background: var(--card-bg); gap: 8px; }
.chat-form input { flex: 1; border: 1px solid var(--border); border-radius: 20px; padding: 8px 16px; outline: none; background: var(--bg); color: var(--text); font-size: 14px; }
.chat-form button { background: var(--primary); color: #fff; border: none; border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.chat-form button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Chat Widget — Mobile responsive */
@media (max-width: 600px) {
  .chat-widget {
    bottom: calc(98px + env(safe-area-inset-bottom, 0px));
    right: 16px;
  }
  .chat-window {
    position: fixed;
    bottom: calc(82px + env(safe-area-inset-bottom, 0px));
    right: 0;
    left: 0;
    top: auto;
    width: 100%;
    height: min(75vh, calc(100vh - 96px - env(safe-area-inset-bottom, 0px)));
    max-height: calc(100vh - 82px - env(safe-area-inset-bottom, 0px));
    border-radius: 16px 16px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }
  .chat-window.chat-open {
    bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  }
  .chat-toggle-btn {
    width: 52px;
    height: 52px;
  }
  .chat-unread-badge {
    font-size: 10px;
    padding: 1px 5px;
  }
  .chat-header {
    padding: 14px 16px;
    font-size: 15px;
  }
  .chat-admin-list li {
    padding: 14px 16px;
  }
  .chat-form {
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .chat-form input {
    font-size: 16px; /* Ngăn iOS zoom khi focus */
    padding: 10px 16px;
  }
  .chat-messages {
    padding: 12px;
  }
  .chat-message {
    max-width: 88%;
    font-size: 14px;
  }
}




/* ===== PERFORMANCE OVERRIDES - tắt hiệu ứng nặng ===== */
*, *::before, *::after {
  animation: none !important;
  transition: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
body::before, body::after,
.sidebar::before, .sidebar::after,
.shell::before, .shell::after {
  display: none !important;
}
/* Đơn giản hoá shadow toàn cục */
.panel, .modal, .card, .employee-card, .payroll-detail-card {
  box-shadow: 0 1px 3px rgba(0,0,0,.08) !important;
}
/* Tắt filter blur/drop-shadow */
* {
  filter: none !important;
}

/* ===== Today Attendance Card ===== */
.today-attendance-card { padding: 16px; border-radius: 12px; }
.today-attendance-body { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.today-attendance-slot { padding: 12px; border: 1px solid var(--line, #e2e8f0); border-radius: 10px; background: #fbfffd; }
.today-attendance-slot .slot-title { font-size: 13px; color: var(--muted, #637083); display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.today-attendance-slot .slot-icon { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; border-radius: 50%; font-size: 14px; }
.today-attendance-slot .slot-icon[data-status="done"] { background: #10b981; color: #fff; }
.today-attendance-slot .slot-icon[data-status="empty"] { background: #e2e8f0; color: #94a3b8; }
.today-attendance-slot .slot-time { font-size: 26px; font-weight: 700; color: var(--ink, #21324a); line-height: 1.1; }
.today-attendance-slot .slot-meta { font-size: 12px; color: var(--muted, #637083); margin-top: 4px; line-height: 1.4; }
.today-attendance-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 8px; border-top: 1px solid var(--line, #e2e8f0); }
.today-attendance-footer span { font-size: 13px; color: var(--muted, #637083); }
.today-attendance-footer span.done { color: #10b981; font-weight: 600; }
@media (max-width: 640px) {
  .today-attendance-body { grid-template-columns: 1fr; }
}
