/* ═══════════════════════════════════════════════════════════════
   SI Agenda Surat RSD — Design System
   Stack: Vanilla CSS · Laravel 12 Blade
   ═══════════════════════════════════════════════════════════════ */

/* ── Google Fonts ────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── CSS Variables ───────────────────────────────────────────── */
:root {
  /* Brand Colors */
  --color-navy: #1a3a5c;
  --color-blue-dark: #1e4d80;
  --color-primary: #2563EB;
  --color-primary-light: #3B82F6;
  --color-primary-hover: #1d4ed8;

  /* Surface */
  --color-white: #ffffff;
  --color-surface: #F3F4F6;
  --color-surface-alt: #F9FAFB;

  /* Text */
  --color-text: #111827;
  --color-text-muted: #6B7280;
  --color-text-inv: #ffffff;

  /* Border */
  --color-border: #E5E7EB;
  --color-border-focus: #2563EB;

  /* Status Colors */
  --status-baru-bg: #EFF6FF;
  --status-baru-text: #1D4ED8;
  --status-didisposisi-bg: #FEF9C3;
  --status-didisposisi-text: #854D0E;
  --status-diproses-bg: #FFF7ED;
  --status-diproses-text: #9A3412;
  --status-selesai-bg: #F0FDF4;
  --status-selesai-text: #166534;
  --status-belum-dibaca-bg: #FEF2F2;
  --status-belum-dibaca-text: #991B1B;
  --status-sla-bg: #FFF1F2;
  --status-sla-text: #BE123C;

  /* Sidebar */
  --sidebar-width: 240px;
  --topbar-height: 64px;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadow */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, .08), 0 2px 4px -1px rgba(0, 0, 0, .05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, .08), 0 4px 6px -2px rgba(0, 0, 0, .05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 10px 10px -5px rgba(0, 0, 0, .04);

  /* Transition */
  --transition: 0.18s ease;
}

/* ── Alpine.js x-cloak (mencegah flash sebelum Alpine siap) ───── */
[x-cloak] {
  display: none !important;
}

/* ── Reset & Base ────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-surface);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  color: var(--color-primary-hover);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul,
ol {
  list-style: none;
}

/* ══════════════════════════════════════════════════════════════
   LAYOUT — App Shell
   ══════════════════════════════════════════════════════════════ */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-navy);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--transition);
  position: relative;
  z-index: 10;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-4);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  min-height: var(--topbar-height);
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--color-primary);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 18px;
}

.sidebar-logo-text {
  overflow: hidden;
}

.sidebar-logo-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-white);
  line-height: 1.2;
  white-space: nowrap;
}

.sidebar-logo-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, .55);
  white-space: nowrap;
}

/* Nav */
.nav-section {
  padding: var(--sp-3) 0;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.nav-section-label {
  padding: var(--sp-2) var(--sp-4);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .35);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-4);
  color: rgba(255, 255, 255, .75);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  position: relative;
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(255, 255, 255, .08);
  color: var(--color-white);
  text-decoration: none;
}

.nav-item.active {
  background: var(--color-primary);
  color: var(--color-white);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #93C5FD;
  border-radius: 0 2px 2px 0;
}

.nav-item .nav-icon {
  font-size: 16px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.nav-badge {
  display: none !important;
  margin-left: auto;
  background: #EF4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  line-height: 14px;
}

.nav-badge.active {
  display: inline-flex !important;
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--sp-4);
  border-top: 1px solid rgba(255, 255, 255, .1);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: rgba(255, 255, 255, .5);
}

/* ── Main Content Area ───────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: clip;
  min-width: 0;
}

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-6);
  gap: var(--sp-4);
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* ── Page Content ────────────────────────────────────────────── */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-6);
  /* NOTE: do NOT use display:flex here — it causes children to shrink
     and prevents overflow-based scrolling (scrollHeight = clientHeight) */
  max-height: calc(100vh - var(--topbar-height));
}

/* Spacing between page-content children (replaces flex gap) */
.page-content>*+* {
  margin-top: var(--sp-5);
}

