/* =========================================================
   HPP KONVEKSI — EDS KIDS | Design System
   ========================================================= */

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

/* --- CSS Variables --- */
:root {
  --primary:       #6366f1;
  --primary-dark:  #4f46e5;
  --primary-glow:  rgba(99,102,241,0.25);
  --accent:        #8b5cf6;
  --success:       #10b981;
  --success-bg:    rgba(16,185,129,0.12);
  --warning:       #f59e0b;
  --warning-bg:    rgba(245,158,11,0.12);
  --danger:        #ef4444;
  --danger-bg:     rgba(239,68,68,0.12);
  --info:          #06b6d4;
  --info-bg:       rgba(6,182,212,0.12);

  --bg:            #0d0d1a;
  --bg-2:          #13132a;
  --surface:       #1a1a35;
  --surface-2:     #21213f;
  --surface-3:     #2a2a50;
  --border:        rgba(255,255,255,0.08);
  --border-focus:  rgba(99,102,241,0.6);

  --text-primary:  #f1f1f8;
  --text-secondary:#a8a8c8;
  --text-muted:    #6b6b9a;

  --sidebar-w:     240px;
  --sidebar-w-sm:  64px;
  --topbar-h:      64px;

  --radius:        12px;
  --radius-sm:     8px;
  --radius-lg:     16px;
  --radius-xl:     24px;

  --shadow:        0 4px 24px rgba(0,0,0,0.35);
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.25);
  --shadow-glow:   0 0 24px var(--primary-glow);

  --transition:    0.22s cubic-bezier(0.4,0,0.2,1);
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* =========================================================
   APP SHELL
   ========================================================= */
#app {
  display: flex;
  min-height: 100vh;
}

/* =========================================================
   SIDEBAR
   ========================================================= */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  transition: width var(--transition);
  overflow: hidden;
}

#sidebar.collapsed { width: var(--sidebar-w-sm); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
  flex-shrink: 0;
}

.sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}

.sidebar-brand .brand-text {
  overflow: hidden;
  transition: opacity var(--transition), width var(--transition);
}
.sidebar-brand .brand-text .brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}
.sidebar-brand .brand-text .brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
#sidebar.collapsed .brand-text { opacity: 0; width: 0; }

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 8px 4px;
  white-space: nowrap;
  transition: opacity var(--transition);
}
#sidebar.collapsed .nav-section-title { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 2px;
  white-space: nowrap;
  position: relative;
  user-select: none;
}
.nav-item:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-item.active {
  background: linear-gradient(135deg, var(--primary-glow), rgba(139,92,246,0.15));
  color: var(--primary);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}
.nav-item .nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.nav-item .nav-label {
  font-size: 13.5px;
  transition: opacity var(--transition);
}
#sidebar.collapsed .nav-item .nav-label { opacity: 0; }

.sidebar-toggle {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  white-space: nowrap;
}
.toggle-btn:hover { background: var(--surface-2); color: var(--text-primary); }
.toggle-icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.toggle-label { font-size: 13px; transition: opacity var(--transition); }
#sidebar.collapsed .toggle-label { opacity: 0; }

/* Tooltip for collapsed sidebar */
#sidebar.collapsed .nav-item:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(var(--sidebar-w-sm) + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface-3);
  color: var(--text-primary);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  white-space: nowrap;
  pointer-events: none;
  z-index: 200;
  box-shadow: var(--shadow);
}

/* =========================================================
   MAIN WRAPPER
   ========================================================= */
#main {
  flex: 1;
  margin-left: var(--sidebar-w);
  transition: margin-left var(--transition);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  overflow-x: hidden;
}
#main.sidebar-collapsed { margin-left: var(--sidebar-w-sm); }

/* =========================================================
   TOPBAR
   ========================================================= */
#topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  height: var(--topbar-h);
  background: rgba(13,13,26,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0 14px;
  flex: 1;
  max-width: 380px;
  transition: border-color var(--transition);
}
.search-wrap:focus-within { border-color: var(--border-focus); }
.search-wrap input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  padding: 8px 0;
  width: 100%;
}
.search-wrap input::placeholder { color: var(--text-muted); }
.search-icon { color: var(--text-muted); font-size: 15px; }

.topbar-spacer { flex: 1; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text-primary); border-color: var(--border-focus); }
.icon-btn .badge-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: border-color var(--transition);
}
.user-avatar:hover { border-color: var(--primary); }

