:root {
  --color-bg: #f3f5f9;
  --color-surface: #ffffff;
  --color-border: #e4e8f0;
  --color-text: #1c2333;
  --color-text-muted: #6b7488;
  --color-text-faint: #9aa2b2;
  --color-primary: #ff0059;
  --color-primary-dark: #cc0047;
  --color-primary-light: #ffe0eb;
  --color-accent: #f97316;
  --color-accent-light: #fff1e5;
  --color-success: #17a673;
  --color-success-light: #e7f8f1;
  --color-danger: #e0374a;
  --color-danger-light: #fde8ea;
  --color-warning: #f0ad4e;
  --color-warning-light: #fdf3e2;
  --sidebar-bg: #1e0010;
  --sidebar-bg-active: #3d0021;
  --sidebar-text: #ffffff;
  --sidebar-text-active: #ffffff;
  --sidebar-width: 250px;
  --sidebar-width-collapsed: 76px;
  --topbar-height: 68px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(20, 24, 40, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 24, 40, 0.08);
  --shadow-lg: 0 20px 45px rgba(20, 24, 40, 0.14);
  --font-sans:
    "Inter", "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font-family: inherit;
}
ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
h1,
h2,
h3,
h4,
p {
  margin: 0;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: #d3d8e4;
  border-radius: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
.auth-page {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, #330011, #5e1c2a 45%, #ff0059);
}
.auth-visual {
  flex: 1.1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px 64px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.auth-visual:before,
.auth-visual:after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: #ffffff14;
}
.auth-visual:before {
  width: 420px;
  height: 420px;
  top: -140px;
  right: -120px;
}
.auth-visual:after {
  width: 260px;
  height: 260px;
  bottom: -100px;
  left: -60px;
  background: #f973162e;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.auth-brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}
.auth-brand-name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.auth-visual-copy {
  position: relative;
  z-index: 1;
  max-width: 460px;
}
.auth-visual-copy h1 {
  font-size: 34px;
  line-height: 1.3;
  font-weight: 700;
  margin-bottom: 16px;
}
.auth-visual-copy p {
  font-size: 15px;
  color: #ffffffc7;
  line-height: 1.7;
}
.auth-stats {
  display: flex;
  gap: 32px;
  position: relative;
  z-index: 1;
}
.auth-stat b {
  display: block;
  font-size: 26px;
  font-weight: 700;
}
.auth-stat span {
  font-size: 13px;
  color: #ffffffb3;
}
.auth-form-side {
  flex: 1;
  min-width: 380px;
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
}
.auth-card h2 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
}
.auth-card .auth-sub {
  color: var(--color-text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}
.auth-hint {
  margin-top: 18px;
  background: var(--color-primary-light);
  border: 1px solid #ffc0d2;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--color-primary-dark);
  line-height: 1.6;
}
.auth-error {
  display: none;
  margin-bottom: 16px;
  background: var(--color-danger-light);
  color: var(--color-danger);
  border: 1px solid #f7c7ce;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
}
.auth-error.show {
  display: block;
}
.field {
  margin-bottom: 18px;
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 7px;
}
.field .required {
  color: var(--color-danger);
}
.input,
select.input,
textarea.input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--color-text);
  background: #fff;
  font-family: inherit;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.input:focus,
select.input:focus,
textarea.input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px #ff005924;
}
textarea.input {
  resize: vertical;
  min-height: 80px;
}
.input-group {
  position: relative;
}
.input-group .input {
  padding-right: 44px;
}
.input-icon-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-faint);
}
.input-icon-btn:hover {
  background: var(--color-bg);
  color: var(--color-text-muted);
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--color-text-muted);
}
.field-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 18px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10.5px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background 0.15s ease,
    border-color 0.15s ease;
  white-space: nowrap;
}
.btn:active {
  transform: scale(0.97);
}
.btn-block {
  width: 100%;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 6px 16px #ff005947;
}
.btn-primary:hover {
  background: var(--color-primary-dark);
}
.btn-outline {
  background: #fff;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}
.btn-ghost:hover {
  background: var(--color-bg);
  color: var(--color-text);
}
.btn-danger {
  background: var(--color-danger-light);
  color: var(--color-danger);
}
.btn-danger:hover {
  background: var(--color-danger);
  color: #fff;
}
.btn-sm {
  padding: 7px 13px;
  font-size: 12.5px;
  border-radius: 7px;
}
.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
}
.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.app-shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  transition:
    width 0.2s ease,
    transform 0.25s ease;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: var(--topbar-height);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-brand-name {
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 18px 12px;
}
.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  padding: 6px 12px;
  margin-top: 6px;
  white-space: nowrap;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--sidebar-text);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-link svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}
