:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f0f3f8;
  --text: #172033;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #059669;
  --shadow: 0 16px 35px rgba(15, 23, 42, 0.08);
}

body.dark {
  --bg: #0f172a;
  --surface: #111827;
  --surface-2: #1f2937;
  --text: #f8fafc;
  --muted: #9ca3af;
  --border: #374151;
  --primary: #60a5fa;
  --primary-strong: #3b82f6;
  --danger: #f87171;
  --warning: #fbbf24;
  --success: #34d399;
  --shadow: 0 16px 35px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, select, textarea {
  font: inherit;
}
button {
  border: 0;
  cursor: pointer;
}
a { color: var(--primary); text-decoration: none; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 28px;
  padding: 28px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.logo {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.brand h1 { font-size: 24px; margin: 0; }
.brand p { margin: 4px 0 0; color: var(--muted); }

.form-grid {
  display: grid;
  gap: 14px;
}
label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  padding: 11px 12px;
  outline: none;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.error-box {
  display: none;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
  font-size: 13px;
}
.error-box.show { display: block; }

.app-shell {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 280ms ease;
}
.app-shell.sidebar-collapsed {
  grid-template-columns: 0 1fr;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: transform 280ms ease, opacity 220ms ease, box-shadow 220ms ease;
  z-index: 40;
}
.app-shell.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}
.sidebar-toggle {
  position: fixed;
  top: 30px;
  left: 224px;
  z-index: 70;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  display: inline-grid;
  place-content: center;
  gap: 4px;
  transition: left 280ms ease, top 220ms ease, background 220ms ease, transform 180ms ease, color 220ms ease;
}
.sidebar-toggle:hover {
  background: var(--surface-2);
  transform: translateY(-1px);
}
.sidebar-toggle:active { transform: scale(0.96); }
.sidebar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 99px;
  background: currentColor;
  transform-origin: center;
  transition: transform 260ms ease, opacity 180ms ease, width 220ms ease;
}
.app-shell:not(.sidebar-collapsed) .sidebar-toggle span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.app-shell:not(.sidebar-collapsed) .sidebar-toggle span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.app-shell:not(.sidebar-collapsed) .sidebar-toggle span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}
.app-shell.sidebar-collapsed .sidebar-toggle {
  top: 30px;
  left: 22px;
}
.sidebar .brand {
  margin-bottom: 28px;
  padding-right: 48px;
}
.nav {
  display: grid;
  gap: 8px;
}
.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 700;
}
.nav button.active, .nav button:hover {
  background: var(--surface-2);
  color: var(--text);
}
.sidebar-footer {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  display: grid;
  gap: 10px;
}
.user-mini {
  padding: 12px;
  background: var(--surface-2);
  border-radius: 18px;
}
.user-mini strong { display: block; }
.user-mini span { color: var(--muted); font-size: 13px; }