/* =========================================================
   CONTENT AREA
   ========================================================= */
#content {
  flex: 1;
  padding: 28px 24px;
  overflow-y: auto;
}

.page { display: none; }
.page.active { display: block; animation: fadeInUp 0.28s ease; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   PAGE HEADER
   ========================================================= */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title-group {}
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}
.page-actions { display: flex; align-items: center; gap: 8px; }

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: none;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 11px; }
.btn-icon { padding: 8px; }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 0 16px var(--primary-glow); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-3); border-color: var(--border-focus); }

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #0da271; }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.25);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245,158,11,0.25);
}
.btn-warning:hover { background: var(--warning); color: #fff; }

.btn-info {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(6,182,212,0.25);
}
.btn-info:hover { background: var(--info); color: #fff; }

.btn-ghost {
  background: none;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }

/* =========================================================
   KPI CARDS
   ========================================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  cursor: default;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-focus); }
.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 0 var(--radius-lg) 0 80px;
  opacity: 0.08;
}
.kpi-card.c-primary::after { background: var(--primary); }
.kpi-card.c-success::after { background: var(--success); }
.kpi-card.c-warning::after { background: var(--warning); }
.kpi-card.c-danger::after  { background: var(--danger); }

.kpi-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}
.kpi-card.c-primary .kpi-icon { background: var(--primary-glow); color: var(--primary); }
.kpi-card.c-success .kpi-icon { background: var(--success-bg); color: var(--success); }
.kpi-card.c-warning .kpi-icon { background: var(--warning-bg); color: var(--warning); }
.kpi-card.c-danger  .kpi-icon { background: var(--danger-bg); color: var(--danger); }

.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.kpi-value { font-size: 26px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.kpi-sub   { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* =========================================================
   CARDS / PANELS
   ========================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}

/* =========================================================
   CHARTS GRID
   ========================================================= */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 900px) { .charts-grid { grid-template-columns: 1fr; } }
.chart-wrap { position: relative; height: 220px; }

/* =========================================================
   TABLES
   ========================================================= */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 11px 14px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}
tbody tr {
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.selected { background: rgba(99,102,241,0.08); }
td {
  padding: 12px 14px;
  color: var(--text-primary);
  vertical-align: middle;
}
td.muted { color: var(--text-secondary); }

/* sortable headers */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text-primary); }
th.sortable .sort-icon { margin-left: 4px; opacity: 0.5; }
th.sort-asc .sort-icon, th.sort-desc .sort-icon { opacity: 1; color: var(--primary); }

/* Table toolbar */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}

/* =========================================================
   BADGES
   ========================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-info    { background: var(--info-bg); color: var(--info); }
.badge-primary { background: var(--primary-glow); color: var(--primary); }
.badge-muted   { background: var(--surface-3); color: var(--text-muted); }
.badge::before { content: '●'; font-size: 7px; }

/* =========================================================
   FORMS
   ========================================================= */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.col-span-2 { grid-column: span 2; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-control {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 9px 12px;
  font-size: 13.5px;
  transition: all var(--transition);
  outline: none;
  width: 100%;
}
.form-control:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
select.form-control option { background: var(--surface-2); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11px; color: var(--text-muted); }

/* =========================================================
   DASHBOARD LAYOUT
   ========================================================= */
.dashboard-split {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* =========================================================
   DETAIL PANEL
   ========================================================= */
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.detail-panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--text-muted);
  text-align: center;
}
.detail-panel-empty .empty-icon { font-size: 42px; opacity: 0.4; }
.detail-panel-empty p { font-size: 13px; }