/* ══════════════════════════════════════════════════════════════
   COMPONENTS
   ══════════════════════════════════════════════════════════════ */

/* ── Card ────────────────────────────────────────────────────── */
.card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  justify-content: space-between;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}

.card-body {
  padding: var(--sp-5);
}

.card-footer {
  padding: var(--sp-4) var(--sp-5);
  background: var(--color-surface-alt);
  border-top: 1px solid var(--color-border);
}

/* ── Stat Cards ──────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-4);
}

.stat-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  transition: box-shadow var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-card.navy::before {
  background: var(--color-navy);
}

.stat-card.blue::before {
  background: var(--color-primary);
}

.stat-card.green::before {
  background: #16A34A;
}

.stat-card.red::before {
  background: #DC2626;
}

.stat-card.orange::before {
  background: #D97706;
}

.stat-card.purple::before {
  background: #8B5CF6;
}

.stat-card.teal::before {
  background: #14B8A6;
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 20px;
}

.stat-icon.navy {
  background: #EFF6FF;
  color: var(--color-navy);
}

.stat-icon.blue {
  background: #EFF6FF;
  color: var(--color-primary);
}

.stat-icon.green {
  background: #F0FDF4;
  color: #16A34A;
}

.stat-icon.red {
  background: #FEF2F2;
  color: #DC2626;
}

.stat-icon.orange {
  background: #FFF7ED;
  color: #D97706;
}

.stat-icon.purple {
  background: #F5F3FF;
  color: #8B5CF6;
}

.stat-icon.teal {
  background: #F0FDFA;
  color: #14B8A6;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Badge Status ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-baru {
  background: var(--status-baru-bg);
  color: var(--status-baru-text);
}

.badge-didisposisi {
  background: var(--status-didisposisi-bg);
  color: var(--status-didisposisi-text);
}

.badge-diproses {
  background: var(--status-diproses-bg);
  color: var(--status-diproses-text);
}

.badge-selesai {
  background: var(--status-selesai-bg);
  color: var(--status-selesai-text);
}

.badge-belum-dibaca {
  background: var(--status-belum-dibaca-bg);
  color: var(--status-belum-dibaca-text);
}

.badge-sla {
  background: var(--status-sla-bg);
  color: var(--status-sla-text);
}

.badge-secondary {
  background: #F3F4F6;
  color: #6B7280;
}

.badge-booked {
  background: #EDE9FE;
  color: #6D28D9;
  font-weight: 700;
}

.badge-warning {
  background: #FEF9C3;
  color: #854D0E;
}

.badge-danger {
  background: #FEF2F2;
  color: #991B1B;
}

.badge-dark {
  background: #1F2937;
  color: #F9FAFB;
}

/* ── Surat Keluar Badges ────────────────────────────────────────── */
.badge-draft {
  background: #E5E7EB;
  color: #4B5563;
}

.badge-diajukan {
  background: #FEF3C7;
  color: #D97706;
}

.badge-disetujui {
  background: #DBEAFE;
  color: #1D4ED8;
}

.badge-ditolak {
  background: #FEE2E2;
  color: #DC2626;
}

.badge-terkirim {
  background: #D1FAE5;
  color: #047857;
}


/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .3);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-border);
  color: var(--color-text);
}

.btn-success {
  background: #16A34A;
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #15803D;
  color: white;
}

.btn-danger {
  background: #DC2626;
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #B91C1C;
  color: white;
}

.btn-warning {
  background: #D97706;
  color: white;
}

.btn-warning:hover:not(:disabled) {
  background: #B45309;
  color: white;
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--color-primary);
  color: white;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 11px 22px;
  font-size: 15px;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius);
}

.btn-icon.btn-sm {
  padding: 5px;
}