.sidebar-link:hover {
  background: #ffffff0f;
  color: #fff;
}
.sidebar-link.active {
  background: var(--color-primary);
  color: #fff;
}
.sidebar-link .label {
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-footer {
  padding: 14px 12px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 10px;
}
.sidebar-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.sidebar-user-info {
  overflow: hidden;
}
.sidebar-user-name {
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
}
.sidebar-logout-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #9aa2bd;
  cursor: pointer;
  margin-left: auto;
}
.sidebar-logout-btn:hover {
  background: #ffffff14;
  color: #fff;
}
.sidebar-collapse-btn {
  width: 100%;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px;
  border-radius: 9px;
  background: #ffffff0d;
  border: none;
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 12.5px;
}
.sidebar-collapse-btn:hover {
  background: #ffffff1a;
  color: #fff;
}
.sidebar-collapse-btn svg {
  transition: transform 0.2s ease;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #0a0e1e8c;
  z-index: 190;
}
.app-shell.sidebar-collapsed .sidebar {
  width: var(--sidebar-width-collapsed);
}
.app-shell.sidebar-collapsed .sidebar-brand-name,
.app-shell.sidebar-collapsed .sidebar-section-label,
.app-shell.sidebar-collapsed .sidebar-link .label,
.app-shell.sidebar-collapsed .sidebar-user-info,
.app-shell.sidebar-collapsed .sidebar-logout-btn,
.app-shell.sidebar-collapsed .sidebar-collapse-btn span {
  display: none;
}
.app-shell.sidebar-collapsed .sidebar-link,
.app-shell.sidebar-collapsed .sidebar-user {
  justify-content: center;
}
.app-shell.sidebar-collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}
.app-shell.sidebar-collapsed .main-area {
  margin-left: var(--sidebar-width-collapsed);
}
.main-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left 0.2s ease;
}
.topbar {
  height: var(--topbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.mobile-menu-btn,
.desktop-collapse-btn {
  border: none;
  background: var(--color-bg);
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  flex-shrink: 0;
}
.mobile-menu-btn:hover,
.desktop-collapse-btn:hover {
  background: #e8ebf3;
}
.mobile-menu-btn {
  display: none;
}
.page-title-group h1 {
  font-size: 19px;
  font-weight: 700;
}
.page-title-group p {
  font-size: 12.5px;
  color: var(--color-text-muted);
  margin-top: 2px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.topbar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
}
.notification-wrap {
  position: relative;
}
.topbar-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.topbar-icon-btn:hover {
  background: #e8ebf3;
}
.notification-badge {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-danger, #e0433f);
  border: 2px solid var(--color-surface);
}
.notification-panel {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 300px;
  max-width: 86vw;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  overflow: hidden;
}
.notification-panel.show {
  display: block;
}
.notification-panel-header {
  padding: 14px 16px;
  font-weight: 700;
  font-size: 14px;
  border-bottom: 1px solid var(--color-border);
}
.notification-list {
  max-height: 320px;
  overflow-y: auto;
}
.notification-item {
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
}
.notification-item:last-child {
  border-bottom: none;
}
.notification-empty {
  padding: 22px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted);
}
.content {
  flex: 1;
  padding: 26px 28px 60px;
  max-width: 1600px;
  width: 100%;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.stat-card .stat-info span {
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 500;
}
.stat-card .stat-info h3 {
  font-size: 27px;
  font-weight: 700;
  margin-top: 8px;
}
.stat-card .stat-info small {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
}
.stat-card .stat-info small.up {
  color: var(--color-success);
}
.stat-card .stat-info small.down {
  color: var(--color-danger);
}
.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg {
  width: 22px;
  height: 22px;
}
.stat-icon.blue {
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.stat-icon.orange {
  background: var(--color-accent-light);
  color: var(--color-accent);
}
.stat-icon.green {
  background: var(--color-success-light);
  color: var(--color-success);
}
.stat-icon.red {
  background: var(--color-danger-light);
  color: var(--color-danger);
}
.panel-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--color-border);
  gap: 12px;
  flex-wrap: wrap;
}
.card-header h2 {
  font-size: 16px;
  font-weight: 700;
}
.card-header p {
  font-size: 12.5px;
  color: var(--color-text-muted);
  margin-top: 2px;
}
.card-body {
  padding: 20px 22px;
}
.card-body.flush {
  padding: 0;
}
.dept-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.dept-bar-row:last-child {
  margin-bottom: 0;
}
.dept-bar-label {
  width: 118px;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.dept-bar-track {
  flex: 1;
  height: 9px;
  background: var(--color-bg);
  border-radius: 6px;
  overflow: hidden;
}
.dept-bar-fill {
  height: 100%;
  border-radius: 6px;
  background: var(--color-primary);
}
.dept-bar-count {
  width: 30px;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.activity-list li {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}
.activity-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.activity-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 700;
  font-size: 12.5px;
}
.activity-text {
  font-size: 13.5px;
  line-height: 1.5;
}
.activity-text b {
  font-weight: 600;
}
.activity-time {
  font-size: 11.5px;
  color: var(--color-text-faint);
  margin-top: 2px;
}
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: nowrap;
  padding: 18px 22px;
  border-bottom: 1px solid var(--color-border);
}
.toolbar-filters {
  display: grid;
  grid-template-columns: 1fr 150px 150px;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.search-box {
  position: relative;
  min-width: 0;
}
.search-box svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-text-faint);
}
.search-box .input {
  padding-left: 38px;
  width: 100%;
}
.select-filter {
  min-width: 0;
  width: 100%;
}
.table-scroll {
  overflow-x: auto;
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
table.data-table thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  background: #f7f8fb;
  padding: 13px 18px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
table.data-table tbody td {
  padding: 14px 18px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
table.data-table tbody tr:last-child td {
  border-bottom: none;
}
table.data-table tbody tr:hover {
  background: #fafbfd;
}
.cell-person {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cell-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.cell-person-name {
  font-weight: 600;
}
.cell-person-sub {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 1px;
}
.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge.green {
  background: var(--color-success-light);
  color: var(--color-success);
}
.badge.red {
  background: var(--color-danger-light);
  color: var(--color-danger);
}
.badge.orange {
  background: var(--color-accent-light);
  color: var(--color-accent);
}
.badge.blue {
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.badge.gray {
  background: #eef0f5;
  color: var(--color-text-muted);
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--color-text-muted);
}
.pagination-btns {
  display: flex;
  gap: 6px;
}
.page-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text);
}
.page-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.page-btn:hover:not(.active) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
}
.empty-state svg {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  color: var(--color-text-faint);
}
.empty-state h3 {
  font-size: 16px;
  margin-bottom: 6px;
  color: var(--color-text);
}
.empty-state p {
  font-size: 13.5px;
}
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #0f142880;
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show {
  display: flex;
}
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.18s ease;
}
.modal.modal-sm {
  max-width: 420px;
}
.modal.modal-xl {
  max-width: 900px;
}
@keyframes modalIn {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
}
.modal-close {
  border: none;
  background: var(--color-bg);
  width: 34px;
  height: 34px;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}
