/* ============================================================
   Dasbor Realisasi Anggaran dan IKPA - Sentra Wirajaya Makassar
   Modern, Ultra-Responsive UI/UX Stylesheet
   ============================================================ */

:root {
  --teal: #4FB08A;
  --teal-dim: rgba(79, 176, 138, 0.16);
  --teal-hover: #439b78;
  --orange: #E0994D;
  --orange-dim: rgba(224, 153, 77, 0.16);
  --red: #E2685A;
  --red-dim: rgba(226, 104, 90, 0.16);
  --gold: #E0B563;
  --gold-dim: rgba(224, 181, 99, 0.18);
  --grey: #9AA79E;
  --bg: #0D1210;
  --surface: #151C18;
  --surface-alt: #1A221E;
  --surface-card: #18201C;
  --surface-card-hover: #202924;
  --ink: #EDF2EE;
  --sub: #9EABA3;
  --faint: #738078;
  --line: #242E28;
  --line-light: rgba(255, 255, 255, 0.06);
  --chip: #1F2823;
  --chip-hover: #29352F;
  --border: #2C3831;
  --border-focus: #4FB08A;
  --brand: #D6453A;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 8px 28px rgba(0, 0, 0, 0.45);
  --radius: 12px;
  --radius-sm: 8px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: Georgia, 'Times New Roman', serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  line-height: 1.5;
  position: relative;
}

.serif { font-family: var(--font-serif); }

.wrap {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 64px;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* ============================================================
   HEADER & TOP BAR
   ============================================================ */
.header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
  margin-bottom: 22px;
  position: relative;
  width: 100%;
  max-width: 100%;
}
.header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--teal) 0%, var(--teal) 40%, var(--orange) 100%);
}

.header-top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.header-titles {
  flex: 1;
  min-width: 0;
}

.badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.updated-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--sub);
  background: var(--chip);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px 9px;
  flex-shrink: 0;
}
.updated-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  animation: pulseDot 2s infinite;
}
@keyframes pulseDot { 0%,100%{ opacity: 1; } 50%{ opacity: .3; } }

.header-date {
  font-size: 11.5px;
  color: var(--faint);
  line-height: 1.3;
}

.header-h1 {
  font-family: var(--font-serif);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.25;
  margin-bottom: 3px;
}

.header-sub {
  font-size: 13px;
  color: var(--sub);
  line-height: 1.4;
}

.header-brand-wrap {
  flex-shrink: 0;
}
.brand-badge {
  background: #FFFFFF;
  border-radius: 8px;
  padding: 5px 12px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  flex-shrink: 0;
}
.brand-badge img {
  height: 28px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

/* Header Toolbar */
.header-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.satker-select-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  flex: 1;
  min-width: 250px;
  max-width: 520px;
  transition: border-color .2s;
}
.satker-select-box:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px var(--teal-dim);
}
.satker-select-icon {
  color: var(--teal);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.satker-select-box select {
  background: transparent;
  border: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  outline: none;
  width: 100%;
  cursor: pointer;
  text-overflow: ellipsis;
}
.satker-select-box select option {
  background: #18201C;
  color: var(--ink);
}

.header-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
button { font-family: inherit; cursor: pointer; transition: .18s ease; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--chip);
  color: var(--ink);
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: var(--chip-hover); border-color: var(--grey); }
.btn-primary { background: var(--teal); color: #fff; border: none; }
.btn-primary:hover { background: var(--teal-hover); }
.btn-secondary { background: var(--chip); color: var(--ink); }
.btn-sm { padding: 5px 10px; font-size: 11.5px; }

/* ============================================================
   SEGMENTED NAVIGATION (TOP VIEW SWITCHER)
   ============================================================ */
.nav-segmented {
  display: flex;
  gap: 4px;
  background: var(--surface);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
  width: 100%;
  max-width: 440px;
}
.nav-tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--sub);
  font-size: 13px;
  font-weight: 500;
  transition: all .2s ease;
  user-select: none;
  cursor: pointer;
}
.nav-tab-btn:hover { color: var(--ink); background: var(--chip); }
.nav-tab-btn.active {
  background: var(--chip);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.nav-tab-btn[data-view="realisasi"].active {
  border-left: 3px solid var(--orange);
}
.nav-tab-btn[data-view="ikpa"].active {
  border-left: 3px solid var(--teal);
}

/* ============================================================
   APP SHELL & MAIN PANEL
   ============================================================ */
.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.main-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* ============================================================
   CARDS & HIGHLIGHT SECTION
   ============================================================ */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.highlight-card {
  background: linear-gradient(180deg, rgba(224, 153, 77, 0.08) 0%, var(--surface) 100%);
  border: 1px solid rgba(224, 153, 77, 0.35);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  box-shadow: var(--shadow);
}
.highlight-teal {
  background: linear-gradient(180deg, rgba(79, 176, 138, 0.08) 0%, var(--surface) 100%);
  border: 1px solid rgba(79, 176, 138, 0.35);
}

.highlight-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.highlight-meta {
  flex: 1;
  min-width: 0;
}
.highlight-badge-pill {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--orange);
  background: var(--orange-dim);
  padding: 2px 8px;
  border-radius: 99px;
  display: inline-block;
  margin-bottom: 6px;
}
.highlight-badge-pill.teal {
  color: var(--teal);
  background: var(--teal-dim);
}