.detail-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.04));
}
.detail-article-no {
  font-size: 10px;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
}
.detail-article-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-meta {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.detail-info-item {}
.detail-info-label { font-size: 10px; color: var(--text-muted); font-weight: 500; margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.04em; }
.detail-info-value { font-size: 12px; color: var(--text-primary); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.detail-cost-table { overflow-x: auto; width: 100%; }
.detail-cost-table table { table-layout: auto; width: 100%; min-width: 400px; }
.detail-cost-table table td, .detail-cost-table table th {
  padding: 8px 12px;
  font-size: 12px;
}

.detail-summary {
  padding: 14px 20px;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
}
.detail-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
}
.detail-summary-row .label { font-size: 12px; color: var(--text-muted); }
.detail-summary-row .value { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.detail-summary-row.total { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.detail-summary-row.total .label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.detail-summary-row.total .value { font-size: 16px; font-weight: 800; color: var(--primary); }

.detail-actions {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  flex-wrap: wrap;
}

/* =========================================================
   MODALS
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.open { display: flex; animation: fadeIn 0.2s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.22s ease;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.modal-lg { max-width: 820px; }
.modal-xl { max-width: 1060px; }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  background: var(--bg-2);
}

/* =========================================================
   EDITABLE TABLE (Komponen Biaya)
   ========================================================= */
.editable-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}
.editable-table { width: 100%; border-collapse: collapse; }
.editable-table th {
  background: var(--bg-2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.editable-table td {
  padding: 6px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.editable-table tr:last-child td { border-bottom: none; }
.editable-table input, .editable-table select {
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-primary);
  padding: 6px 8px;
  font-size: 12.5px;
  width: 100%;
  outline: none;
  transition: all var(--transition);
}
.editable-table input:focus, .editable-table select:focus {
  border-color: var(--border-focus);
  background: var(--surface-3);
}
.editable-table .total-cell { font-weight: 600; color: var(--primary); font-size: 12.5px; }
.editable-table .del-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all var(--transition);
}
.editable-table .del-btn:hover { background: var(--danger-bg); color: var(--danger); }

.table-add-row {
  display: flex;
  gap: 8px;
  padding: 12px 0 4px;
}

.hpp-summary-sticky {
  background: linear-gradient(135deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
}
.hpp-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
}
.hpp-summary-row .hs-label { font-size: 13px; color: var(--text-muted); }
.hpp-summary-row .hs-value { font-size: 14px; font-weight: 600; }
.hpp-summary-row.hs-total .hs-label { color: var(--text-primary); font-weight: 700; font-size: 15px; }
.hpp-summary-row.hs-total .hs-value { color: var(--primary); font-size: 20px; font-weight: 800; }
.hpp-summary-row.hs-margin .hs-value { color: var(--success); }
.hpp-summary-row.hs-margin-bad .hs-value { color: var(--danger); }

/* =========================================================
   EMPTY STATES
   ========================================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 24px;
  color: var(--text-muted);
  text-align: center;
}
.empty-state .es-icon { font-size: 48px; opacity: 0.3; margin-bottom: 8px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-secondary); }
.empty-state p { font-size: 13px; max-width: 320px; }

/* =========================================================
   IMPORT AREA
   ========================================================= */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-glow);
}
.drop-icon { font-size: 48px; margin-bottom: 16px; }
.drop-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.drop-hint { font-size: 13px; color: var(--text-muted); }

/* =========================================================
   PROGRESS BAR
   ========================================================= */
.progress-bar-wrap {
  background: var(--surface-2);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
  margin: 12px 0;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* =========================================================
   LAPORAN
   ========================================================= */
.laporan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .laporan-grid { grid-template-columns: 1fr; } }

/* =========================================================
   PAGINATION
   ========================================================= */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  padding: 12px 16px;
}
.page-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.page-btn:hover { background: var(--surface-3); color: var(--text-primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-info { font-size: 12px; color: var(--text-muted); padding: 0 8px; }

/* =========================================================
   STATUS INDICATORS
   ========================================================= */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.status-aktif .status-dot { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-nonaktif .status-dot { background: var(--text-muted); }

/* =========================================================
   PRICE HISTORY DRAWER
   ========================================================= */
.price-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.price-history-item:last-child { border-bottom: none; }
.price-history-date { font-size: 11px; color: var(--text-muted); }
.price-history-val  { font-size: 13px; font-weight: 600; }
.price-history-by   { font-size: 11px; color: var(--text-muted); }
.price-change-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 99px;
}
.price-up   { background: var(--danger-bg); color: var(--danger); }
.price-down { background: var(--success-bg); color: var(--success); }

/* =========================================================
   RESPONSIVE HELPERS
   ========================================================= */
.hide-sm { display: block; }
@media (max-width: 768px) {
  .hide-sm { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: span 1; }
  #content { padding: 16px; }
}

/* =========================================================
   NOTIFICATIONS
   ========================================================= */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: slideInRight 0.25s ease;
  max-width: 320px;
}
.toast-success { border-left: 3px solid var(--success); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-danger  { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--info); }
.toast-icon    { font-size: 18px; }
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOutRight {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}

/* =========================================================
   VIEW TOGGLE (Table / Card)
   ========================================================= */
.view-toggle-group {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}
.view-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.view-toggle-btn:hover { color: var(--text-primary); background: var(--surface-2); }
.view-toggle-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* =========================================================
   ARTIKEL CARD GRID
   ========================================================= */
.artikel-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}

