/* --- 1. IMPORT FONT INTER DI PALING ATAS --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* --- 2. SETTING FONT UTAMA YANG AMAN UNTUK TEKS --- */
body, input, button, select, textarea {
  font-family: 'Inter', sans-serif !important;
}

/* Lindungi Logo dan Ikon agar tidak berubah atau hilang */
img, i.fa-solid, i.fa-regular, i.fa-brands, .fa, .fas, .far, .fab {
  font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands", sans-serif !important;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #0878d1;
  --primary-dark: #065fa8;
  --text: #263238;
  --muted: #78828c;
  --border: #e4e8ed;
  --sidebar: #ffffff;
  --bg: #f5f7fa;
  --hover: #f0f7fd;
  --active: #eaf5ff;
  --shadow: 0 2px 12px rgba(32, 53, 70, 0.05);
}

/* Menyembunyikan scrollbar bawaan body & penataan layout */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

button, input {
  font: inherit;
}

button, a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 260px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  transition: transform .25s ease, width .25s ease;
}

.brand {
  height: 72px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.bolt {
  font-size: 22px;
  color: #e52b25;
  line-height: 1;
}

.brand-logo-box {
  width: 32px;
  height: 32px;
  background-color: #ffd400;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bolt-icon {
  color: #e52b25;
  font-size: 18px;
  font-weight: bold;
}

.brand-text-group {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.brand-text-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 36px;
}

.brand-pln {
  color: #0080ff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1;
}

.brand-iconplus {
  color: #55606d;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1;
  margin-top: 3px;
}

.brand-img {
  height: 36px !important;
  width: 36px !important;
  min-height: 36px !important;
  min-width: 36px !important;
  object-fit: contain !important;
  background: transparent !important;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 22px 13px;
}

.section-title {
  color: #8d98a3;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.3px;
  padding: 0 10px 9px;
  margin-top: 7px;
}

.section-title:not(:first-child) {
  margin-top: 26px;
}

.nav-item {
  width: 100%;
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 0;
  background: transparent;
  border-radius: 7px;
  color: #56616c;
  font-size: 13px;
  font-weight: 500;
  padding: 0 10px;
  cursor: pointer;
  transition: .18s ease;
}

.nav-item:hover {
  background: var(--hover);
  color: var(--primary);
}

.nav-item.active {
  background: var(--active);
  color: var(--primary);
  font-weight: 650;
}

.icon {
  width: 20px;
  text-align: center;
  color: #7c8791;
  font-size: 17px;
}

.active .icon {
  color: var(--primary);
}

.nav-parent {
  justify-content: flex-start;
}

.nav-parent .label {
  flex: 1;
  text-align: left;
}

.chevron {
  font-size: 12px;
  color: #94a3b8;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: auto;
}

.chevron.closed {
  transform: rotate(-90deg);
}

.submenu {
  max-height: 400px;
  overflow: hidden;
  transition: max-height .25s ease;
  margin-left: 30px;
}

.submenu:not(.open) {
  max-height: 0;
}

.sub-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 39px;
  color: #68737d;
  font-size: 12px;
  padding-left: 5px;
  transition: .18s ease;
}

.sub-item:hover,
.sub-item.active {
  color: var(--primary);
  font-weight: 600;
}

.sub-line {
  position: absolute;
  left: -12px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #dfe5ea;
}

.sub-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #9ba5ae;
  flex: 0 0 auto;
}

.sub-item.active .sub-dot {
  background: var(--primary);
  box-shadow: 0 0 0 3px #e1f1fd;
}

/* SUBMENU TREE BRANCH LINE */
.submenu-tree {
  list-style: none;
  padding-left: 28px;
  margin: 6px 0 0 0;
  position: relative;
}

.submenu-tree::before {
  content: '';
  position: absolute;
  top: 0;
  left: 14px;
  height: calc(100% - 22px);
  width: 2px;
  background-color: #cbd5e1;
  border-radius: 1px;
  transition: background-color 0.2s ease;
}

.submenu-tree li {
  position: relative;
  margin-bottom: 4px;
}

.submenu-tree li::before {
  content: '';
  position: absolute;
  top: 14px;
  left: -14px;
  width: 12px;
  height: 10px;
  border-left: 2px solid #cbd5e1;
  border-bottom: 2px solid #cbd5e1;
  border-bottom-left-radius: 8px;
  transition: border-color 0.2s ease;
}