/* ── Form Elements ───────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-4);
}

.form-row-3 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-4);
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: .03em;
}

.form-label .required {
  color: #DC2626;
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  line-height: 1.5;
}

.form-control:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.form-control::placeholder {
  color: var(--color-text-muted);
}

.form-control[readonly] {
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

select.form-control {
  cursor: pointer;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.form-text {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.is-invalid {
  border-color: #DC2626 !important;
}

.invalid-feedback {
  font-size: 11px;
  color: #DC2626;
  margin-top: 2px;
}

/* ── Table ───────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

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

table.datatable thead th {
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

table.datatable tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition);
}

table.datatable tbody tr:last-child {
  border-bottom: none;
}

table.datatable tbody tr:hover {
  background: var(--color-surface);
}

table.datatable tbody td {
  padding: 12px;
  color: var(--color-text);
  vertical-align: middle;
}

table.datatable tbody td.text-muted {
  color: var(--color-text-muted);
}

.no-data {
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  color: var(--color-text-muted);
  font-size: 14px;
}

.no-data-icon {
  font-size: 48px;
  margin-bottom: var(--sp-3);
  opacity: .4;
}

/* DataTables custom styling */
.dt-container .dt-search input,
.dt-container .dt-length select {
  font-family: inherit !important;
  font-size: 13px !important;
  padding: 6px 10px !important;
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius) !important;
  outline: none !important;
}

.dt-container .dt-search input:focus,
.dt-container .dt-length select:focus {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12) !important;
}

.dt-container .dt-pager .dt-pager-nav .page-link {
  padding: 5px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--color-primary);
  cursor: pointer;
}

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  backdrop-filter: blur(3px);
  animation: fade-in .15s ease;
}

.swal2-container {
  z-index: 999999 !important;
}

.modal {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slide-up .2s ease;
  overflow: hidden;
}

.modal form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.modal-lg {
  max-width: 800px;
}

.modal-sm {
  max-width: 420px;
}

.modal-header {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--color-text-muted);
  transition: background var(--transition);
}

.modal-close:hover {
  background: var(--color-surface);
}

.modal-body {
  padding: var(--sp-6);
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.modal-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  flex-shrink: 0;
  background: var(--color-surface-alt);
}

/* ── Toast / Alert ───────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: var(--sp-5);
  right: var(--sp-5);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-width: 360px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid;
  animation: slide-in-right .25s ease;
}

.toast.success {
  border-color: #16A34A;
}

.toast.error {
  border-color: #DC2626;
}

.toast.warning {
  border-color: #D97706;
}

.toast.info {
  border-color: var(--color-primary);
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
  padding-top: 1px;
}

.toast-text {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
}

/* ── Notification Bell Dropdown ──────────────────────────────── */
.notif-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-white);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 16px;
  color: var(--color-text-muted);
  transition: all var(--transition);
}

.notif-btn:hover {
  background: var(--color-surface);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #EF4444;
  color: white;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  padding: 0 3px;
  border: 2px solid white;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 500;
}

.notif-dropdown-header {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notif-item {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: var(--sp-3);
  cursor: pointer;
  transition: background var(--transition);
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item:hover {
  background: var(--color-surface);
}

.notif-item.unread {
  background: #EFF6FF;
}

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
  margin-top: 5px;
}

.notif-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
}

.notif-pesan {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 1px;
}

.notif-time {
  font-size: 10px;
  color: var(--color-text-muted);
  margin-top: 3px;
}

/* ── Pohon Disposisi ─────────────────────────────────────────── */
.pohon-tree {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.pohon-node {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-white);
  overflow: hidden;
}

.pohon-node-header {
  padding: var(--sp-3) var(--sp-4);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.pohon-level {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
}

.pohon-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 24px;
  flex-shrink: 0;
}

.pohon-line-v {
  width: 2px;
  background: var(--color-border);
  flex: 1;
  min-height: 16px;
}

.pohon-line-h {
  height: 2px;
  width: 16px;
  background: var(--color-border);
}

.pohon-children {
  padding-left: 28px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 12px;
  color: var(--color-text-muted);
}

.breadcrumb a {
  color: var(--color-primary);
  font-weight: 500;
}

.breadcrumb-sep {
  color: var(--color-border);
}

.breadcrumb-current {
  font-weight: 600;
  color: var(--color-text);
}

