/* ============================================================
   PINUS PACKINDO INTERNAL AUDIT v.2 — CORE STYLESHEET
   ============================================================ */

:root {
  --primary:        #8B0050;
  --primary-dark:   #5C0035;
  --primary-mid:    #A0005E;
  --primary-light:  #C2185B;
  --accent:         #E91E8C;
  --accent-light:   #F48FB1;
  --bg-page:        #FDF0F7;
  --bg-card:        #FFFFFF;
  --sidebar-bg:     #5C0035;
  --sidebar-hover:  #8B0050;
  --sidebar-active: #A0005E;
  --sidebar-text:   #F8BBD0;
  --sidebar-icon:   #F48FB1;
  --text-dark:      #2D1B2D;
  --text-mid:       #5A3A5A;
  --text-light:     #9E7E9E;
  --border:         #EDD5E8;
  --shadow:         rgba(139, 0, 80, 0.12);
  --success:        #2E7D32;
  --success-bg:     #E8F5E9;
  --warning:        #F57F17;
  --warning-bg:     #FFF8E1;
  --danger:         #C62828;
  --danger-bg:      #FFEBEE;
  --info:           #01579B;
  --info-bg:        #E1F5FE;
  --orange:         #E65100;
  --orange-bg:      #FFF3E0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg-page);
  color: var(--text-dark);
  font-size: 14px;
  line-height: 1.5;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1e0ed; }
::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 3px; }

/* ══════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #5C0035 0%, #8B0050 50%, #C2185B 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
  top: -200px; right: -200px;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
  bottom: -150px; left: -100px;
}

.login-box {
  background: white;
  border-radius: 20px;
  padding: 48px 40px;
  width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .logo-icon {
  width: 72px; height: 72px;
  background: white;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px var(--shadow);
  overflow: hidden;
}
.login-logo .logo-icon svg { width: 36px; height: 36px; fill: white; }
.login-logo .logo-icon img { width: 100%; height: 100%; object-fit: cover; }
.login-logo h1 { font-size: 20px; font-weight: 700; color: var(--primary); }
.login-logo p { font-size: 12px; color: var(--text-light); margin-top: 4px; }

.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-dark);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-group input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(194, 24, 91, 0.1);
}

.btn-login {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-top: 8px;
}
.btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--shadow);
}
.btn-login:active { transform: translateY(0); }

.login-error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
  display: none;
}

/* ══════════════════════════════════════════
   APP LAYOUT
══════════════════════════════════════════ */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ── */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;           /* clip content during width transition */
  transition: width 0.25s ease;
}

/* ── FROZEN HEADER (brand) ── */
.sidebar-sticky-header {
  flex-shrink: 0;             /* never shrink — stays at top */
  background: var(--sidebar-bg);
  border-bottom: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18); /* visual "above nav" cue */
  z-index: 2;
}

.sidebar-brand {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  white-space: nowrap;
}
.brand-logo-icon {
  width: 34px; height: 34px;
  background: white;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.brand-logo-icon svg { width: 19px; height: 19px; fill: white; }
.brand-logo-icon img { width: 100%; height: 100%; object-fit: cover; }
.brand-text { overflow: hidden; min-width: 0; }
.sidebar-brand .brand-name {
  font-size: 12px;
  font-weight: 700;
  color: white;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-brand .brand-sub {
  font-size: 10px;
  color: var(--sidebar-text);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── SCROLLABLE NAV MIDDLE ── */
.sidebar-nav { padding: 12px 0; flex: 1; overflow-y: auto; min-height: 0; }
.nav-section-label {
  padding: 8px 20px 4px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(248,187,208,0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
  position: relative;
}
.nav-item:hover { background: var(--sidebar-hover); color: white; }
.nav-item.active {
  background: var(--sidebar-active);
  color: white;
  border-left-color: var(--accent);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; fill: currentColor; }
.nav-item span { font-size: 13px; font-weight: 500; }

.nav-submenu {
  background: rgba(0,0,0,0.15);
  display: none;
}
.nav-submenu.open { display: block; }
.nav-submenu .nav-item { padding-left: 52px; font-size: 12px; }

.nav-item .chevron {
  margin-left: auto;
  width: 14px; height: 14px;
  transition: transform 0.2s;
}
.nav-item.open .chevron { transform: rotate(90deg); }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;             /* never shrink — stays at bottom */
  background: var(--sidebar-bg);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.18); /* visual "below nav" cue */
  z-index: 2;
}
.btn-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.12); color: white; }
.btn-logout svg { width: 16px; height: 16px; fill: currentColor; }