/* SIDEBAR FOOTER */
.sidebar-footer {
  border-top: 1px solid #edf0f3;
  padding: 13px;
}

.user-mini {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px;
  border-radius: 8px;
}

.avatar, .top-avatar {
  display: grid;
  place-items: center;
  background: #e9f4fb;
  color: var(--primary);
  font-weight: 700;
  border-radius: 50%;
}

.avatar {
  width: 32px;
  height: 32px;
  font-size: 12px;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-info strong,
.user-info span {
  display: block;
}

.user-info strong {
  font-size: 11px;
  color: #3c4751;
}

.user-info span {
  font-size: 9px;
  color: #8a949e;
  margin-top: 2px;
}

.more-btn,
.logout-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #87919a;
}

.more-btn {
  font-size: 18px;
}

/* =========================================================
   MAIN LAYOUT & STICKY TOPBAR
   ========================================================= */

.main {
  flex: 1;
  margin-left: 260px;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: 72px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 25px;
  gap: 20px;
  position: sticky !important;
  top: 0 !important;
  z-index: 1000 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.search-box {
  width: 360px;
  height: 39px;
  border: 1px solid #e3e7eb;
  border-radius: 9px;
  background: #fbfcfd;
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 8px;
}

.search-icon {
  font-size: 23px;
  color: #78838e;
  transform: rotate(-15deg);
}

.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #34414c;
  font-size: 12px;
}

.search-box kbd {
  font-size: 9px;
  color: #747f89;
  border: 1px solid #d8dde2;
  background: #f0f2f4;
  border-radius: 4px;
  padding: 4px 7px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.clock {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 7px;
  align-items: center;
  min-width: 115px;
}

.clock span {
  grid-column: 1;
  font-size: 8px;
  color: #9aa3ab;
  letter-spacing: 1px;
}

.clock strong {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-size: 14px;
  color: #2f3942;
}

.clock small {
  grid-column: 1;
  font-size: 8px;
  color: #8e989f;
  justify-self: end;
}

.theme-btn {
  height: 34px;
  padding: 0 12px;
  border: 1px solid #e4e8eb;
  border-radius: 17px;
  background: #fff;
  color: #69747d;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  gap: 7px;
  align-items: center;
}

.top-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 17px;
  border-left: 1px solid #e5e8eb;
}

.top-avatar {
  width: 31px;
  height: 31px;
  font-size: 11px;
}

.top-user strong,
.top-user span {
  display: block;
}

.top-user strong {
  font-size: 11px;
  color: #3e4952;
}

.top-user span {
  font-size: 8px;
  color: #8c969e;
  margin-top: 2px;
}

.logout-btn {
  font-size: 19px;
}

.mobile-menu {
  display: none;
  border: 0;
  background: transparent;
  font-size: 20px;
  color: #59636d;
  cursor: pointer;
}

/* =========================================================
   AREA KONTEN & EMBEDDED IFRAME FULLSCREEN FIX
   ========================================================= */

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 72px);
  padding: 0;
  overflow: hidden !important;
}

.page {
  display: none;
  width: 100%;
  height: 100%;
  flex: 1;
}

.page.active-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
}

.dashboard-page {
  padding: 24px;
}

.dashboard-container, 
.app-wrapper, 
.main-content {
  width: 100%;
  box-sizing: border-box;
  padding: 16px 24px;
  height: auto !important;
  min-height: 100vh;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  margin-bottom: 22px;
}

.eyebrow {
  font-size: 10px;
  color: var(--primary);
  letter-spacing: 1.2px;
  font-weight: 700;
}

.page-heading h1 {
  font-size: 24px;
  margin-top: 6px;
}

.page-heading p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 7px;
}

.integration-placeholder {
  min-height: 420px;
  background: #fff;
  border: 1px dashed #cfd8df;
  border-radius: 12px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  padding: 30px;
  box-shadow: var(--shadow);
}

.placeholder-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #eef7fd;
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 23px;
  margin-bottom: 13px;
}

.integration-placeholder h2 {
  font-size: 17px;
  margin-bottom: 7px;
}

.integration-placeholder p {
  color: var(--muted);
  font-size: 12px;
}

.live-badge {
  background: #dcfce7;
  color: #15803d;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  height: max-content;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.card-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
}