/* ── Detail List ─────────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: var(--sp-2) var(--sp-4);
}

.detail-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  padding-top: 2px;
}

.detail-value {
  font-size: 14px;
  color: var(--color-text);
}

/* ── File Upload ─────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-8);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--color-primary);
  background: #EFF6FF;
}

.upload-zone input[type="file"] {
  display: none;
}

.upload-zone-icon {
  font-size: 32px;
  color: var(--color-text-muted);
  margin-bottom: var(--sp-2);
}

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

.upload-zone-hint {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}

.file-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--color-surface);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.file-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.file-name {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text);
}

.file-size {
  font-size: 11px;
  color: var(--color-text-muted);
}

/* ── Filter Bar ──────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
}

/* ── SLA Warning ─────────────────────────────────────────────── */
.sla-warning {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--status-sla-text);
  font-size: 11px;
  font-weight: 600;
}

/* ── Loading Spinner ─────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.spinner.dark {
  border-color: rgba(0, 0, 0, .12);
  border-top-color: var(--color-primary);
}

/* ── Section Divider ─────────────────────────────────────────── */
.section-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: var(--sp-4) 0;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ── Login Page ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--color-white);
}

.login-hero {
  background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-blue-dark) 50%, #1a56a0 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12);
  position: relative;
  overflow: hidden;
}

.login-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.login-hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.login-hero-logo {
  width: 72px;
  height: 72px;
  background: rgba(255, 255, 255, .15);
  border-radius: var(--radius-xl);
  display: grid;
  place-items: center;
  font-size: 36px;
  margin: 0 auto var(--sp-5);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, .2);
}

.login-hero-title {
  font-size: 26px;
  font-weight: 700;
  color: white;
  margin-bottom: var(--sp-3);
}

.login-hero-sub {
  font-size: 14px;
  color: rgba(255, 255, 255, .7);
  line-height: 1.7;
}

.login-form-area {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12);
}

.login-box {
  width: 100%;
  max-width: 400px;
}

.login-box-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--sp-2);
}

.login-box-sub {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: var(--sp-8);
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slide-up {
  from {
    transform: translateY(24px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slide-in-right {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Utilities ───────────────────────────────────────────────── */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-end {
  justify-content: flex-end;
}

.gap-2 {
  gap: var(--sp-2);
}

.gap-3 {
  gap: var(--sp-3);
}

.gap-4 {
  gap: var(--sp-4);
}

.gap-6 {
  gap: var(--sp-6);
}

.flex-1 {
  flex: 1;
}

.flex-wrap {
  flex-wrap: wrap;
}

.w-full {
  width: 100%;
}

.min-w-0 {
  min-width: 0;
}

.text-muted {
  color: var(--color-text-muted);
}

.text-sm {
  font-size: 12px;
}

.text-xs {
  font-size: 11px;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-1 {
  margin-top: var(--sp-1);
}

.mt-2 {
  margin-top: var(--sp-2);
}

.mt-3 {
  margin-top: var(--sp-3);
}

.mt-4 {
  margin-top: var(--sp-4);
}

.mt-6 {
  margin-top: var(--sp-6);
}

.mb-2 {
  margin-bottom: var(--sp-2);
}

.mb-4 {
  margin-bottom: var(--sp-4);
}

.p-4 {
  padding: var(--sp-4);
}

.p-5 {
  padding: var(--sp-5);
}

.p-6 {
  padding: var(--sp-6);
}

.px-4 {
  padding-left: var(--sp-4);
  padding-right: var(--sp-4);
}

.py-2 {
  padding-top: var(--sp-2);
  padding-bottom: var(--sp-2);
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relative {
  position: relative;
}

.hidden {
  display: none !important;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar {
    width: 60px;
  }

  .sidebar-logo-text,
  .nav-item span:not(.nav-icon),
  .nav-section-label,
  .sidebar-user-name,
  .sidebar-user-role {
    display: none;
  }

  .sidebar:not(.open) #btn-pwa-install {
    display: none !important;
  }

  .sidebar-logo {
    justify-content: center;
  }

  .sidebar-logo-icon {
    margin: 0;
  }

  .nav-item {
    justify-content: center;
    padding: 12px;
  }

  .sidebar-user {
    justify-content: center;
  }

  .login-page {
    grid-template-columns: 1fr;
  }

  .login-hero {
    display: none;
  }
}

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

  .form-row,
  .form-row-3 {
    grid-template-columns: 1fr;
  }

  .page-content {
    padding: var(--sp-4);
  }

  .detail-grid {
    grid-template-columns: 120px 1fr;
  }
}

/* ── Select2 Aesthetic Customizations ─────────────────────────── */
.select2-container {
  width: 100% !important;
}

.select2-container--default .select2-selection--single {
  height: 38px !important;
  padding: 5px 12px !important;
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius) !important;
  background-color: var(--color-white) !important;
  outline: none !important;
  display: flex !important;
  align-items: center !important;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.select2-container--default .select2-selection--single:focus,
.select2-container--default.select2-container--focus .select2-selection--single {
  border-color: var(--color-border-focus) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  padding-left: 0 !important;
  font-size: 14px !important;
  color: var(--color-text) !important;
  font-family: inherit !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 36px !important;
  right: 8px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--color-text-muted) transparent transparent transparent !important;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
  border-color: transparent transparent var(--color-text-muted) transparent !important;
}

.select2-dropdown {
  border: 1px solid var(--color-border-focus) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-lg) !important;
  z-index: 99999 !important;
  overflow: hidden;
}

.select2-container--default .select2-search--dropdown {
  padding: 8px !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  padding: 6px 10px !important;
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius) !important;
  font-family: inherit !important;
  font-size: 13px !important;
  outline: none !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12) !important;
}

.select2-results__option {
  padding: 8px 12px !important;
  font-size: 13px !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--color-primary) !important;
  color: white !important;
}