/* ── MAIN ── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── TOPBAR ── */
.topbar {
  background: white;
  padding: 0 20px 0 16px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--shadow);
}
.topbar-title { font-size: 18px; font-weight: 700; color: var(--primary); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-date { font-size: 12px; color: var(--text-light); }

/* ── Topbar avatar circle ── */
.topbar-avatar-wrap { position: relative; }
.topbar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  font-size: 15px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  transition: box-shadow 0.2s;
}
.topbar-avatar:hover { box-shadow: 0 0 0 3px rgba(139,0,80,0.2); }

/* ── Dropdown profil ── */
.topbar-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 28px rgba(0,0,0,0.13);
  padding: 12px 16px;
  min-width: 160px;
  z-index: 999;
  display: none;
  animation: dropIn 0.15s ease;
}
.topbar-dropdown.open { display: block; }
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.topbar-dd-name { font-size: 14px; font-weight: 700; color: var(--text-dark); white-space: nowrap; }
.topbar-dd-role { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.topbar-dd-logout {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 6px 0 4px;
  background: none; border: none; cursor: pointer;
  font-size: 13px; color: var(--danger); font-weight: 600;
  transition: opacity 0.15s;
}
.topbar-dd-logout:hover { opacity: 0.75; }
.topbar-dd-logout svg { width: 16px; height: 16px; fill: currentColor; }

/* ── CONTENT ── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ══════════════════════════════════════════
   DASHBOARD PAGE
══════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: white;
  border-radius: 14px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 26px; height: 26px; fill: white; }
.stat-icon.pink { background: linear-gradient(135deg, var(--primary), var(--primary-light)); }
.stat-icon.green { background: linear-gradient(135deg, #2E7D32, #66BB6A); }
.stat-icon.orange { background: linear-gradient(135deg, #E65100, #FFA726); }
.stat-icon.blue { background: linear-gradient(135deg, #01579B, #29B6F6); }

.stat-info .stat-val { font-size: 28px; font-weight: 700; color: var(--text-dark); }
.stat-info .stat-label { font-size: 12px; color: var(--text-light); margin-top: 2px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* ══════════════════════════════════════════
   CARDS & PANELS
══════════════════════════════════════════ */
.card {
  background: white;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title svg { width: 18px; height: 18px; fill: var(--primary); }
.card-body { padding: 20px 24px; }

/* ══════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.btn svg { width: 15px; height: 15px; fill: currentColor; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px var(--shadow); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #1B5E20; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #B71C1C; }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon svg { width: 16px; height: 16px; margin: 0; }

/* ══════════════════════════════════════════
   TABLE
══════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg-page);
  padding: 7px 10px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dark);
  vertical-align: middle;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FDF0F7; }

/* ══════════════════════════════════════════
   BADGES & STATUS
══════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-done { background: var(--success-bg); color: var(--success); }
.badge-process { background: var(--warning-bg); color: var(--warning); }
.badge-failed { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-pending { background: #F3E5F5; color: #6A1B9A; }

/* ══════════════════════════════════════════
   SCORE DISPLAY
══════════════════════════════════════════ */
.score-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  min-width: 80px;
}
.score-pct { font-size: 11px; font-weight: 700; white-space: nowrap; }
.score-pct.high { color: var(--success); }
.score-pct.mid { color: var(--warning); }
.score-pct.low { color: var(--danger); }
.score-track {
  height: 5px;
  width: 50px;
  flex-shrink: 0;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.score-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}
.score-fill.high { background: var(--success); }
.score-fill.mid { background: var(--warning); }
.score-fill.low { background: var(--danger); }

/* ══════════════════════════════════════════
   ACTION ICONS (Book, Runner)
══════════════════════════════════════════ */
.icon-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: none;
}
.icon-btn svg { width: 15px; height: 15px; }

.icon-btn.book { background: var(--info-bg); color: var(--info); }
.icon-btn.book:hover { background: var(--info); color: white; }
.icon-btn.book svg { fill: currentColor; }

.icon-btn.runner { background: var(--orange-bg); color: var(--orange); }
.icon-btn.runner.done { background: var(--success-bg); color: var(--success); }
.icon-btn.runner svg { fill: currentColor; }
.icon-btn.runner:hover { background: var(--orange); color: white; }
.icon-btn.runner.done:hover { background: var(--success); color: white; }
.icon-btn.runner.done.pending-verif { background: var(--warning-bg); color: var(--warning); }
.icon-btn.runner.done.pending-verif:hover { background: var(--warning); color: white; }