.modal-close:hover {
  background: #e8ebf3;
}
.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
}
.modal-footer {
  padding: 18px 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}
.modal-icon-danger {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-danger-light);
  color: var(--color-danger);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.modal-icon-danger svg {
  width: 24px;
  height: 24px;
}
.toast-wrap {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: #1c2333;
  color: #fff;
  padding: 13px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  animation: toastIn 0.2s ease;
}
.toast.success {
  background: #12805f;
}
.toast.error {
  background: #b6293a;
}
@keyframes toastIn {
  0% {
    opacity: 0;
    transform: translate(30px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.detail-header {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 26px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.detail-avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 26px;
  flex-shrink: 0;
}
.detail-header-info {
  flex: 1;
  min-width: 200px;
}
.detail-header-info h1 {
  font-size: 21px;
  font-weight: 700;
}
.detail-header-info p {
  font-size: 13.5px;
  color: var(--color-text-muted);
  margin-top: 4px;
}
.detail-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.info-list dt {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.info-list dd {
  font-size: 14px;
  margin: 0 0 18px;
  font-weight: 500;
}
.info-list dd:last-child {
  margin-bottom: 0;
}
.info-row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
  margin-bottom: 15px;
}
.tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.group-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.chip button {
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
  display: flex;
  padding: 0;
}
.chip button svg {
  width: 12px;
  height: 12px;
}
/* ===== Multi-select ===== */
.ms-wrap {
  position: relative;
  display: block;
}
.ms-trigger {
  min-height: 36px;
  border: 1.5px solid var(--color-border);
  border-radius: 7px;
  padding: 4px 28px 4px 7px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  background: var(--color-surface);
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: border-color 0.15s;
  min-width: 120px;
}
.ms-trigger:hover,
.ms-trigger.active {
  border-color: var(--color-primary);
}
.ms-trigger.active {
  box-shadow: 0 0 0 3px rgba(255, 0, 89, 0.1);
}
.ms-arrow {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--color-text-faint);
  flex-shrink: 0;
  line-height: 0;
}
.ms-chip {
  background: rgba(255, 0, 89, 0.1);
  color: var(--color-primary);
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.5;
}
.ms-placeholder {
  font-size: 12px;
  color: var(--color-text-faint);
  line-height: 1.6;
  padding: 1px 0;
  white-space: nowrap;
}
.ms-panel {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  min-width: 190px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  z-index: 9999;
  max-height: 240px;
  overflow-y: auto;
  padding: 5px 0;
}
.ms-panel.open {
  display: block;
}
.ms-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 13px;
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text);
  transition: background 0.1s;
  user-select: none;
}
.ms-item:hover {
  background: var(--color-bg);
}
.ms-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--color-primary);
  flex-shrink: 0;
  cursor: pointer;
  pointer-events: none;
}
/* ===== Attendance table ===== */
.att-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.att-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1000px;
}
.att-table thead th {
  background: var(--color-primary);
  color: #fff;
  padding: 11px 10px;
  text-align: center;
  border: 1px solid var(--color-primary-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.att-table tbody td {
  padding: 7px 8px;
  border: 1px solid var(--color-border);
  vertical-align: middle;
  text-align: center;
  background: #fff;
}
.att-table tbody tr:nth-child(even) td {
  background: #fdf7f9;
}
.att-table tbody tr:hover td {
  background: var(--color-primary-light) !important;
}
.att-table select,
.att-table input[type="text"] {
  width: 100%;
  padding: 6px 8px;
  border: 1.5px solid var(--color-border);
  border-radius: 6px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--color-text);
  background: #fff;
  transition: border-color 0.15s;
}
.att-table select:focus,
.att-table input[type="text"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(255, 0, 89, 0.1);
}
.att-row-del {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--color-text-faint);
  padding: 5px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.att-row-del:hover {
  color: var(--color-danger);
  background: var(--color-danger-light);
}
.att-add-row {
  width: 100%;
  padding: 11px;
  border: 2px dashed var(--color-border);
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.15s;
  font-family: inherit;
  margin-top: 10px;
}
.att-add-row:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
}
/* ===== Task-assign table ===== */
.ta-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.ta-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}
.ta-table thead th {
  background: var(--color-primary);
  color: #fff;
  padding: 11px 12px;
  text-align: center;
  border: 1px solid var(--color-primary-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.ta-table thead th.th-blue {
  background: #1d4fb5;
  border-color: #1842a0;
}
.ta-table tbody td {
  padding: 7px 8px;
  border: 1px solid var(--color-border);
  vertical-align: middle;
  font-size: 13px;
  text-align: center;
  background: #fff;
}
.ta-table tbody tr:nth-child(even) td.td-body {
  background: #fafbfd;
}
.ta-table tbody tr:hover td {
  background: var(--color-primary-light) !important;
}
.ta-table td.td-group {
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  text-align: center;
  vertical-align: middle;
  line-height: 1.4;
  padding: 10px 8px;
}
.ta-table td.td-stt {
  color: var(--color-text-muted);
  font-size: 12px;
  white-space: nowrap;
}
.ta-table td.td-name {
  text-align: left;
  font-weight: 600;
  font-size: 13px;
}
/* ===== Date nav bar ===== */
.date-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.date-nav-arrow {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: all 0.15s;
}
.date-nav-arrow:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.date-nav input[type="date"] {
  padding: 8px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  cursor: pointer;
}
.date-nav input[type="date"]:focus {
  outline: none;
  border-color: var(--color-primary);
}
.date-saved-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--color-success-light);
  color: var(--color-success);
}
.date-unsaved-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--color-accent-light);
  color: var(--color-accent);
}
/* ===== Page section header (red banner) ===== */
.section-banner {
  background: var(--color-primary);
  color: #fff;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
@media (max-width: 1180px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .panel-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 900px) {
  .sidebar {
    transform: translate(-100%);
    box-shadow: var(--shadow-lg);
  }
  .app-shell.sidebar-mobile-open .sidebar {
    transform: translate(0);
  }
  .app-shell.sidebar-mobile-open .sidebar-overlay {
    display: block;
  }
  .main-area,
  .app-shell.sidebar-collapsed .main-area {
    margin-left: var(--sidebar-width-collapsed);
  }
  .mobile-menu-btn {
    display: flex;
  }
  .desktop-collapse-btn {
    display: none;
  }
  .content {
    padding: 20px 16px 50px;
  }
  .topbar {
    padding: 0 16px;
  }
}
@media (max-width: 720px) {
  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .stat-card {
    padding: 16px;
    flex-direction: column;
    gap: 14px;
  }
  .field-grid-2 {
    grid-template-columns: 1fr;
  }
  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-filters {
    grid-template-columns: 1fr;
  }
  .search-box,
  .select-filter {
    max-width: none;
  }
  .pagination {
    flex-direction: column;
    align-items: center;
  }
  .auth-visual {
    display: none;
  }
  .auth-form-side {
    min-width: 0;
  }
  .detail-header {
    flex-direction: column;
    text-align: center;
  }
  .detail-header-actions {
    width: 100%;
    justify-content: center;
  }
  .page-title-group p {
    display: none;
  }
}
@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== ms-search (tìm kiếm trong multi-select) ===== */
.ms-search-wrap {
  padding: 6px 8px 5px;
  position: sticky;
  top: 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  z-index: 1;
}
.ms-search {
  width: 100%;
  border: 1.5px solid var(--color-border);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
  background: var(--color-bg);
  box-sizing: border-box;
}
.ms-search:focus {
  border-color: var(--color-primary);
}
/* ===== Custom single-select (cs-wrap) ===== */
.cs-wrap {
  position: relative;
  display: block;
}
.cs-trigger {
  min-height: 36px;
  border: 1.5px solid var(--color-border);
  border-radius: 7px;
  padding: 5px 28px 5px 9px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-surface);
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: border-color 0.15s;
  min-width: 100px;
  font-size: 13px;
  color: var(--color-text);
}
.cs-trigger:hover,
.cs-trigger.active {
  border-color: var(--color-primary);
}
.cs-trigger.active {
  box-shadow: 0 0 0 3px rgba(255, 0, 89, 0.1);
}
.cs-display {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}
.cs-arrow {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--color-text-faint);
  flex-shrink: 0;
  line-height: 0;
}
.cs-panel {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  min-width: 180px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  z-index: 9999;
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 4px;
}
.cs-panel.open {
  display: block;
}
.cs-search {
  width: calc(100% - 16px);
  margin: 8px 8px 4px;
  border: 1.5px solid var(--color-border);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
  background: var(--color-bg);
  display: block;
  box-sizing: border-box;
}
.cs-search:focus {
  border-color: var(--color-primary);
}
.cs-item {
  padding: 8px 13px;
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text);
  transition: background 0.1s;
}
.cs-item:hover {
  background: var(--color-bg);
}
.cs-item-empty {
  color: var(--color-text-faint);
}
/* ===== Textarea tự xuống dòng trong bảng báo cáo ===== */
.att-ta {
  resize: none;
  overflow: hidden;
  min-height: 32px;
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
  box-sizing: border-box;
  line-height: 1.5;
  display: block;
}
.att-ta:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(255, 0, 89, 0.08);
}
.notification-item {
  position: relative;
}
.notification-item.unread {
  padding-left: 30px;
}
.notification-item.unread::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-danger, #e0433f);
}

