/* =============================================================
   styles.css — Tema "Executive Agenda Dashboard" TVRI Kalimantan Barat
   VERSI REFINED (lebih modern & bersih)

   Cara pakai: TIMPA isi styles.css lama Anda dengan file ini.
   - Struktur HTML tidak diubah sama sekali.
   - Semua id data (exec-total, jam-digital, dst) & logo base64 tetap.
   - Bar "Progress Hari" dihapus rapi lewat CSS (tanpa mengedit HTML),
     grid statistik otomatis menyesuaikan dari 8 -> 7 kolom.
   ============================================================= */

/* -------------------------------------------------------------
   1. PALET WARNA (Mode Gelap = default)
   Variabel ini dipakai oleh .card-flat, .glass, dll di HTML.
   Nuansa navy dibuat lebih pekat & bersih, border lebih halus.
   ------------------------------------------------------------- */
:root {
  --color-bg:       #0B1220; /* latar utama — navy pekat, bersih   */
  --color-card:     #131D31; /* permukaan kartu utama              */
  --color-card-alt: #1A2740; /* permukaan sekunder                 */
  --border-glass:   rgba(148, 163, 184, 0.10); /* border slate halus */

  --color-accent:   #2563EB; /* biru TVRI (aksen)                  */
  --color-warning:  #F59E0B;
  --color-success:  #22C55E;
  --color-danger:   #EF4444;
}

/* -------------------------------------------------------------
   2. KELAS DASAR yang dibutuhkan HTML
   (.glass & .animate-slide-up dipakai di markup tapi tidak
    didefinisikan pada <style> inline — jadi wajib ada di sini.)
   ------------------------------------------------------------- */
.glass {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.045),
    rgba(255, 255, 255, 0.012)
  );
  border: 1px solid var(--border-glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-slide-up { animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* -------------------------------------------------------------
   3. RETHEME PERMUKAAN yang di-hardcode di HTML
   Class arbitrary Tailwind (bg-[#0F172A], bg-[#334155]) dipetakan
   ke palet baru. Selektor [class*="..."] dipakai agar tidak perlu
   meng-escape karakter # [ ] (pola yang sama seperti mode terang).
   ------------------------------------------------------------- */
html, body { background: var(--color-bg); }

[class*="bg-[#0F172A]"] { background-color: var(--color-bg) !important; }
[class*="bg-[#334155]"] { background-color: #1E293B !important; }

/* -------------------------------------------------------------
   4. SENTUHAN MODERN pada kartu
   Load order styles.css < <style> inline, jadi untuk menimpa
   .card-flat/.card-shadow inline dipakai prefiks #stage agar
   spesifisitas lebih tinggi (id > class), tanpa mengubah HTML.
   ------------------------------------------------------------- */
#stage .card-flat {
  background: var(--color-card);
  border: 1px solid var(--border-glass);
}

/* Bayangan berlapis + garis highlight tipis di tepi atas (efek "kaca") */
#stage .card-shadow {
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.04) inset,
    0 18px 40px -20px rgba(2, 6, 23, 0.85);
}

#stage .card-hover {
  transition:
    transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.35s ease,
    border-color 0.35s ease;
}
#stage .card-hover:hover {
  transform: translateY(-4px);
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.06) inset,
    0 26px 54px -22px rgba(2, 6, 23, 0.9);
}

/* Ikon statistik: sedikit lebih besar radius + ring halus */
#stage .stat-icon {
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Header lebih bersih: pemisah tipis di bawah, bukan bayangan berat */
#stage header.glass {
  border-bottom: 1px solid var(--border-glass);
}

/* Timeline garis lebih halus & modern */
#stage .timeline-row::before { background: rgba(148, 163, 184, 0.14); }
#stage .timeline-dot { box-shadow: 0 0 0 3px rgba(11, 18, 32, 0.9); }

/* Progress "Persentase Jam Kerja" — track & isian lebih halus */
#stage [class*="bg-[#334155]"] { background-color: rgba(148, 163, 184, 0.16) !important; }

/* -------------------------------------------------------------
   5. HAPUS BAR "PROGRESS HARI" (permintaan Anda)
   Kartunya disembunyikan lewat :has() sehingga elemen tetap ada
   di DOM (app.js tidak error), lalu grid dirapikan jadi 7 kolom.
   ------------------------------------------------------------- */
