/* ============================================================
   MEI ASTRA — Design System (Light Theme)
   Brand: Astra Motor — Red #CC1F1F | Navy #1B3E8C
   WCAG 2.1 AA compliant
   ============================================================ */

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

/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */
:root {
  /* Brand — Astra Motor */
  --brand-red:        #CC1F1F;
  --brand-red-light:  #E53535;
  --brand-red-dim:    rgba(204,31,31,0.08);
  --brand-red-border: rgba(204,31,31,0.20);
  --brand-navy:       #1B3E8C;
  --brand-navy-light: #2551B3;
  --brand-navy-dim:   rgba(27,62,140,0.08);

  /* Primary CTA */
  --brand:        var(--brand-red);
  --brand-hover:  var(--brand-red-light);

  /* Background surfaces — Light */
  --bg-page:      #F4F5F7;
  --bg-panel:     #FFFFFF;
  --bg-surface:   #FFFFFF;
  --bg-elevated:  #FFFFFF;
  --bg-hover:     #F1F3F5;
  --bg-active:    #E8EAED;
  --bg-sidebar:   #1B3E8C;

  /* Text */
  --text-primary:   #111827;
  --text-secondary: #374151;
  --text-muted:     #6B7280;
  --text-subtle:    #9CA3AF;
  --text-sidebar:   rgba(255,255,255,0.85);
  --text-sidebar-muted: rgba(255,255,255,0.55);

  /* Borders */
  --border-subtle:   #E5E7EB;
  --border-standard: #D1D5DB;
  --border-strong:   #9CA3AF;

  /* Status */
  --green:       #16a34a;
  --green-dim:   rgba(22,163,74,0.08);
  --red:         #dc2626;
  --red-dim:     rgba(220,38,38,0.08);
  --yellow:      #d97706;
  --yellow-dim:  rgba(217,119,6,0.08);
  --blue:        #2563eb;
  --blue-dim:    rgba(37,99,235,0.08);
  --orange:      #ea580c;
  --orange-dim:  rgba(234,88,12,0.08);

  /* WA green */
  --wa-green:       #16a34a;
  --wa-green-hover: #15803d;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', Menlo, monospace;

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

  /* Radius */
  --radius-sm:   4px;
  --radius-md:   6px;
  --radius-lg:   8px;
  --radius-xl:   12px;
  --radius-pill: 9999px;

  /* Layout */
  --sidebar-w: 204px;
  --topbar-h:  52px;
  --transition: 150ms ease;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family:    var(--font-sans);
  background:     var(--bg-page);
  color:          var(--text-secondary);
  font-size:      14px;
  line-height:    1.6;
  font-weight:    400;
  -webkit-font-smoothing: antialiased;
  min-height:     100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

:focus-visible {
  outline:        2px solid var(--brand-red);
  outline-offset: 2px;
  border-radius:  var(--radius-md);
}

/* ============================================================
   3. LAYOUT
   ============================================================ */
.app-shell {
  display:    flex;
  min-height: 100vh;
}

/* --- SIDEBAR (navy) --- */
.sidebar {
  width:          var(--sidebar-w);
  min-height:     100vh;
  background:     #183b84;
  display:        flex;
  flex-direction: column;
  position:       fixed;
  top:            0;
  left:           0;
  z-index:        200;
  transition:     transform var(--transition);
  overflow-y:     auto;
  border-right:   1px solid rgba(255,255,255,0.08);
  box-shadow:     14px 0 36px rgba(9, 22, 49, 0.18);
}

.sidebar-logo {
  display:       flex;
  align-items:   center;
  gap:           8px;
  padding:       13px 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  min-height:    58px;
  background:    linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.03) 100%);
}

.sidebar-logo-mark {
  width:         36px;
  height:        36px;
  display:       flex;
  align-items:   center;
  justify-content:center;
  border-radius: 10px;
  background:    linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(244,246,250,0.96) 100%);
  box-shadow:    0 10px 24px rgba(6, 16, 38, 0.22);
  flex-shrink:   0;
}

.sidebar-logo img {
  height:      20px;
  width:       auto;
  object-fit:  contain;
  display:     block;
}

