/* =========================================================
   STYLE GANGGUAN OVER SLA - PLN ICON PLUS
   ========================================================= */

:root {
  --primary: #4f46e5;          /* Indigo Modern */
  --primary-hover: #4338ca;
  --bg: #f8fafc;               /* Slate Light BG */
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  
  --success-bg: #ecfdf5;
  --success-text: #047857;
  --success-border: #10b981;

  --danger-bg: #fff1f2;
  --danger-text: #be123c;
  --danger-border: #f43f5e;

  --warning-bg: #fffbeb;
  --warning-text: #b45309;
  --warning-border: #f59e0b;
}

* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
  font-family: 'Inter', system-ui, -apple-system, sans-serif; 
}

/* Atur body agar fleksibel penuh di dalam iframe */
body { 
  background-color: var(--bg); 
  color: var(--text-main); 
  padding: 16px; /* Kurangi dari 24px ke 16px agar tidak sesak */
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}

.container { 
  max-width: 100%; /* Ubah dari 1400px ke 100% agar fleksibel mengikut ukuran layar iframe */
  margin: 0 auto; 
}

/* Kartu Utama */
.card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.03);
}

/* Header Section */
.filter-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-header i {
  font-size: 1.2rem;
  padding: 10px;
  border-radius: 10px;
}

.filter-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Grid KPI Stat Cards */
.exec-stat-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 16px !important;
  margin-bottom: 24px !important;
  width: 100% !important;
}

.exec-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 18px 20px !important;
  min-height: 145px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.03);
}

.exec-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.exec-title {
  font-size: 0.72rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.5px !important;
  color: var(--text-muted) !important;
  text-transform: uppercase !important;
  max-width: 80%;
}

.exec-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.exec-card-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.exec-num-group {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.exec-num {
  font-size: 1.6rem !important;
  font-weight: 800 !important;
  line-height: 1 !important;
}

.exec-unit {
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  color: var(--text-muted) !important;
}

.exec-sub {
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  color: var(--text-muted) !important;
  margin: 4px 0 0 0 !important;
}

/* Border Aksen Warna Kiri Kartu KPI */
.border-left-red { border-left: 4px solid #f43f5e; }
.border-left-blue { border-left: 4px solid #3b82f6; }
.border-left-green { border-left: 4px solid #10b981; }

.bg-light-red { background: #ffe4e6; }
.bg-light-blue { background: #e0e7ff; }
.bg-light-green { background: #d1fae5; }
.bg-light-purple { background: #f3e8ff; }

.text-red { color: #f43f5e; }
.text-blue { color: #2563eb; }
.text-green { color: #10b981; }
.text-purple { color: #9333ea; }

/* Toolbar area (Pencarian & Tombol) */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 280px;
  max-width: 420px;
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 0.88rem;
  outline: none;
  background: #f8fafc;
  transition: all 0.2s;
}

.search-box input:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.data-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 5px;
}

/* Tombol */
.btn {
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-outline {
  background: white;
  border-color: var(--border-color);
  color: var(--text-main);
}
.btn-outline:hover {
  background: #f1f5f9;
}

.btn-icon {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-muted);
  cursor: pointer;
}
.btn-icon:hover {
  background: #f1f5f9;
}

/* Tabel Over SLA */
.table-responsive {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
  background: white;
  table-layout: fixed !important;
}

th, td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

th {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f8fafc;
}

tr:hover {
  background-color: #f8fafc;
}

.olt-text {
  font-weight: 700;
  color: var(--text-main);
}

/* Tag & Badges */
.badge-kategori {
  display: inline-block;
  background: #e0e7ff;
  color: #3730a3;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.cause-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #e0e7ff;
  color: #3730a3;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
}

.cause-tag.red {
  background: #ffe4e6;
  color: #9f1239;
}

.badge-percent {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 20px;
}

.badge-red { 
  background: var(--danger-bg); 
  color: var(--danger-text); 
  border: 1px solid var(--danger-border); 
}

/* Form Styles & Grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}

input, select, textarea {
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.88rem;
  outline: none;
  background: #f8fafc;
}

input:focus, select:focus, textarea:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Modal Popup Overlay */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100vh;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #ffffff;
  border-radius: 16px;
  width: 90%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  padding: 24px;
  transform: translateY(20px);
  transition: all 0.25s ease;
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 18px;
}

.modal-header h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #64748b;
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
}

/* =========================================================
   DARK MODE SUPPORT (PLN Enterprise Navy)
   ========================================================= */

html body.dark {
  --bg: #0b1220;
  --card-bg: #111c2e;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #26354a;

  background-color: #0b1220 !important;
  color: #f8fafc !important;
}

html body.dark .card,
html body.dark .exec-card,
html body.dark .modal-card {
  background: #111c2e !important;
  color: #f8fafc !important;
  border-color: #26354a !important;
}

html body.dark table,
html body.dark .table-responsive {
  background: #111c2e !important;
  border-color: #26354a !important;
}

html body.dark th {
  background: #172338 !important;
  color: #cbd5e1 !important;
  border-color: #334155 !important;
}

html body.dark td {
  background: #111c2e !important;
  color: #cbd5e1 !important;
  border-color: #26354a !important;
}

html body.dark tr:hover td {
  background: #172338 !important;
}

html body.dark input,
html body.dark select,
html body.dark textarea {
  background: #172338 !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

html body.dark .btn-icon,
html body.dark .btn-outline {
  background: #172338 !important;
  color: #cbd5e1 !important;
  border-color: #334155 !important;
}