
/* ============================================
   GLOBAL VARIABLES & THEMES
============================================ */
:root {
  /* Theme Default: Dark */
  --global-font-size: 16px;
  --global-font-family: system-ui;
  
  /* Colors - Dark Theme */
  --bg: #0f1724;
  --card: #0b1220;
  --surface: #071027;
  --text: #e6eef8;
  --muted: #94a3b8;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #1e293b;
  --glass: rgba(255, 255, 255, 0.03);
  --main-title-color: #ffffff;
  
  /* Status Colors - Dark */
  --status-rfu: #22c55e;
  --status-progress: #3b82f6;
  --status-waiting: #f59e0b;
  --status-error: #ef4444;
  
  /* Chart Colors - Dark */
  --chart-1: #22c55e;
  --chart-2: #3b82f6;
  --chart-3: #f59e0b;
  --chart-4: #8b5cf6;
  --chart-5: #ec4899;
  --chart-6: #06b6d4;
  --chart-7: #84cc16;
  --chart-8: #f97316;
  
  /* Button Colors - Dark */
  --btn-primary: #2563eb;
  --btn-primary-hover: #1d4ed8;
  --btn-secondary: #374151;
  --btn-secondary-hover: #4b5563;
  --btn-success: #059669;
  --btn-success-hover: #047857;
  --btn-danger: #dc2626;
  --btn-danger-hover: #b91c1c;
  --btn-warning: #d97706;
  --btn-warning-hover: #b45309;
  
  /* Shadow - Dark */
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.35);
  
  /* Table Colors - Dark */
  --table-header-bg: color-mix(in srgb, var(--card) 75%, transparent);
  --table-row-bg: color-mix(in srgb, var(--surface) 35%, transparent);
  --table-row-alt-bg: color-mix(in srgb, var(--surface) 50%, transparent);
  --table-row-hover: color-mix(in srgb, var(--glass) 70%, transparent);
  
  /* Scrollbar - Dark */
  --scrollbar-track: var(--surface);
  --scrollbar-thumb: var(--border);
  --scrollbar-thumb-hover: #334155;
}

[data-theme="light"] {
  /* Colors - Light Theme */
  --bg: #f8fafc;
  --card: #ffffff;
  --surface: #f1f5f9;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --border: #e2e8f0;
  --glass: rgba(0, 0, 0, 0.03);
  --main-title-color: #1e293b;
  
  /* Status Colors - Light */
  --status-rfu: #16a34a;
  --status-progress: #2563eb;
  --status-waiting: #d97706;
  --status-error: #dc2626;
  
  /* Chart Colors - Light */
  --chart-1: #16a34a;
  --chart-2: #2563eb;
  --chart-3: #d97706;
  --chart-4: #7c3aed;
  --chart-5: #db2777;
  --chart-6: #0891b2;
  --chart-7: #65a30d;
  --chart-8: #ea580c;
  
  /* Button Colors - Light */
  --btn-primary: #3b82f6;
  --btn-primary-hover: #2563eb;
  --btn-secondary: #94a3b8;
  --btn-secondary-hover: #64748b;
  --btn-success: #10b981;
  --btn-success-hover: #059669;
  --btn-danger: #ef4444;
  --btn-danger-hover: #dc2626;
  --btn-warning: #f59e0b;
  --btn-warning-hover: #d97706;
  
  /* Shadow - Light */
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
  
  /* Table Colors - Light */
  --table-header-bg: color-mix(in srgb, var(--surface) 75%, transparent);
  --table-row-bg: color-mix(in srgb, var(--card) 35%, transparent);
  --table-row-alt-bg: color-mix(in srgb, var(--surface) 50%, transparent);
  --table-row-hover: color-mix(in srgb, var(--glass) 70%, transparent);
  
  /* Scrollbar - Light */
  --scrollbar-track: var(--surface);
  --scrollbar-thumb: #cbd5e1;
  --scrollbar-thumb-hover: #94a3b8;
}

/* ============================================
   BASE STYLES
============================================ */
* {
  box-sizing: border-box;
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--global-font-family);
  font-size: var(--global-font-size);
  min-height: 100vh;
  line-height: 1.5;
}

body, body * {
  font-size: var(--global-font-size) !important;
  font-family: var(--global-font-family) !important;
}

/* ============================================
   TYPOGRAPHY
============================================ */
h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  margin-top: 0;
  font-weight: 600;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  color: var(--text);
  margin: 0.5rem 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ============================================
   APP LAYOUT
============================================ */
.app {
  display: flex;
  gap: 20px;
  padding: 18px;
  min-height: 100vh;
}

/* ============================================
   SIDEBAR
============================================ */
.sidebar {
  width: 220px;
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  height: fit-content;
  position: sticky;
  top: 20px;
}

.logo {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
  font-size: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tab-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--text);
}

.tab-btn.active {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  font-weight: 600;
  border-left: 3px solid var(--accent);
}

/* ============================================
   CONTENT AREA
============================================ */
.content {
  flex: 1;
  min-height: 70vh;
}