.sidebar-logo-copy {
  min-width: 0;
}

.sidebar-logo-title {
  font-size:    12px;
  font-weight:  600;
  color:        #fff;
  letter-spacing: -0.02em;
}

.sidebar-logo-subtitle {
  margin-top:   2px;
  font-size:    9px;
  color:        rgba(255,255,255,0.62);
  line-height:  1.35;
}

.sidebar-logo-text {
  font-size:   10px;
  font-weight: 600;
  color:       rgba(255,255,255,0.70);
  line-height: 1.3;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex:    1;
  padding: 9px 8px;
}

.nav-section-label {
  font-size:      10px;
  font-weight:    600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color:          rgba(255,255,255,0.35);
  padding:        var(--space-3) var(--space-3) var(--space-1);
}

.nav-item {
  display:       flex;
  align-items:   center;
  gap:           9px;
  padding:       8px 9px;
  border-radius: 10px;
  font-size:     12px;
  font-weight:   500;
  color:         var(--text-sidebar);
  transition:    background var(--transition), color var(--transition), transform var(--transition), border-color var(--transition);
  line-height:   1;
  margin-bottom: 4px;
  border:        1px solid transparent;
  position:      relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.08);
  color:      #fff;
  transform:  translateX(2px);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0.08) 100%);
  color:      #fff;
  font-weight: 600;
  border-color: rgba(255,255,255,0.14);
  box-shadow:  inset 0 1px 0 rgba(255,255,255,0.08);
}

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

.nav-item svg {
  width:       15px;
  height:      15px;
  flex-shrink: 0;
  opacity:     0.9;
}
.nav-item.active svg { opacity: 1; }

.nav-icon {
  width:         24px;
  height:        24px;
  display:       inline-flex;
  align-items:   center;
  justify-content:center;
  border-radius: 7px;
  background:    rgba(255,255,255,0.06);
  flex-shrink:   0;
}

.nav-item.active .nav-icon {
  background: rgba(255,255,255,0.12);
}

.nav-label {
  flex: 1;
  min-width: 0;
}

.sidebar-footer {
  padding:       10px 8px 12px;
  border-top:    1px solid rgba(255,255,255,0.10);
  background:    linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(0,0,0,0.08) 100%);
}

.sidebar-user {
  display:       flex;
  align-items:   center;
  gap:           8px;
  padding:       8px;
  border-radius: 10px;
  margin-bottom: 5px;
  background:    rgba(255,255,255,0.06);
  border:        1px solid rgba(255,255,255,0.08);
}

.sidebar-user-trigger {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.sidebar-user-trigger:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.12);
}