.main {
  padding: 24px;
  overflow: auto;
  transition: padding-left 280ms ease;
}
.app-shell.sidebar-collapsed .main .topbar {
  padding-left: 44px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
.topbar h2 { margin: 0; font-size: 28px; }
.topbar p { margin: 5px 0 0; color: var(--muted); }
.mobile-menu { display: none; }
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.btn {
  padding: 11px 14px;
  border-radius: 14px;
  font-weight: 800;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn.danger {
  color: var(--danger);
}
.btn.small { padding: 8px 10px; border-radius: 11px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.topbar-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-left: auto;
}
/* Toggle mode terang/gelap - compact */
.theme-mode-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  line-height: 1;
  min-height: 24px;
}
.theme-mode-toggle:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.35);
  outline-offset: 5px;
  border-radius: 999px;
}
.theme-word {
  font-size: 8px;
  letter-spacing: 0.01em;
  color: var(--muted);
  opacity: 0.55;
  transition: color 220ms ease, opacity 220ms ease, transform 220ms ease;
  white-space: nowrap;
}
.theme-word.active {
  color: var(--text);
  opacity: 1;
  transform: translateY(-0.5px);
}
.theme-switch-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, #a9c2ff 0%, #5f91f6 100%);
  box-shadow: 0 6px 14px rgba(59, 130, 246, 0.18);
  overflow: hidden;
  transition: background 260ms ease, box-shadow 260ms ease, transform 180ms ease;
}
.theme-mode-toggle:hover .theme-switch-pill {
  transform: translateY(-0.5px);
  box-shadow: 0 8px 18px rgba(59, 130, 246, 0.23);
}
.theme-mode-toggle:active .theme-switch-pill {
  transform: scale(0.96);
}
.theme-switch-thumb {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #ffffff;
  color: #f59e0b;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.18);
  transform: translateX(0);
  transition: transform 320ms cubic-bezier(.34, 1.56, .64, 1), color 220ms ease, box-shadow 260ms ease;
  z-index: 2;
  display: grid;
  place-items: center;
}
.theme-thumb-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  line-height: 1;
  font-weight: 900;
  transform: translateY(-0.2px);
}
.theme-switch-dot {
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  transition: transform 320ms ease, opacity 260ms ease;
}
.theme-switch-dot-one {
  width: 3px;
  height: 3px;
  right: 11px;
  top: 5px;
}
.theme-switch-dot-two {
  width: 2px;
  height: 2px;
  right: 19px;
  top: 11px;
}
.theme-mode-toggle.is-dark .theme-switch-pill {
  background: linear-gradient(135deg, #253047 0%, #0f172a 100%);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.28);
}
.theme-mode-toggle.is-dark .theme-switch-thumb {
  transform: translateX(16px);
  color: #475569;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.26);
}
.theme-mode-toggle.is-dark .theme-switch-dot-one {
  transform: translateX(-17px) translateY(1px);
  opacity: 0.72;
}
.theme-mode-toggle.is-dark .theme-switch-dot-two {
  transform: translateX(-12px) translateY(-2px);
  opacity: 0.48;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.stat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}
.content-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 16px;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-title h3 { margin: 0; }
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}
th, td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}
th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  background: var(--surface-2);
}
.badge.safe { color: var(--success); background: rgba(5, 150, 105, 0.12); }
.badge.warn { color: var(--warning); background: rgba(217, 119, 6, 0.14); }
.badge.danger { color: var(--danger); background: rgba(220, 38, 38, 0.12); }
.badge.muted { color: var(--muted); }

.filter-bar {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr 0.8fr auto;
  gap: 10px;
  margin-bottom: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 16px;
}
.modal-backdrop.show { display: flex; }
.modal {
  width: min(760px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-head h3 { margin: 0; }
.form-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-two .full { grid-column: 1 / -1; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 30;
}
.toast.show { display: block; }

.empty-state {
  text-align: center;
  padding: 30px;
  color: var(--muted);
}

.chart-row {
  display: grid;
  gap: 10px;
}
.chart-item {
  display: grid;
  grid-template-columns: 120px 1fr 34px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.bar {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  background: var(--primary);
}

@media (max-width: 1100px) {
  .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app-shell,
  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    z-index: 50;
    inset: 0 auto 0 0;
    width: min(290px, 82vw);
    box-shadow: 18px 0 45px rgba(15, 23, 42, 0.22);
  }
  .app-shell:not(.sidebar-collapsed) .sidebar-toggle {
    top: 30px;
    left: min(242px, calc(82vw - 48px));
  }
  .app-shell.sidebar-collapsed .sidebar { transform: translateX(-100%); opacity: 0; pointer-events: none; }
  .app-shell.sidebar-collapsed .sidebar-toggle {
    top: 30px;
    left: 22px;
  }
  .main { padding: 16px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .app-shell .main .topbar { padding-left: 44px; }
  .topbar-controls { width: 100%; justify-content: flex-end; }
  .theme-mode-toggle { gap: 6px; }
  .theme-word { font-size: 8px; }
  .theme-switch-pill { width: 36px; height: 20px; }
  .theme-switch-thumb { width: 14px; height: 14px; }
  .theme-mode-toggle.is-dark .theme-switch-thumb { transform: translateX(16px); }
  .mobile-menu { display: none; }
  .grid-cards { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: 1fr; }
  .form-two { grid-template-columns: 1fr; }
  .topbar h2 { font-size: 24px; }
}

.wide-modal {
  width: min(1080px, 100%);
}

.checklist-section {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 20px;
  padding: 14px;
}

.checklist-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.checklist-row {
  display: grid;
  grid-template-columns: 120px minmax(160px, 1fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.checklist-row.device-row {
  grid-template-columns: 120px minmax(140px, 1fr) minmax(130px, 0.8fr) minmax(120px, 0.7fr) minmax(150px, 1fr) auto;
}

.check-label {
  display: inline-flex;
  align-items: center;
  grid-auto-flow: column;
  grid-template-columns: auto 1fr;
  gap: 8px;
  color: var(--text);
  font-weight: 800;
}

.check-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
}

.doc-photo-wrap {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(180px, 1fr);
  gap: 10px;
  align-items: center;
}
.doc-photo-meta {
  display: grid;
  gap: 4px;
}
.doc-photo-meta a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}
.doc-photo-meta a:hover { text-decoration: underline; }
.subtle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

@media (max-width: 820px) {
  .checklist-row,
  .checklist-row.device-row,
  .doc-photo-wrap {
    grid-template-columns: 1fr;
  }
}


/* v1.6 Serah Terima refinement */
.wide-modal {
  width: min(1180px, calc(100vw - 28px));
}
.handover-form {
  gap: 12px;
}
.handover-form > label {
  margin-bottom: 0;
}
.handover-form textarea {
  min-height: 74px;
}
.checklist-section {
  padding: 12px 14px;
  border-radius: 18px;
}
.checklist-section .section-title {
  margin-bottom: 6px;
}
.checklist-section .section-title h3 {
  font-size: 18px;
}
.checklist-section .hint {
  margin: 4px 0 8px;
}
.checklist-list {
  gap: 8px;
  margin-top: 8px;
}
.checklist-row {
  grid-template-columns: 112px minmax(120px, 0.75fr) minmax(190px, 1fr) minmax(230px, 1.25fr) 70px;
  gap: 8px;
  padding: 8px;
  border-radius: 14px;
}
.checklist-row.device-row {
  grid-template-columns: 112px minmax(130px, 0.8fr) minmax(135px, 0.75fr) 105px minmax(150px, 1fr) 70px;
}
.check-label {
  font-size: 12px;
  gap: 6px;
}
.check-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
}
.doc-photo-wrap {
  grid-template-columns: minmax(150px, 0.85fr) minmax(120px, 0.8fr);
  gap: 8px;
}
.doc-photo-meta small {
  line-height: 1.2;
}
.form-actions {
  justify-content: flex-start;
  padding-top: 2px;
}

@media (max-width: 920px) {
  .checklist-row,
  .checklist-row.device-row,
  .doc-photo-wrap {
    grid-template-columns: 1fr;
  }
}


.division-list {
  display: grid;
  gap: 10px;
}
.division-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
}
.division-number {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--muted);
  font-weight: 900;
  border: 1px solid var(--border);
}
.division-main {
  display: grid;
  gap: 4px;
}
.division-main strong {
  font-size: 15px;
}
.division-main span {
  color: var(--muted);
  font-size: 12px;
}
.division-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 16px;
}
@media (max-width: 820px) {
  .division-item,
  .division-add-form {
    grid-template-columns: 1fr;
  }
  .division-number {
    display: none;
  }
}