/* ============================================
   HEADER
============================================ */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px 20px;
  border-radius: 12px;
  background: var(--glass);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.header-title .main-title {
  font-size: 65px;
  font-weight: 900;
  margin: 0;
  color: var(--main-title-color);
  background: linear-gradient(90deg, var(--accent), var(--chart-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sub-title {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.kv {
  font-size: 14px;
  color: var(--muted);
}

.kv strong {
  color: var(--text);
}

/* ============================================
   CARDS
============================================ */
.card {
  background: var(--card);
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.tab-panel {
  animation: fadeIn 0.3s ease;
}

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

/* ============================================
   FORMS
============================================ */
.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.form-row > div {
  flex: 1;
  min-width: 180px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.input, select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s ease;
}

.input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.input::placeholder, textarea::placeholder {
  color: color-mix(in srgb, var(--text) 40%, transparent);
}

.input.disabled {
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  cursor: not-allowed;
  opacity: 0.7;
}

.input.non-unit {
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border-style: dashed;
  opacity: 0.9;
}

.input.small {
  min-width: auto;
  width: 120px;
}

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

/* ============================================
   BUTTONS
============================================ */
.btn {
  background: var(--btn-primary);
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn:hover {
  background: var(--btn-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 20%, transparent);
}

.btn:active {
  transform: translateY(0);
}

.btn.small {
  padding: 8px 12px;
  font-size: 13px;
}

/* Button Variants */
.btn.btn-secondary {
  background: var(--btn-secondary);
}

.btn.btn-secondary:hover {
  background: var(--btn-secondary-hover);
}

.btn.btn-success {
  background: var(--btn-success);
}

.btn.btn-success:hover {
  background: var(--btn-success-hover);
}

.btn.btn-danger {
  background: var(--btn-danger);
}

.btn.btn-danger:hover {
  background: var(--btn-danger-hover);
}

.btn.btn-warning {
  background: var(--btn-warning);
}

.btn.btn-warning:hover {
  background: var(--btn-warning-hover);
}
.action-cell {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
}


.btn-edit {
  background: #2d7df6;
  color: #fff;
}

.btn-delete {
  background: #d14343;
  color: #fff;
}


/* ============================================
   TABLES
============================================ */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  background: var(--card);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  border: 1px solid var(--border);
  scrollbar-width: thin;
  max-height: 500px;
}

.table-wrapper::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 10px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 10px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

.table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 14px;
  color: var(--text);
}

.table-wrapper table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--table-header-bg);
  backdrop-filter: blur(10px);
  color: var(--muted);
  padding: 14px 12px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table-wrapper table tbody td {
  padding: 12px;
  background: var(--table-row-bg);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}

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

.table-wrapper table tbody tr:hover td {
  background: var(--table-row-hover);
}

.table-wrapper table tbody tr:nth-child(even) td {
  background: var(--table-row-alt-bg);
}

.table-wrapper table td input,
.table-wrapper table td select {
  font-size: 13px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--surface) 40%, transparent);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  width: 100%;
}

/* ============================================
   STATUS BADGES
============================================ */
.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
  text-align: center;
  min-width: 90px;
}

.status-rfu {
  background: color-mix(in srgb, var(--status-rfu) 15%, transparent);
  color: var(--status-rfu);
  border: 1px solid color-mix(in srgb, var(--status-rfu) 30%, transparent);
}

.status-progress {
  background: color-mix(in srgb, var(--status-progress) 15%, transparent);
  color: var(--status-progress);
  border: 1px solid color-mix(in srgb, var(--status-progress) 30%, transparent);
}

.status-waiting {
  background: color-mix(in srgb, var(--status-waiting) 15%, transparent);
  color: var(--status-waiting);
  border: 1px solid color-mix(in srgb, var(--status-waiting) 30%, transparent);
}

.status-error {
  background: color-mix(in srgb, var(--status-error) 15%, transparent);
  color: var(--status-error);
  border: 1px solid color-mix(in srgb, var(--status-error) 30%, transparent);
}
/* ============================================
   TABLE HEADER PANEL (ENTERPRISE STYLE)
============================================ */
.table-header-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  gap: 12px;
}

.filter-status-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.status-label {
  color: var(--muted);
}

.status-value {
  color: var(--text); /* Mengikuti tema: putih di dark, hitam di light */
  font-weight: 700;
}

.status-count {
  color: var(--muted);
  font-size: 12px;
}

/* Tombol Clear Filter yang mengikuti tema */
.btn-clear-filter {
  background: color-mix(in srgb, var(--status-error) 10%, transparent);
  color: var(--status-error);
  border: 1px solid color-mix(in srgb, var(--status-error) 30%, transparent);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-clear-filter:hover {
  background: var(--status-error);
  color: #fff;
}

.btn-clear-filter span {
  font-size: 14px;
}

/* Tampilan Empty State */
.empty-state-container {
  padding: 40px 20px;
  text-align: center;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: 12px;
  margin-top: 10px;
}

.empty-icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state-container p {
  color: var(--muted);
  font-size: 14px;
}

/* Responsive adjustment */
@media (max-width: 480px) {
  .table-header-panel {
    flex-direction: column;
    align-items: flex-start;
  }
  .btn-clear-filter {
    width: 100%;
    justify-content: center;
  }
}
/* ============================================
   MODALS
============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}

.modal-box {
  width: 92%;
  max-width: 500px;
  padding: 24px;
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-box h3 {
  margin-top: 0;
  margin-bottom: 20px;
  color: var(--text);
}

.modal-box input,
.modal-box textarea,
.modal-box select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ============================================
   FONT SETTINGS PANEL
============================================ */
#fontSettingsBtn {
  position: fixed;
  top: 20px;
  right: 65px;
  width: 44px;
  height: 44px;
  background: var(--accent);
  color: white;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  cursor: pointer;
  font-size: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

#fontSettingsBtn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

#fontSettingsPanel {
  position: fixed;
  top: 74px;
  left: 20px;
  width: 240px;
  padding: 20px;
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: none;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

#fontSettingsPanel label {
  margin-top: 12px;
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

#fontSizeControl {
  width: 100%;
  margin: 8px 0;
}