.sidebar-user-avatar {
  width:       28px;
  height:      28px;
  border-radius: 8px;
  background:  linear-gradient(135deg, #f04a4a 0%, #cc1f1f 100%);
  display:     flex;
  align-items: center;
  justify-content: center;
  font-size:   11px;
  font-weight: 600;
  color:       #fff;
  flex-shrink: 0;
  box-shadow:  0 10px 20px rgba(204, 31, 31, 0.22);
  overflow:    hidden;
}

.sidebar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.sidebar-user-role {
  margin-top: 2px;
  font-size:  9px;
  color:      rgba(255,255,255,0.56);
  text-transform: capitalize;
  letter-spacing: 0.04em;
}

.nav-item-logout {
  margin-top: 4px;
  color: rgba(255,255,255,0.72);
}

.nav-item-logout:hover {
  color: #fff;
}

.profile-modal-grid {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 18px;
}

.profile-photo-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.profile-photo-preview {
  width: 96px;
  height: 96px;
  border-radius: 18px;
  background: linear-gradient(135deg, #f04a4a 0%, #cc1f1f 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 700;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(204, 31, 31, 0.18);
}

.profile-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-upload-btn {
  position: relative;
  overflow: hidden;
}

.profile-help-text {
  font-size: 11px;
  color: var(--text-subtle);
  text-align: center;
  line-height: 1.5;
}

.profile-form-panel .form-group {
  margin-bottom: 14px;
}

/* --- MAIN CONTENT --- */
.main-content {
  margin-left: var(--sidebar-w);
  flex:        1;
  min-height:  100vh;
  display:     flex;
  flex-direction: column;
}

/* --- TOP BAR --- */
.topbar {
  height:         var(--topbar-h);
  background:     var(--bg-panel);
  border-bottom:  1px solid var(--border-subtle);
  display:        flex;
  align-items:    center;
  justify-content: space-between;
  padding:        0 var(--space-6);
  position:       sticky;
  top:            0;
  z-index:        100;
  gap:            var(--space-3);
  box-shadow:     var(--shadow-sm);
}

.topbar-title {
  font-size:   15px;
  font-weight: 600;
  color:       var(--text-primary);
  letter-spacing: -0.01em;
  min-width:   0;
  overflow:    hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.hamburger {
  display:       none;
  background:    none;
  border:        1px solid var(--border-standard);
  color:         var(--text-muted);
  padding:       5px 8px;
  border-radius: var(--radius-md);
  font-size:     14px;
  line-height:   1;
  align-items:   center;
}

.page-body {
  padding:   var(--space-6);
  flex:      1;
  max-width: 1280px;
  width:     100%;
  margin:    0 auto;
}

/* ============================================================
   4. PAGE HEADER
   ============================================================ */
.page-header {
  display:         flex;
  align-items:     flex-start;
  justify-content: space-between;
  margin-bottom:   var(--space-5);
  gap:             var(--space-4);
  flex-wrap:       wrap;
}

.page-header-title {
  font-size:      20px;
  font-weight:    600;
  color:          var(--text-primary);
  letter-spacing: -0.3px;
  line-height:    1.2;
}

.page-header-subtitle {
  font-size:  13px;
  color:      var(--text-subtle);
  margin-top: 3px;
}

.page-header-actions {
  display:     flex;
  gap:         var(--space-2);
  align-items: center;
  flex-wrap:   wrap;
}

/* ============================================================
   5. CARDS
   ============================================================ */
.card {
  background:    var(--bg-panel);
  border:        1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding:       var(--space-5);
  margin-bottom: var(--space-4);
  box-shadow:    var(--shadow-sm);
}

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

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

/* ============================================================
   6. KPI CARDS
   ============================================================ */
.kpi-grid {
  display:               grid;
  grid-template-columns: repeat(4, 1fr);
  gap:                   var(--space-4);
  margin-bottom:         var(--space-6);
}

.kpi-card {
  background:    var(--bg-panel);
  border:        1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding:       var(--space-4) var(--space-5);
  box-shadow:    var(--shadow-sm);
  border-left:   3px solid var(--brand-red);
  transition:    box-shadow var(--transition), transform var(--transition);
}

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

.kpi-label {
  font-size:      11px;
  font-weight:    600;
  color:          var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom:  var(--space-2);
}

.kpi-value {
  font-size:      28px;
  font-weight:    700;
  color:          var(--text-primary);
  letter-spacing: -0.5px;
  line-height:    1;
}

.kpi-meta {
  margin-top: var(--space-2);
  font-size:  12px;
  color:      var(--text-subtle);
}

/* ============================================================
   7. BUTTONS
   ============================================================ */
.btn {
  display:       inline-flex;
  align-items:   center;
  gap:           6px;
  padding:       7px var(--space-4);
  border-radius: var(--radius-md);
  font-size:     13px;
  font-weight:   500;
  border:        1px solid transparent;
  cursor:        pointer;
  transition:    all var(--transition);
  white-space:   nowrap;
  text-decoration: none;
  line-height:   1.4;
  font-family:   var(--font-sans);
}

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

.btn-primary {
  background:   var(--brand-red);
  color:        #fff;
  border-color: var(--brand-red);
  box-shadow:   0 1px 3px rgba(204,31,31,0.30);
}
.btn-primary:hover:not(:disabled) {
  background:   var(--brand-red-light);
  border-color: var(--brand-red-light);
}

.btn-navy {
  background:   var(--brand-navy);
  color:        #fff;
  border-color: var(--brand-navy);
}
.btn-navy:hover:not(:disabled) {
  background:   var(--brand-navy-light);
  border-color: var(--brand-navy-light);
}

.btn-ghost {
  background:   #fff;
  color:        var(--text-secondary);
  border-color: var(--border-standard);
}
.btn-ghost:hover:not(:disabled) {
  background:    var(--bg-hover);
  border-color:  var(--border-strong);
  color:         var(--text-primary);
}

.btn-danger {
  background:   var(--red-dim);
  color:        var(--red);
  border-color: rgba(220,38,38,0.25);
}
.btn-danger:hover:not(:disabled) { background: rgba(220,38,38,0.14); }

.btn-wa {
  background:   var(--green-dim);
  color:        var(--wa-green);
  border-color: rgba(22,163,74,0.25);
}
.btn-wa:hover:not(:disabled) { background: rgba(22,163,74,0.14); }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px var(--space-5); font-size: 14px; }
.w-100  { width: 100%; justify-content: center; }

.icon-inline {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 14px;
}

.icon-inline svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
}

.title-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.title-inline .icon-inline {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
  color: var(--brand-navy);
}

/* ============================================================
   8. FORMS
   ============================================================ */
.form-group  { margin-bottom: var(--space-4); }

.form-label {
  display:       block;
  font-size:     12.5px;
  font-weight:   500;
  color:         var(--text-secondary);
  margin-bottom: var(--space-1);
}

.required { color: var(--brand-red); margin-left: 2px; }

.form-control {
  width:         100%;
  padding:       8px 12px;
  background:    #fff;
  border:        1px solid var(--border-standard);
  border-radius: var(--radius-md);
  color:         var(--text-primary);
  font-size:     13.5px;
  font-family:   var(--font-sans);
  transition:    border-color var(--transition), box-shadow var(--transition);
  outline:       none;
  line-height:   1.5;
}

.form-control::placeholder { color: var(--text-subtle); }
.form-control:focus {
  border-color: var(--brand-red);
  box-shadow:   0 0 0 3px rgba(204,31,31,0.10);
}
.form-control:disabled { background: var(--bg-page); opacity: 0.7; cursor: not-allowed; }

select.form-control {
  appearance:         none;
  background-image:   url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1.5 3.5h9L6 8z'/%3E%3C/svg%3E");
  background-repeat:  no-repeat;
  background-position: right 10px center;
  padding-right:      32px;
}

.form-hint {
  font-size:  11.5px;
  color:      var(--text-subtle);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

/* ============================================================
   9. TABLE
   ============================================================ */
.table-wrapper {
  background:    var(--bg-panel);
  border:        1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow:      hidden;
  overflow-x:    auto;
  box-shadow:    var(--shadow-sm);
}

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

.table th {
  background:     var(--bg-page);
  color:          var(--text-muted);
  font-size:      11px;
  font-weight:    600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding:        10px 14px;
  text-align:     left;
  border-bottom:  1px solid var(--border-standard);
  white-space:    nowrap;
}

.table td {
  padding:        10px 14px;
  border-bottom:  1px solid var(--border-subtle);
  color:          var(--text-secondary);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-hover); }

/* ============================================================
   10. BADGES
   ============================================================ */
.badge {
  display:       inline-flex;
  align-items:   center;
  padding:       2px 8px;
  border-radius: var(--radius-sm);
  font-size:     11px;
  font-weight:   600;
  letter-spacing: 0.02em;
  white-space:   nowrap;
  line-height:   1.5;
}

.badge-green   { background: var(--green-dim);  color: var(--green);   border: 1px solid rgba(22,163,74,0.20); }
.badge-red     { background: var(--red-dim);    color: var(--red);     border: 1px solid rgba(220,38,38,0.20); }
.badge-yellow  { background: var(--yellow-dim); color: var(--yellow);  border: 1px solid rgba(217,119,6,0.20); }
.badge-blue    { background: var(--blue-dim);   color: var(--blue);    border: 1px solid rgba(37,99,235,0.20); }
.badge-orange  { background: var(--orange-dim); color: var(--orange);  border: 1px solid rgba(234,88,12,0.20); }
.badge-neutral { background: var(--bg-page);    color: var(--text-muted); border: 1px solid var(--border-standard); }
.badge-brand   { background: var(--brand-red-dim); color: var(--brand-red); border: 1px solid var(--brand-red-border); }
.badge-navy    { background: var(--brand-navy-dim); color: var(--brand-navy); border: 1px solid rgba(27,62,140,0.20); }

.wa-status-sent { font-size: 11px; color: var(--wa-green); font-weight: 600; }

/* ============================================================
   11. FILTER BAR
   ============================================================ */
.filter-bar {
  display:       flex;
  gap:           var(--space-3);
  flex-wrap:     wrap;
  align-items:   flex-end;
  background:    var(--bg-panel);
  border:        1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding:       var(--space-4);
  margin-bottom: var(--space-4);
  box-shadow:    var(--shadow-sm);
}

.filter-bar .form-group { margin-bottom: 0; min-width: 150px; }

.filter-bar .form-control,
[class*="-filter-card"] .form-control,
[class*="-filter"] .form-control {
  min-height:    34px;
  padding-top:   6px;
  padding-bottom:6px;
  border-radius: 8px;
}

.filter-bar .btn-sm,
[class*="-filter-actions"] .btn-sm,
[class*="-table-toolbar"] .btn-sm,
[class*="-toolbar"] .btn-sm,
.page-header-actions .btn-sm {
  min-height:      34px;
  padding:         0 12px;
  border-radius:   8px;
  align-items:     center;
  justify-content: center;
}

/* ============================================================
   12. ALERTS
   ============================================================ */
.alert {
  padding:       10px 14px;
  border-radius: var(--radius-md);
  font-size:     13px;
  margin-bottom: var(--space-4);
  line-height:   1.5;
  border:        1px solid transparent;
}

.alert-success { background: var(--green-dim);  color: #15803d; border-color: rgba(22,163,74,0.25); }
.alert-error   { background: var(--red-dim);    color: #b91c1c; border-color: rgba(220,38,38,0.25); }
.alert-info    { background: var(--blue-dim);   color: #1d4ed8; border-color: rgba(37,99,235,0.25); }
.alert-warning { background: var(--yellow-dim); color: #b45309; border-color: rgba(217,119,6,0.25); }

/* ============================================================
   13. TOAST
   ============================================================ */
#toast-container {
  position:   fixed;
  bottom:     24px;
  right:      24px;
  z-index:    9999;
  display:    flex;
  flex-direction: column-reverse;
  gap:        8px;
  max-width:  360px;
}

.toast {
  background:    #fff;
  border:        1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding:       12px 16px;
  font-size:     13px;
  color:         var(--text-secondary);
  box-shadow:    var(--shadow-lg);
  animation:     toast-in 200ms ease forwards;
  line-height:   1.5;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--blue); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   14. MODAL
   ============================================================ */
.modal-backdrop {
  display:         none;
  position:        fixed;
  inset:           0;
  background:      rgba(0,0,0,0.45);
  z-index:         1000;
  align-items:     center;
  justify-content: center;
  padding:         var(--space-4);
}
.modal-backdrop.open { display: flex; }

.modal {
  background:    #fff;
  border:        1px solid var(--border-subtle);
  border-radius: 14px;
  width:         100%;
  max-width:     480px;
  max-height:    calc(100vh - 32px);
  overflow:      hidden;
  box-shadow:    var(--shadow-lg);
}

.modal-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         var(--space-4) var(--space-5);
  border-bottom:   1px solid var(--border-subtle);
}

.modal-title {
  font-size:   14px;
  font-weight: 600;
  color:       var(--text-primary);
}

.modal-close {
  background:    none;
  border:        1px solid var(--border-standard);
  color:         var(--text-muted);
  width:         28px;
  height:        28px;
  border-radius: 50%;
  display:       flex;
  align-items:   center;
  justify-content: center;
  font-size:     14px;
  cursor:        pointer;
  transition:    background var(--transition);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body   {
  padding:    var(--space-5);
  overflow-y: auto;
}
.modal-footer {
  padding:         var(--space-4) var(--space-5);
  border-top:      1px solid var(--border-subtle);
  display:         flex;
  justify-content: flex-end;
  gap:             var(--space-2);
}

.confirm-modal {
  max-width: 420px;
  border-radius: 18px;
}

.confirm-modal-body {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: flex-start;
}

.confirm-modal-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(27,62,140,0.08);
  color: var(--brand-navy);
  font-size: 18px;
  font-weight: 700;
}

.confirm-modal-icon.is-danger {
  background: rgba(220,38,38,0.10);
  color: var(--red);
}

.confirm-modal-heading {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.confirm-modal-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.confirm-modal-footer {
  justify-content: space-between;
}

/* ============================================================
   15. PAGINATION
   ============================================================ */
.pagination {
  display:         flex;
  gap:             4px;
  justify-content: center;
  margin-top:      var(--space-4);
}

.page-btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  width:           32px;
  height:          32px;
  border-radius:   var(--radius-md);
  font-size:       13px;
  font-weight:     500;
  color:           var(--text-muted);
  border:          1px solid var(--border-standard);
  background:      #fff;
  transition:      all var(--transition);
  text-decoration: none;
}

.page-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.page-btn.active {
  background:   var(--brand-red);
  border-color: var(--brand-red);
  color:        #fff;
}

/* ============================================================
   16. TIMELINE
   ============================================================ */
.timeline { padding: 0; }

.timeline-item {
  position:    relative;
  padding:     0 0 var(--space-5) 28px;
  border-left: 2px solid var(--border-subtle);
}
.timeline-item:last-child { border-left-color: transparent; padding-bottom: 0; }

.timeline-dot {
  position:      absolute;
  left:          -6px;
  top:           4px;
  width:         10px;
  height:        10px;
  border-radius: 50%;
  background:    var(--brand-red);
  border:        2px solid #fff;
  box-shadow:    0 0 0 2px var(--brand-red-border);
}

.timeline-date {
  font-size:     11.5px;
  color:         var(--text-subtle);
  margin-bottom: 4px;
}

.timeline-title {
  font-size:   13px;
  color:       var(--text-secondary);
  font-weight: 500;
  margin-bottom: 4px;
}

.timeline-note {
  font-size:    12.5px;
  color:        var(--text-muted);
  background:   var(--bg-page);
  border:       1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding:      var(--space-2) var(--space-3);
  margin-top:   var(--space-2);
  line-height:  1.5;
}

/* ============================================================
   17. EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding:    var(--space-10) var(--space-6);
}

.empty-state-icon {
  font-size:     32px;
  margin-bottom: var(--space-3);
  opacity:       0.3;
}

.empty-state-title {
  font-size:     15px;
  font-weight:   600;
  color:         var(--text-primary);
  margin-bottom: 6px;
}

.empty-state-desc {
  font-size:   13px;
  color:       var(--text-subtle);
  max-width:   300px;
  margin:      0 auto;
  line-height: 1.6;
}

/* ============================================================
   18. SPINNER
   ============================================================ */
.spinner {
  display:        inline-block;
  width:          13px;
  height:         13px;
  border:         2px solid rgba(0,0,0,0.15);
  border-top-color: currentColor;
  border-radius:  50%;
  animation:      spin 0.7s linear infinite;
}

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

/* ============================================================
   19. LOGIN PAGE
   ============================================================ */
.login-root {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4vw, 40px);
  background:
    radial-gradient(circle at top left, rgba(229,53,53,0.18), transparent 34%),
    radial-gradient(circle at bottom right, rgba(27,62,140,0.18), transparent 30%),
    linear-gradient(135deg, #f7f9fc 0%, #eef3fb 52%, #fff8f8 100%);
}

.login-root::before,
.login-root::after {
  content: '';
  position: absolute;
  border-radius: 999px;
  filter: blur(0);
  pointer-events: none;
}

.login-root::before {
  width: 340px;
  height: 340px;
  top: -90px;
  right: -110px;
  background: linear-gradient(180deg, rgba(204,31,31,0.14) 0%, rgba(204,31,31,0.02) 100%);
}

.login-root::after {
  width: 260px;
  height: 260px;
  bottom: -100px;
  left: -80px;
  background: linear-gradient(180deg, rgba(27,62,140,0.14) 0%, rgba(27,62,140,0.02) 100%);
}

.login-shell {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  margin: 0 auto;
}

.login-box {
  width: 100%;
  padding: clamp(24px, 4vw, 30px);
  border-radius: 24px;
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(255,255,255,0.82);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.10);
  backdrop-filter: blur(14px);
}

.login-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.login-logo {
  width: 82px;
  height: 82px;
  object-fit: contain;
  padding: 9px;
  border-radius: 20px;
  background: #fff;
  box-shadow:
    0 12px 28px rgba(15, 23, 42, 0.08),
    inset 0 0 0 1px rgba(17,24,39,0.05);
}

.login-form-head {
  margin-bottom: 20px;
  text-align: center;
}

.login-title {
  font-size: clamp(26px, 3vw, 30px);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.06;
  margin-bottom: 6px;
}

.login-sub {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}

.login-form .form-group {
  margin-bottom: 16px;
}

.login-form .form-label {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-weight: 600;
}

.login-form .form-control {
  min-height: 50px;
  border-radius: 14px;
  border-color: #d7deea;
  background: #fff;
  padding-left: 14px;
  padding-right: 14px;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.02);
}

.login-form .form-control:focus {
  border-color: rgba(27,62,140,0.34);
  box-shadow: 0 0 0 4px rgba(27,62,140,0.08);
}

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

.login-capslock {
  color: var(--brand-red);
  font-size: 12px;
  font-weight: 600;
}

.login-password-wrap {
  position: relative;
}

.login-password-wrap .form-control {
  padding-right: 58px;
}

.login-password-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border: none;
  background: rgba(15,23,42,0.05);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
}