.highlight-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}
.highlight-note {
  font-size: 12.5px;
  color: var(--sub);
  margin-top: 4px;
}

.highlight-rank-box {
  background: var(--chip);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 14px;
  text-align: center;
  flex-shrink: 0;
  min-width: 105px;
}
.rank-label {
  font-size: 10px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
}
.rank-number {
  font-size: 22px;
  font-weight: 800;
  color: var(--gold);
  line-height: 1.1;
  display: block;
  margin: 1px 0;
}
.rank-total {
  font-size: 11px;
  color: var(--sub);
  display: block;
}

/* ============================================================
   MINI STATS GRID (2x2 ON MOBILE, 4 COLS ON DESKTOP)
   ============================================================ */
.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
@media(min-width: 820px) {
  .mini-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
  }
}

.mini {
  background: var(--chip);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}
.mini .label {
  font-size: 11.5px;
  color: var(--sub);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini .value {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.mini-with-ring {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Progress Ring */
.ring-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}
.ring-wrap svg {
  transform: rotate(-90deg);
  width: 44px;
  height: 44px;
}
.ring-wrap .ring-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
}

.trend-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 3px;
  white-space: nowrap;
}
.trend-up { background: var(--teal-dim); color: var(--teal); }
.trend-down { background: var(--red-dim); color: var(--red); }
.trend-flat { background: var(--chip); color: var(--faint); }
.sparkline { height: 26px; margin-top: 4px; }

/* Sections inside Highlight */
.sparkline-section {
  margin-bottom: 18px;
}
.section-sub-label {
  font-size: 11.5px;
  color: var(--faint);
  margin-bottom: 4px;
}
.chart-section {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}
.section-title-sm {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sub);
  margin-bottom: 12px;
}
.chart-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* ============================================================
   TABLE & CARD LIST CARD HEADER / TOOLBAR
   ============================================================ */
.card-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  width: 100%;
}
.card-title-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.card-heading {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.category-indicator {
  font-size: 12px;
  color: var(--sub);
}
.category-indicator strong {
  color: var(--orange);
}
.category-indicator strong.teal {
  color: var(--teal);
}

.card-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--chip);
  min-width: 160px;
  max-width: 240px;
}
.search-input-wrap svg {
  color: var(--faint);
  flex-shrink: 0;
}
.search-input-wrap input {
  border: none;
  outline: none;
  width: 100%;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}

/* View Switcher (Kartu vs Tabel) */
.view-switch-group {
  display: inline-flex;
  background: var(--chip);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}