.art-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}
.art-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: rgba(99,102,241,0.35);
}

/* Foto area */
.art-card-foto {
  width: 100%;
  height: 180px;
  background: var(--bg-2);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}
.art-card-foto img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.art-card:hover .art-card-foto img { transform: scale(1.04); }
.art-card-foto-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 6px;
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
}
.art-card-foto-placeholder .ph-icon { font-size: 40px; opacity: 0.3; }
.art-card-foto-placeholder .ph-text { font-size: 11px; }

/* Card badges overlay on foto */
.art-card-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.art-card-actions-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}
.art-card:hover .art-card-actions-overlay { opacity: 1; }
.art-card-actions-overlay button {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(13,13,26,0.8);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.art-card-actions-overlay button:hover { background: var(--primary); border-color: var(--primary); }

/* Card body */
.art-card-body { padding: 14px 16px; flex: 1; }
.art-card-no   { font-size: 10px; color: var(--primary); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 4px; }
.art-card-name { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; line-height: 1.3; }
.art-card-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.art-card-tag  { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 3px; }

/* HPP bar */
.art-card-hpp-bar {
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.art-card-hpp-row { display: flex; justify-content: space-between; align-items: center; }
.art-card-hpp-label { font-size: 11px; color: var(--text-muted); }
.art-card-hpp-value { font-size: 12px; font-weight: 600; }
.art-card-margin-track {
  height: 4px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 4px;
}
.art-card-margin-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.6s ease;
}

/* Card footer */
.art-card-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 6px;
  background: var(--bg-2);
}
.art-card-footer button { flex: 1; }

/* Thumbnail di tabel */
.table-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.table-thumb-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* =========================================================
   FOTO UPLOAD ZONE (Modal Artikel)
   ========================================================= */
.foto-upload-zone {
  width: 100%;
  aspect-ratio: 3/4;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.foto-upload-zone:hover,
.foto-upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-glow);
}
.foto-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  height: 100%;
}
.foto-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  #content {
    padding: 16px 14px;
  }
}

/* =========================================================
   LOGIN SCREEN
   ========================================================= */
.app-hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 10% 20%, rgba(99,102,241,0.15) 0%, rgba(13,13,26,1) 90%);
  position: relative;
  overflow: hidden;
  padding: 20px;
}

/* Moving glow effect */
.login-screen::before {
  content: '';
  position: absolute;
  top: -10%; left: -10%;
  width: 50%; height: 50%;
  background: radial-gradient(circle, rgba(139,92,246,0.2) 0%, rgba(0,0,0,0) 70%);
  z-index: 1;
  animation: floatGlow 12s ease-in-out infinite alternate;
  pointer-events: none;
}
.login-screen::after {
  content: '';
  position: absolute;
  bottom: -10%; right: -10%;
  width: 50%; height: 50%;
  background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, rgba(0,0,0,0) 70%);
  z-index: 1;
  animation: floatGlow 15s ease-in-out infinite alternate-reverse;
  pointer-events: none;
}

@keyframes floatGlow {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(10%, 15%) scale(1.1); }
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(26,26,53,0.7);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-lg);
  padding: 36px 30px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  position: relative;
  z-index: 10;
  animation: fadeInUp 0.4s ease-out;
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo {
  font-size: 40px;
  margin-bottom: 12px;
  display: inline-block;
  filter: drop-shadow(0 0 12px var(--primary-glow));
}
.login-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.login-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.login-form-group {
  margin-bottom: 18px;
}
.login-btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  margin-top: 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  transition: all var(--transition);
  box-shadow: 0 4px 14px var(--primary-glow);
}
.login-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.login-tips {
  background: rgba(99,102,241,0.06);
  border: 1px dashed rgba(99,102,241,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 24px;
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* User avatar logout popup style */
.user-menu-wrap {
  position: relative;
}
.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 6px;
  display: none;
  animation: fadeInUp 0.2s ease-out;
  z-index: 1000;
}
.user-dropdown.show {
  display: block;
}
.user-dropdown-item {
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
}
.user-dropdown-item:hover {
  background: var(--danger-bg);
  color: var(--danger);
}