.login-password-toggle:hover {
  background: rgba(15,23,42,0.08);
  color: var(--text-secondary);
}

.login-password-icon {
  width: 18px;
  height: 18px;
}

.login-submit {
  min-height: 52px;
  margin-top: 8px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 12px 22px rgba(27,62,140,0.18);
}

.login-submit:disabled {
  opacity: 0.78;
  cursor: not-allowed;
  box-shadow: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .login-root {
    padding: 16px;
  }

  .login-box {
    border-radius: 24px;
  }
}

@media (max-width: 560px) {
  .login-box {
    padding: 22px 18px;
  }

  .login-logo {
    width: 74px;
    height: 74px;
  }

  .login-title {
    font-size: 24px;
  }

  .login-label-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .login-password-wrap .form-control {
    padding-right: 56px;
  }

  .profile-modal-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   20. SKIP LINK
   ============================================================ */
.skip-link {
  position:   absolute;
  top:        -40px;
  left:       0;
  background: var(--brand-red);
  color:      #fff;
  padding:    8px 16px;
  z-index:    9999;
  font-size:  13px;
  border-radius: 0 0 var(--radius-md) 0;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* ============================================================
   21. RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform:  translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    display:    none;
    position:   fixed;
    inset:      0;
    background: rgba(0,0,0,0.40);
    z-index:    199;
  }
  .sidebar-overlay.open { display: block; }

  .main-content  { margin-left: 0; }
  .hamburger     { display: inline-flex; }
  .form-row      { grid-template-columns: 1fr; }
  .page-body     { padding: var(--space-4); }
}

@media (max-width: 480px) {
  .kpi-grid    { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .topbar      { padding: 0 var(--space-4); }
  .modal-backdrop { padding: 10px; align-items: flex-start; }
  .modal       { border-radius: 12px; max-height: calc(100vh - 20px); }
  .modal-header,
  .modal-body,
  .modal-footer { padding-left: var(--space-4); padding-right: var(--space-4); }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; }
}

/* ============================================================
   22. SCROLLBAR & UTILITY
   ============================================================ */
::-webkit-scrollbar             { width: 6px; height: 6px; }
::-webkit-scrollbar-track       { background: var(--bg-page); }
::-webkit-scrollbar-thumb       { background: var(--border-standard); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

.mb-0  { margin-bottom: 0 !important; }
.mb-16 { margin-bottom: 16px; }
.mt-16 { margin-top:    16px; }

@media print {
  .sidebar, .topbar, .btn, .pagination { display: none !important; }
  .main-content { margin-left: 0 !important; }
  body { background: #fff !important; color: #000 !important; }
}