.select2-container--default .select2-results__option[aria-selected="true"] {
  background-color: var(--color-bg-alt) !important;
  color: var(--color-primary) !important;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile & Tablet
   Breakpoints:
     md  ≤ 768px  (tablet portrait & HP landscape)
     sm  ≤ 640px  (HP portrait)
   ══════════════════════════════════════════════════════════════ */

/* ── Hamburger toggle button (hanya terlihat di mobile) ─────── */
.btn-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 18px;
  color: var(--color-text);
  flex-shrink: 0;
  transition: background var(--transition);
}

.btn-hamburger:hover {
  background: var(--color-surface);
}

/* ── Sidebar backdrop overlay ────────────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 99;
}

.sidebar-backdrop.active {
  display: block;
}

/* ════════════════════════════════
   TABLET — ≤ 768px
   ════════════════════════════════ */
@media (max-width: 768px) {

  /* Hamburger button tampil */
  .btn-hamburger {
    display: flex;
  }

  /* Show, Dashboard, Laporan pages: 2 kolom → 1 kolom */
  .show-layout-grid,
  .dashboard-layout-grid,
  .laporan-layout-grid {
    grid-template-columns: 1fr !important;
  }


  /* Detail grid: label di atas, value di bawah */
  .detail-grid {
    grid-template-columns: 1fr !important;
  }

  .detail-label {
    padding-bottom: 0 !important;
    font-weight: 700;
    color: var(--color-text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: var(--sp-3);
  }

  .detail-value {
    padding-top: 2px !important;
  }

  .detail-label:first-child {
    margin-top: 0;
  }

  /* Sidebar: SEMBUNYIKAN sepenuhnya saat mobile (closed) */
  .sidebar {
    display: none !important;
    /* Hapus dari layout */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: var(--sidebar-width) !important;
    height: 100vh !important;
    z-index: 200 !important;
    box-shadow: none;
  }

  /* Sidebar: TAMPILKAN saat hamburger ditekan */
  .sidebar.open {
    display: flex !important;
    /* Kembali ke flex column */
    animation: slideInSidebar .22s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, .4);
  }

  /* Paksa teks di dalam sidebar untuk tampil saat sidebar dibuka di mobile */
  .sidebar.open .sidebar-logo-text,
  .sidebar.open .nav-item span:not(.nav-badge),
  .sidebar.open .nav-section-label,
  .sidebar.open .sidebar-user-name,
  .sidebar.open .sidebar-user-role {
    display: block !important;
  }

  /* Badge: hanya tampil jika JS menambahkan class .active */
  .sidebar.open .nav-badge.active {
    display: inline-flex !important;
  }

  .sidebar.open .nav-item {
    justify-content: flex-start !important;
    padding: 10px var(--sp-4) !important;
  }

  .sidebar.open .sidebar-logo {
    justify-content: flex-start !important;
  }

  .sidebar.open .sidebar-user {
    justify-content: flex-start !important;
  }


  /* Main content ambil seluruh lebar */
  .main-content {
    width: 100%;
    max-width: 100%;
  }

  /* App shell: hapus overflow hidden agar sidebar fixed bisa muncul */
  .app-shell {
    overflow: visible;
  }

  /* Body: clip overflow horizontal */
  body {
    overflow-x: hidden;
  }

  /* Topbar lebih kompak */
  .topbar {
    padding: 0 var(--sp-3);
    gap: var(--sp-2);
  }

  .topbar-title {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Page content: kurangi padding */
  .page-content {
    padding: var(--sp-3);
  }

  .page-content>*+* {
    margin-top: var(--sp-3);
  }

  /* Stat grid: 2 kolom */
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-3);
  }

  .stat-value {
    font-size: 22px;
  }

  /* Form grid: 1 kolom */
  .form-row {
    grid-template-columns: 1fr;
  }

  .form-row-3 {
    grid-template-columns: 1fr;
  }

  /* Modal: padding overlay dikecilkan, muncul dari bawah */
  .modal-overlay {
    padding: var(--sp-2);
    align-items: flex-end;
  }

  .modal,
  .modal-lg {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
  }

  /* Tabel: font & padding lebih kecil */
  table.datatable thead th {
    font-size: 10px;
    padding: 8px 8px;
  }

  table.datatable tbody td {
    padding: 10px 8px;
    font-size: 12px;
  }

  /* Filter bar: wrap */
  .filter-bar {
    flex-wrap: wrap;
    gap: var(--sp-2);
  }

  .filter-bar .form-control {
    width: 100% !important;
    min-width: unset !important;
  }

  /* Card header */
  .card-header {
    flex-wrap: wrap;
    gap: var(--sp-2);
  }

  /* Flex justify-between: wrap di mobile */
  .flex.justify-between {
    flex-wrap: wrap;
    gap: var(--sp-2);
  }
}