#fontFamilyControl {
  width: 100%;
  margin-top: 4px;
}

/* ============================================
   THEME TOGGLE
============================================ */
#themeToggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  cursor: pointer;
  font-size: 20px;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

#themeToggle:hover {
  background: var(--surface);
  transform: translateY(-2px);
}

/* ============================================
   TOAST NOTIFICATION - LEFT TOP
============================================ */
#toastBox {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
  pointer-events: none; /* Agar klik bisa menembus ke konten di belakang */
}

.toast {
  padding: 14px 18px;
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  backdrop-filter: blur(6px);
  font-size: 14px;
  opacity: 0;
  transform: translateX(-100px); /* Ubah dari 100px ke -100px */
  animation: toastSlide 0.3s forwards;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto; /* Toast bisa diklik */
}

.toast::before {
  content: "ℹ️";
  font-size: 16px;
}

.toast.success::before {
  content: "✅";
}

.toast.error::before {
  content: "❌";
}

.toast.warning::before {
  content: "⚠️";
}

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

.toast.success {
  border-left: 4px solid var(--status-rfu);
}

.toast.error {
  border-left: 4px solid var(--status-error);
}

.toast.warning {
  border-left: 4px solid var(--status-waiting);
}
/* Tambah di bagian CSS */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface);
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6, #3b82f6);
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

.zip-file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 14px;
}

.zip-file-item .size {
  color: var(--muted);
  font-size: 12px;
}
/* ============================================
   CHART STYLES
============================================ */
.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
  margin: 20px 0;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.chart-toggle {
  display: flex;
  gap: 6px;
}

.chart-toggle button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}

.chart-toggle button:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.chart-toggle button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
/* ===============================
   CHART GRID CONTAINER (FIXED)
   =============================== */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
  width: 100%;
  box-sizing: border-box;
}

/* ===============================
   CHART CARD
   =============================== */
.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0; /* 🔑 penting untuk flex + grid */
  box-sizing: border-box;
}

/* Card wide (desktop only) */
.chart-card.wide {
  grid-column: span 2;
}

/* Mobile override */
@media (max-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .chart-card.wide {
    grid-column: span 1;
  }
}

/* ===============================
   CHART HEADER (FIX OVERFLOW)
   =============================== */
.chart-header {
  display: flex;
  flex-wrap: wrap;          /* 🔑 boleh turun baris */
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  min-width: 0;
}

/* Title */
.chart-header h4 {
  margin: 0;
  font-size: 0.95rem;       /* pakai rem, ikut font global */
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  word-break: break-word;  /* 🔑 cegah overflow teks */
}

/* ===============================
   CHART TOGGLE (RESPONSIVE)
   =============================== */
.chart-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--surface);
  padding: 4px;
  border-radius: 8px;
}

.chart-toggle button {
  background: none;
  border: none;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;       /* ikut font scale */
  cursor: pointer;
  transition: all 0.2s;
  min-width: fit-content;  /* ❌ jangan paksa lebar */
  white-space: nowrap;
  text-align: center;
}

.chart-toggle button:hover {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--text);
}

.chart-toggle button.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ===============================
   CHART SUMMARY
   =============================== */
.chart-summary {
  display: flex;
  flex-wrap: wrap;          /* 🔑 biar tidak maksa satu baris */
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
}

.chart-summary span {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  word-break: break-word;
}

/* ===============================
   CHART CANVAS
   =============================== */
.chart-card canvas {
  flex: 1;
  width: 100% !important;
  max-width: 100%;
  min-height: 200px;
  max-height: 260px;
}

/* ===============================
   CANVAS ERROR STATE
   =============================== */
.chart-card canvas.error {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ef4444;
  font-size: 0.8rem;
  text-align: center;
}

/* ============================================
   SYNC STATUS
============================================ */
.sync-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
  margin: 16px 0;
  font-size: 13px;
}

.sync-online {
  color: var(--status-rfu);
  animation: pulse 2s infinite;
}

.sync-offline {
  color: var(--status-error);
}

.sync-syncing {
  color: var(--status-waiting);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

/* ============================================
   EMPTY STATE
============================================ */
.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty i {
  font-size: 40px;
  opacity: 0.5;
}

/* ============================================
   LOADING SPINNER
============================================ */
.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

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

/* ============================================
   BOTTOM NAV FOR MOBILE
============================================ */
#bottomNavModern {
  display: none;
}