.view-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  font-size: 11.5px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--sub);
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
}
.view-switch-btn:hover { color: var(--ink); }
.view-switch-btn.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* ============================================================
   CATEGORY FILTER PILLS (SMOOTH HORIZONTAL TOUCH SCROLL)
   ============================================================ */
.tabs-scroll-outer {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  margin-bottom: 14px;
}
.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
  width: 100%;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-pill {
  padding: 5px 12px;
  font-size: 11.5px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--chip);
  color: var(--sub);
  cursor: pointer;
  flex-shrink: 0;
  transition: all .15s ease;
}
.tab-pill:hover { background: var(--chip-hover); color: var(--ink); }
.tab-pill.active {
  background: var(--orange);
  color: #111;
  font-weight: 600;
  border-color: var(--orange);
}

/* ============================================================
   MOBILE CARD LIST VIEW (CLEAN, MODERN, TOUCH-FRIENDLY)
   ============================================================ */
.satker-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.satker-card-item {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
  user-select: none;
  width: 100%;
  box-sizing: border-box;
}
.satker-card-item:hover {
  background: var(--surface-card-hover);
  border-color: var(--grey);
}
.satker-card-item.active-satker {
  border-color: var(--orange);
  background: rgba(224, 153, 77, 0.09);
  box-shadow: 0 0 0 1px var(--orange);
}
.satker-card-item.active-satker-ikpa {
  border-color: var(--teal);
  background: rgba(79, 176, 138, 0.09);
  box-shadow: 0 0 0 1px var(--teal);
}

.sci-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.sci-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.rank-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--chip);
  color: var(--sub);
  flex-shrink: 0;
}
.rank-chip.top3 {
  background: rgba(224, 181, 99, 0.22);
  color: var(--gold);
}
.sci-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sci-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  flex-shrink: 0;
  white-space: nowrap;
}

.sci-progress-track {
  width: 100%;
  height: 4px;
  background: var(--chip);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}
.sci-progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .4s ease;
}