.card-tag.red { background: #fef2f2; color: #dc2626; }
.card-tag.blue { background: #f0f9ff; color: #0284c7; }
.card-tag.purple { background: #faf5ff; color: #9333ea; }
.card-tag.green { background: #f0fdf4; color: #16a34a; }

.card-icon { font-size: 16px; }
.card-icon.red { color: #dc2626; }
.card-icon.blue { color: #0284c7; }
.card-icon.purple { color: #9333ea; }
.card-icon.green { color: #16a34a; }

.card-val {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
}

.card-val small {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.card-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.visual-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.visual-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.visual-header h3 {
  font-size: 15px;
  font-weight: 700;
}

.canvas-area {
  height: 350px;
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
}

.btn {
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.btn-sec { background: #f1f5f9; color: #334155; }
.btn-pri { background: var(--primary); color: #fff; margin-left: 6px; }

/* FIX EMBED FRAME BESAR & PRESISI */
.embed-frame {
  width: 100%;
  height: calc(100vh - 72px);
  min-height: calc(100vh - 72px);
  border: none;
  display: block;
  flex: 1;
}

/* RESPONSIVE LAYOUT */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 10px 0 30px rgba(0,0,0,.12);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .mobile-menu {
    display: block;
  }

  .topbar {
    padding: 0 16px;
  }

  .search-box {
    width: min(360px, 42vw);
  }

  .clock,
  .theme-btn span,
  .top-user div:last-child {
    display: none;
  }
}

@media (max-width: 600px) {
  .topbar {
    gap: 10px;
  }

  .search-box {
    flex: 1;
    width: auto;
  }

  .top-actions {
    gap: 8px;
  }

  .theme-btn {
    padding: 0 9px;
  }

  .search-box kbd {
    display: none;
  }
}

/* =========================================================
   DARK MODE — PLN ENTERPRISE NAVY
   ========================================================= */

body.dark {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --text: #f8fafc;
  --muted: #94a3b8;
  --border: #26354a;
  --sidebar: #0f172a;
  --bg: #0b1220;
  --hover: #172338;
  --active: #12345a;
  --surface: #111c2e;
  --surface-2: #172338;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.30);

  background: var(--bg) !important;
  color: var(--text) !important;
}

body.dark,
body.dark html {
  background-color: var(--bg) !important;
  color: var(--text) !important;
}

body.dark a {
  color: inherit;
}

body.dark .sidebar {
  background: #0f172a !important;
  border-right: 1px solid #243247 !important;
  box-shadow: 4px 0 18px rgba(0, 0, 0, 0.20);
}

body.dark .brand {
  border-bottom: 1px solid #243247 !important;
}

body.dark .brand-pln {
  color: #3b82f6 !important;
}

body.dark .brand-iconplus {
  color: #cbd5e1 !important;
}

body.dark .section-title {
  color: #64748b !important;
}

body.dark .nav-item {
  background: transparent !important;
  color: #cbd5e1 !important;
}

body.dark .nav-item .icon {
  color: #94a3b8 !important;
}

body.dark .nav-item:hover {
  background: #172338 !important;
  color: #60a5fa !important;
}

body.dark .nav-item:hover .icon {
  color: #60a5fa !important;
}

body.dark .nav-item.active {
  background: #12345a !important;
  color: #60a5fa !important;
}

body.dark .nav-item.active .icon {
  color: #60a5fa !important;
}

body.dark .nav-parent {
  color: #cbd5e1 !important;
}

body.dark .nav-parent:hover {
  background: #172338 !important;
  color: #60a5fa !important;
}

body.dark .chevron {
  color: #64748b !important;
}

body.dark .sub-item {
  color: #94a3b8 !important;
}

body.dark .sub-item:hover,
body.dark .sub-item.active {
  color: #60a5fa !important;
}

body.dark .submenu-tree::before {
  background-color: #334155 !important;
}

body.dark .submenu-tree li::before {
  border-color: #334155 !important;
}

body.dark .sub-line {
  background-color: #334155 !important;
}

body.dark .sub-dot {
  background-color: #64748b !important;
}

body.dark .sub-item.active .sub-dot {
  background-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18) !important;
}

body.dark .sidebar-footer {
  border-top: 1px solid #243247 !important;
}

body.dark .user-mini {
  background: transparent !important;
}

body.dark .avatar,
body.dark .top-avatar {
  background: #1b2a40 !important;
  color: #60a5fa !important;
}

body.dark .user-info strong {
  color: #f8fafc !important;
}

body.dark .user-info span {
  color: #94a3b8 !important;
}

body.dark .more-btn {
  color: #64748b !important;
}

body.dark .main,
body.dark .content {
  background: #0b1220 !important;
}

body.dark .page {
  background: transparent !important;
}

body.dark .topbar {
  background: #0f172a !important;
  border-bottom: 1px solid #243247 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.20) !important;
}

body.dark .search-box {
  background: #111c2e !important;
  border: 1px solid #2a3a51 !important;
}

body.dark .search-box:focus-within {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.10);
}

body.dark .search-icon {
  color: #64748b !important;
}

body.dark .search-box input {
  background: transparent !important;
  color: #f8fafc !important;
}

body.dark .search-box input::placeholder {
  color: #64748b !important;
}

body.dark .search-box kbd {
  background: #0b1220 !important;
  border-color: #2a3a51 !important;
  color: #94a3b8 !important;
}

body.dark .clock span,
body.dark .clock small {
  color: #64748b !important;
}

body.dark .clock strong {
  color: #f8fafc !important;
}

body.dark .theme-btn {
  background: #111c2e !important;
  border: 1px solid #2a3a51 !important;
  color: #e2e8f0 !important;
}

body.dark .theme-btn:hover {
  background: #172338 !important;
  border-color: #3b82f6 !important;
  color: #60a5fa !important;
}

body.dark .top-user {
  border-left-color: #243247 !important;
}

body.dark .top-user strong {
  color: #f8fafc !important;
}

body.dark .top-user span {
  color: #64748b !important;
}

body.dark .logout-btn {
  color: #94a3b8 !important;
}

body.dark .logout-btn:hover {
  color: #60a5fa !important;
}

body.dark .mobile-menu {
  color: #cbd5e1 !important;
}

body.dark .page-heading h1 {
  color: #f8fafc !important;
}

body.dark .page-heading p {
  color: #94a3b8 !important;
}

body.dark .eyebrow {
  color: #60a5fa !important;
}

body.dark .live-badge {
  background: #143523 !important;
  color: #4ade80 !important;
}

body.dark .card {
  background: #111c2e !important;
  border: 1px solid #26354a !important;
  box-shadow: var(--shadow) !important;
}

body.dark .card:hover {
  border-color: #334b6d !important;
  transform: translateY(-1px);
}

body.dark .card-val {
  color: #f8fafc !important;
}

body.dark .card-val small,
body.dark .card-sub {
  color: #94a3b8 !important;
}

body.dark .card-tag.red { background: #3a1d25 !important; color: #f87171 !important; }
body.dark .card-tag.blue { background: #172d45 !important; color: #60a5fa !important; }
body.dark .card-tag.purple { background: #2d2140 !important; color: #c084fc !important; }
body.dark .card-tag.green { background: #153827 !important; color: #4ade80 !important; }

body.dark .card-icon.red { color: #f87171 !important; }
body.dark .card-icon.blue { color: #60a5fa !important; }
body.dark .card-icon.purple { color: #c084fc !important; }
body.dark .card-icon.green { color: #4ade80 !important; }

body.dark .visual-card {
  background: #111c2e !important;
  border: 1px solid #26354a !important;
  box-shadow: var(--shadow) !important;
}

body.dark .visual-header h3 {
  color: #f8fafc !important;
}

body.dark .canvas-area {
  background: #0d1626 !important;
  border: 2px dashed #334155 !important;
  color: #94a3b8 !important;
}

body.dark .btn-sec {
  background: #1a2638 !important;
  color: #cbd5e1 !important;
  border: 1px solid #2d3d54 !important;
}

body.dark .btn-sec:hover {
  background: #24344c !important;
  color: #f8fafc !important;
}

body.dark .btn-pri {
  background: #2563eb !important;
  color: #ffffff !important;
}

body.dark .btn-pri:hover {
  background: #3b82f6 !important;
}

body.dark iframe {
  background: #0b1220 !important;
  color-scheme: dark;
}

@media (max-width: 900px) {
  body.dark .sidebar {
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.45);
  }
}

@media (max-width: 600px) {
  body.dark .search-box {
    background: #111c2e !important;
  }
}