/* v2.4 Manager division settings */
.settings-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
}
.division-sub {
  display: block;
  margin-top: 2px;
}
.muted-text {
  color: var(--muted);
}
.manager-division-list {
  display: grid;
  gap: 10px;
}
.manager-division-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 0.8fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
}
.manager-info {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.manager-info strong {
  font-size: 15px;
}
.manager-info span,
.manager-info small {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.manager-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
@media (max-width: 980px) {
  .settings-grid,
  .manager-division-item {
    grid-template-columns: 1fr;
  }
  .manager-actions {
    justify-content: flex-start;
  }
}

/* v2.5 User account settings */

.settings-grid-manager {
  grid-template-columns: minmax(0, 1fr) !important;
}
.user-modal {
  width: min(720px, 100%);
}
.settings-wide-card {
  grid-column: 1 / -1;
}
.user-account-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}
.user-account-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
}
.user-add-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 170px 220px auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}
@media (max-width: 1180px) {
  .user-add-form {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 720px) {
  .user-add-form,
  .user-account-item {
    grid-template-columns: 1fr;
  }
  .user-account-item {
    align-items: flex-start;
    flex-direction: column;
  }
}

input[type="date"] {
  cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
}

/* v5.1 Peminjaman Aset: empty rows by default + dropdown-only rows */
.checklist-row.compact-doc-row {
  grid-template-columns: 112px minmax(180px, 0.85fr) minmax(300px, 1.35fr) 76px;
}
.checklist-row.compact-device-row {
  grid-template-columns: 112px minmax(180px, 0.9fr) minmax(160px, 0.85fr) 120px 76px;
}
.checklist-row.compact-doc-row select,
.checklist-row.compact-device-row select {
  min-width: 0;
}
@media (max-width: 920px) {
  .checklist-row.compact-doc-row,
  .checklist-row.compact-device-row {
    grid-template-columns: 1fr;
  }
}


.print-number-backdrop {
  z-index: 60;
}

.print-number-modal {
  width: min(560px, 100%);
}

.print-target-card {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 16px;
}

.print-target-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.print-target-name {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
}

.print-target-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.print-target-meta span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
}