#stage .grid-cols-8 > div:has(#exec-progress-hari-label) { display: none !important; }
#stage .grid-cols-8 { grid-template-columns: repeat(7, minmax(0, 1fr)) !important; }

/* -------------------------------------------------------------
   6. MODE TERANG
   Variabel di :root sudah otomatis ditimpa oleh blok
   html[data-theme="light"] pada <style> inline index.html.
   Di sini hanya penyesuaian ringan agar kartu tetap bersih.
   ------------------------------------------------------------- */
html[data-theme="light"] #stage .card-shadow {
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.9) inset,
    0 12px 28px -18px rgba(15, 23, 42, 0.25);
}
html[data-theme="light"] #stage .card-flat { border-color: rgba(15, 23, 42, 0.08); }
html[data-theme="light"] #stage .stat-icon { box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05); }

/* -------------------------------------------------------------
   7. POLISH KHUSUS PANEL KANAN MAIN CONTENT
   Hanya memengaruhi:
   - #card-berlangsung
   - #card-berikutnya
   - Statistik Kategori
   Struktur, ukuran kolom, dan logika aplikasi tidak diubah.
   ------------------------------------------------------------- */

/* Permukaan panel kanan dibuat sedikit lebih berlapis dan rapi */
#stage #card-berlangsung,
#stage #card-berikutnya,
#stage main > div > div:last-child > section:last-child {
  position: relative;
  isolation: isolate;
  border-color: rgba(148, 163, 184, 0.13);
}

#stage #card-berlangsung::before,
#stage #card-berikutnya::before,
#stage main > div > div:last-child > section:last-child::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(circle at 92% 10%, rgba(37, 99, 235, 0.10), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,0.025), transparent 42%);
}

/* Garis aksen tipis di sisi kiri — memberi hierarki tanpa mengubah layout */
#stage #card-berlangsung::after,
#stage #card-berikutnya::after,
#stage main > div > div:last-child > section:last-child::after {
  content: "";
  position: absolute;
  left: 0;
  top: 22px;
  bottom: 22px;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(180deg, rgba(96,165,250,.92), rgba(37,99,235,.28));
  opacity: .75;
}

#stage #card-berlangsung::after {
  background: linear-gradient(180deg, rgba(34,197,94,.95), rgba(34,197,94,.22));
}

#stage #card-berikutnya::after {
  background: linear-gradient(180deg, rgba(245,158,11,.95), rgba(245,158,11,.22));
}

/* Sedang berlangsung: susunan informasi lebih lega dan fokus */
#stage #berlangsung-content {
  padding: 2px 4px 2px 2px;
}

#stage #berlangsung-content .badge-status {
  width: fit-content;
  min-height: 27px;
  padding: 5px 10px;
  border-radius: 999px;
  letter-spacing: .01em;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}

#stage #berlangsung-content h3 {
  margin-top: 10px;
  font-size: 22px;
  line-height: 1.24;
  letter-spacing: -0.02em;
}

#stage #berlangsung-content .progress-track-premium {
  background: rgba(148,163,184,.14);
  border: 1px solid rgba(148,163,184,.06);
}

/* Empty state card berlangsung — tidak lagi terlihat seperti teks mengambang */
#stage #berlangsung-content:has(> p:only-child),
#stage #berikutnya-content:has(> p:only-child) {
  height: 100%;
  display: flex;
  align-items: center;
}

#stage #berlangsung-content:has(> p:only-child) > p,
#stage #berikutnya-content:has(> p:only-child) > p {
  width: 100%;
  margin: 0;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px dashed rgba(148,163,184,.15);
  background: rgba(15,23,42,.20);
  color: #94A3B8;
  line-height: 1.45;
}

/* Agenda berikutnya: isi memenuhi tinggi kartu dan tidak menempel di atas */
#stage #berikutnya-content:not(:has(> p:only-child)) {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 3px 0 2px;
}

#stage #berikutnya-content > div:first-child {
  margin-bottom: 9px;
}

#stage #berikutnya-content h3 {
  margin-top: 6px;
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

/* Statistik Kategori — redesign compact 2 kolom, seluruh item langsung terlihat tanpa scroll */
#stage main > div > div:last-child > section:last-child {
  padding: 14px 16px !important;
}