@media (max-width: 768px) {
  .sidebar {
    display: none !important;
  }
  
  .app {
    flex-direction: column;
    padding: 12px;
    margin-left: 0 !important;
  }
  
  #bottomNavModern {
    display: flex;
    position: fixed;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 4px);
    background: var(--card);
    padding: 5px;
    justify-content: space-between;
    border-radius: 16px;
    z-index: 998;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    overflow-x: auto;
  }
  
  #bottomNavModern button {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 11px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 70px;
    padding: 6px 8px;
    flex-shrink: 0;
    border-radius: 5px;
    transition: all 0.2s ease;
  }
  
  #bottomNavModern button:hover {
    background: var(--surface);
  }
  
  #bottomNavModern button .icon {
    font-size: 16px;
    background: var(--surface);
    color: var(--text);
    padding: 8px;
    border-radius: 50%;
    transition: 0.2s;
  }
  
  #bottomNavModern button.active .icon {
    background: var(--accent);
    color: white;
  }
  
  #bottomNavModern button.active {
    color: var(--accent);
    font-weight: 600;
  }
  
  body, .app, .content {
    padding-bottom: 100px !important;
  }
  
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .header-title .main-title {
    font-size: 22px;
  }
  
  .controls {
    width: 100%;
    justify-content: space-between;
  }
  
  .modal-box {
    width: 95%;
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .form-row > div {
    min-width: 100%;
  }
  
  .input.small {
    width: 100%;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================
   PRINT STYLES
============================================ */
@media print {
  .sidebar,
  #fontSettingsBtn,
  #themeToggle,
  #bottomNavModern,
  .btn:not(.print-only) {
    display: none !important;
  }
  
  .app {
    display: block;
    padding: 0;
  }
  
  .card {
    border: 1px solid #000;
    box-shadow: none;
    break-inside: avoid;
  }
  
  .table-wrapper {
    max-height: none;
    overflow: visible;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
}

/* ============================================
   UTILITY CLASSES
============================================ */
.text-muted {
  color: var(--muted);
}

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

.text-success {
  color: var(--status-rfu);
}

.text-warning {
  color: var(--status-waiting);
}

.text-error {
  color: var(--status-error);
}

.bg-surface {
  background: var(--surface);
}

.bg-card {
  background: var(--card);
}

.border {
  border: 1px solid var(--border);
}

.rounded {
  border-radius: 8px;
}

.shadow {
  box-shadow: var(--shadow);
}

.shadow-lg {
  box-shadow: var(--shadow-lg);
}

.flex {
  display: flex;
}

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

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

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

.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }

.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.p-2 { padding: 8px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }

/* ============================================
   FAB GROUP STYLES - MOBILE ONLY
============================================ */
#mobileFabGroup {
  position: fixed;
  bottom: 90px; /* Di atas bottom nav */
  right: 20px;
  z-index: 1000;
  display: none; /* Hidden di desktop */
}

/* FAB UTAMA (Tombol Besar) */
.fab-main {
  width: 60px;
  height: 60px;
  border-radius: 30px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  z-index: 10;
}

.fab-main:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.fab-main:active {
  transform: scale(0.95);
}

/* Animasi rotate untuk icon FAB */
.fab-main.open .fab-main-icon {
  transform: rotate(45deg);
}

.fab-main-icon {
  transition: transform 0.3s ease;
}

/* FAB MENU (Items yang muncul) */
.fab-menu {
  position: absolute;
  bottom: 70px;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  transform: translateY(20px) scale(0.8);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fab-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* FAB ITEM (Tombol-tombol kecil) */
.fab-item {
  width: 50px;
  height: 50px;
  border-radius: 25px;
  background: var(--fab-color);
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
  animation: fabItemSlideUp 0.3s ease backwards;
}

/* Stagger animation untuk setiap item */
.fab-item:nth-child(1) { animation-delay: 0.05s; }
.fab-item:nth-child(2) { animation-delay: 0.1s; }
.fab-item:nth-child(3) { animation-delay: 0.15s; }
.fab-item:nth-child(4) { animation-delay: 0.2s; }

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

.fab-item:hover {
  transform: scale(1.15);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Label untuk FAB item */
.fab-item-label {
  position: absolute;
  right: 60px;
  background: var(--card);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.fab-item:hover .fab-item-label {
  opacity: 1;
}

/* Counter badge untuk Clear All */
.fab-item[onclick*="Clear"]::after {
  content: attr(data-count);
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: bold;
  padding: 3px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* ============================================
   RESPONSIVE: TAMPILKAN HANYA DI MOBILE
============================================ */
@media (max-width: 768px) {
  #mobileFabGroup {
    display: block !important;
  }
  
  /* Sembunyikan tombol di sidebar di mobile */
  .sidebar .btn {
    display: none !important;
  }
}

@media (min-width: 769px) {
  #mobileFabGroup {
    display: none !important;
  }
}

/* ============================================
   ABOUT & HELP PAGE STYLES
============================================ */

.about-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 4px;
}

.about-header {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.about-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

.about-section {
  margin-bottom: 40px;
  padding: 24px;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.about-section h2 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid var(--border);
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
}

.stat-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  color: var(--muted);
}

/* FEATURES GRID */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.feature-card {
  background: var(--surface);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.feature-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.feature-card h3 {
  margin: 0 0 12px 0;
  font-size: 18px;
}

.feature-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--text);
}

.feature-card li {
  margin-bottom: 6px;
  font-size: 14px;
}

/* TUTORIAL STEPS */
.tutorial-steps {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

.tutorial-step {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 16px;
  background: var(--surface);
  border-radius: 12px;
  border-left: 4px solid var(--accent);
}

.step-number {
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  flex-shrink: 0;
}

.step-content h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
}

.step-content p {
  margin: 0 0 8px 0;
  color: var(--text);
  font-size: 14px;
}

.step-tip {
  background: rgba(59, 130, 246, 0.1);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--accent);
  border-left: 3px solid var(--accent);
}