.print-number-form {
  display: grid;
  gap: 10px;
}

.print-number-form label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.print-number-actions {
  justify-content: flex-end;
  margin-top: 8px;
}

/* Employee table: show all employee fields and allow horizontal scrolling */
.table-scroll-note {
  margin: 10px 0 8px;
  color: var(--muted);
  font-size: 12px;
}
.employee-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}
.employee-full-table {
  min-width: 3400px;
}
.contract-full-table {
  min-width: 1500px;
}
.contract-archive-full-table {
  min-width: 1650px;
}
.handover-full-table {
  min-width: 2100px;
}
.employee-full-table th,
.employee-full-table td,
.contract-full-table th,
.contract-full-table td,
.contract-archive-full-table th,
.contract-archive-full-table td,
.handover-full-table th,
.handover-full-table td {
  white-space: nowrap;
  vertical-align: top;
}
.employee-full-table .employee-address-cell {
  min-width: 260px;
  max-width: 360px;
  white-space: normal;
  line-height: 1.35;
}
.employee-full-table .actions-cell {
  min-width: 130px;
  white-space: nowrap;
}
.employee-table-wrap::-webkit-scrollbar {
  height: 10px;
}
.employee-table-wrap::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.18);
  border-radius: 999px;
}
.employee-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.55);
  border-radius: 999px;
}

/* Employee table sorting and per-column search */
.employee-table-tools {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 10px 0 12px;
}
.employee-table-tools .btn {
  flex: 0 0 auto;
}
.table-result-info {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.employee-full-table thead th,
.contract-full-table thead th,
.contract-archive-full-table thead th,
.handover-full-table thead th {
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 2;
}
.table-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  text-align: left;
}
.table-sort-btn span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
}
.table-sort-btn.active {
  color: var(--primary);
}
.table-sort-btn.active span {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.12);
}
.table-column-filters th {
  padding-top: 4px;
  padding-bottom: 10px;
  background: var(--surface);
  position: sticky;
  top: 43px;
  z-index: 2;
}
.table-column-filters input,
.table-column-filters select {
  width: 100%;
  min-width: 120px;
  height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  outline: none;
}
.table-column-filters select {
  cursor: pointer;
}
.table-column-filters input[type="date"] {
  min-width: 135px;
}
.table-column-filters input::placeholder {
  color: var(--muted);
  font-weight: 500;
}
.employee-full-table th:first-child,
.employee-full-table td:first-child,
.contract-full-table th:first-child,
.contract-full-table td:first-child,
.contract-archive-full-table th:first-child,
.contract-archive-full-table td:first-child,
.handover-full-table th:first-child,
.handover-full-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--surface);
}
.employee-full-table thead th:first-child,
.contract-full-table thead th:first-child,
.contract-archive-full-table thead th:first-child,
.handover-full-table thead th:first-child {
  z-index: 4;
}

@media (max-width: 720px) {
  .employee-table-tools {
    align-items: flex-start;
    flex-direction: column;
  }
  .table-result-info {
    white-space: normal;
  }
}

/* Sticky action column: keep Aksi visible while scrolling left/right */
.employee-full-table th:last-child,
.employee-full-table td:last-child,
.contract-full-table th:last-child,
.contract-full-table td:last-child,
.contract-archive-full-table th:last-child,
.contract-archive-full-table td:last-child,
.handover-full-table th:last-child,
.handover-full-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 5;
  background: var(--surface);
  box-shadow: -10px 0 18px -16px rgba(15, 23, 42, 0.85);
}

.employee-full-table thead th:last-child,
.contract-full-table thead th:last-child,
.contract-archive-full-table thead th:last-child,
.handover-full-table thead th:last-child,
.employee-full-table .table-column-filters th:last-child,
.contract-full-table .table-column-filters th:last-child,
.contract-archive-full-table .table-column-filters th:last-child,
.handover-full-table .table-column-filters th:last-child {
  z-index: 8;
}

.employee-full-table td:last-child,
.contract-full-table td:last-child,
.contract-archive-full-table td:last-child,
.handover-full-table td:last-child {
  min-width: 145px;
}

.employee-full-table .actions-cell,
.contract-full-table .actions-cell,
.contract-archive-full-table .actions-cell,
.handover-full-table .actions-cell {
  background: var(--surface);
  white-space: nowrap;
}