.runner-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.runner-date { font-size: 10px; color: var(--success); font-weight: 600; white-space: nowrap; }

/* ══════════════════════════════════════════
   MODAL
══════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
  transform: scale(0.95);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal.modal-lg { max-width: 800px; }
.modal.modal-xl { max-width: 1000px; }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--primary); }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--bg-page);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-mid);
  font-size: 18px;
  transition: background 0.2s;
}
.modal-close:hover { background: var(--border); }
.modal-body { padding: 24px; }
/* Tabel di dalam modal: hanya scroll kiri-kanan, vertikal diurus modal-body */
.modal-body .table-wrap {
  overflow-x: auto;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── FORM ELEMENTS IN MODAL ── */
.field-group { margin-bottom: 18px; }
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-input, .field-select, .field-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-dark);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.field-input:focus, .field-select:focus, .field-textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(194,24,91,0.08);
}
.field-textarea { resize: vertical; min-height: 80px; }
.field-input[type="file"] { padding: 8px; }

.upload-area {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.upload-area:hover { border-color: var(--primary-light); background: #FDF0F7; }
.upload-area.drag-over { border-color: var(--primary); background: #FDE8F3; }
.upload-area svg { width: 36px; height: 36px; fill: var(--text-light); }
.upload-area p { font-size: 13px; color: var(--text-light); margin-top: 8px; }
.upload-area .file-name { font-size: 13px; color: var(--primary); font-weight: 600; margin-top: 6px; }

/* ══════════════════════════════════════════
   WORKSHEET DETAIL VIEW (Book Modal)
══════════════════════════════════════════ */
.detail-section { margin-bottom: 24px; }
.detail-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.detail-item label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.detail-item p {
  font-size: 13px;
  color: var(--text-dark);
  font-weight: 500;
  margin-top: 2px;
}

.loss-banner {
  background: linear-gradient(135deg, var(--danger-bg), #FFD7D7);
  border: 1px solid #FFCDD2;
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}
.loss-banner svg { width: 24px; height: 24px; fill: var(--danger); flex-shrink: 0; }
.loss-banner .loss-label { font-size: 12px; color: var(--danger); font-weight: 600; text-transform: uppercase; }
.loss-banner .loss-val { font-size: 22px; font-weight: 700; color: var(--danger); }

/* Score Cards Row (3-column grid in detail modal) */
.score-cards-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin: 16px 0; }
.score-card { border-radius: 10px; border: 1px solid; padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.score-card svg { width: 24px; height: 24px; flex-shrink: 0; }
.score-card .sc-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.score-card .sc-val { font-size: 22px; font-weight: 700; line-height: 1.1; }
.score-card .sc-sub { font-size: 10px; font-weight: 400; margin-top: 2px; opacity: .8; }
.score-card.sc-green { background: linear-gradient(135deg, #E8F5E9, #C8E6C9); border-color: #A5D6A7; }
.score-card.sc-green svg { fill: var(--success); }
.score-card.sc-green .sc-label, .score-card.sc-green .sc-val { color: var(--success); }
.score-card.sc-blue { background: linear-gradient(135deg, #E3F2FD, #BBDEFB); border-color: #90CAF9; }
.score-card.sc-blue svg { fill: var(--info); }
.score-card.sc-blue .sc-label, .score-card.sc-blue .sc-val { color: var(--info); }
.score-card.sc-red { background: linear-gradient(135deg, var(--danger-bg), #FFD7D7); border-color: #FFCDD2; }
.score-card.sc-red svg { fill: var(--danger); }
.score-card.sc-red .sc-label, .score-card.sc-red .sc-val { color: var(--danger); }

/* ── Formula Panel (Rumus Penilaian) ────────────────────────── */
.formula-panel { border: 1px solid #e8c8da; border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.formula-toggle { width: 100%; display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: linear-gradient(135deg, #fdf5f9, #fce8f3); border: none; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--primary); text-align: left; }
.formula-toggle svg { width: 15px; height: 15px; fill: var(--primary); flex-shrink: 0; }
.formula-toggle .fm-chevron { margin-left: auto; transition: transform .2s; }
.formula-toggle.fm-open .fm-chevron { transform: rotate(180deg); }
.formula-body { padding: 14px 16px; background: white; border-top: 1px solid #e8c8da; font-size: 12px; }
.formula-block { margin-bottom: 12px; }
.formula-block:last-child { margin-bottom: 0; }
.formula-block-title { font-size: 11px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 5px; }
.formula-expr { font-size: 12px; background: var(--bg-page); border-radius: 6px; padding: 9px 12px; color: var(--text-dark); line-height: 2; }
.fm-var  { color: var(--primary); font-weight: 700; }
.fm-val  { color: #1B5E20; font-weight: 700; }
.fm-note { color: var(--text-light); font-size: 10px; }
.formula-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.formula-tag { background: var(--bg-page); border: 1px solid var(--border); border-radius: 16px; padding: 3px 10px; font-size: 11px; color: var(--text-dark); }
.formula-tag strong { color: var(--primary); }
.formula-divider { border: none; border-top: 1px solid var(--border); margin: 10px 0; }

/* ── Finance Module ──────────────────────────────────────────── */
.finance-row { display:flex; gap:8px; align-items:center; margin-bottom:6px; }
.score-tag { display:inline-block; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:600; white-space:nowrap; }
.score-tag-green  { background:#E8F5E9; color:var(--success); }
.score-tag-yellow { background:#FFF3E0; color:var(--warning); }
.score-tag-red    { background:var(--danger-bg); color:var(--danger); }
.score-tag-gray   { background:var(--bg-page); color:var(--text-light); border:1px solid var(--border); }
.btn-add-row { display:flex; align-items:center; justify-content:center; gap:6px; width:100%; background:none; border:1.5px dashed var(--border); border-radius:8px; padding:8px 14px; font-size:12px; color:var(--text-light); cursor:pointer; margin-top:4px; transition:all .15s; }
.btn-add-row:hover { border-color:var(--primary-light); color:var(--primary-light); background:rgba(194,24,91,.04); }
.btn-danger-sm { background:none; border:1px solid var(--danger); color:var(--danger); padding:4px 10px; border-radius:6px; font-size:14px; cursor:pointer; line-height:1; flex-shrink:0; }
.btn-danger-sm:hover { background:var(--danger-bg); }

/* ── FREEZE COLUMNS ── */
.col-freeze-1 { position:sticky; left:0;     width:40px;  min-width:40px;  z-index:1; }
.col-freeze-2 { position:sticky; left:40px;  width:108px; min-width:108px; z-index:1; }
.col-freeze-3 { position:sticky; left:148px; min-width:160px; z-index:1; box-shadow:2px 0 5px rgba(0,0,0,0.06); }
table tbody .col-freeze-1,
table tbody .col-freeze-2,
table tbody .col-freeze-3 { background:var(--bg-card); }
table thead .col-freeze-1,
table thead .col-freeze-2,
table thead .col-freeze-3 { background:var(--bg-page); z-index:2; }
tbody tr:hover .col-freeze-1,
tbody tr:hover .col-freeze-2,
tbody tr:hover .col-freeze-3 { background:#FDF0F7; }

/* ══════════════════════════════════════════
   RECENT ACTIVITY
══════════════════════════════════════════ */
.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary-light);
  margin-top: 5px;
  flex-shrink: 0;
}
.activity-text { font-size: 13px; color: var(--text-dark); }
.activity-meta { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* ══════════════════════════════════════════
   PAGE HEADERS
══════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header-left h2 { font-size: 22px; font-weight: 700; color: var(--primary); }
.page-header-left p { font-size: 13px; color: var(--text-light); margin-top: 4px; }

/* ══════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}
.empty-state svg { width: 64px; height: 64px; fill: var(--border); margin-bottom: 16px; }
.empty-state p { color: var(--text-light); font-size: 14px; }

/* ══════════════════════════════════════════
   TOAST
══════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: white;
  border-radius: 10px;
  padding: 14px 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  border-left: 4px solid var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  animation: slideInRight 0.3s ease;
  font-size: 13px;
  font-weight: 500;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }
.toast.success svg { color: var(--success); }
.toast.error svg { color: var(--danger); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { width: 200px; }
  .content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .field-row { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════
   MOBILE — FULL REDESIGN (≤ 640px)
   Navigasi: sidebar drawer (hamburger ☰), tanpa bottom nav
══════════════════════════════════════════ */
@media (max-width: 640px) {

  /* ── Body ── */
  body { font-size: 13px; }

  /* ══ LOGIN ══ */
  .login-box {
    width: calc(100vw - 24px);
    padding: 28px 20px 24px;
    border-radius: 16px;
  }
  .login-logo .logo-icon { width: 56px; height: 56px; border-radius: 14px; }
  .login-logo .logo-icon svg { width: 28px; height: 28px; }
  .login-logo h1 { font-size: 16px; }
  .login-logo { margin-bottom: 22px; }
  .form-group { margin-bottom: 14px; }
  .form-group input { padding: 11px 14px; font-size: 14px; }
  .btn-login { padding: 13px; font-size: 14px; }

  /* ══ APP LAYOUT ══ */
  .app { position: relative; overflow: hidden; }

  /* ── SIDEBAR: drawer (slide-in dari kiri) ── */
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100%;
    width: 270px !important;  /* selalu full-text, tidak collapse */
    z-index: 500;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    overflow-y: auto;         /* internal scroll jika konten panjang */
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 6px 0 24px rgba(0,0,0,0.30);
  }

  /* ── Backdrop di belakang drawer ── */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 499;
  }
  .sidebar-backdrop.visible { display: block; }

  /* ── MAIN: full width ── */
  .main { width: 100%; }

  /* ── TOPBAR ── */
  .topbar {
    height: 52px;
    padding: 0 12px 0 10px;
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .topbar-title { font-size: 15px; }
  .topbar-date  { display: none; }
  .hamburger-btn { display: flex; margin-right: 8px; }
  /* Avatar lebih compact di mobile */
  .topbar-avatar { width: 32px; height: 32px; font-size: 13px; }
  /* Dropdown muncul ke kiri agar tidak terpotong */
  .topbar-dropdown { right: 0; min-width: 160px; }
  #ghSyncIndicator { display: none; } /* sembunyikan indikator sync di mobile */

  /* ── CONTENT ── */
  .content { padding: 14px 12px 20px; }

  /* ══ PAGE HEADER ══ */
  .page-header { flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
  .page-header-left h2 { font-size: 17px; }
  .page-header-left p  { font-size: 12px; }
  .page-header .btn   { font-size: 12px; padding: 7px 12px; }

  /* ══ STAT CARDS ══ */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .stat-card { padding: 13px 12px; gap: 10px; border-radius: 12px; }
  .stat-icon { width: 40px; height: 40px; border-radius: 10px; }
  .stat-icon svg { width: 20px; height: 20px; }
  .stat-info .stat-val   { font-size: 20px; }
  .stat-info .stat-label { font-size: 11px; }

  /* ══ DASHBOARD GRID ══ */
  .dashboard-grid { grid-template-columns: 1fr; gap: 14px; }

  /* ══ CARDS ══ */
  .card { border-radius: 12px; }
  .card-header { padding: 13px 16px 11px; }
  .card-title  { font-size: 13px; }
  .card-body   { padding: 14px 16px; }

  /* ══ TABLES — compact + touch scroll ══ */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  thead th { font-size: 9px; padding: 6px 8px; white-space: nowrap; }
  tbody td { font-size: 11px; padding: 6px 8px; }

  /* LK table: freeze hanya No. + Kode LK (col-1 & col-2), biarkan col-3 scroll */
  .col-freeze-3 {
    position: static !important;
    width: auto !important;
    min-width: 120px;
    box-shadow: none !important;
  }
  table tbody .col-freeze-3 { background: transparent; }
  table thead .col-freeze-3 { background: var(--bg-page); }
  /* Tambahkan shadow pemisah di col-freeze-2 sebagai ganti col-freeze-3 */
  .col-freeze-2 { box-shadow: 2px 0 6px rgba(0,0,0,0.08); }

  /* ══ MODAL: bottom-sheet style ══ */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: 16px 16px 0 0;
    max-width: 100%;
    max-height: 92vh;
    width: 100%;
  }
  .modal.modal-lg,
  .modal.modal-xl { max-width: 100%; }
  .modal-header { padding: 14px 16px 12px; }
  .modal-title  { font-size: 14px; }
  .modal-body   { padding: 16px; }
  .modal-footer { padding: 12px 16px; gap: 8px; }
  .modal-footer .btn { flex: 1; justify-content: center; }
  .modal::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 10px auto 0;
  }

  /* ══ FORM FIELDS ══ */
  .field-row { grid-template-columns: 1fr; }
  .field-input, .field-select, .field-textarea { padding: 9px 12px; font-size: 13px; }

  /* ══ SCORE CARDS ROW ══ */
  .score-cards-row { grid-template-columns: 1fr; gap: 8px; }
  .score-card { padding: 11px 14px; }
  .score-card .sc-val { font-size: 18px; }

  /* ══ DETAIL GRID ══ */
  .detail-grid { grid-template-columns: 1fr; }

  /* ══ BUTTONS ══ */
  .btn { font-size: 12px; padding: 7px 12px; }
  .btn-sm { font-size: 11px; padding: 4px 8px; }

  /* ══ EMPTY STATE ══ */
  .empty-state { padding: 32px 16px; }
  .empty-state svg { width: 48px; height: 48px; }
  .empty-state p { font-size: 13px; }

  /* ══ TOAST ══ */
  .toast-container { bottom: 16px; right: 12px; left: 12px; }
  .toast { min-width: unset; font-size: 12px; padding: 11px 14px; }

  /* ══ CHAT — compact, chat area naik (tanpa bottom-nav) ══ */
  .chat-wrap {
    flex-direction: column;
    height: calc(100vh - 130px);  /* topbar 52px + page-header + card padding */
    border-radius: 10px;
  }
  .chat-users-panel {
    width: 100% !important;
    min-width: unset !important;
    height: auto;          /* tinggi otomatis sesuai isi */
    max-height: 148px;     /* maks 2 baris avatar */
    flex-shrink: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .chat-users-list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;       /* user flow ke baris berikutnya, tidak scroll kanan */
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1;
  }
  .chat-user-row {
    flex-direction: column;
    align-items: center;
    padding: 5px 4px;
    min-width: 68px;
    max-width: 68px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    text-align: center;
    gap: 3px;
  }
  .chat-user-info { flex: unset; width: 100%; }
  .chat-avatar { width: 30px; height: 30px; font-size: 11px; }
  .chat-user-name {
    font-size: 9px; font-weight: 600;
    white-space: normal; word-break: break-word;
    overflow: hidden; width: 100%; line-height: 1.2;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  }
  .chat-user-sub  { display: none; }
  .chat-thread-panel { flex: 1; min-height: 0; }
  .chat-bubble { max-width: 85%; font-size: 12px; }

  /* ══ SCORE BAR ══ */
  .score-bar { min-width: 60px; }
  .score-track { width: 36px; }

  /* ══ LOSS BANNER ══ */
  .loss-banner { padding: 12px 14px; }
  .loss-banner .loss-val { font-size: 18px; }

  /* ══ ACTIVITY LIST ══ */
  .activity-text { font-size: 12px; }
  .activity-meta { font-size: 10px; }

  /* ══ FORMULA PANEL ══ */
  .formula-toggle { font-size: 11px; }
  .formula-expr { font-size: 11px; line-height: 1.8; }

  /* ══ WA SETTINGS ══ */
  .wa-settings-header { display: none !important; }
  .wa-settings-row {
    grid-template-columns: 1fr !important;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }
  .wa-settings-row:last-child { border-bottom: none; }
}

/* ══════════════════════════════════════════
   LOADING SPINNER
══════════════════════════════════════════ */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
}
.loading-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ══════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-light); }
.fw-bold { font-weight: 700; }
.fw-600 { font-weight: 600; }
.mt-auto { margin-top: auto; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.hidden { display: none !important; }
.w-full { width: 100%; }

.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ══════════════════════════════════════════
   HAMBURGER BUTTON
══════════════════════════════════════════ */
.hamburger-btn {
  width: 38px; height: 38px;
  border-radius: 8px;
  border: none;
  background: var(--bg-page);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
  margin-right: 12px;
  transition: background 0.2s;
}
.hamburger-btn:hover { background: var(--border); }
.hamburger-btn svg { width: 20px; height: 20px; fill: currentColor; }

/* ══════════════════════════════════════════
   SIDEBAR COLLAPSED STATE (minimize = icon only)
══════════════════════════════════════════ */
.sidebar.collapsed { width: 64px; }

/* ── Brand: hide text, center icon ── */
.sidebar.collapsed .brand-text   { display: none; }
.sidebar.collapsed .sidebar-brand {
  justify-content: center;
  padding: 14px 0;
}

/* ── Nav section labels: hidden ── */
.sidebar.collapsed .nav-section-label { display: none; }

/* ── Nav items: icon only, centered ── */
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 11px 0;
  border-left-color: transparent;
}
.sidebar.collapsed .nav-item.active { border-left-color: var(--accent); }
.sidebar.collapsed .nav-item > span  { display: none; }
.sidebar.collapsed .nav-item .chevron { display: none; }
.sidebar.collapsed .nav-submenu { display: none !important; }

/* ── Pending badge: small dot when collapsed ── */
.sidebar.collapsed .nav-badge {
  display: none !important;
}

/* ── Logout: icon only, centered ── */
.sidebar.collapsed .sidebar-footer { padding: 10px 0; }
.sidebar.collapsed .btn-logout {
  justify-content: center;
  padding: 10px 0;
  border: none;
  background: rgba(255,255,255,0.07);
  border-radius: 0;
}
.sidebar.collapsed .btn-logout > span { display: none; }

.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ══════════════════════════════════════════
   NAV BADGE (pending count & unread chat)
══════════════════════════════════════════ */
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
  line-height: 1;
}
.nav-item .nav-badge + svg.chevron { margin-left: 4px; }
.sidebar.collapsed .nav-badge { display: none !important; }

/* ══════════════════════════════════════════
   CHAT MODULE
══════════════════════════════════════════ */
.chat-wrap {
  display: flex;
  height: calc(100vh - 178px);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.chat-users-panel {
  width: 240px; min-width: 240px;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  background: var(--bg-card);
}
.chat-users-header {
  padding: 13px 16px;
  font-size: 13px; font-weight: 700; color: var(--primary);
  border-bottom: 1px solid var(--border);
  letter-spacing: .3px;
  display: flex; align-items: center; gap: 8px;
}
.chat-users-list { flex: 1; overflow-y: auto; }
.chat-user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.chat-user-row:hover { background: var(--bg-page); }
.chat-user-row.active { background: var(--primary); }
.chat-user-row.active .chat-user-name,
.chat-user-row.active .chat-user-sub  { color: white; }
.chat-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.chat-user-row.active .chat-avatar { background: rgba(255,255,255,.25); }
.chat-user-info { flex: 1; min-width: 0; }
.chat-user-name { font-size: 12px; font-weight: 600; color: var(--text-dark); }
.chat-user-sub  { font-size: 11px; color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.chat-unread-dot {
  background: var(--danger); color: white;
  border-radius: 10px; font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; flex-shrink: 0;
}
.chat-thread-panel {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}
.chat-thread-header {
  padding: 11px 16px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.chat-thread-title { font-size: 13px; font-weight: 700; color: var(--text-dark); }
.chat-thread-sub   { font-size: 11px; color: var(--text-light); margin-top: 1px; }
.chat-thread-actions { margin-left: auto; display: flex; gap: 6px; }
.chat-messages-area {
  flex: 1; overflow-y: auto;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--bg-page);
}
.chat-date-sep { text-align: center; margin: 12px 0 8px; }
.chat-date-sep span {
  background: var(--bg-card); color: var(--text-light);
  font-size: 11px; padding: 3px 14px;
  border-radius: 20px; border: 1px solid var(--border); font-weight: 500;
}
.chat-msg-group { display: flex; flex-direction: column; margin-bottom: 6px; }
.chat-msg-group.mine   { align-items: flex-end; }
.chat-msg-group.theirs { align-items: flex-start; }
.chat-sender-lbl { font-size: 10px; color: var(--text-light); margin-bottom: 2px; padding: 0 4px; }
.chat-bubble {
  max-width: 68%; padding: 8px 12px; border-radius: 16px;
  font-size: 13px; line-height: 1.55;
  word-break: break-word; white-space: pre-wrap;
}
.mine   .chat-bubble { background: var(--primary); color: white; border-bottom-right-radius: 4px; }
.theirs .chat-bubble { background: var(--bg-card); color: var(--text-dark); border-bottom-left-radius: 4px; border: 1px solid var(--border); }
.chat-bubble.sticker  { background: transparent !important; border: none !important; font-size: 54px; line-height: 1; padding: 4px 8px; }
.chat-bubble-img { max-width: 220px; max-height: 220px; border-radius: 8px; display: block; cursor: zoom-in; object-fit: cover; }
.chat-bubble-file { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.chat-bubble-file svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
.chat-time { font-size: 10px; color: var(--text-light); margin-top: 3px; padding: 0 4px; }
.mine .chat-time { text-align: right; }
.chat-input-wrap {
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-card); position: relative;
}
.chat-input-row {
  display: flex; align-items: flex-end; gap: 4px;
  background: var(--bg-page); border: 1px solid var(--border);
  border-radius: 24px; padding: 4px 4px 4px 14px;
  transition: border-color .2s;
}
.chat-input-row:focus-within { border-color: var(--primary-light); }
.chat-input-row textarea {
  flex: 1; border: none; background: none; resize: none; outline: none;
  font-size: 13px; color: var(--text-dark);
  max-height: 100px; min-height: 34px;
  line-height: 1.5; padding: 7px 0; font-family: inherit;
}
.chat-icn {
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-light); font-size: 18px;
  transition: background .15s, color .15s; flex-shrink: 0;
}
.chat-icn:hover { background: var(--border); color: var(--primary); }
.chat-icn.send  { background: var(--primary); color: white; }
.chat-icn.send:hover { background: var(--primary-dark); }
.chat-icn.send svg { width: 16px; height: 16px; fill: white; }
.chat-picker {
  position: absolute;
  bottom: calc(100% + 2px); left: 14px; right: 14px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px;
  box-shadow: 0 -4px 20px var(--shadow);
  z-index: 300; max-height: 260px; overflow-y: auto;
  display: none;
}
.chat-picker.open { display: block; }
.chat-picker-tabs { display: flex; gap: 6px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.chat-picker-tab {
  font-size: 11px; font-weight: 600; color: var(--text-light);
  background: none; border: none; cursor: pointer;
  padding: 3px 10px; border-radius: 10px; transition: background .1s, color .1s;
}
.chat-picker-tab.active { background: var(--primary); color: white; }
.chat-emoji-grid { display: flex; flex-wrap: wrap; gap: 1px; }
.chat-emoji-item {
  font-size: 22px; cursor: pointer; padding: 5px; border-radius: 6px;
  transition: background .1s; user-select: none; line-height: 1;
}
.chat-emoji-item:hover { background: var(--bg-page); }
.chat-sticker-grid { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.chat-sticker-item {
  font-size: 44px; cursor: pointer; padding: 6px; border-radius: 10px;
  transition: background .1s; user-select: none; line-height: 1;
}
.chat-sticker-item:hover { background: var(--bg-page); }
.chat-empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-light); gap: 12px;
}
.chat-empty-state svg { width: 60px; height: 60px; fill: currentColor; opacity: .2; }
.chat-empty-state p { font-size: 13px; }
.chat-lightbox {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.85);
  align-items: center; justify-content: center;
}
.chat-lightbox.open { display: flex; }
.chat-lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 8px; }
.chat-lightbox-close {
  position: absolute; top: 16px; right: 20px; color: white; font-size: 32px;
  cursor: pointer; line-height: 1; font-weight: 300; user-select: none;
}
@media (max-width: 768px) {
  .chat-users-panel { width: 180px; min-width: 180px; }
  .chat-wrap { height: calc(100vh - 160px); }
}

/* ── ACI Detail — right-side drawer ── */
#modalACIDetail { justify-content: flex-end; padding: 0; }
#modalACIDetail .modal {
  width: 92vw; max-width: 92vw !important;
  height: 100vh; max-height: 100vh !important;
  margin: 0; border-radius: 16px 0 0 16px;
  display: flex; flex-direction: column;
}
#modalACIDetail .modal-body {
  flex: 1; min-height: 0; overflow: hidden;
  padding: 0 !important; display: flex; flex-direction: column;
}
#aciDetailFixed {
  padding: 12px 18px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
#aciDetailTables { flex: 1; overflow: auto; padding: 12px 18px; }
#aciDetailTables table { font-size: 11px; }
#aciDetailTables th, #aciDetailTables td { padding: 5px 8px !important; }
#aciDetailTables td { word-break: break-all !important; overflow-wrap: anywhere !important; }
#modalACIFU table td { word-break: break-all !important; overflow-wrap: anywhere !important; }
#modalACIVerif table td { word-break: break-all !important; overflow-wrap: anywhere !important; }

/* ── ACI FU modal — wider, scrollable body ── */
#modalACIFU .modal { max-width: 92vw !important; width: 92vw; }
#modalACIFU .modal-body { max-height: 82vh; overflow-y: auto; }
#modalACIFU .table-wrap { overflow-x: auto; }
#modalACIFU table { font-size: 11px; }
#modalACIFU th, #modalACIFU td { padding: 5px 8px !important; }
#aciFUBody input[type="text"] { font-size: 11px; padding: 3px 6px; }