/* CONCEPTS GRID */
.concepts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.concept-card {
  background: var(--surface);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.concept-card h3 {
  margin: 0 0 12px 0;
  color: var(--accent);
}

.concept-card p {
  margin: 0 0 16px 0;
  color: var(--text);
  font-size: 14px;
}

.concept-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}

.concept-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  background: var(--surface);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  border: 1px solid var(--border);
}

/* FAQ SECTION */
.faq-list {
  margin-top: 20px;
}

.faq-item {
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.faq-question {
  width: 100%;
  padding: 16px 20px;
  background: var(--surface);
  border: none;
  text-align: left;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.faq-question:hover {
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.faq-toggle {
  font-size: 20px;
  transition: transform 0.3s;
}

.faq-question.active .faq-toggle {
  transform: rotate(45deg);
}

.faq-answer {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  background: var(--card);
}

.faq-answer.open {
  padding: 16px 20px;
  max-height: 500px;
}

.faq-answer p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* SHORTCUTS */
.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border-radius: 8px;
}

.shortcut-item kbd {
  background: var(--card);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 13px;
  border: 1px solid var(--border);
  min-width: 60px;
  text-align: center;
}

/* SYSTEM INFO */
.system-info {
  background: var(--surface);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--muted);
  font-weight: 500;
}

.info-value {
  color: var(--text);
  font-weight: 600;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.action-buttons .btn {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* FOOTER */
.about-footer {
  text-align: center;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .about-container {
    padding: 0;
  }
  
  .about-section {
    padding: 16px;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .features-grid {
    grid-template-columns: 1fr;
  }
  
  .tutorial-step {
    flex-direction: column;
    gap: 12px;
  }
  
  .action-buttons .btn {
    min-width: 100%;
  }
}
/* ============================================
   USER ACTIVITY LOG STYLES
============================================ */

/* Activity Stats Cards */
.activity-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.activity-stat-card {
  background: var(--surface);
  padding: 16px 12px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid var(--border);
}

.activity-stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.activity-stat-value {
  font-size: 24px;
  font-weight: bold;
  color: var(--text);
}

.activity-stat-value.create {
  color: #22c55e;
}

.activity-stat-value.update {
  color: #3b82f6;
}

.activity-stat-value.units {
  color: #8b5cf6;
}

/* Filter Bar */
.activity-filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.activity-filter-item {
  min-width: 140px;
}

.activity-search {
  flex: 1;
  min-width: 250px;
}

/* Table Styles */
.activity-table tbody td {
  vertical-align: middle;
}

.activity-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.activity-badge.create {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.activity-badge.update {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
/* Activity Badges - Tambahkan ini */
.activity-badge.delete {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.activity-badge.delete-history {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.activity-unit-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.activity-unit-code {
  font-weight: 600;
  color: var(--text);
}

.activity-unit-model {
  font-size: 11px;
  color: var(--muted);
}

.activity-changes {
  max-width: 250px;
  font-size: 12px;
  color: var(--muted);
}

.activity-problem {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.activity-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.activity-actions .btn-icon {
  padding: 6px;
  min-width: 32px;
}

/* Detail Modal */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 8px;
  font-size: 14px;
  padding: 8px 0;
}

.detail-label {
  color: var(--muted);
}

.detail-value {
  color: var(--text);
  font-weight: 500;
}

.change-item {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 10px;
  background: var(--surface);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
}

.change-field {
  color: var(--accent);
  font-weight: 500;
}

.change-from {
  color: #ef4444;
}

.change-to {
  color: #22c55e;
}

/* Responsive */
@media (max-width: 768px) {
  .activity-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .activity-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .activity-filter-item,
  .activity-search {
    width: 100%;
    min-width: auto;
  }
  
  .activity-actions {
    flex-direction: column;
  }
  
  .activity-actions .btn {
    width: 100%;
  }
}
/* ============================================
   CLOUD LOCK STYLES
============================================ */

/* Cloud Lock Overlay */
.cloud-lock-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  min-height: 400px;
}

.cloud-lock-content {
  background: var(--card);
  padding: 30px;
  border-radius: 16px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: lockPulse 2s infinite;
}

@keyframes lockPulse {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.3); }
  70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.cloud-lock-icon {
  font-size: 48px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--accent), var(--chart-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.cloud-lock-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.cloud-lock-message {
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

.cloud-lock-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.cloud-lock-buttons .btn {
  flex: 1;
  padding: 12px;
  font-weight: 600;
}

/* Tab yang di-lock */
.tab-btn[data-target="tab-firebase"].locked {
  opacity: 0.5;
  pointer-events: none;
  position: relative;
  cursor: not-allowed;
}

.tab-btn[data-target="tab-firebase"].locked::after {
  content: "🔒";
  position: absolute;
  right: 10px;
  font-size: 14px;
  opacity: 0.7;
}

/* Badge di bottom nav */
#bottomNavModern button[onclick*="tab-firebase"].locked {
  opacity: 0.5;
  pointer-events: none;
  position: relative;
}

#bottomNavModern button[onclick*="tab-firebase"].locked::after {
  content: "🔒";
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 10px;
  opacity: 0.7;
}
/* ============================================
   LOCKED TABS STYLES
============================================ */

/* Tab yang di-lock (semua kecuali cloud) */
.tab-btn.locked {
  opacity: 0.5;
  pointer-events: none;
  position: relative;
  cursor: not-allowed;
}

.tab-btn.locked::after {
  content: "🔒";
  position: absolute;
  right: 10px;
  font-size: 14px;
  opacity: 0.7;
}

/* Bottom nav yang di-lock */
#bottomNavModern button.locked {
  opacity: 0.5;
  pointer-events: none;
  position: relative;
}

#bottomNavModern button.locked::after {
  content: "🔒";
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 10px;
  opacity: 0.7;
}

/* Cloud Lock Overlay (tetap sama) */
.cloud-lock-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  min-height: 400px;
}

.cloud-lock-content {
  background: var(--card);
  padding: 30px;
  border-radius: 16px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: lockPulse 2s infinite;
}

@keyframes lockPulse {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.3); }
  70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.cloud-lock-icon {
  font-size: 48px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--accent), var(--chart-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.cloud-lock-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.cloud-lock-message {
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

.cloud-lock-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.cloud-lock-buttons .btn {
  flex: 1;
  padding: 12px;
  font-weight: 600;
}
/* ============================================
   PHOTO GALLERY & UPLOAD STYLES
============================================ */

/* Photo Upload Area */
.photo-upload-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  background: var(--surface);
  margin-bottom: 12px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.photo-upload-area:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.photo-upload-area.dragover {
  border-color: #22c55e;
  background: color-mix(in srgb, #22c55e 10%, transparent);
  transform: scale(1.02);
}

.upload-icon {
  font-size: 40px;
  margin-bottom: 8px;
  opacity: 0.7;
}

.upload-text {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 8px;
}

.upload-hint {
  font-size: 12px;
  color: var(--muted);
  opacity: 0.7;
}

/* Photo Preview Grid */
.photo-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 16px;
}

.photo-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border);
  transition: all 0.2s ease;
  cursor: pointer;
}

.photo-preview-item:hover {
  transform: scale(1.05);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 10;
}

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

.photo-preview-item .remove-photo {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 11;
}

.photo-preview-item:hover .remove-photo {
  opacity: 1;
}

.photo-preview-item .remove-photo:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.photo-count-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
}

/* ============================================
   PROGRESS OVERLAY - GLOBAL STYLES
============================================ */
.progress-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 20000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.progress-overlay.active {
  opacity: 1;
  visibility: visible;
}

.progress-card {
  background: var(--card);
  padding: 30px;
  border-radius: 16px;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 90%;
  animation: progressPulse 2s infinite;
}

@keyframes progressPulse {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.3); }
  70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.progress-spinner {
  width: 60px;
  height: 60px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

.progress-title {
  margin: 0 0 8px 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
}

.progress-message {
  color: var(--muted);
  margin: 0 0 16px 0;
  font-size: 14px;
}

.progress-detail {
  background: var(--surface);
  border-radius: 8px;
  padding: 12px;
  margin-top: 16px;
  border: 1px solid var(--border);
}

.progress-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
}

