/* ==========================================================================
   DelSmart DRCU - Professional Theme Design System v2.0
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap");

/* --- CSS Variables --- */
:root {
  --orange-50: #fef5e8;
  --orange-100: #fde8d0;
  --orange-200: #fbd0a1;
  --orange-300: #f8b371;
  --orange-400: #f59642;
  --orange-500: #F37F34;
  --orange-600: #e06a1e;
  --orange-700: #c95a1a;
  --orange-800: #a84a16;
  --orange-900: #8a3d12;
  --warm-50: #fdfaf7;
  --warm-100: #faf8f6;
  --warm-200: #f5f0eb;
  --warm-300: #e8e2db;
  --warm-400: #ddd5cc;
  --warm-500: #b8a99a;
  --warm-600: #8a7a6b;
  --warm-700: #5c4f43;
  --warm-800: #3d342e;
  --warm-900: #1c1816;
  --blue-500: #3b82f6;
  --green-500: #10b981;
  --red-500: #ef4444;
  --yellow-500: #f59e0b;
  --orange-grad: linear-gradient(135deg, #F37F34, #e06a1e);
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(28, 24, 22, 0.08);
  --shadow-md: 0 4px 16px rgba(28, 24, 22, 0.06);
  --shadow-lg: 0 8px 30px rgba(28, 24, 22, 0.1);
  --shadow-xl: 0 20px 60px rgba(28, 24, 22, 0.12);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-family);
  background: #f7f5f2;
  color: var(--warm-900);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--orange-500); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--orange-600); }

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 { color: var(--warm-900); font-weight: 700; line-height: 1.3; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9rem; }
p { color: var(--warm-700); margin-bottom: 1rem; }
.text-muted { color: var(--warm-600) !important; }
.text-primary { color: var(--orange-500) !important; }
.text-success { color: var(--green-500) !important; }
.text-danger { color: var(--red-500) !important; }
.text-warning { color: var(--yellow-500) !important; }
.text-info { color: var(--blue-500) !important; }
.text-dark { color: var(--warm-900) !important; }
.text-white { color: #fff !important; }

/* ==========================================================================
   TOPBAR
   ========================================================================== */
.navbar-custom {
  position: fixed; top: 0; left: 0; right: 0; height: 42px; z-index: 1000;
  background: rgba(255,255,255,0.95); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--warm-300);
  box-shadow: 0 1px 2px rgba(28,24,22,0.04);
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%; padding: 0 10px;
}
.logo-box { display: flex; align-items: center; }
.logo-box .logo span { line-height: 1; }
.company-title-container {
  flex: 1; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 12px;
}
.company-title-text {
  font-size: 0.92rem; font-weight: 800;
  background: var(--orange-grad); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.2px;
}
.topnav-menu { list-style: none; display: flex; align-items: center; gap: 4px; margin: 0; }
.topnav-menu li { position: relative; }
.topnav-menu .nav-link {
  color: var(--warm-700); padding: 4px 8px; border-radius: var(--radius-sm);
  transition: all var(--transition); display: flex; align-items: center; font-size: 0.82rem;
}
.topnav-menu .nav-link:hover { background: var(--orange-50); color: var(--orange-500); }
.nav-user { gap: 6px; }
.nav-user .avatar-placeholder { width: 30px; height: 30px !important; font-size: 12px !important; }
.nav-user img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.pro-user-name { font-weight: 600; font-size: 0.78rem; color: var(--warm-800); }

/* ==========================================================================
   NAVBAR (Horizontal Menu)
   ========================================================================== */
.topnav {
  position: fixed; top: 42px; left: 0; right: 0; z-index: 999;
  background: rgba(255,255,255,0.97); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--warm-300);
  box-shadow: var(--shadow-sm); padding: 0 10px;
}
.topnav .navbar-nav { display: flex; align-items: center; gap: 1px; list-style: none; margin: 0; padding: 3px 0; }
.topnav .nav-link {
  color: var(--warm-700); font-weight: 600; font-size: 0.85rem;
  padding: 6px 12px; border-radius: var(--radius-sm);
  transition: all var(--transition); display: flex; align-items: center; gap: 4px;
}
.topnav .nav-link:hover { background: var(--orange-50); color: var(--orange-500); }
.topnav .nav-link.active,
.topnav .nav-item.show > .nav-link {
  background: var(--orange-grad); color: #fff !important;
  box-shadow: 0 4px 12px rgba(243,127,52,0.25);
}
.topnav .nav-item { position: relative; }
.arrow-down::after {
  content: ''; display: inline-block; width: 0; height: 0;
  margin-left: 6px; vertical-align: middle;
  border-top: 4px solid currentColor; border-right: 4px solid transparent; border-left: 4px solid transparent;
  transition: transform var(--transition);
}
.nav-item.show .arrow-down::after { transform: rotate(180deg); }
.navbar-toggle { color: var(--warm-700); padding: 8px; border: none; background: none; cursor: pointer; display: none; }
.topnav-menu-left { display: none; }
.lines { width: 22px; height: 16px; position: relative; display: inline-block; }
.lines span { display: block; height: 2px; width: 100%; background: var(--warm-700); margin-bottom: 4px; border-radius: 2px; }
.navbar-collapse.collapse:not(.show) { display: none; }
.navbar-collapse.collapse.show { display: block; }