.sci-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  font-size: 11px;
  color: var(--sub);
  border-top: 1px solid var(--line-light);
  padding-top: 8px;
}
.sci-stat-col {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sci-stat-col span {
  display: block;
  font-size: 9.5px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.sci-stat-col strong {
  color: var(--ink);
  font-weight: 600;
  font-size: 11.5px;
}

/* IKPA Card Stats */
.sci-stats.ikpa-stats {
  grid-template-columns: repeat(3, 1fr);
}

/* ============================================================
   TABLE STYLING WITH SMOOTH HORIZONTAL SCROLL & STICKY COLUMN
   ============================================================ */
.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
  display: block;
  margin-top: 10px;
  border: 1px solid var(--border);
  box-sizing: border-box;
}
table {
  width: 100%;
  min-width: 580px;
  border-collapse: collapse;
  font-size: 12.5px;
  white-space: nowrap;
}
th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--line);
  color: var(--sub);
  font-weight: 600;
  background: var(--surface-card);
}
th.num, td.num { text-align: right; }
td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-light);
}
tr.highlighted-row td {
  background: rgba(224, 153, 77, 0.12);
  font-weight: 600;
}
tr:hover td { background: #1F2823; }
.empty-row {
  text-align: center;
  color: var(--faint);
  padding: 32px;
  font-size: 12.5px;
}

.badge {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 99px;
  background: #2A2116;
  color: var(--orange);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge.teal {
  background: #17251F;
  color: var(--teal);
}

/* ============================================================
   TOAST & MODALS
   ============================================================ */
.toast-wrap {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 12.5px;
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .25s ease, transform .25s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-left-color: var(--teal); }

.view-fade {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .2s ease, transform .2s ease;
}
.view-fade.show { opacity: 1; transform: translateY(0); }

/* Upload Modal (Kept for compatibility) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  padding: 16px;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-hover);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--sub);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

/* Spinner */
.spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* ============================================================
   SMARTPHONE RESPONSIVE OVERRIDES (<= 768px)
   ============================================================ */
@media(max-width: 768px) {
  .wrap {
    padding: 14px 12px 48px;
  }

  /* Compact Header */
  .header {
    padding-bottom: 14px;
    margin-bottom: 16px;
  }
  .header-top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .header-h1 {
    font-size: 19px;
  }
  .header-sub {
    font-size: 12px;
  }
  .header-brand-wrap {
    align-self: flex-start;
  }
  .brand-badge {
    padding: 4px 10px;
  }
  .brand-badge img {
    height: 24px;
  }

  /* Toolbar stacked */
  .header-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .satker-select-box {
    max-width: 100%;
    width: 100%;
  }
  .header-buttons {
    width: 100%;
  }
  .header-buttons .btn {
    flex: 1;
  }

  /* Segmented Nav */
  .nav-segmented {
    max-width: 100%;
    width: 100%;
  }
  .nav-tab-btn {
    padding: 8px 10px;
    font-size: 12px;
  }

  /* Card Spacing */
  .card, .highlight-card {
    padding: 14px 12px;
    margin-bottom: 14px;
    border-radius: 10px;
  }
  .highlight-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .highlight-rank-box {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 8px 12px;
    width: 100%;
  }
  .rank-number {
    font-size: 20px;
  }

  /* Mini KPIs: 2x2 Clean Proportional Grid */
  .mini-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
  }
  .mini {
    padding: 10px 10px;
  }
  .mini .label { font-size: 10.5px; }
  .mini .value { font-size: 15.5px; }

  .ring-wrap { width: 38px; height: 38px; }
  .ring-wrap svg { width: 38px; height: 38px; }
  .ring-wrap .ring-value { font-size: 9.5px; }

  /* Toolbar */
  .card-top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .card-actions-row {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
  }
  .search-input-wrap {
    flex: 1;
    min-width: 0;
    max-width: none;
  }
  .view-switch-btn .btn-label {
    display: none;
  }
  .view-switch-btn {
    padding: 6px 8px;
  }

  /* Satker Card Item on Mobile */
  .satker-card-item {
    padding: 10px 12px;
  }
  .sci-name {
    font-size: 12.5px;
  }
  .sci-stats {
    gap: 4px;
  }
  .sci-stat-col strong {
    font-size: 11px;
  }

  /* Toast */
  .toast-wrap { left: 12px; right: 12px; bottom: 12px; }
}

@media(max-width: 380px) {
  .header-h1 { font-size: 17px; }
  .mini .value { font-size: 14px; }
  .rank-chip { font-size: 10px; padding: 2px 5px; }
  .sci-name { font-size: 11.5px; }
}

/* ============================================================
   LIGHT THEME OVERRIDES ([data-theme="light"])
   ============================================================ */
[data-theme="light"] {
  --teal: #1A8C60;
  --teal-dim: rgba(26, 140, 96, 0.12);
  --teal-hover: #14724E;
  --orange: #D1731E;
  --orange-dim: rgba(209, 115, 30, 0.12);
  --red: #D33D2E;
  --red-dim: rgba(211, 61, 46, 0.12);
  --gold: #A06D09;
  --gold-dim: rgba(160, 109, 9, 0.14);
  --grey: #5D7066;
  --bg: #F4F7F5;
  --surface: #FFFFFF;
  --surface-alt: #F8FAF9;
  --surface-card: #FFFFFF;
  --surface-card-hover: #F2F7F4;
  --ink: #142019;
  --sub: #4E6056;
  --faint: #76877E;
  --line: #E1E8E3;
  --line-light: rgba(0, 0, 0, 0.06);
  --chip: #EEF3F0;
  --chip-hover: #E2ECE5;
  --border: #D5DFD8;
  --border-focus: #1A8C60;
  --brand: #C9392E;
  --shadow: 0 4px 18px rgba(18, 35, 25, 0.05);
  --shadow-hover: 0 8px 24px rgba(18, 35, 25, 0.09);
}

[data-theme="light"] .header::after {
  background: linear-gradient(90deg, var(--teal) 0%, var(--teal) 40%, var(--orange) 100%);
}

[data-theme="light"] .brand-badge {
  background: #FFFFFF;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .highlight-card {
  background: linear-gradient(180deg, rgba(209, 115, 30, 0.05) 0%, #FFFFFF 100%);
  border: 1px solid rgba(209, 115, 30, 0.35);
  box-shadow: 0 4px 18px rgba(209, 115, 30, 0.06);
}

[data-theme="light"] .highlight-teal {
  background: linear-gradient(180deg, rgba(26, 140, 96, 0.05) 0%, #FFFFFF 100%);
  border: 1px solid rgba(26, 140, 96, 0.35);
  box-shadow: 0 4px 18px rgba(26, 140, 96, 0.06);
}

[data-theme="light"] .highlight-rank-box {
  background: #F7FAF8;
  border-color: var(--border);
}

[data-theme="light"] .mini {
  background: #F8FAF9;
  border-color: var(--border);
}

[data-theme="light"] .satker-card-item {
  background: #FFFFFF;
  border-color: var(--border);
}
[data-theme="light"] .satker-card-item:hover {
  background: #F3F8F5;
  border-color: var(--grey);
}
[data-theme="light"] .satker-card-item.active-satker {
  background: rgba(209, 115, 30, 0.08);
  border-color: var(--orange);
}
[data-theme="light"] .satker-card-item.active-satker-ikpa {
  background: rgba(26, 140, 96, 0.08);
  border-color: var(--teal);
}

[data-theme="light"] th {
  background: #F6FAF7;
}
[data-theme="light"] tr:hover td {
  background: #F2F7F4;
}
[data-theme="light"] tr.highlighted-row td {
  background: rgba(209, 115, 30, 0.10);
}

[data-theme="light"] .tab-pill {
  background: #EEF3F0;
  border-color: var(--border);
  color: var(--sub);
}
[data-theme="light"] .tab-pill:hover {
  background: #E2ECE5;
  color: var(--ink);
}
[data-theme="light"] .tab-pill.active {
  background: var(--orange);
  color: #FFFFFF;
  border-color: var(--orange);
}

[data-theme="light"] .nav-segmented {
  background: #EEF3F0;
  border-color: var(--border);
}
[data-theme="light"] .nav-tab-btn.active {
  background: #FFFFFF;
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

[data-theme="light"] .satker-select-box select option {
  background: #FFFFFF;
  color: #142019;
}
[data-theme="light"] .satker-select-box {
  background: #FFFFFF;
}

[data-theme="light"] .search-input-wrap {
  background: #F4F7F5;
}

[data-theme="light"] .badge {
  background: #FAF0E4;
  color: var(--orange);
}
[data-theme="light"] .badge.teal {
  background: #E7F6F0;
  color: var(--teal);
}

/* Theme Toggle Button Transitions */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  user-select: none;
  flex-shrink: 0;
}
.theme-toggle-btn svg {
  display: block;
  transition: transform .25s ease;
}
.theme-toggle-btn:hover svg {
  transform: rotate(25deg);
}

/* ============================================================
   EXPORT DROPDOWN MENU
   ============================================================ */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 28px rgba(0,0,0,0.45);
  min-width: 195px;
  z-index: 500;
  display: none;
  flex-direction: column;
  padding: 6px;
  animation: fadeInDrop .18s ease;
}
@keyframes fadeInDrop {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.dropdown.open .dropdown-menu {
  display: flex;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}
.dropdown-item:hover {
  background: var(--chip);
}
.dropdown-item .item-icon {
  flex-shrink: 0;
}

[data-theme="light"] .dropdown-menu {
  background: #FFFFFF;
  border-color: var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
[data-theme="light"] .dropdown-item:hover {
  background: #EEF4F0;
}