.progress-status-label {
  color: var(--muted);
}

.progress-status-value {
  color: var(--accent);
  font-weight: 600;
}

/* ============================================
   PROGRESS BAR - UNIFIED STYLES
============================================ */
.progress-bar-container {
  background: var(--border);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  margin: 12px 0;
  width: 100%;
}

.progress-bar-container.small {
  width: 120px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--chart-2));
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-status {
  min-width: 60px;
  text-align: right;
  font-size: 12px;
  color: var(--muted);
}

.progress-percent {
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  text-align: right;
}

.progress-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
  color: #ef4444;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-error i {
  font-size: 18px;
}

.progress-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: center;
}

.progress-btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 120px;
}

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

.progress-btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

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

.progress-btn-secondary:hover {
  background: var(--btn-secondary-hover);
}

.progress-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================
   PHOTO UPLOAD PROGRESS - SPESIFIK UNTUK FOTO
============================================ */
.photo-upload-progress {
  background: var(--surface);
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
  border: 1px solid var(--border);
}

.photo-upload-progress .progress-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
}

.photo-upload-progress .progress-item:last-child {
  margin-bottom: 0;
}

.photo-upload-progress .progress-filename {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  min-width: 120px;
}

.photo-upload-progress .progress-bar-container {
  flex: 2;
  min-width: 100px;
  margin: 0; /* Override margin dari global */
}

.photo-upload-progress .progress-status {
  min-width: 45px; /* Lebih kecil dari global */
}

/* ============================================
   CLEANUP BUTTON
============================================ */
#cleanupOrphanBtn {
  background: linear-gradient(90deg, #f59e0b, #d97706);
  transition: all 0.2s ease;
}

#cleanupOrphanBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}
/* ============================================
   PHOTO GALLERY & MODAL STYLES - FIXED VERSION
============================================ */

/* Photo Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
  margin-bottom: 24px;
}

.gallery-item {
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
  border-color: var(--accent);
}

.gallery-item:hover .gallery-info {
  background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
}

.gallery-thumbnail {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--surface);
}

.gallery-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  color: white;
  transition: all 0.3s ease;
}

.gallery-unit {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.gallery-model {
  font-size: 12px;
  opacity: 0.9;
  margin-bottom: 2px;
}

.gallery-date {
  font-size: 11px;
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 4px;
}

.gallery-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  color: white;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.2);
  z-index: 2;
}

/* ============================================
   PHOTO MODAL STYLES
============================================ */