/* --- Dropdowns --- */
.dropdown-menu {
  display: none; position: absolute; top: 100%; left: 0; z-index: 1050;
  background: #fff; border: 1px solid var(--warm-300);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  padding: 6px; min-width: 210px; margin-top: 4px;
}
.dropdown-menu.show { display: block; }
.nav-item.dropdown:hover > .dropdown-menu { display: block; }
.dropdown-item {
  display: block; width: 100%; padding: 8px 14px; clear: both;
  font-weight: 500; font-size: 0.85rem; color: var(--warm-700);
  text-align: inherit; white-space: nowrap; background: none; border: 0;
  border-radius: var(--radius-sm); transition: all var(--transition); text-decoration: none;
}
.dropdown-item:hover, .dropdown-item:focus { background: var(--orange-50); color: var(--orange-500); }
.dropdown-header { padding: 6px 14px; font-size: 0.72rem; font-weight: 600; color: var(--warm-500); text-transform: uppercase; letter-spacing: 0.5px; }
.dropdown-divider { height: 0; margin: 4px 0; border-top: 1px solid var(--warm-300); }
.dropdown-menu-end { left: auto; right: 0; }
.profile-dropdown .noti-title { padding: 8px 14px; }
.profile-dropdown .noti-title h6 { font-size: 0.85rem; color: var(--warm-700); margin: 0; }

/* ==========================================================================
   CONTENT PAGE
   ========================================================================== */
.content-page {
  margin-top: 92px; padding: 10px 12px; min-height: calc(100vh - 92px);
}
.content { background: transparent; padding: 0; }

/* ==========================================================================
   CARDS
   ========================================================================== */