/* Employee Excel import modal */
.import-help p {
  margin: 0 0 8px;
}
.import-result {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: var(--surface-2);
}
.import-result h4 {
  margin: 0 0 12px;
}
.import-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.import-summary-grid div {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: var(--surface);
}
.import-summary-grid strong {
  display: block;
  font-size: 20px;
}
.import-summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
.import-errors,
.import-warnings {
  color: var(--text);
}
.import-warnings {
  border: 1px solid rgba(245, 158, 11, .35);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 12px;
  background: rgba(245, 158, 11, .08);
}
.import-warnings.compact {
  padding: 8px 10px;
}
.import-errors ul,
.import-warnings ul {
  margin: 8px 0 0;
  padding-left: 18px;
  max-height: 220px;
  overflow: auto;
}
.import-errors li,
.import-warnings li {
  margin-bottom: 6px;
}
@media (max-width: 720px) {
  .import-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* v7.5 Account password reset visibility */
.user-account-item-detailed {
  align-items: flex-start;
}
.account-user-info span b,
.account-user-info small b {
  color: var(--text);
}
.user-account-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}
.soft-warning {
  background: rgba(245, 158, 11, 0.10);
  border-color: rgba(245, 158, 11, 0.28);
  color: var(--text);
  padding: 12px;
  margin-bottom: 14px;
  font-size: 13px;
}
@media (max-width: 720px) {
  .user-account-actions {
    justify-content: flex-start;
  }
}

/* v7.6 Activity log */
.activity-filters {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.activity-filters input {
  min-width: min(520px, 100%);
  flex: 1;
}
.activity-log-table th,
.activity-log-table td {
  vertical-align: top;
}
.activity-log-table .nowrap {
  white-space: nowrap;
}
@media (max-width: 720px) {
  .activity-filters {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Realtime data update indicator */
.realtime-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.realtime-indicator::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.14);
}
.realtime-indicator.is-connected {
  color: #047857;
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.10);
}
.realtime-indicator.is-connected::before {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}
.realtime-indicator.is-disconnected {
  color: #92400e;
}

.btn.warn {
  color: var(--warning);
}

.resign-summary {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
  margin-bottom: 14px;
}

.resign-summary strong {
  color: var(--text);
  font-size: 16px;
}

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

/* Fix sticky action column: tetap mepet kanan dan tetap berada di atas saat tabel di-scroll kiri/kanan */
.employee-table-wrap,
.contract-table-wrap,
.archive-table-wrap,
.table-wrap {
  position: relative;
}

.employee-full-table th:last-child,
.employee-full-table td:last-child,
.contract-full-table th:last-child,
.contract-full-table td:last-child,
.contract-archive-full-table th:last-child,
.contract-archive-full-table td:last-child,
.handover-full-table th:last-child,
.handover-full-table td:last-child,
.resign-table th:last-child,
.resign-table td:last-child {
  position: sticky !important;
  right: 0 !important;
  z-index: 30 !important;
  background: var(--surface) !important;
  box-shadow: -12px 0 20px -16px rgba(15, 23, 42, 0.95);
}

.employee-full-table thead th:last-child,
.contract-full-table thead th:last-child,
.contract-archive-full-table thead th:last-child,
.handover-full-table thead th:last-child,
.resign-table thead th:last-child,
.employee-full-table .table-column-filters th:last-child,
.contract-full-table .table-column-filters th:last-child,
.contract-archive-full-table .table-column-filters th:last-child,
.handover-full-table .table-column-filters th:last-child,
.resign-table .table-column-filters th:last-child {
  right: 0 !important;
  z-index: 45 !important;
  background: var(--surface) !important;
}

.employee-full-table td:last-child,
.contract-full-table td:last-child,
.contract-archive-full-table td:last-child,
.handover-full-table td:last-child,
.resign-table td:last-child {
  min-width: 150px;
}

.employee-full-table .actions-cell,
.contract-full-table .actions-cell,
.contract-archive-full-table .actions-cell,
.handover-full-table .actions-cell,
.resign-table .actions-cell {
  background: var(--surface) !important;
  white-space: nowrap;
}

/* v9.0 Fix: modal harus selalu berada di atas tabel/sticky columns */
.modal-backdrop,
.modal-backdrop.show {
  z-index: 10000 !important;
}

.modal-backdrop .modal,
.modal {
  position: relative;
  z-index: 10001 !important;
}

.toast {
  z-index: 10050 !important;
}