/* Modal Container */
.photo-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

/* Image Container */
.photo-modal-image-container {
  display: none;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  max-height: 70vh;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface);
}

.photo-modal-image-container.active {
  display: flex;
}

#photoModalImg {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  display: block;
  transition: all 0.3s ease;
}

/* Loading State */
.photo-modal-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  background: var(--surface);
  border-radius: 8px;
  color: var(--muted);
  gap: 16px;
}

.photo-modal-loading .spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Close Button */
.photo-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.2s ease;
  border: 1px solid rgba(255,255,255,0.2);
}

.photo-modal-close:hover {
  background: #ef4444;
  transform: scale(1.1);
}

/* Navigation Buttons */
.photo-modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
  border: 1px solid rgba(255,255,255,0.2);
}

.photo-modal-nav:hover {
  background: var(--accent);
  transform: translateY(-50%) scale(1.1);
}

.photo-modal-nav.prev {
  left: 20px;
}

.photo-modal-nav.next {
  right: 20px;
}

/* Info Bar */
.photo-modal-info {
  margin-top: 16px;
  padding: 16px;
  background: var(--surface);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.photo-modal-info .unit-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.photo-modal-info .unit-info span {
  background: var(--card);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.photo-modal-info .date-info {
  color: var(--muted);
  font-size: 13px;
}

.photo-modal-info .problem {
  font-size: 13px;
  color: var(--muted);
  background: rgba(0,0,0,0.2);
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ===== ACTIONS BAR - YANG DIPERBAIKI ===== */
.photo-modal-info .actions {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  align-items: center !important;
  justify-content: flex-start !important;
  margin-top: 8px !important;
  width: 100% !important;
}

/* Badge untuk counter + mode */
#photoModalMode {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 8px 16px !important;
  border-radius: 30px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: white !important;
  background: #8b5cf6 !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  height: 36px !important;
  box-sizing: border-box !important;
}

/* Tombol HD/Thumbnail */
#photoModalHDBtn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 8px 16px !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  background: var(--btn-primary) !important;
  color: white !important;
  border: none !important;
  cursor: pointer !important;
  min-width: 100px !important;
  flex-shrink: 0 !important;
  height: 36px !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
  transition: all 0.2s ease !important;
}

/* Tombol Download */
.photo-modal-info .actions .btn.small[onclick*="downloadCurrentPhoto"] {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 8px 16px !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  background: var(--btn-success) !important;
  color: white !important;
  border: none !important;
  cursor: pointer !important;
  min-width: 100px !important;
  flex-shrink: 0 !important;
  height: 36px !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
  transition: all 0.2s ease !important;
}

/* Hover effects */
#photoModalHDBtn:hover,
.photo-modal-info .actions .btn.small[onclick*="downloadCurrentPhoto"]:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important;
  opacity: 0.9 !important;
}

/* ===== RESPONSIVE ===== */

/* Tablet */
@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }
  
  .photo-modal-nav {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }
  
  .photo-modal-nav.prev {
    left: 10px;
  }
  
  .photo-modal-nav.next {
    right: 10px;
  }
  
  .photo-modal-info .actions {
    justify-content: center !important;
  }
  
  #photoModalMode {
    padding: 6px 12px !important;
    font-size: 12px !important;
    height: 32px !important;
  }
  
  #photoModalHDBtn,
  .photo-modal-info .actions .btn.small[onclick*="downloadCurrentPhoto"] {
    padding: 6px 12px !important;
    min-width: 80px !important;
    font-size: 12px !important;
    height: 32px !important;
  }
}

/* Mobile kecil */
@media (max-width: 480px) {
  .photo-modal-info .actions {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 6px !important;
  }
  
  #photoModalMode {
    width: 100% !important;
    justify-content: center !important;
    margin-bottom: 4px !important;
    text-align: center !important;
  }
  
  #photoModalHDBtn,
  .photo-modal-info .actions .btn.small[onclick*="downloadCurrentPhoto"] {
    flex: 1 1 auto !important;
    min-width: 100px !important;
  }
}

/* Mobile sangat kecil */
@media (max-width: 360px) {
  #photoModalHDBtn,
  .photo-modal-info .actions .btn.small[onclick*="downloadCurrentPhoto"] {
    min-width: calc(50% - 4px) !important;
  }
}

/* ============================================
   PHOTO THUMBNAIL & STATUS STYLES
============================================ */

/* Photo Thumbnail in Table */
.photo-thumbnail {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.photo-thumbnail:hover {
  transform: scale(1.5);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 100;
  position: relative;
}

/* Photo Count Indicator */
.photo-count-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--surface);
  border-radius: 20px;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.photo-count-indicator:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.photo-count-indicator i {
  font-size: 14px;
}

/* Photo Status Badge */
.photo-status-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: var(--accent);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  z-index: 12;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  line-height: 1.2;
}

.photo-status-badge.existing {
  background: #22c55e;
}

.photo-status-badge.new {
  background: var(--accent);
}

/* Loading Spinner for Photos */
.photo-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
/* ============================================
   TOAST NOTIFICATION - MOBILE RESPONSIVE
============================================ */
@media (max-width: 768px) {
  #toastBox {
    top: 10px;
    left: 10px;
    right: 10px;
    max-width: none;
    width: auto;
  }
  
  .toast {
    padding: 12px 16px;
    font-size: 13px;
    max-width: 100%;
  }
}
/* ============================================
   SPLASH SCREEN
============================================ */
.splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0b1220 0%, #071027 100%);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.splash-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.splash-content {
  text-align: center;
  max-width: 500px;
  padding: 40px;
  background: rgba(11, 18, 32, 0.8);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  border: 1px solid rgba(59, 130, 246, 0.2);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  animation: splashFadeIn 0.8s ease;
}

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