/* ════════════════════════════════
   MOBILE — ≤ 640px
   ════════════════════════════════ */
@media (max-width: 640px) {

  /* Stat grid: 1 kolom di HP kecil */
  .stat-grid {
    grid-template-columns: 1fr;
  }

  /* Modal: fullscreen dari bawah */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal,
  .modal-lg {
    max-height: 95vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  /* Topbar title lebih kecil */
  .topbar-title {
    font-size: 13px;
  }

  /* Sembunyikan nama user di topbar, tampilkan hanya avatar */
  .topbar-username {
    display: none;
  }

  /* Buttons di mobile lebih kecil */
  .btn {
    font-size: 12px;
    padding: 7px 12px;
  }

  .btn-sm {
    font-size: 11px;
    padding: 4px 8px;
  }
}

@keyframes slideInSidebar {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(0);
  }
}

/* ── Toast Notification System ──────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
  width: calc(100% - 40px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-white, #ffffff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-left: 5px solid var(--color-primary, #2563eb);
  border-radius: var(--radius-lg, 8px);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1));
  pointer-events: auto;
  animation: slide-in-right .25s ease forwards;
}

.toast.success {
  border-left-color: #10b981;
}

.toast.error {
  border-left-color: #ef4444;
}

.toast.warning {
  border-left-color: #f59e0b;
}

.toast.info {
  border-left-color: #3b82f6;
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.toast-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text, #1e293b);
  line-height: 1.4;
}



/* ── DataTables 2 Responsive Layout Fixes ── */
.dt-layout-table,
.dt-layout-row,
.dt-layout-cell {
  max-width: 100% !important;
}

.dt-layout-table {
  width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}