#stage main > div > div:last-child > section:last-child h2 {
  margin: 0 0 8px 0 !important;
  padding: 0 0 7px 0;
  min-height: 24px;
  border-bottom: 1px solid rgba(148,163,184,.10);
  font-size: 11px;
  line-height: 1.15;
  letter-spacing: .07em;
  white-space: nowrap;
}

#stage main > div > div:last-child > section:last-child h2 svg {
  width: 14px;
  height: 14px;
  padding: 2px;
  border-radius: 6px;
  background: rgba(37,99,235,.12);
  box-sizing: content-box;
}

/* Maksimal 5 item dari renderer = 3 baris pada grid 2 kolom */
#stage #statistik-content {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(25px, 1fr);
  gap: 5px 7px !important;
  padding: 0;
  overflow: hidden !important;
  min-height: 0;
  align-content: stretch;
}

#stage #statistik-content > div {
  min-width: 0;
  min-height: 25px;
  height: auto;
  margin: 0 !important;
  padding: 4px 7px !important;
  border: 1px solid rgba(148,163,184,.075) !important;
  border-radius: 9px;
  background: rgba(255,255,255,.022);
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  transition: background .2s ease, border-color .2s ease;
}

#stage #statistik-content > div:hover {
  transform: none;
  background: rgba(255,255,255,.045);
  border-color: rgba(96,165,250,.14) !important;
}

#stage #statistik-content > div > span:first-child {
  min-width: 0;
  flex: 1 1 auto;
  gap: 6px !important;
  font-size: 10.5px !important;
  line-height: 1.15;
  color: #E2E8F0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#stage #statistik-content > div > span:first-child .status-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  box-shadow: 0 0 0 2px rgba(255,255,255,.025);
}

#stage #statistik-content > div > span:last-child {
  flex: 0 0 auto;
  min-width: 22px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 7px;
  background: rgba(37,99,235,.11);
  border: 1px solid rgba(96,165,250,.12);
  color: #F8FAFC;
  font-size: 11px !important;
  line-height: 1;
}

/* Jika hanya 1 kategori, biarkan tetap proporsional dan tidak melebar penuh dua kolom */
#stage #statistik-content > div:only-child {
  grid-column: 1 / -1;
}

/* Light mode — tetap bersih tanpa mengubah karakter desain */
html[data-theme="light"] #stage #card-berlangsung::before,
html[data-theme="light"] #stage #card-berikutnya::before,
html[data-theme="light"] #stage main > div > div:last-child > section:last-child::before {
  background:
    radial-gradient(circle at 92% 10%, rgba(37,99,235,.07), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,.7), transparent 46%);
}

html[data-theme="light"] #stage #berlangsung-content:has(> p:only-child) > p,
html[data-theme="light"] #stage #berikutnya-content:has(> p:only-child) > p {
  background: rgba(37,99,235,.025);
  color: #64748B;
}

html[data-theme="light"] #stage #statistik-content > div {
  background: rgba(15,23,42,.018);
}

html[data-theme="light"] #stage #statistik-content > div > span:first-child {
  color: #334155;
}

/* -------------------------------------------------------------
   8. STABILISASI LAYOUT DESKTOP / KIOSK
   Tidak mengubah struktur HTML maupun logika aplikasi. Bagian ini
   hanya mengunci sizing/flex/grid agar proporsi 1920x1080 tetap
   konsisten ketika browser melakukan scaling ke resolusi lain.
   ------------------------------------------------------------- */

/* Pastikan padding dan border selalu dihitung di dalam ukuran elemen. */
#stage,
#stage *,
#stage *::before,
#stage *::after {
  box-sizing: border-box;
}

/* Cegah browser membuat kolom/grid melebar akibat isi teks panjang. */
#stage main,
#stage main > div,
#stage main > div > section,
#stage main > div > div,
#stage main > div > div > section,
#stage #agenda-hari-ini-content,
#stage #berlangsung-content,
#stage #berikutnya-content,
#stage #statistik-content,
#stage #agenda-mendatang-content {
  min-width: 0;
  min-height: 0;
}

/* Pertahankan komposisi referensi: 1248px kiri + 24px gap + sisa kanan,
   tetapi izinkan kolom kanan menyusut secara benar tanpa overflow. */