.splash-logo {
  font-size: 64px;
  margin-bottom: 16px;
  animation: splashPulse 2s infinite;
}

@keyframes splashPulse {
  0% {
    transform: scale(1);
    text-shadow: 0 0 20px rgba(59, 130, 246, 0);
  }
  50% {
    transform: scale(1.1);
    text-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
  }
  100% {
    transform: scale(1);
    text-shadow: 0 0 20px rgba(59, 130, 246, 0);
  }
}

.splash-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px 0;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.splash-subtitle {
  color: #94a3b8;
  font-size: 14px;
  margin-bottom: 32px;
}

.splash-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(59, 130, 246, 0.1);
  border-top-color: #3b82f6;
  border-right-color: #8b5cf6;
  border-radius: 50%;
  animation: splashSpin 1s linear infinite;
  margin: 0 auto 24px;
}

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

.splash-status {
  margin: 24px 0 16px;
  text-align: left;
}

.splash-status span {
  display: block;
  color: #94a3b8;
  font-size: 13px;
  margin-bottom: 8px;
}

.splash-progress {
  width: 100%;
  height: 6px;
  background: rgba(148, 163, 184, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.splash-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

.splash-version {
  color: #4b5563;
  font-size: 12px;
  margin-top: 16px;
}

/* Light theme support */
[data-theme="light"] .splash-screen {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

[data-theme="light"] .splash-content {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(59, 130, 246, 0.1);
}

[data-theme="light"] .splash-title {
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
/* ============================================
   APP CONTAINER SPLASH TRANSITION
============================================ */
.app {
  transition: opacity 0.5s ease;
}

/* Pastikan app container tetap flex saat ditampilkan */
.app[style*="display: flex"] {
  display: flex !important;
}
/* ============================================
   MOBILE TABLE TO CARD VIEW (RESPONSIVE)
============================================ */
/* ============================================
   ENTERPRISE MOBILE CARD VIEW - STABLE VERSION
============================================ */
@media (max-width: 768px) {

  /* Sembunyikan header tabel */
  .table-wrapper table thead {
    display: none;
  }

  /* Wrapper dibuat bebas scroll */
  .table-wrapper {
    border: none;
    background: transparent;
    max-height: none;
    overflow: visible;
  }

  /* ============================================
     CARD CONTAINER
  ============================================ */
  .table-wrapper table tbody tr {
    display: block;
    margin-bottom: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 12px 12px;
    box-shadow: var(--shadow);
    position: relative;

    /* Animasi ringan agar terasa seperti app */
    transition: transform .15s ease, box-shadow .15s ease;

    /* Optimasi rendering */
    contain: layout style;
  }

  .table-wrapper table tbody tr:active {
    transform: scale(.995);
  }

  /* ============================================
     CELL BASE STYLE
  ============================================ */
  .table-wrapper table tbody td {
    display: flex;
    align-items: flex-start;
    padding: 8px 4px;
    gap: 10px;

    border-bottom: 1px solid
      color-mix(in srgb, var(--border) 40%, transparent);

    white-space: normal;
    text-align: left;
    font-size: 13px !important;
    line-height: 1.4;
  }

  /* ============================================
     LABEL COLUMN
  ============================================ */
  .table-wrapper table tbody td[data-label]::before {
    content: attr(data-label);

    flex: 0 0 115px;
    flex-shrink: 0;

    font-weight: 700;
    color: var(--muted);
    font-size: 10px;

    text-transform: uppercase;
    letter-spacing: .5px;

    margin-right: 4px;
  }

  /* ============================================
     CHECKBOX POSITION
  ============================================ */
  .table-wrapper table tbody td:nth-child(1) {
    position: absolute;
    top: 12px;
    right: 12px;

    border: none;
    padding: 6px;
    width: auto;
  }

  .table-wrapper table tbody td:nth-child(1) input {
    transform: scale(1.2);
  }

  /* ============================================
     ROW NUMBER
  ============================================ */
  .table-wrapper table tbody td:nth-child(2) {
    display: block;

    border: none;
    padding: 0;
    margin-bottom: 8px;

    font-weight: 800;
    color: var(--accent);
    font-size: 14px !important;
  }

  /* ============================================
     TEXT CONTROL (Problem panjang dll)
  ============================================ */
  .table-wrapper table tbody td[data-label="Problem"] {
    word-break: break-word;
  }

  /* ============================================
     ACTION BUTTON AREA
  ============================================ */
  .table-wrapper table tbody td:last-child {
    display: block;

    border: none;
    padding-top: 12px;
    margin-top: 6px;

    border-top: 1px solid
      color-mix(in srgb, var(--border) 40%, transparent);
  }

  .table-wrapper table tbody td:last-child::before {
    display: none;
  }

  /* Tombol container */
  .table-wrapper table tbody td:last-child div {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px !important;
  }

  /* Tombol responsive */
  .table-wrapper table tbody td:last-child .btn {
    flex: 1;
    min-width: 90px;
    padding: 10px;
  }

}