.card {
  background: #fff; border: 1px solid var(--warm-300);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  margin-bottom: 12px; position: relative; overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 2px; background: var(--orange-grad); z-index: 1;
}
.card-header {
  padding: 8px 14px; background: var(--warm-50);
  border-bottom: 1px solid var(--warm-300);
  font-weight: 600; font-size: 0.84rem; color: var(--warm-900);
}
.card-header:first-child { border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0; }
.card-body { padding: 12px 14px; }
.card-footer {
  padding: 6px 14px; background: var(--warm-50);
  border-top: 1px solid var(--warm-300);
  border-radius: 0 0 calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 16px; font-size: 0.82rem; font-weight: 600;
  border: none; border-radius: 50px; cursor: pointer;
  transition: all var(--transition); text-decoration: none;
  font-family: var(--font-family); line-height: 1.4;
}
.btn-primary { background: var(--orange-grad); color: #fff; box-shadow: 0 4px 14px rgba(243,127,52,0.25); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(243,127,52,0.35); color: #fff; }
.btn-secondary { background: var(--warm-100); color: var(--warm-700); border: 1px solid var(--warm-300); }
.btn-secondary:hover { background: var(--warm-200); color: var(--warm-900); }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: #fff; box-shadow: 0 4px 14px rgba(16,185,129,0.25); }
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(16,185,129,0.35); color: #fff; }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; box-shadow: 0 4px 14px rgba(239,68,68,0.2); }
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(239,68,68,0.3); color: #fff; }
.btn-warning { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; box-shadow: 0 4px 14px rgba(245,158,11,0.2); }
.btn-warning:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(245,158,11,0.3); color: #fff; }
.btn-info { background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; box-shadow: 0 4px 14px rgba(59,130,246,0.25); }
.btn-info:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(59,130,246,0.35); color: #fff; }
.btn-light { background: var(--warm-50); color: var(--warm-700); border: 1px solid var(--warm-300); }
.btn-light:hover { background: var(--warm-100); }
.btn-dark { background: var(--warm-900); color: #fff; }
.btn-dark:hover { background: var(--warm-800); color: #fff; }
.btn-link { background: none; color: var(--orange-500); padding: 0; }
.btn-link:hover { color: var(--orange-600); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-lg { padding: 14px 30px; font-size: 1rem; }

/* ==========================================================================
   FORMS
   ========================================================================== */
.form-label {
  display: block; font-size: 0.82rem; font-weight: 600;
  color: var(--warm-700); margin-bottom: 6px;
}
.form-control, .form-select {
  width: 100%; padding: 7px 11px; font-size: 0.83rem;
  font-family: var(--font-family); color: var(--warm-900);
  background: #fff; border: 1.5px solid var(--warm-400);
  border-radius: var(--radius-sm); transition: all var(--transition);
  outline: none; height: auto;
}
.form-control:focus, .form-select:focus {
  border-color: var(--orange-500);
  box-shadow: 0 0 0 3px rgba(243,127,52,0.12);
}
.form-control::placeholder { color: var(--warm-500); }
.form-control:disabled { background: var(--warm-100); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-select { cursor: pointer; }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check-input { width: 17px; height: 17px; accent-color: var(--orange-500); cursor: pointer; margin: 0; }
.form-check-label { font-size: 0.85rem; color: var(--warm-700); cursor: pointer; }
.form-text { font-size: 0.78rem; color: var(--warm-600); }
.input-group { display: flex; align-items: stretch; }
.input-group .form-control { flex: 1; }
.input-group-text {
  display: flex; align-items: center; padding: 7px 11px;
  background: var(--warm-100); border: 1.5px solid var(--warm-400);
  border-radius: var(--radius-sm); color: var(--warm-700); font-size: 0.9rem;
}

/* ==========================================================================
   TABLES
   ========================================================================== */
.table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  color: var(--warm-700); margin-bottom: 0;
}
.table thead th {
  background: var(--warm-50); color: var(--warm-700);
  font-weight: 700; font-size: 0.74rem; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 8px 12px;
  border-bottom: 2px solid var(--warm-300); text-align: left;
}
.table tbody td {
  padding: 8px 12px; border-bottom: 1px solid var(--warm-200);
  color: var(--warm-700); font-weight: 450; font-size: 0.83rem;
  vertical-align: middle;
}
.table tbody tr:hover td { background: var(--warm-50); }
.table-striped tbody tr:nth-child(odd) td { background: var(--warm-50); }
.table-bordered { border: 1px solid var(--warm-300); }
.table-bordered th, .table-bordered td { border: 1px solid var(--warm-300); }
.table-sm th, .table-sm td { padding: 5px 10px; }

/* ==========================================================================
   BADGES
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  font-size: 0.72rem; font-weight: 600; border-radius: 50px;
  line-height: 1.4; white-space: nowrap;
}
.badge-primary { background: var(--orange-50); color: var(--orange-700) !important; }
.badge-success { background: #dcfce7; color: #166534 !important; }
.badge-danger { background: #fee2e2; color: #991b1b !important; }
.badge-warning { background: #fef3c7; color: #92400e !important; }
.badge-info { background: #dbeafe; color: #1e40af !important; }

/* ==========================================================================
   ALERTS
   ========================================================================== */
.alert {
  padding: 14px 18px; border-radius: var(--radius-md);
  font-weight: 500; margin-bottom: 16px; border: none;
  border-left: 4px solid transparent;
}
.alert-primary { background: var(--orange-50); color: var(--orange-800); border-left-color: var(--orange-500); }
.alert-success { background: #ecfdf5; color: #065f46; border-left-color: var(--green-500); }
.alert-danger { background: #fef2f2; color: #991b1b; border-left-color: var(--red-500); }
.alert-warning { background: #fffbeb; color: #92400e; border-left-color: var(--yellow-500); }
.alert-info { background: #eff6ff; color: #1e40af; border-left-color: var(--blue-500); }
.alert-dismissible { display: flex; align-items: center; justify-content: space-between; }
.alert .btn-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: inherit; opacity: 0.6; padding: 4px; }

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1050; overflow: auto; }
.modal.show { display: block; }
.modal-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(28,24,22,0.5); z-index: 1040; }
.modal-dialog { position: relative; max-width: 500px; margin: 40px auto; padding: 0 16px; }
.modal-content { background: #fff; border: none; border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); position: relative; }
.modal-header { padding: 18px 24px; border-bottom: 1px solid var(--warm-300); display: flex; align-items: center; justify-content: space-between; }
.modal-header h5 { margin: 0; font-size: 1.05rem; }
.modal-header .btn-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--warm-600); padding: 4px; }
.modal-body { padding: 24px; }
.modal-footer { padding: 14px 24px; border-top: 1px solid var(--warm-300); display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.modal-lg { max-width: 800px; }
.modal-sm { max-width: 350px; }
.modal-dialog-centered { display: flex; align-items: center; min-height: calc(100% - 80px); }

/* ==========================================================================
   DROPDOWNS (Global)
   ========================================================================== */
.dropdown { position: relative; }
.notification-list { display: flex; align-items: center; }
.notify-item { display: flex; align-items: center; gap: 10px; }
.notify-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.notify-icon .mdi { font-size: 1.2rem; }
.notify-message { font-size: 0.83rem; color: var(--warm-700); line-height: 1.4; }
.notify-message small { color: var(--warm-500); }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.footer {
  background: rgba(255,255,255,0.95); border-top: 1px solid var(--warm-200);
  padding: 8px 16px; font-size: 0.75rem; color: var(--warm-500);
}
.footer a { color: var(--warm-600); font-weight: 500; }
.footer a:hover { color: var(--orange-500); }

/* ==========================================================================
   PAGINATION
   ========================================================================== */
.pagination { display: flex; list-style: none; gap: 4px; margin: 16px 0; }
.page-link {
  display: flex; align-items: center; justify-content: center;
  padding: 8px 14px; border: 1px solid var(--warm-300);
  border-radius: var(--radius-sm); color: var(--warm-700);
  font-weight: 500; font-size: 0.85rem; text-decoration: none;
  transition: all var(--transition); background: #fff;
}
.page-link:hover { background: var(--orange-50); color: var(--orange-500); border-color: var(--orange-200); }
.page-item.active .page-link { background: var(--orange-grad); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(243,127,52,0.2); }
.page-item.disabled .page-link { opacity: 0.5; pointer-events: none; }

/* ==========================================================================
   TABS
   ========================================================================== */
.nav-tabs { display: flex; list-style: none; gap: 2px; border-bottom: 1px solid var(--warm-300); margin-bottom: 16px; }
.nav-tabs .nav-link {
  padding: 10px 18px; font-weight: 500; font-size: 0.85rem;
  color: var(--warm-700); border: none; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: all var(--transition); text-decoration: none; display: flex; align-items: center; gap: 6px;
}
.nav-tabs .nav-link:hover { background: var(--orange-50); color: var(--orange-500); }
.nav-tabs .nav-link.active { background: #fff; color: var(--orange-500); box-shadow: inset 0 -2px 0 var(--orange-500); }
.nav-pills { display: flex; list-style: none; gap: 4px; }
.nav-pills .nav-link {
  padding: 8px 18px; font-weight: 500; font-size: 0.85rem;
  color: var(--warm-700); border-radius: 50px; transition: all var(--transition); text-decoration: none;
}
.nav-pills .nav-link:hover { background: var(--orange-50); color: var(--orange-500); }
.nav-pills .nav-link.active { background: var(--orange-grad); color: #fff; box-shadow: 0 4px 12px rgba(243,127,52,0.2); }
.tab-content > .tab-pane { display: none; }
.tab-content > .tab-pane.active { display: block; }

/* ==========================================================================
   PROGRESS
   ========================================================================== */
.progress { display: flex; height: 8px; background: var(--warm-200); border-radius: 50px; overflow: hidden; }
.progress-bar { display: flex; align-items: center; justify-content: center; background: var(--orange-grad); color: #fff; font-size: 0.7rem; font-weight: 600; transition: width 0.6s ease; }

/* ==========================================================================
   LIST GROUP
   ========================================================================== */
.list-group { list-style: none; }
.list-group-item {
  padding: 12px 18px; border: 1px solid var(--warm-300);
  color: var(--warm-700); background: #fff;
}
.list-group-item:first-child { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.list-group-item:last-child { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.list-group-item + .list-group-item { border-top: none; }
.list-group-item-action { cursor: pointer; transition: background var(--transition); text-decoration: none; display: block; }
.list-group-item-action:hover { background: var(--warm-50); }

/* ==========================================================================
   BREADCRUMB
   ========================================================================== */
.breadcrumb { display: flex; list-style: none; gap: 8px; margin-bottom: 16px; }
.breadcrumb-item { font-size: 0.85rem; }
.breadcrumb-item a { color: var(--orange-500); font-weight: 500; }
.breadcrumb-item.active { color: var(--warm-600); }
.breadcrumb-item + .breadcrumb-item::before { content: '/'; color: var(--warm-500); margin-right: 8px; }

/* ==========================================================================
   UTILITIES
   ========================================================================== */
.text-center { text-align: center; }
.text-start { text-align: left; }
.text-end { text-align: right; }
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }
.d-grid { display: grid; }
.d-block { display: block; }
.d-none { display: none; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.justify-content-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-column { flex-direction: column; }
.flex-grow-1 { flex-grow: 1; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 24px; }
.m-0 { margin: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 24px; }
.ms-1 { margin-left: 4px; }
.ms-2 { margin-left: 8px; }
.ms-3 { margin-left: 12px; }
.ms-auto { margin-left: auto; }
.me-1 { margin-right: 4px; }
.me-2 { margin-right: 8px; }
.me-auto { margin-right: auto; }
.p-0 { padding: 0; }
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 24px; }
.py-1 { padding-top: 4px; padding-bottom: 4px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.py-5 { padding-top: 24px; padding-bottom: 24px; }
.px-1 { padding-left: 4px; padding-right: 4px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.px-5 { padding-left: 24px; padding-right: 24px; }
.w-100 { width: 100%; }
.h-100 { height: 100%; }
.position-relative { position: relative; }
.position-absolute { position: absolute; }
.position-fixed { position: fixed; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.rounded { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-circle { border-radius: 50%; }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.border { border: 1px solid var(--warm-300); }
.border-top { border-top: 1px solid var(--warm-300); }
.border-bottom { border-bottom: 1px solid var(--warm-300); }
.bg-white { background: #fff; }
.bg-light { background: var(--warm-50); }
.bg-primary { background: var(--orange-500); }
.bg-success { background: var(--green-500); }
.bg-danger { background: var(--red-500); }
.bg-warning { background: var(--yellow-500); }
.bg-info { background: var(--blue-500); }
.fw-normal { font-weight: 400; }
.fw-medium { font-weight: 500; }
.fw-semibold { font-weight: 600; }
.fw-bold { font-weight: 700; }
.fw-bolder { font-weight: 800; }
.fs-small { font-size: 0.78rem; }
.fs-normal { font-size: 0.88rem; }
.fs-medium { font-size: 1rem; }
.fs-large { font-size: 1.2rem; }
.clearfix::after { content: ''; display: table; clear: both; }
.row { display: flex; flex-wrap: wrap; margin: 0 -12px; }
.col, [class*="col-"] { padding: 0 12px; }
.col { flex: 1; }
.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-4 { flex: 0 0 33.33%; max-width: 33.33%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-md-6 { flex: 0 0 100%; max-width: 100%; }
.col-md-4 { flex: 0 0 100%; max-width: 100%; }
.col-md-3 { flex: 0 0 100%; max-width: 100%; }
@media (min-width: 768px) {
  .col-md-6 { flex: 0 0 50%; max-width: 50%; }
  .col-md-4 { flex: 0 0 33.33%; max-width: 33.33%; }
  .col-md-3 { flex: 0 0 25%; max-width: 25%; }
  .col-md-2 { flex: 0 0 16.67%; max-width: 16.67%; }
}
.col-lg-4 { flex: 0 0 100%; max-width: 100%; }
.col-lg-3 { flex: 0 0 100%; max-width: 100%; }
@media (min-width: 992px) {
  .col-lg-4 { flex: 0 0 33.33%; max-width: 33.33%; }
  .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
  .col-lg-2 { flex: 0 0 16.67%; max-width: 16.67%; }
  .col-lg-6 { flex: 0 0 50%; max-width: 50%; }
}
.mb-4 { margin-bottom: 16px; }
@media (max-width: 600px) {
  .row { margin: 0 -8px; }
  .col, [class*="col-"] { padding: 0 8px; }
  .col-12 { flex: 0 0 100%; max-width: 100%; }
}

/* ==========================================================================
   RESPONSIVE TOPBAR
   ========================================================================== */
@media (max-width: 768px) {
  .navbar-toggle { display: block; }
  .topnav-menu-left { display: block; }
  .topnav .navbar-nav { flex-direction: column; align-items: stretch; }
  .topnav .nav-link { padding: 6px 12px; font-size: 0.82rem; }
  .topnav .dropdown-menu { position: static; box-shadow: none; border: none; padding-left: 16px; }
  .topnav-menu .nav-user .pro-user-name { display: none; }
  .company-title-text { font-size: 0.85rem; }
  .content-page { padding: 10px; margin-top: 98px; }
  .footer { font-size: 0.7rem; padding: 6px 12px; }
}

/* ==========================================================================
   SELECT2 CUSTOM
   ========================================================================== */
.select2-container--default .select2-selection--single {
  border: 1.5px solid var(--warm-400) !important;
  border-radius: var(--radius-sm) !important;
  padding: 6px 12px !important; min-height: 40px !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--warm-900) !important; line-height: 28px !important; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 38px !important; }
.select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--orange-50) !important; color: var(--orange-700) !important; }

/* ==========================================================================
   TOASTR
   ========================================================================== */
.toast-success { background: var(--orange-grad) !important; }
.toast-info { background: linear-gradient(135deg, #3b82f6, #2563eb) !important; }
.toast-warning { background: linear-gradient(135deg, #f59e0b, #d97706) !important; }
.toast-error { background: linear-gradient(135deg, #ef4444, #dc2626) !important; }
#toast-container > .toast { border-radius: var(--radius-md) !important; box-shadow: var(--shadow-lg) !important; }

/* ==========================================================================
   FLATPICKR
   ========================================================================== */
.flatpickr-calendar.open { z-index: 1060 !important; }

/* ==========================================================================
   SCROLLBAR
   ========================================================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--warm-100); }
::-webkit-scrollbar-thumb { background: var(--warm-400); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--warm-500); }

/* ==========================================================================
   SPINNER
   ========================================================================== */
@keyframes spinner-border { to { transform: rotate(360deg); } }
.spinner-border {
  display: inline-block; width: 1rem; height: 1rem;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spinner-border 0.75s linear infinite;
}
.spinner-border-sm { width: 0.8rem; height: 0.8rem; border-width: 1.5px; }

/* ==========================================================================
   NOTIFICATIONS
   ========================================================================== */
.count { font-size: 0.7rem; background: var(--red-500); color: #fff; border-radius: 50%; padding: 1px 5px; position: absolute; top: 2px; right: 2px; font-weight: 700; }

/* ==========================================================================
   BLINKING DOT & IMPORTANT LINK
   ========================================================================== */
.blink-dot {
  width: 8px; height: 8px; background: var(--red-500); border-radius: 50%;
  display: inline-block; animation: blink 1.2s ease-in-out infinite;
  box-shadow: 0 0 6px rgba(239,68,68,0.4);
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.2; } }
.nav-link.important-link { color: #d97706 !important; font-weight: 700 !important; }
.important-badge {
  background: linear-gradient(135deg, #f59e0b, #ef4444); font-size: 10px;
  border-radius: 50px; padding: 2px 8px; color: #fff; font-weight: 700;
  box-shadow: 0 0 6px rgba(239,68,68,0.3);
}

/* ==========================================================================
   LOGIN PAGE
   ========================================================================== */
body.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #f7f5f2; padding: 20px; margin: 0;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(243,127,52,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(243,127,52,0.04) 0%, transparent 50%);
  background-attachment: fixed;
}
.login-container { width: 100%; max-width: 420px; animation: loginFade 0.5s ease-out; }
@keyframes loginFade { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand .brand-logo {
  width: 56px; height: 56px; background: var(--orange-grad); border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 16px; box-shadow: 0 8px 24px rgba(243,127,52,0.25);
}
.login-brand .brand-logo span { color: #fff; font-size: 24px; font-weight: 800; letter-spacing: -1px; font-family: 'Inter', sans-serif; }
.login-brand h1 { font-size: 1.5rem; font-weight: 800; color: var(--warm-900); margin: 0; }
.login-brand p { font-size: 0.88rem; color: var(--warm-600); margin: 4px 0 0; }
.login-card {
  background: #fff; border: 1px solid var(--warm-300); border-radius: var(--radius-xl);
  padding: 32px; box-shadow: var(--shadow-xl); position: relative; overflow: hidden;
}
.login-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: var(--orange-grad);
}
.login-field { margin-bottom: 20px; }
.login-field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--warm-700); margin-bottom: 6px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input-icon {
  position: absolute; left: 14px; color: var(--warm-500); font-size: 1.15rem;
  pointer-events: none; z-index: 2; transition: color var(--transition);
}
.input-wrap input {
  width: 100%; background: var(--warm-50); border: 1.5px solid var(--warm-300);
  border-radius: var(--radius-md); padding: 12px 14px 12px 44px;
  font-size: 0.92rem; color: var(--warm-900); font-weight: 500;
  font-family: var(--font-family); outline: none; transition: all var(--transition);
}
.input-wrap input:focus { background: #fff; border-color: var(--orange-500); box-shadow: 0 0 0 4px rgba(243,127,52,0.1); }
.input-wrap:focus-within .input-icon { color: var(--orange-500); }
.input-wrap .toggle-pwd {
  position: absolute; right: 12px; background: none; border: none;
  color: var(--warm-500); cursor: pointer; padding: 6px; z-index: 2;
  font-size: 1.1rem; transition: color var(--transition);
}
.input-wrap .toggle-pwd:hover { color: var(--warm-700); }
.login-options { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.checkbox-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-wrap input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--orange-500); cursor: pointer; margin: 0; }
.checkbox-wrap span { font-size: 0.85rem; color: var(--warm-700); font-weight: 500; }
.forgot-link { font-size: 0.82rem; color: var(--orange-500); font-weight: 600; text-decoration: none; }
.forgot-link:hover { color: var(--orange-700); }
.login-security {
  background: var(--warm-50); border: 1px solid var(--warm-300);
  border-radius: var(--radius-md); padding: 16px; margin-bottom: 20px;
}
.login-security .security-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.login-security .sec-label { font-size: 0.8rem; font-weight: 600; color: var(--warm-700); display: flex; align-items: center; gap: 6px; }
.login-security .sec-label i { color: var(--orange-500); }
.login-security .sec-answer { background: var(--orange-100); color: var(--orange-800); padding: 3px 10px; border-radius: var(--radius-sm); font-family: 'Inter', monospace; font-size: 0.9rem; font-weight: 700; }
.login-security input { width: 100%; background: #fff; border: 1.5px solid var(--warm-300); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.88rem; color: var(--warm-900); font-family: var(--font-family); outline: none; transition: all var(--transition); }
.login-security input:focus { border-color: var(--orange-500); box-shadow: 0 0 0 4px rgba(243,127,52,0.1); }
.btn-login {
  width: 100%; background: var(--orange-grad); border: none; border-radius: var(--radius-md);
  padding: 14px 20px; font-size: 0.95rem; font-weight: 700; color: #fff;
  font-family: var(--font-family); cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 4px 16px rgba(243,127,52,0.3);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(243,127,52,0.4); }
.btn-login:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.login-footer { text-align: center; margin-top: 24px; font-size: 0.75rem; color: var(--warm-500); }
.login-footer strong { color: var(--warm-600); font-weight: 600; }
.login-status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 14px 5px 10px; background: rgba(243,127,52,0.06);
  border: 1px solid rgba(243,127,52,0.15); border-radius: 50px;
  font-size: 0.72rem; font-weight: 600; color: var(--orange-700);
  text-transform: uppercase; margin-bottom: 24px;
}
.login-status .status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-500); animation: pulse-dot 2s ease-in-out infinite; }
@keyframes pulse-dot { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(1.3); } }

/* ==========================================================================
   PANEL VIEW - Summary Stats Grid
   ========================================================================== */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--warm-300);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  text-align: center;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--warm-900);
  line-height: 1.2;
}
.stat-card .stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--warm-500);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 4px;
}
.card-active::before { background: var(--green-500); }
.card-inactive::before { background: var(--red-500); }
.card-import::before { background: var(--blue-500); }
.card-export::before { background: var(--orange-500); }
.card-noload::before { background: var(--warm-400); }
.card-kw::before { background: #8b5cf6; }
.card-kva::before { background: #06b6d4; }
.card-pf::before { background: #f59e0b; }
.card-kvar::before { background: #ec4899; }

/* ==========================================================================
   PANEL VIEW - Header & Controls
   ========================================================================== */
.card-header-custom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 18px;
  background: var(--warm-50);
  border-bottom: 1px solid var(--warm-300);
}
.view-toggle {
  display: inline-flex;
  background: var(--warm-100);
  border-radius: var(--radius-sm);
  padding: 2px;
  border: 1px solid var(--warm-300);
}
.view-btn {
  background: transparent;
  border: none;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--warm-600);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
}
.view-btn.active {
  background: var(--orange-grad);
  color: #fff;
  box-shadow: 0 2px 8px rgba(243,127,52,0.2);
}
.view-btn:hover:not(.active) { color: var(--orange-500); }
.search-box {
  position: relative;
  min-width: 220px;
}
.search-box .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--warm-500);
  font-size: 0.82rem;
}
.search-box .search-input {
  width: 100%;
  padding: 6px 10px 6px 30px;
  border: 1.5px solid var(--warm-300);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--warm-800);
  background: #fff;
  outline: none;
  transition: all var(--transition);
}
.search-box .search-input:focus {
  border-color: var(--orange-500);
  box-shadow: 0 0 0 3px rgba(243,127,52,0.08);
}

/* ==========================================================================
   PANEL VIEW - Hierarchical Table
   ========================================================================== */
.hierarchical-table { margin: 0; }
.hierarchical-table thead th {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--warm-500);
  background: var(--warm-50);
  border-bottom: 2px solid var(--warm-300);
  padding: 8px 12px;
  white-space: nowrap;
}
.hierarchical-table tbody td {
  padding: 10px 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--warm-200);
  font-size: 0.82rem;
}
.group-row {
  background: #f8f7f5 !important;
  cursor: pointer;
  border-top: 2px solid var(--warm-300);
}
.group-row td {
  font-weight: 700;
  color: var(--warm-800);
  font-size: 0.85rem;
}
.group-row.collapsed .fa-chevron-down { transform: rotate(-90deg); }
.group-row .fa-chevron-down { transition: transform 0.2s; margin-right: 8px; }
.device-row { background: #fff; }
.device-row:hover {
  background: var(--warm-50) !important;
}
.device-row.hidden { display: none; }

/* ==========================================================================
   PANEL VIEW - Status Badges
   ========================================================================== */
.status-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 50px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-online {
  background: #dcfce7;
  color: #166534;
}
.badge-offline {
  background: #fee2e2;
  color: #991b1b;
}

/* ==========================================================================
   PANEL VIEW - Capacitor Step Indicators
   ========================================================================== */
.cap-step {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 2px;
  transition: all 0.2s;
}
.cap-on { background: var(--orange-500); box-shadow: 0 0 4px rgba(243,127,52,0.4); }
.cap-off { background: var(--warm-300); }

/* ==========================================================================
   PANEL VIEW - Intelligence Tags
   ========================================================================== */
.intelligence-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-right: 4px;
  color: #fff;
}
.tag-stale {
  background: #ef4444;
  box-shadow: 0 0 0 0 rgba(239,68,68,0.4);
}
.tag-imbalance {
  background: #f59e0b;
  box-shadow: 0 0 0 0 rgba(245,158,11,0.4);
}

/* ==========================================================================
   PANEL VIEW - Tree View
   ========================================================================== */
.tree-container { padding: 8px 0; }
.tree-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.tree-item { position: relative; }
.tree-node-content {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  font-size: 0.82rem;
  color: var(--warm-700);
}
.tree-node-content:hover { background: var(--orange-50); color: var(--orange-600); }
.tree-node-content .toggle-icon {
  margin-right: 6px;
  transition: transform 0.2s;
  font-size: 0.7rem;
  color: var(--warm-500);
}
.tree-item.collapsed > .tree-node-content .toggle-icon { transform: rotate(-90deg); }
.tree-item.collapsed > .tree-branch { display: none; }
.tree-branch {
  list-style: none;
  padding-left: 24px;
  margin: 0;
}
.tree-node-content .node-label { font-weight: 500; }
.device-card-node {
  background: var(--warm-50);
  border: 1px solid var(--warm-200);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin: 4px 0;
}
.device-card-node:hover {
  background: #fff;
  border-color: var(--orange-200);
  box-shadow: 0 2px 8px rgba(243,127,52,0.08);
}

/* ==========================================================================
   PANEL VIEW - Metrics Grid
   ========================================================================== */
.metrics-mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 16px;
  font-size: 0.75rem;
}
.metrics-mini-grid .metric-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}
.metrics-mini-grid .metric-label { color: var(--warm-500); }
.metrics-mini-grid .metric-value { color: var(--warm-900); font-weight: 600; }

/* ==========================================================================
   PANEL VIEW - GIS Map
   ========================================================================== */
#panelGisMap {
  width: 100%;
  height: 600px;
  border-radius: var(--radius-md);
  border: 1px solid var(--warm-300);
}
@media (max-width: 768px) {
  #panelGisMap { height: 350px; }
  .summary-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; }
  .stat-card { padding: 8px 10px; }
  .stat-card .stat-value { font-size: 1.15rem; }
  .card-header-custom { flex-direction: column; align-items: stretch; }
  .search-box { min-width: 100%; }
}

/* ==========================================================================
   PANEL VIEW - Animations (moved from page inline)
   ========================================================================== */
@keyframes pulse-stale {
  0% { background-color: #fca5a5; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { background-color: #ef4444; box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
  100% { background-color: #fca5a5; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
@keyframes pulse-imbalance {
  0% { background-color: #fcd34d; box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  50% { background-color: #f59e0b; box-shadow: 0 0 0 4px rgba(245, 158, 11, 0); }
  100% { background-color: #fcd34d; box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}
.tag-stale { animation: pulse-stale 2s infinite; }
.tag-imbalance { animation: pulse-imbalance 2s infinite; }

/* ==========================================================================
   DASHBOARD - Energy Summary Table
   ========================================================================== */
.energy-summary-table {
  width: 80%;
  margin: 10px auto;
  border-collapse: collapse;
  font-size: 0.78rem;
  background-color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.energy-summary-table th,
.energy-summary-table td {
  padding: 8px 12px;
  text-align: center;
}
.energy-summary-table th {
  background-color: #f1f5f9;
  color: #334155;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.energy-summary-table tbody tr:nth-child(even) { background-color: #f8fafc; }
.energy-summary-table tbody tr:hover { background-color: #f1f5f9; }
.energy-summary-table .import-column {
  background-color: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
}
.energy-summary-table .export-column {
  background-color: #fff1f2;
  color: #be123c;
  font-weight: 700;
}
.energy-summary-table .import-export-header {
  background-color: #e2e8f0;
  color: #1e293b;
}
.energy-summary-table td { border-bottom: 1px solid #ddd; }
.energy-summary-table tfoot {
  font-weight: bold;
  background-color: #e9ecef;
}

/* ==========================================================================
   DASHBOARD - KPI Widget Cards
   ========================================================================== */
.kpi-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  border: 1px solid #f1f5f9;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.kpi-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}
.kpi-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 12px; right: 12px;
  height: 3px;
  border-radius: 2px;
}
.kpi-active::after { background: #22c55e; }
.kpi-inactive::after { background: #ef4444; }
.kpi-pf::after { background: #3b82f6; }
.kpi-md::after { background: #8b5cf6; }
.kpi-hours::after { background: #f59e0b; }
.kpi-ihours::after { background: #ec4899; }
.kpi-inject::after { background: #06b6d4; }
.kpi-thd::after { background: #f97316; }

.kpi-body {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
}
.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}
.kpi-icon-bg-active { background: #22c55e; }
.kpi-icon-bg-inactive { background: #ef4444; }
.kpi-icon-bg-pf { background: #3b82f6; }
.kpi-icon-bg-md { background: #8b5cf6; }
.kpi-icon-bg-hours { background: #f59e0b; }
.kpi-icon-bg-ihours { background: #ec4899; }
.kpi-icon-bg-inject { background: #06b6d4; }
.kpi-icon-bg-thd { background: #f97316; }

.kpi-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.kpi-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #64748b;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}
.kpi-sub {
  font-size: 0.62rem;
  color: #94a3b8;
  font-weight: 500;
}

/* ==========================================================================
   DASHBOARD - Compact Energy Report
   ========================================================================== */
.compact-energy-report {
  font-size: 0.7rem !important;
  margin-bottom: 0 !important;
}
.compact-energy-report th,
.compact-energy-report td {
  padding: 3px 5px !important;
  white-space: nowrap !important;
  vertical-align: middle !important;
  border-color: #e2e8f0 !important;
}
.compact-energy-report thead th {
  background: #f1f5f9 !important;
  color: #334155 !important;
  font-weight: 700;
}
.compact-energy-report tbody tr:hover { background-color: #f8fafc !important; }
.dataTables_scrollBody { overflow-y: hidden !important; }

/* Phase color utilities */
.bg-blue-dash { background-color: #0d6efd !important; color: #fff !important; }
.bg-black-dash { background-color: #1a1a1a !important; color: #fff !important; }

/* ==========================================================================
   DASHBOARD - Next-Gen Dashboard (moved from inline)
   ========================================================================== */
.dashboard-container {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: transparent;
  color: #1e293b;
  padding: 5px 0;
}
.dashboard-container::-webkit-scrollbar { width: 5px; }
.dashboard-container::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 3px; }
.dashboard-container::-webkit-scrollbar-thumb { background: #475569; border-radius: 3px; }
.dashboard-container::-webkit-scrollbar-thumb:hover { background: #64748b; }

.premium-title {
  background: linear-gradient(135deg, #F37F34, #e06a1e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 900;
  letter-spacing: -0.5px;
  font-size: 1.8rem;
}

.chart-placeholder {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: all 0.3s ease;
  margin-top: 10px;
}
.chart-placeholder:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

.diagnostic-item {
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 4px;
  font-size: 0.85rem;
}

.feature-tile {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  transition: all 0.2s;
}
.feature-tile:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  border-color: var(--orange-200);
}
.feature-tile .fw-bolder.text-uppercase {
  font-size: 0.65rem;
  color: #64748b;
  margin-bottom: 2px;
}

.x-small { font-size: 0.6rem; }

.grid-metric-box {
  background: #f8fafc;
  border-radius: 6px;
  padding: 10px 5px;
  text-align: center;
}

/* Telemetry DataTable */
#telemetryDataTable th { padding: 6px 4px !important; font-size: 0.65rem !important; }
#telemetryDataTable td { padding: 4px 4px !important; font-size: 0.7rem !important; }
.dataTables_wrapper { font-size: 0.7rem; }

/* Live badge pulse */
.live-badge { animation: live-pulse 2s infinite; }
@keyframes live-pulse {
  0% { opacity: 0.7; }
  50% { opacity: 1; }
  100% { opacity: 0.7; }
}

/* Dashboard metric display */
.metric-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  letter-spacing: -0.5px;
}
.metric-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  font-weight: 700;
  margin-bottom: 2px;
}
.status-badge {
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 0.5px;
}
.pulse-dot {
  height: 8px;
  width: 8px;
  background-color: #10b981;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.icon-wrapper {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}
.card:hover .icon-wrapper { transform: scale(1.1) rotate(5deg); }
.icon-primary { color: #F37F34; background: rgba(243, 127, 52, 0.1); border-color: rgba(243, 127, 52, 0.2); }
.icon-success { color: #059669; background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.2); }
.icon-warning { color: #d97706; background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.2); }
.icon-danger { color: #dc2626; background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.2); }
.tree-node-card { margin-bottom: 2px; }
.tree-node-header { padding: 6px 10px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; display: flex; align-items: center; gap: 6px; font-size: 0.7rem; cursor: pointer; transition: background 0.2s; }
.tree-node-header:hover { background: #fff7ed; border-color: rgba(243,127,52,0.3); }
.tree-toggle { font-size: 0.6rem; color: #94a3b8; transition: transform 0.2s; width: 14px; text-align: center; }
.tree-children { padding: 4px 0; }
.device-node-card { margin-bottom: 3px; }
.badge-online { background: #10b981; color: #fff; padding: 1px 6px; border-radius: 10px; font-size: 0.55rem; font-weight: 700; }
.badge-offline { background: #ef4444; color: #fff; padding: 1px 6px; border-radius: 10px; font-size: 0.55rem; font-weight: 700; }

/* Network Assets Table */
#networkTable thead th {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  background: #f8fafc;
  padding: 8px 10px;
  white-space: nowrap;
  border-bottom: 2px solid #F37F34;
}
#networkTable .group-row td.group-label {
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #F37F34;
  background: #fff7ed;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}
#networkTable .group-row .mdi-chevron-down { transition: transform 0.15s; }
#networkTable .group-row.collapsed .mdi-chevron-down { transform: rotate(-90deg); }
#networkTable .device-row td {
  font-size: 0.72rem;
  padding: 8px 10px;
  border-bottom: 1px dashed #e2e8f0;
}
#networkTable .device-row:hover td { background: #fff7ed !important; }
#networkTable .device-row td .small { font-size: 0.65rem; }
#networkTable .device-row .btn { font-size: 0.7rem; line-height: 1.4; }
#networkTable .status-badge { font-size: 0.62rem; padding: 2px 8px; }
#networkTable .group-chip { font-size: 0.68rem; }
#networkTable .device-row { cursor: pointer; }
#networkTable .device-row .device-toggle { color: #94a3b8; font-size: 0.85rem; transition: transform 0.15s; }
#networkTable .device-row.expanded td { background: #fff7ed !important; }
#networkTable .device-row.expanded .device-toggle { transform: rotate(90deg); color: #F37F34; }
#networkTable .device-detail td { background: #f8fafc; padding: 0 !important; border-bottom: 1px solid #e2e8f0; }
.device-detail-inner { padding: 8px 12px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.detail-block { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 10px; }
.detail-block h6 { font-size: 0.6rem; font-weight: 700; color: #0f172a; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }

/* Panel View - Stats icons */
.stat-card .stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 1rem;
  margin-bottom: 6px;
  border: 1px solid transparent;
  background: #f1f5f9;
  color: #475569;
}
.icon-import { color: #2563eb; background: rgba(37, 99, 235, 0.1); border-color: rgba(37, 99, 235, 0.2); }
.icon-export { color: #F37F34; background: rgba(243, 127, 52, 0.1); border-color: rgba(243, 127, 52, 0.2); }
.icon-noload { color: #94a3b8; background: rgba(148, 163, 184, 0.15); border-color: rgba(148, 163, 184, 0.25); }
.icon-kw { color: #8b5cf6; background: rgba(139, 92, 246, 0.1); border-color: rgba(139, 92, 246, 0.2); }
.icon-kva { color: #06b6d4; background: rgba(6, 182, 212, 0.1); border-color: rgba(6, 182, 212, 0.2); }
.icon-pf { color: #f59e0b; background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.2); }
.icon-kvar { color: #ec4899; background: rgba(236, 72, 153, 0.1); border-color: rgba(236, 72, 153, 0.2); }
.icon-mwh { color: #059669; background: rgba(5, 150, 105, 0.1); border-color: rgba(5, 150, 105, 0.2); }
.icon-amount { color: #0f766e; background: rgba(13, 148, 136, 0.1); border-color: rgba(13, 148, 136, 0.2); }
.card-total::before { background: #0f172a; }
.card-mwh::before { background: #059669; }
.card-amount::before { background: #0f766e; }

/* Panel View - Substation group chips */
.group-chip {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.65rem;
  font-weight: 600;
  color: #475569;
  margin-left: 6px;
  vertical-align: middle;
}

/* Panel View - Detail key/value tables */
.detail-kv { width: 100%; border-collapse: collapse; }
.detail-kv td { font-size: 0.6rem; padding: 2px 4px; border-bottom: 1px dashed #eef2f7; }
.detail-kv td:first-child { color: #64748b; width: 45%; }
.detail-kv td:last-child { font-weight: 600; color: #0f172a; text-align: right; }
.detail-kv tr:last-child td { border-bottom: none; }
.detail-kv tr.detail-total td { border-top: 1px solid #e2e8f0; border-bottom: none; color: #F37F34; font-weight: 800; }
.detail-kv tr.detail-total td:first-child { color: #F37F34; }