#stage main > .grid {
  grid-template-columns: minmax(0, 1248px) minmax(0, 1fr) !important;
}

/* Panel kanan harus selalu memenuhi kolomnya, bukan mengikuti intrinsic width isi. */
#stage main > .grid > div:last-child,
#stage #card-berlangsung,
#stage #card-berikutnya,
#stage main > .grid > div:last-child > section:last-child {
  width: 100%;
  max-width: 100%;
}

/* Judul agenda panjang tidak boleh mendorong ukuran kartu/panel. */
#stage #berlangsung-content h3,
#stage #berikutnya-content h3,
#stage #agenda-hari-ini-content h3,
#stage #agenda-mendatang-content h3 {
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* Bar statistik atas tetap 7 kolom simetris setelah Progress Hari disembunyikan. */
#stage section > .grid.grid-cols-8 {
  width: 100%;
  grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
}

#stage section > .grid.grid-cols-8 > div {
  min-width: 0;
  overflow: hidden;
}

/* Label kartu statistik tidak boleh menggeser nilai/ikon saat teks panjang. */
#stage section > .grid.grid-cols-8 > div > div:last-child {
  min-width: 0;
}

/* Agenda mendatang: distribusi kartu selalu rapi dan tinggi konsisten. */
#stage #agenda-mendatang-content > div {
  min-width: 0;
}

/* Stabilkan rasterisasi ketika #stage diskalakan oleh JS. */
#stage {
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}


/* =============================================================
   9. RESPONSIVE TABLET & MOBILE
   Aktif hanya <= 1024px. Layout desktop/kiosk > 1024px tetap identik.
   ============================================================= */