/* ======================================================
   RESPONSIVE MOBILE — toàn bộ web (override & additions)
   ====================================================== */

/* 900px: sidebar off-canvas → main-area full width, no left margin */
@media (max-width: 900px) {
  .main-area,
  .app-shell.sidebar-collapsed .main-area,
  .app-shell.sidebar-mobile-open .main-area {
    margin-left: 0 !important;
  }
  .topbar {
    padding: 0 12px;
  }
  .content {
    padding: 16px 12px 40px;
  }
  .page-title-group h1 {
    font-size: 16px;
  }
}

/* 720px: bổ sung cải tiến thêm */
@media (max-width: 720px) {
  .card-header {
    padding: 14px 16px;
  }
  .card-header h2 {
    font-size: 14px;
  }
  .card-body {
    padding: 14px 16px;
  }
  .topbar-right {
    gap: 8px;
  }
  /* Thanh toolbar bảng */
  .table-toolbar {
    padding: 14px 16px;
  }
  /* Detail header */
  .detail-header {
    padding: 18px 16px;
  }
}

/* 540px: màn hình nhỏ hơn nữa */
@media (max-width: 540px) {
  .topbar {
    height: 56px;
    padding: 0 10px;
  }
  .main-area {
    margin-top: 0;
  }
  .content {
    padding: 12px 10px 36px;
  }
  .page-title-group h1 {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 44vw;
  }
  .page-title-group p {
    display: none;
  }
  .topbar-icon-btn {
    width: 34px;
    height: 34px;
  }
  .btn {
    padding: 8px 14px;
    font-size: 13px;
  }
  .btn-sm {
    padding: 6px 10px;
    font-size: 12px;
  }
  /* Stat grid: 1 cột */
  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .stat-card {
    padding: 14px;
  }
  .stat-card .stat-info h3 {
    font-size: 22px;
  }
  /* Pagination */
  .pagination {
    padding: 12px 16px;
  }
}

/* 400px: rất nhỏ */
@media (max-width: 400px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
  .topbar {
    height: 52px;
    padding: 0 8px;
  }
  .page-title-group h1 {
    font-size: 13px;
    max-width: 38vw;
  }
  .mobile-menu-btn {
    width: 34px;
    height: 34px;
  }
  .content {
    padding: 10px 8px 30px;
  }
}

/* Phiếu Quản Lý Ca: responsive bổ sung */
@media (max-width: 900px) {
  .phieu-controls-bar {
    padding: 12px 14px;
  }
}
@media (max-width: 540px) {
  .phieu-row-bottom {
    flex-wrap: wrap;
    gap: 8px;
  }
  .phieu-row-bottom .btn-primary {
    margin-left: 0 !important;
    width: 100%;
    justify-content: center;
  }
  .shift-tabs {
    flex: 1;
    min-width: 0;
  }
  .shift-tab {
    flex: 1;
    padding: 6px 8px;
    font-size: 12px;
  }
  .phieu-notes-body {
    padding: 12px 12px;
  }
}
