/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  font-size: 0.75rem;
  background: #f1f5f9;
  color: #1e293b;
  min-height: 100vh;
}

/* =============================================
   SCROLLBAR
   ============================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* =============================================
   HEADER
   ============================================= */
.app-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #1a3352 100%);
  color: #fff;
  padding: 0;
  margin: 0;
  width: 100%;
  box-shadow: 0 2px 12px rgba(0,0,0,0.22);
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}
.app-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px 6px;
}
.app-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.app-title-sub {
  font-size: 0.75rem;
  font-weight: 600;
  color: #93c5fd;
  letter-spacing: 0.04em;
}
.header-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}
.badge-online {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(34,197,94,0.15);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #86efac;
}
.badge-dot {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}
.header-time {
  font-size: 0.75rem;
  color: #93c5fd;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* =============================================
   TAB NAVIGATION
   ============================================= */
.tab-row {
  display: flex;
  gap: 0;
  align-items: flex-end;
  padding: 0 14px;
}
.tab-btn {
  flex: 0 0 auto;
  padding: 6px 20px;
  height: 32px;
  box-sizing: border-box;
  border-radius: 0;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  border-bottom: 3px solid transparent;
  transition: all 0.15s;
  color: #93c5fd;
  background: transparent;
  letter-spacing: 0.06em;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
}
.tab-btn.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-bottom: 3px solid #38bdf8;
}
.tab-btn:not(.active):hover {
  background: rgba(255,255,255,0.13);
  color: #e0f2fe;
}
.tab-btn svg { flex-shrink: 0; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* =============================================
   TOOLBAR
   ============================================= */
.toolbar-wrap {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  padding: 7px 14px;
  position: sticky;
  top: 0;
  z-index: 90;
}
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  max-width: 100%;
  margin: 0;
}
.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.toolbar-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.toolbar-select {
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 0.75rem;
  color: #1e3a5f;
  background: #fff;
  cursor: pointer;
  transition: border 0.15s, box-shadow 0.15s;
  min-width: 0;
}
.toolbar-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.toolbar-input {
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 0.75rem;
  color: #1e3a5f;
  transition: border 0.15s, box-shadow 0.15s;
  background: #fff;
}
.toolbar-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.toolbar-sep {
  width: 1px;
  height: 24px;
  background: #e2e8f0;
  flex-shrink: 0;
}
.toolbar-info {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-left: auto;
  font-style: italic;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  padding: 7px 16px;
  border-radius: 7px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.18s;
  white-space: nowrap;
  letter-spacing: 0.03em;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: #1e3a5f; color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; }
.btn-info { background: #0891b2; color: #fff; }
.btn-info:hover { background: #0e7490; }
.btn-outline {
  background: #fff;
  color: #1e3a5f;
  border: 1.5px solid #1e3a5f;
}
.btn-outline:hover { background: #eff6ff; }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; }
.btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
}

/* =============================================
   SUB-TAB (DATA VIEW)
   ============================================= */
.subtab-row {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}
.subtab-btn {
  padding: 6px 14px;
  height: 32px;
  border-radius: 6px 6px 0 0;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid #e2e8f0;
  border-bottom: none;
  background: #f8fafc;
  color: #64748b;
  letter-spacing: 0.04em;
  transition: all 0.15s;
  white-space: nowrap;
}
.subtab-btn.active {
  background: #1e3a5f;
  color: #fff;
  border-color: #1e3a5f;
}
.subtab-btn:not(.active):hover {
  background: #e2e8f0;
  color: #1e3a5f;
}

/* =============================================
   MAIN CONTENT AREA
   ============================================= */
.content-wrap {
  padding: 14px 16px;
  max-width: 1600px;
  margin: 0 auto;
}

/* =============================================
   STAT CARDS
   ============================================= */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: default;
}
.stat-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  transform: translateY(-1px);
}
.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stat-card-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-card-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}
.icon-blue { background: #eff6ff; color: #2563eb; }
.icon-green { background: #f0fdf4; color: #16a34a; }
.icon-yellow { background: #fffbeb; color: #d97706; }
.icon-red { background: #fef2f2; color: #dc2626; }
.icon-purple { background: #faf5ff; color: #7c3aed; }
.icon-cyan { background: #ecfeff; color: #0891b2; }
.stat-card-value {
  font-size: 0.75rem;
  font-weight: 800;
  color: #1e293b;
  line-height: 1;
}
.stat-card-value span {
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  margin-left: 4px;
}
.stat-card-footer {
  font-size: 0.75rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-trend-up { color: #16a34a; font-weight: 700; }
.stat-trend-down { color: #dc2626; font-weight: 700; }

/* =============================================
   TABLE
   ============================================= */
.table-wrap {
  overflow-x: hidden;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  background: #fff;
}
.table-outer {
  margin-bottom: 14px;
}
table {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
}
thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #1e3a5f;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: normal;
  word-break: break-word;
  padding: 10px 12px;
  border-right: 1px solid #2d5382;
  text-align: center;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 30;
  background: #152d4a;
  min-width: 180px;
  text-align: left;
}
tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 10;
  background: #fff;
  font-weight: 600;
  font-size: 0.75rem;
  color: #374151;
  padding: 8px 12px;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  min-width: 180px;
}
tbody tr:hover td:first-child { background: #f0f7ff; }
tbody td {
  padding: 6px 10px;
  border-right: 1px solid #e8ecf0;
  border-bottom: 1px solid #e8ecf0;
  text-align: center;
  font-size: 0.75rem;
  background: #fff;
  color: #374151;
  white-space: normal;
  word-break: break-word;
}
tbody tr:hover td { background: #f0f7ff; }
tbody tr:last-child td { border-bottom: none; }

/* Status badges in table */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-danger  { background: #fee2e2; color: #dc2626; }
.badge-warning { background: #fef9c3; color: #a16207; }
.badge-info    { background: #e0f2fe; color: #0369a1; }
.badge-neutral { background: #f1f5f9; color: #64748b; }

/* =============================================
   CELL INPUT
   ============================================= */
.cell-input {
  width: 88px;
  padding: 5px 6px;
  min-height: 32px;
  border: 1.5px solid transparent;
  border-radius: 5px;
  text-align: center;
  font-size: 0.75rem;
  background: #f8fafc;
  transition: all 0.15s;
  color: #1e293b;
}
.cell-input:focus {
  outline: none;
  border-color: #3b82f6;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
.cell-input.modified { border-color: #f59e0b; background: #fffbeb; }
.cell-input.saved { border-color: #22c55e; background: #f0fdf4; }
select.cell-input { width: 120px; cursor: pointer; }

/* =============================================
   CARD / PANEL
   ============================================= */
.card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  overflow: hidden;
}
.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}
.card-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #1e3a5f;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-body { padding: 14px 16px; }

/* =============================================
   FORM
   ============================================= */
.form-group {
  margin-bottom: 14px;
}
.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  font-size: 0.75rem;
  color: #1e293b;
  background: #fff;
  transition: border 0.15s, box-shadow 0.15s;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* =============================================
   MODAL
   ============================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.22s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  padding: 16px 20px;
  background: #1e3a5f;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-title {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.modal-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.modal-close:hover { background: rgba(255,255,255,0.25); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* =============================================
   TOAST NOTIFICATION
   ============================================= */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  min-width: 240px;
  max-width: 380px;
  animation: toastIn 0.25s ease;
  pointer-events: auto;
}
@keyframes toastIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-success { background: #16a34a; }
.toast-error   { background: #dc2626; }
.toast-info    { background: #0891b2; }
.toast-warning { background: #d97706; }
.toast-icon { font-size: 0.75rem; flex-shrink: 0; }

/* =============================================
   SPINNER / LOADING
   ============================================= */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  flex-direction: column;
  gap: 12px;
  color: #94a3b8;
  font-size: 0.75rem;
}
.loading-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: #64748b;
  font-size: 0.75rem;
}
.loading-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  gap: 10px;
}
.empty-icon { font-size: 0.75rem; opacity: 0.4; }
.empty-title { font-size: 0.75rem; font-weight: 700; color: #64748b; }
.empty-desc { font-size: 0.75rem; color: #94a3b8; max-width: 280px; }

/* =============================================
   PAGINATION
   ============================================= */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 0 0;
}
.page-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.page-btn:hover { background: #f0f7ff; border-color: #93c5fd; color: #1e3a5f; }
.page-btn.active { background: #1e3a5f; border-color: #1e3a5f; color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* =============================================
   CHART CONTAINER
   ============================================= */
.chart-container {
  position: relative;
  width: 100%;
  padding: 16px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  margin-bottom: 14px;
}
.chart-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #1e3a5f;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* =============================================
   PROGRESS BAR
   ============================================= */
.progress-bar-wrap {
  width: 100%;
  background: #e2e8f0;
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}
.progress-blue  { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.progress-green { background: linear-gradient(90deg, #16a34a, #22c55e); }
.progress-red   { background: linear-gradient(90deg, #dc2626, #f87171); }
.progress-yellow { background: linear-gradient(90deg, #d97706, #fbbf24); }

/* =============================================
   TAG / CHIP
   ============================================= */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tag-blue   { background: #dbeafe; color: #1d4ed8; }
.tag-green  { background: #dcfce7; color: #15803d; }
.tag-red    { background: #fee2e2; color: #b91c1c; }
.tag-yellow { background: #fef9c3; color: #92400e; }
.tag-gray   { background: #f1f5f9; color: #475569; }
.tag-purple { background: #ede9fe; color: #6d28d9; }

/* =============================================
   SEARCH INPUT
   ============================================= */
.search-wrap {
  position: relative;
}
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.75rem;
  pointer-events: none;
}
.search-input {
  padding: 7px 10px 7px 32px;
  border: 1.5px solid #cbd5e1;
  border-radius: 7px;
  font-size: 0.75rem;
  color: #1e293b;
  width: 200px;
  background: #fff;
  transition: border 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
  width: 240px;
}

/* =============================================
   FORM SECTION TITLE
   ============================================= */
.section-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: #1e3a5f;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 0 6px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* =============================================
   TABS within card
   ============================================= */
.card-tabs {
  display: flex;
  border-bottom: 2px solid #e2e8f0;
  margin: 0 -16px;
  padding: 0 16px;
  gap: 0;
}
.card-tab {
  padding: 8px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: none;
  color: #64748b;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  letter-spacing: 0.04em;
  transition: all 0.15s;
}
.card-tab.active { color: #1e3a5f; border-bottom-color: #1e3a5f; }
.card-tab:hover { color: #1e3a5f; }

/* =============================================
   DETAIL ROW (key:value)
   ============================================= */
.detail-row {
  display: flex;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.75rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-key {
  width: 40%;
  flex-shrink: 0;
  font-weight: 700;
  color: #64748b;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.detail-val { flex: 1; color: #1e293b; font-weight: 600; }

/* =============================================
   ALERT
   ============================================= */
.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}
.alert-info    { background: #e0f2fe; color: #0369a1; border-left: 3px solid #0891b2; }
.alert-success { background: #dcfce7; color: #15803d; border-left: 3px solid #16a34a; }
.alert-warning { background: #fffbeb; color: #92400e; border-left: 3px solid #d97706; }
.alert-danger  { background: #fee2e2; color: #b91c1c; border-left: 3px solid #dc2626; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
  .app-header { padding: 0; }
  .app-header-top { padding: 6px 10px 5px; }
  .tab-row { padding: 0 10px; }
  .app-name { font-size: 0.75rem; }
  .toolbar-wrap { padding: 8px 12px; top: 0; }
  .content-wrap { padding: 10px 12px; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card-value { font-size: 0.75rem; }
  .form-row { grid-template-columns: 1fr; }
  .tab-btn { padding: 6px 10px; font-size: 0.75rem; }
  .modal { max-width: 100%; }
  .search-input, .search-input:focus { width: 160px; }
  thead th { font-size: 0.75rem; padding: 8px 8px; }
  tbody td { font-size: 0.75rem; }
}
@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .app-subtitle { display: none; }
  .header-time { display: none; }
}

/* =============================================
   UTILITY
   ============================================= */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-3 { margin-bottom: 12px; }
.fw-700 { font-weight: 700; }
.text-sm { font-size: 0.75rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: #94a3b8; }
.text-primary { color: #1e3a5f; }
.text-success { color: #16a34a; }
.text-danger  { color: #dc2626; }
.text-warning { color: #d97706; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.rounded { border-radius: 8px; }

/* =============================================
   DOKUMEN CELL
   ============================================= */
.doc-cell { vertical-align: top; padding: 6px 8px !important; }

/* Tombol pilih file */
.doc-upload-btn {
  display: inline-block;
  padding: 3px 10px;
  background: #f1f5f9;
  border: 1.5px dashed #cbd5e1;
  border-radius: 5px;
  font-size: 0.75rem;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.doc-upload-btn:hover {
  background: #e0f2fe;
  border-color: #38bdf8;
  color: #0369a1;
}

/* Status upload kecil */
.doc-upload-status {
  display: block;
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 2px;
}

/* Wrapper tombol upload */
.doc-upload-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

/* ── INLINE PREVIEW (gambar/PDF langsung tampil) ── */
.doc-inline-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 160px;
}

/* Gambar inline — tampil langsung, klik untuk penuh */
.doc-inline-img {
  width: 140px;
  height: 100px;
  object-fit: cover;
  border-radius: 6px;
  border: 1.5px solid #e2e8f0;
  cursor: pointer;
  display: block;
  transition: box-shadow 0.15s, transform 0.15s;
  background: #f8fafc;
}
.doc-inline-img:hover {
  box-shadow: 0 4px 16px rgba(30,58,95,0.22);
  transform: scale(1.03);
}

/* PDF inline — embed langsung di sel */
.doc-inline-pdf {
  width: 140px;
  height: 110px;
  border-radius: 6px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  display: block;
}

/* File generik (bukan gambar/PDF) */
.doc-inline-generic {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 6px;
}
.doc-generic-icon {
  font-size: 0.75rem;
  font-weight: 800;
  color: #fff;
  background: #64748b;
  padding: 3px 5px;
  border-radius: 3px;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

/* Footer bawah preview (nama file + tombol hapus) */
.doc-inline-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.doc-inline-nama {
  font-size: 0.75rem;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.doc-inline-fallback {
  padding: 4px 0;
}

/* Thumbnail kecil (legacy, dipertahankan) */
.doc-thumb-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
}
.doc-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: transform 0.15s;
}
.doc-thumb:hover { transform: scale(1.1); }

/* Link file non-gambar */
.doc-file-link {
  font-size: 0.75rem;
  color: #1d4ed8;
  text-decoration: underline;
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
}

/* Tombol hapus dokumen */
.doc-del-btn {
  background: none;
  border: 1px solid #fca5a5;
  color: #dc2626;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 1px 6px;
  border-radius: 3px;
  line-height: 1.4;
  flex-shrink: 0;
  opacity: 0.8;
  white-space: nowrap;
}
.doc-del-btn:hover { opacity: 1; background: #fee2e2; }

/* ═══════════════════════════════════════════
   TAB KOMPARASI BBM
   ═══════════════════════════════════════════ */

/* Badge status komparasi */
.komp-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.komp-sesuai {
  background: #dcfce7;
  color: #16a34a;
  border: 1px solid #86efac;
}
.komp-lebih {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}
.komp-kurang {
  background: #e0f2fe;
  color: #0891b2;
  border: 1px solid #7dd3fc;
}

/* Row coloring untuk tabel komparasi */
.komp-row-sesuai { background: #f0fdf4 !important; }
.komp-row-lebih  { background: #fff5f5 !important; }
.komp-row-kurang { background: #f0f9ff !important; }

/* Summary bar */
.komp-summary-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 20px;
  margin-bottom: 16px;
}
.komp-summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 20px;
  min-width: 120px;
}
.komp-summary-val {
  font-size: 0.75rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}
.komp-summary-label {
  font-size: 0.75rem;
  color: #64748b;
  text-align: center;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.komp-summary-sep {
  width: 1px;
  height: 40px;
  background: #cbd5e1;
  margin: 0 4px;
}

/* Stat cards komparasi */
.komp-stat-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.komp-stat-card {
  flex: 1;
  min-width: 130px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  text-align: center;
}
.komp-stat-num {
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.1;
}
.komp-stat-lbl {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.komp-stat-card.c-total   { border-top: 3px solid #6366f1; }
.komp-stat-card.c-total   .komp-stat-num { color: #4f46e5; }
.komp-stat-card.c-ada     { border-top: 3px solid #0ea5e9; }
.komp-stat-card.c-ada     .komp-stat-num { color: #0284c7; }
.komp-stat-card.c-nodata  { border-top: 3px solid #94a3b8; }
.komp-stat-card.c-nodata  .komp-stat-num { color: #64748b; }
.komp-stat-card.c-sesuai  { border-top: 3px solid #22c55e; }
.komp-stat-card.c-sesuai  .komp-stat-num { color: #16a34a; }
.komp-stat-card.c-lebih   { border-top: 3px solid #ef4444; }
.komp-stat-card.c-lebih   .komp-stat-num { color: #dc2626; }
.komp-stat-card.c-kurang  { border-top: 3px solid #38bdf8; }
.komp-stat-card.c-kurang  .komp-stat-num { color: #0891b2; }

/* % selisih coloring */
.pct-ok     { color: #16a34a; font-weight: 600; }
.pct-warn   { color: #d97706; font-weight: 600; }
.pct-danger { color: #dc2626; font-weight: 600; }
.pct-na     { color: #94a3b8; }

/* Kolom numerik komparasi */
.komp-num { text-align: right; font-variant-numeric: tabular-nums; }
.komp-selisih-pos { color: #dc2626; font-weight: 600; }
.komp-selisih-neg { color: #0891b2; font-weight: 600; }
.komp-selisih-ok  { color: #16a34a; }
.komp-na          { color: #94a3b8; font-size: 0.75rem; }

/* Kolom No — fit content, override sticky first-child */
th.th-no {
  min-width: 0 !important;
  width: 1px !important;
  white-space: nowrap !important;
  padding: 10px 10px !important;
  text-align: center !important;
}
td.td-no {
  min-width: 0 !important;
  width: 1px !important;
  white-space: nowrap !important;
  text-align: center !important;
  font-weight: 400 !important;
  padding: 8px 10px !important;
}

/* ── Komparasi: Detail Unit (info grafis) ── */
.komp-unit-detail {
  margin-top: 8px;
}
.komp-unit-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #1e3a5f;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid #1e3a5f22;
}
.komp-unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.komp-unit-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.komp-unit-card-icon {
  font-size: 0.75rem;
  margin-bottom: 2px;
}
.komp-unit-card-label {
  font-size: 0.75rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.komp-unit-card-val {
  font-size: 0.75rem;
  font-weight: 700;
  color: #111;
  margin-top: 2px;
}

/* ── Komparasi: Detail box (1 box, grid kolom) ── */
.komp-detail-box {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px 32px;
  width: 50%;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.komp-detail-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.komp-detail-label {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.komp-detail-val {
  font-size: 0.75rem;
  font-weight: 700;
  color: #111;
}