@media (max-width: 1024px) {
  html,
  body {
    width: 100%;
    min-height: 100%;
    height: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  body {
    min-height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom);
  }

  #stage {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100dvh;
    transform: none !important;
    transform-origin: initial !important;
    overflow: visible !important;
  }

  /* Header: dua baris yang rapi, tanpa memaksa lebar desktop. */
  #stage > header {
    height: auto !important;
    min-height: 88px;
    margin: 0;
    border-radius: 0;
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  #stage > header > div {
    height: auto !important;
    min-height: 88px;
    padding: 14px 18px !important;
    gap: 14px;
    align-items: center;
  }

  #stage > header > div > div:first-child {
    min-width: 0;
    flex: 1 1 auto;
    gap: 10px !important;
  }

  #stage > header > div > div:first-child > div:first-child {
    width: 42px !important;
    height: 42px !important;
    border-radius: 13px !important;
  }

  #stage > header h1 {
    font-size: 17px !important;
    line-height: 1.18 !important;
    letter-spacing: -0.02em;
  }

  #stage > header h1 + p {
    font-size: 10px !important;
    line-height: 1.35;
    margin-top: 3px !important;
    max-width: 48ch;
  }

  #stage > header > div > div:last-child {
    gap: 9px !important;
    flex: 0 0 auto;
  }

  #stage #auto-refresh-indicator {
    display: none !important;
  }

  #stage #jam-digital {
    font-size: 20px !important;
    line-height: 1.1;
  }

  #stage #tanggal-indonesia {
    max-width: 135px;
    font-size: 9px !important;
    line-height: 1.25;
  }

  #stage #tombol-tema {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
  }

  /* Executive statistics: 2 kolom, touch-friendly, tanpa horizontal scroll. */
  #stage > section:nth-of-type(1) {
    height: auto !important;
    margin-top: 12px !important;
    padding: 0 16px !important;
  }

  #stage section > .grid.grid-cols-8 {
    height: auto !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  #stage section > .grid.grid-cols-8 > div {
    min-height: 78px;
    padding: 12px !important;
    border-radius: 16px !important;
  }

  #stage section > .grid.grid-cols-8 > div:has(#exec-progress-kerja-label) {
    grid-column: 1 / -1;
    min-height: 64px;
  }

  #stage .stat-icon {
    width: 38px !important;
    height: 38px !important;
    border-radius: 12px !important;
  }

  #stage section > .grid.grid-cols-8 p[id^="exec-"]:not([id$="label"]) {
    font-size: 22px !important;
  }

  /* Main: desktop 2 kolom menjadi alur vertikal natural. */
  #stage > main {
    height: auto !important;
    padding: 14px 16px !important;
  }

  #stage main > .grid {
    display: flex !important;
    flex-direction: column;
    height: auto !important;
    gap: 12px !important;
  }

  #stage main > .grid > section:first-child {
    min-height: 300px;
    height: auto !important;
    padding: 18px !important;
    border-radius: 18px !important;
    overflow: visible !important;
  }

  #stage main > .grid > section:first-child > div:first-child {
    margin-bottom: 14px !important;
    gap: 10px;
  }

  #stage main > .grid > section:first-child h2 {
    font-size: 16px !important;
  }

  #stage #tanggal-timeline {
    font-size: 10px !important;
    text-align: right;
  }

  #stage #agenda-hari-ini-content {
    overflow: visible !important;
    height: auto !important;
    min-height: 0 !important;
  }

  #stage .timeline-row {
    padding-left: 24px !important;
  }

  /* Panel kanan menjadi tiga kartu penuh, konsisten. */
  #stage main > .grid > div:last-child {
    display: flex !important;
    flex-direction: column;
    gap: 12px !important;
    width: 100%;
  }

  #stage #card-berlangsung,
  #stage #card-berikutnya,
  #stage main > .grid > div:last-child > section:last-child {
    height: auto !important;
    min-height: 148px;
    padding: 18px !important;
    border-radius: 18px !important;
    overflow: hidden !important;
  }

  #stage #card-berlangsung {
    min-height: 180px;
  }

  #stage #berlangsung-content,
  #stage #berikutnya-content {
    height: auto !important;
    min-height: 108px;
  }

  #stage #berlangsung-content h3 {
    font-size: 18px !important;
  }

  #stage #berikutnya-content h3 {
    font-size: 15px !important;
  }

  /* Statistik kategori: tetap langsung terlihat, 2 kolom. */
  #stage main > .grid > div:last-child > section:last-child {
    min-height: 150px;
  }

  #stage #statistik-content {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-rows: minmax(36px, auto) !important;
    gap: 7px !important;
    overflow: visible !important;
  }

  #stage #statistik-content > div {
    min-height: 36px !important;
    padding: 7px 9px !important;
  }

  #stage #statistik-content > div > span:first-child {
    font-size: 11px !important;
  }

  /* Agenda mendatang: 1 kolom di HP/tablet agar judul dan detail terbaca. */
  #stage > section:nth-of-type(2) {
    height: auto !important;
    padding: 0 16px !important;
    margin-bottom: 14px;
  }

  #stage > section:nth-of-type(2) > div {
    height: auto !important;
    min-height: 220px;
    padding: 18px !important;
    border-radius: 18px !important;
  }

  #stage > section:nth-of-type(2) > div > div:first-child {
    margin-bottom: 12px !important;
  }

  #stage > section:nth-of-type(2) h2 {
    font-size: 12px !important;
    line-height: 1.35;
  }

  #stage #agenda-mendatang-content {
    height: auto !important;
    overflow: visible !important;
  }

  #stage #agenda-mendatang-content > div,
  #stage #agenda-mendatang-content > article {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Renderer lama memakai flex row; paksa daftar menjadi vertikal tanpa ubah JS. */
  #stage #agenda-mendatang-content[class*="flex"],
  #stage #agenda-mendatang-content > div[class*="flex"] {
    flex-direction: column !important;
  }

  #stage #agenda-mendatang-skeleton {
    height: auto !important;
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 10px !important;
  }

  #stage #agenda-mendatang-skeleton > div {
    min-height: 105px;
  }

  /* Footer tidak mengambil ruang berlebihan di layar kecil. */
  #stage > footer {
    height: 42px !important;
    margin-top: 0 !important;
    padding: 0 12px !important;
    position: relative;
  }

  #stage > footer > div:last-child {
    display: none !important;
  }

  #stage .marquee-track span {
    font-size: 11px !important;
  }

  /* Hover desktop tidak relevan di touch device. */
  #stage .card-hover:hover {
    transform: none;
  }
}

/* HP kecil: optimasi kepadatan informasi dan header. */
@media (max-width: 640px) {
  #stage > header > div {
    padding: 12px 14px !important;
  }

  #stage > header h1 {
    font-size: 15px !important;
    max-width: 220px;
  }

  #stage > header h1 + p {
    display: none;
  }

  #stage #jam-digital {
    font-size: 17px !important;
  }

  #stage #tanggal-indonesia {
    display: none;
  }

  #stage section > .grid.grid-cols-8 {
    gap: 8px !important;
  }

  #stage section > .grid.grid-cols-8 > div {
    min-height: 72px;
    padding: 10px !important;
    gap: 9px !important;
  }

  #stage .stat-icon {
    width: 34px !important;
    height: 34px !important;
  }

  #stage section > .grid.grid-cols-8 > div p:first-of-type {
    font-size: 9px !important;
    line-height: 1.2;
  }

  #stage section > .grid.grid-cols-8 p[id^="exec-"]:not([id$="label"]) {
    font-size: 20px !important;
  }

  #stage main > .grid > section:first-child,
  #stage #card-berlangsung,
  #stage #card-berikutnya,
  #stage main > .grid > div:last-child > section:last-child,
  #stage > section:nth-of-type(2) > div {
    border-radius: 16px !important;
  }

  #stage #statistik-content {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* Layar sangat sempit (mis. WebView 320–360px). */
@media (max-width: 380px) {
  #stage > header h1 {
    max-width: 170px;
    font-size: 14px !important;
  }

  #stage #jam-digital {
    display: none;
  }

  #stage section > .grid.grid-cols-8 {
    grid-template-columns: 1fr !important;
  }

  #stage section > .grid.grid-cols-8 > div:has(#exec-progress-kerja-label) {
    grid-column: auto;
  }

  #stage #statistik-content {
    grid-template-columns: 1fr !important;
  }
}

/* =============================================================
   10. MOBILE PROFESSIONAL OVERRIDE — HP / WEBVIEW ONLY
   Penting: blok ini HANYA aktif <= 768px. Desktop > 768px tidak disentuh.
   Tujuan: hilangkan clipping teks, ruang kosong, dan fixed-height desktop.
   ============================================================= */
@media (max-width: 768px) {
  html,
  body {
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  body {
    margin: 0 !important;
    padding: 0 0 max(14px, env(safe-area-inset-bottom)) !important;
    background: var(--color-bg) !important;
  }

  #stage {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 100dvh !important;
    transform: none !important;
    overflow: visible !important;
  }

  /* ---------- HEADER MOBILE ---------- */
  #stage > header {
    position: relative !important;
    top: auto !important;
    width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    border-radius: 0 !important;
  }

  #stage > header > div {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 13px 14px !important;
    gap: 10px !important;
  }

  #stage > header > div > div:first-child {
    min-width: 0 !important;
    width: auto !important;
    gap: 10px !important;
  }

  #stage > header > div > div:first-child > div:first-child {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    flex: 0 0 40px !important;
    padding: 7px !important;
    border-radius: 12px !important;
  }

  #stage > header h1 {
    max-width: none !important;
    font-size: 15px !important;
    line-height: 1.22 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  #stage > header h1 + p {
    display: none !important;
  }

  #stage > header > div > div:last-child {
    min-width: 0 !important;
    width: auto !important;
    gap: 8px !important;
  }

  #stage #auto-refresh-indicator,
  #stage #tanggal-indonesia {
    display: none !important;
  }

  #stage #jam-digital {
    display: block !important;
    font-size: 16px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  #stage #tombol-tema {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    flex: 0 0 34px !important;
  }

  /* ---------- EXECUTIVE STATS ---------- */
  #stage > section:nth-of-type(1) {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 12px 12px 0 !important;
  }

  #stage section > .grid.grid-cols-8 {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    height: auto !important;
    gap: 9px !important;
  }

  #stage section > .grid.grid-cols-8 > div {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 72px !important;
    height: auto !important;
    padding: 10px !important;
    gap: 8px !important;
    overflow: visible !important;
    border-radius: 14px !important;
  }

  #stage section > .grid.grid-cols-8 > div:has(#exec-progress-kerja-label) {
    grid-column: 1 / -1 !important;
    min-height: 58px !important;
  }

  #stage .stat-icon {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    flex: 0 0 34px !important;
    border-radius: 10px !important;
  }

  #stage section > .grid.grid-cols-8 > div > div:last-child {
    min-width: 0 !important;
    overflow: visible !important;
  }

  #stage section > .grid.grid-cols-8 > div p {
    max-width: 100% !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  #stage section > .grid.grid-cols-8 > div p:first-of-type {
    font-size: 9.5px !important;
    line-height: 1.25 !important;
  }

  #stage section > .grid.grid-cols-8 p[id^="exec-"]:not([id$="label"]) {
    font-size: 20px !important;
    line-height: 1.05 !important;
  }

  /* ---------- MAIN FLOW ---------- */
  #stage > main {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 12px !important;
  }

  #stage main > .grid {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    gap: 10px !important;
  }

  /* Agenda Hari Ini */
  #stage main > .grid > section:first-child {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 15px !important;
    border-radius: 16px !important;
    overflow: visible !important;
  }

  #stage main > .grid > section:first-child > div:first-child {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 4px 10px !important;
    margin-bottom: 12px !important;
  }

  #stage main > .grid > section:first-child h2 {
    font-size: 15px !important;
    line-height: 1.25 !important;
  }

  #stage #tanggal-timeline {
    margin-left: auto !important;
    max-width: 48% !important;
    font-size: 10px !important;
    line-height: 1.25 !important;
    text-align: right !important;
    white-space: normal !important;
  }

  #stage #agenda-hari-ini-content,
  #stage #agenda-hari-ini-content > div {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #stage .timeline-row {
    width: 100% !important;
    min-width: 0 !important;
    padding-left: 22px !important;
    margin-bottom: 14px !important;
  }

  #stage .timeline-row:last-child {
    margin-bottom: 2px !important;
  }

  #stage .timeline-row > div,
  #stage .timeline-row > div > div,
  #stage .timeline-row .min-w-0 {
    min-width: 0 !important;
    width: 100% !important;
  }

  #stage .timeline-row .flex.items-start.justify-between {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  #stage .timeline-row .badge-status {
    justify-self: start !important;
    margin-top: 2px !important;
  }

  /* Jangan potong judul/lokasi/peserta pada HP. */
  #stage #agenda-hari-ini-content .truncate,
  #stage #berlangsung-content .truncate,
  #stage #agenda-mendatang-content .truncate {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  #stage #agenda-hari-ini-content h3 {
    font-size: 15px !important;
    line-height: 1.35 !important;
    overflow-wrap: anywhere !important;
  }

  #stage #agenda-hari-ini-content p {
    line-height: 1.4 !important;
    overflow-wrap: anywhere !important;
  }

  /* ---------- PANEL KANAN -> STACK ---------- */
  #stage main > .grid > div:last-child {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    gap: 10px !important;
  }

  #stage #card-berlangsung,
  #stage #card-berikutnya,
  #stage main > .grid > div:last-child > section:last-child {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 15px !important;
    border-radius: 16px !important;
    overflow: visible !important;
  }

  #stage #card-berlangsung::after,
  #stage #card-berikutnya::after,
  #stage main > .grid > div:last-child > section:last-child::after {
    top: 16px !important;
    bottom: 16px !important;
  }

  #stage #berlangsung-content,
  #stage #berikutnya-content {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  #stage #berlangsung-content:has(> p:only-child),
  #stage #berikutnya-content:has(> p:only-child) {
    min-height: 0 !important;
    height: auto !important;
    display: block !important;
  }

  #stage #berlangsung-content:has(> p:only-child) > p,
  #stage #berikutnya-content:has(> p:only-child) > p {
    padding: 12px !important;
    font-size: 12px !important;
  }

  #stage #berlangsung-content h3 {
    margin-top: 8px !important;
    font-size: 17px !important;
    line-height: 1.35 !important;
  }

  #stage #berlangsung-content p,
  #stage #berikutnya-content p,
  #stage #berikutnya-content h3 {
    max-width: 100% !important;
    overflow-wrap: anywhere !important;
  }

  #stage #berikutnya-content:not(:has(> p:only-child)) {
    display: block !important;
    height: auto !important;
    padding: 0 !important;
  }

  #stage #berikutnya-content > div:first-child {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 5px 10px !important;
    margin-bottom: 8px !important;
  }

  #stage #berikutnya-content > div:first-child > p:last-child {
    margin-left: 0 !important;
  }

  #stage #berikutnya-content h3 {
    display: block !important;
    -webkit-line-clamp: unset !important;
    overflow: visible !important;
    font-size: 15px !important;
    line-height: 1.35 !important;
  }

  /* Statistik kategori: semua item terlihat, tanpa scroll dan tanpa label terpotong. */
  #stage main > .grid > div:last-child > section:last-child h2 {
    white-space: normal !important;
    font-size: 11px !important;
    margin-bottom: 8px !important;
  }

  #stage #statistik-content {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-rows: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    gap: 7px !important;
    overflow: visible !important;
  }

  #stage #statistik-content > div {
    min-width: 0 !important;
    min-height: 38px !important;
    height: auto !important;
    padding: 7px 8px !important;
  }

  #stage #statistik-content > div > span:first-child {
    min-width: 0 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    overflow-wrap: anywhere !important;
    font-size: 10.5px !important;
    line-height: 1.2 !important;
  }

  /* ---------- AGENDA MENDATANG ---------- */
  #stage > section:nth-of-type(2) {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 12px 12px !important;
  }

  #stage > section:nth-of-type(2) > div {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 15px !important;
    border-radius: 16px !important;
  }

  #stage > section:nth-of-type(2) > div > div:first-child {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }

  #stage > section:nth-of-type(2) h2 {
    flex: 1 1 160px !important;
    font-size: 12px !important;
    line-height: 1.3 !important;
    white-space: normal !important;
  }

  #stage #agenda-mendatang-lihat-semua {
    flex: 0 0 auto !important;
    margin-left: auto !important;
    white-space: nowrap !important;
  }

  #stage #agenda-mendatang-content {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  #stage #agenda-mendatang-content > div {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    height: auto !important;
    gap: 9px !important;
  }

  #stage #agenda-mendatang-content > div > div {
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 12px !important;
    border-radius: 14px !important;
  }

  #stage #agenda-mendatang-content h3 {
    font-size: 15px !important;
    line-height: 1.35 !important;
    overflow-wrap: anywhere !important;
  }

  #stage #agenda-mendatang-content p,
  #stage #agenda-mendatang-content span {
    overflow-wrap: anywhere !important;
  }

  #stage #agenda-mendatang-content > div > div > div:last-child {
    gap: 8px !important;
    flex-wrap: wrap !important;
  }

  /* Skeleton tidak mempertahankan tinggi desktop saat jaringan lambat. */
  #stage #agenda-mendatang-skeleton {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    height: auto !important;
    gap: 9px !important;
  }

  #stage #agenda-mendatang-skeleton > div {
    min-height: 92px !important;
    height: 92px !important;
  }

  /* Modal seluruh agenda: layar penuh yang aman untuk WebView. */
  #agenda-mendatang-modal {
    align-items: flex-end !important;
    padding: 10px !important;
  }

  #agenda-mendatang-modal > div {
    width: 100% !important;
    max-width: none !important;
    max-height: 88dvh !important;
    border-radius: 18px !important;
  }

  #agenda-mendatang-modal > div > div:first-child {
    padding: 14px !important;
  }

  #agenda-mendatang-modal-content {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 9px !important;
    padding: 12px !important;
    overflow-y: auto !important;
  }

  #agenda-mendatang-modal-content .truncate {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  /* ---------- FOOTER ---------- */
  #stage > footer {
    width: calc(100% - 24px) !important;
    height: auto !important;
    min-height: 38px !important;
    margin: 0 12px !important;
    padding: 8px 10px !important;
    border-radius: 14px !important;
  }

  #stage > footer > div:last-child {
    display: none !important;
  }

  #stage .marquee-track span {
    font-size: 10.5px !important;
  }
}

/* HP sangat sempit: satu kolom hanya untuk statistik kategori bila benar-benar perlu. */
@media (max-width: 360px) {
  #stage #jam-digital {
    display: none !important;
  }

  #stage > header > div {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }

  #stage section > .grid.grid-cols-8 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #stage #statistik-content {
    grid-template-columns: 1fr !important;
  }
}

/* =============================================================
   MOBILE FIX — agenda mendatang skeleton
   Jangan pernah memaksa skeleton tampil setelah JS memberi class hidden.
   Desktop tidak terpengaruh.
   ============================================================= */
@media (max-width: 768px) {
  #stage #agenda-mendatang-skeleton.hidden {
    display: none !important;
  }

  #stage #agenda-mendatang-content.hidden {
    display: none !important;
  }
}
