/* ==========================================================================
   SOCOTECO-1 CSMIS — Clean Enterprise Light Theme (OMS Font Scale)
   Adjusted typography & sizing for large/high-res displays
   ========================================================================== */

/* ==========================================================================
   Design Tokens
   ========================================================================== */
:root {
  /* Brand Colors */
  --brand-primary: #1d4ed8;
  --brand-primary-hover: #1e40af;
  --brand-primary-light: #eff6ff;
  --brand-primary-border: #bfdbfe;
  --brand-accent: #0284c7;

  /* Surfaces & Backgrounds */
  --color-white: #ffffff;
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;
  --color-divider: #f1f5f9;

  /* Typography */
  --text-primary: #0f172a;
  --text-secondary: #ffffff;
  --text-tertiary: #94a3b8;
  --text-inverse: #ffffff;
  --text-link: #1d4ed8;

  /* Status Colors */
  --status-success-bg: #f0fdf4;
  --status-success-border: #bbf7d0;
  --status-success-text: #15803d;

  --status-warning-bg: #fffbeb;
  --status-warning-border: #fef08a;
  --status-warning-text: #b45309;

  --status-danger-bg: #fef2f2;
  --status-danger-border: #fecaca;
  --status-danger-text: #b91c1c;

  --status-info-bg: #eff6ff;
  --status-info-border: #bfdbfe;
  --status-info-text: #1d4ed8;

  /* Sidebar */
  --sidebar-bg: #ffffff;
  --sidebar-border: #e2e8f0;
  --sidebar-hover: #f1f5f9;
  --sidebar-active-bg: #eff6ff;
  --sidebar-active-border: #1d4ed8;
  --sidebar-text: #475569;
  --sidebar-text-active: #1d4ed8;
  --sidebar-text-main: #ffffff;
  --sidebar-section: #94a3b8;

  /* Header */
  --header-bg: #ffffff;
  --header-border: #e2e8f0;

  /* Dimensions — Scaled to match OMS */
  --sidebar-width: 264px;
  --header-height: 62px;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.08), 0 4px 8px rgba(15, 23, 42, 0.04);
  --shadow-modal: 0 20px 50px rgba(15, 23, 42, 0.12), 0 8px 20px rgba(15, 23, 42, 0.06);

  /* Transitions */
  --transition-fast: 0.12s ease;
  --transition-med: 0.22s ease;
}

/* ==========================================================================
   Reset & Base — Generous Sizing (Matches OMS Scale)
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15.5px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--color-bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--text-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input,
select,
textarea {
  font-family: inherit;
}

ul,
ol {
  list-style: none;
}

.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.font-mono {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
}

.text-muted {
  color: var(--text-secondary);
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ==========================================================================
   Login Screen
   ========================================================================== */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 50%, #e2e8f0 100%);
  z-index: 1000;
}

.login-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(29, 78, 216, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 78, 216, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 44px 40px 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: loginFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginFadeIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}

.login-logo-icon {
  width: 52px;
  height: 52px;
  background: var(--brand-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.25);
}

.login-logo-icon svg {
  width: 26px;
  height: 26px;
}

.login-org {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.login-title {
  font-size: 0.84rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 1px;
}

.login-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-wrap svg {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.login-input-wrap input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.login-input-wrap input::placeholder {
  color: var(--text-tertiary);
}

.login-input-wrap input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.login-remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-primary);
  cursor: pointer;
}

.btn-login {
  width: 100%;
  padding: 13px;
  background: var(--brand-primary);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 0.98rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  box-shadow: 0 2px 8px rgba(29, 78, 216, 0.25);
}

.btn-login:hover {
  background: var(--brand-primary-hover);
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.35);
}

.btn-login:active {
  transform: scale(0.99);
}

.btn-login.loading {
  opacity: 0.75;
  pointer-events: none;
}

.btn-login svg {
  width: 19px;
  height: 19px;
}

.login-error {
  background: var(--status-danger-bg);
  border: 1px solid var(--status-danger-border);
  border-radius: var(--radius-sm);
  color: var(--status-danger-text);
  font-size: 0.86rem;
  padding: 10px 16px;
  text-align: center;
}

.login-footer {
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-tertiary);
  padding-top: 2px;
}

/* ==========================================================================
   App Layout
   ========================================================================== */
.app-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns 0.3s ease;
}

/* ==========================================================================
   Sidebar — Scaled Font & Padding (Matches OMS)
   ========================================================================== */
.sidebar {
  grid-row: 1 / -1;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #2B579A;
}

.sidebar-header {
  padding: 0 20px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: var(--brand-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(29, 78, 216, 0.25);
}

.brand-icon svg {
  width: 20px;
  height: 20px;
}

.brand-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--sidebar-text-main);
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-family: 'JetBrains Mono', monospace;
}

.nav-menu {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sidebar-section);
  padding: 12px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: #2B579A;
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background var(--transition-fast), color var(--transition-fast);
  cursor: pointer;
  position: relative;
  margin-bottom: 4px;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #ffffff;
}

.nav-item span {
  flex: 1;
  color: #ffffff;
}

.nav-item:hover {
  background: #18458A;
  color: #ffffff;
  text-decoration: none;
}

.nav-item:hover svg,
.nav-item:hover span {
  color: #ffffff;
}

.nav-item.active {
  background: #FCD00B;
  color: #ffffff;
  font-weight: 700;
}

.nav-item.active svg,
.nav-item.active span {
  color: #ffffff;
}

.nav-item.active::before {
  display: none;
}

.nav-badge {
  background: #dc2626;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  background: #2B579A;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--brand-primary-light);
  border: 1.5px solid var(--brand-primary-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--brand-primary);
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--sidebar-text-main);
  display: block;
}

.user-role {
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.btn-sidebar-logout {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  transition: background var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}

.btn-sidebar-logout:hover {
  background: #fee2e2;
  color: #dc2626;
}

.btn-sidebar-logout svg {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   Top Header (Scaled Fonts)
   ========================================================================== */
.top-header {
  grid-column: 2;
  background: #2B579A;
  border-bottom: 1px solid #1e4277;
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 18px;
  box-shadow: var(--shadow-xs);
}

.header-page-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  flex: 1;
  letter-spacing: -0.01em;
}

.sql-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 0.76rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  border: 1.5px solid;
  cursor: default;
}

.sql-status-indicator svg {
  width: 13px;
  height: 13px;
}

.status-connected {
  background: var(--status-success-bg);
  border-color: var(--status-success-border);
  color: var(--status-success-text);
}

.status-disconnected {
  background: var(--status-danger-bg);
  border-color: var(--status-danger-border);
  color: var(--status-danger-text);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-connected .pulse-dot {
  background: #16a34a;
  animation: pulseGreen 2s infinite;
}

.status-disconnected .pulse-dot {
  background: #dc2626;
}

/* Connection indicator states (conn-indicator-1 / conn-indicator-2) */
.sql-status-indicator.status-fiber {
  background: #16a34a;
  border-color: #15803d;
  color: #ffffff;
}

.sql-status-indicator.status-api {
  background: #facc15;
  border-color: #eab308;
  color: #000000;
}

.sql-status-indicator.status-offline {
  background: #dc2626;
  border-color: #b91c1c;
  color: #ffffff;
}

.sql-status-indicator.status-fiber .pulse-dot,
.sql-status-indicator.status-offline .pulse-dot {
  background: #ffffff;
}

.sql-status-indicator.status-api .pulse-dot {
  background: #000000;
}

.sql-status-indicator.status-fiber .pulse-dot,
.sql-status-indicator.status-api .pulse-dot {
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% {
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(22, 163, 74, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
  }
}

.header-clock {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  padding: 5px 12px;
  border-radius: 99px;
}

/* ==========================================================================
   Main Content (Scaled Sizing)
   ========================================================================== */
.main-content {
  grid-column: 2;
  overflow-y: auto;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--color-bg);
  height: calc(100vh - var(--header-height));
  box-sizing: border-box;
}

/* Full height container support */
.card-full-height {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ==========================================================================
   Page Header (Matches OMS Title Scale)
   ========================================================================== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.page-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.page-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Cards (Scaled Padding & Titles)
   ========================================================================== */
.card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title svg {
  width: 18px;
  height: 18px;
  color: var(--brand-primary);
}

.card-body {
  padding: 20px;
}

/* KPI Row (Generous KPI Sizing) */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--color-border-strong);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon svg {
  width: 24px;
  height: 24px;
}

.kpi-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.02em;
}

.kpi-label {
  font-size: 0.82rem;
  color: var(--text-primary);
  margin-top: 5px;
  font-weight: 600;
}

/* ==========================================================================
   Buttons (Generous Touch Targets & Font Sizes)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  transition: background var(--transition-fast), box-shadow var(--transition-fast),
    border-color var(--transition-fast), transform var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  border: 1px solid #1d4ed8;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  border-color: #1e40af;
  box-shadow: 0 4px 10px rgba(29, 78, 216, 0.35);
}

.btn-secondary {
  background: var(--color-white);
  color: var(--text-primary);
  border: 1px solid var(--color-border-strong);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.btn-danger {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
  border: 1.5px solid var(--status-danger-border);
}

.btn-danger:hover {
  background: #fee2e2;
}

.btn-success {
  background: var(--status-success-bg);
  color: var(--status-success-text);
  border: 1.5px solid var(--status-success-border);
}

.btn-success:hover {
  background: #dcfce7;
}

.btn-sm {
  padding: 6px 13px;
  font-size: 0.8rem;
}

.btn-sm svg {
  width: 14px;
  height: 14px;
}

.btn-icon {
  width: 35px;
  height: 35px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  color: var(--text-secondary);
  box-shadow: var(--shadow-xs);
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.btn-icon:hover {
  background: var(--color-bg);
  border-color: var(--color-border-strong);
  color: var(--text-primary);
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   Table (OMS Font Scale — Comfortable 0.9rem text, generous padding)
   ========================================================================== */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead th {
  background: #f1f5f9;
  padding: 10px 16px;
  text-align: left;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #334155;
  white-space: nowrap;
  border-bottom: 1.5px solid #cbd5e1;
  border-top: 1px solid var(--color-border);
}

tbody td {
  padding: 12px 16px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--color-divider);
  vertical-align: middle;
  font-size: 0.9rem;
}

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover {
  background: #f8fafc;
}

tbody tr:last-child td {
  border-bottom: none;
}

.table-empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-tertiary);
  font-size: 0.92rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.table-empty svg {
  width: 36px;
  height: 36px;
  color: var(--text-tertiary);
  opacity: 0.5;
}

/* ==========================================================================
   Status Badges (Larger, Readable Badges)
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-xs);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge svg {
  width: 12px;
  height: 12px;
}

.badge-pending {
  background: var(--status-warning-bg);
  border-color: var(--status-warning-border);
  color: var(--status-warning-text);
}

.badge-active {
  background: var(--status-success-bg);
  border-color: var(--status-success-border);
  color: var(--status-success-text);
}

.badge-closed {
  background: var(--status-danger-bg);
  border-color: var(--status-danger-border);
  color: var(--status-danger-text);
}

.badge-process {
  background: var(--status-info-bg);
  border-color: var(--status-info-border);
  color: var(--status-info-text);
}

/* ==========================================================================
   Search / Filter Bar
   ========================================================================== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.88rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.search-input::placeholder {
  color: var(--text-tertiary);
}

.search-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.filter-select {
  padding: 5px 14px;
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.88rem;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast);
}

.filter-select:focus {
  border-color: var(--brand-primary);
}

.filter-select option {
  background: var(--color-white);
}

/* ==========================================================================
   Form Elements
   ========================================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.form-control {
  padding: 9px 13px;
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  width: 100%;
}

.form-control::placeholder {
  color: var(--text-tertiary);
}

.form-control:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.form-control:disabled {
  background: var(--color-bg);
  opacity: 0.7;
  cursor: not-allowed;
}

textarea.form-control {
  resize: vertical;
  min-height: 90px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(3px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-lg {
  max-width: 920px;
}

.modal-xl {
  max-width: 1140px;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--color-bg);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.01em;
}

.modal-title svg {
  width: 20px;
  height: 20px;
  color: var(--brand-primary);
}

.btn-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.btn-modal-close:hover {
  background: var(--color-border);
  color: var(--text-primary);
}

.btn-modal-close svg {
  width: 17px;
  height: 17px;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  background: var(--color-bg);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 400px;
  pointer-events: all;
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(16px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.toast-icon svg {
  width: 19px;
  height: 19px;
}

.toast-message {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text-primary);
  font-weight: 500;
}

.toast-success {
  border-left: 4px solid #22c55e;
}

.toast-success .toast-icon svg {
  color: #22c55e;
}

.toast-error {
  border-left: 4px solid #ef4444;
}

.toast-error .toast-icon svg {
  color: #ef4444;
}

.toast-info {
  border-left: 4px solid var(--brand-primary);
}

.toast-info .toast-icon svg {
  color: var(--brand-primary);
}

.toast-warning {
  border-left: 4px solid #f59e0b;
}

.toast-warning .toast-icon svg {
  color: #f59e0b;
}

/* ==========================================================================
   Pagination (Readable Page Numbers & Info)
   ========================================================================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-top: 1px solid var(--color-divider);
  flex-wrap: wrap;
  gap: 10px;
  background: var(--color-bg);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.pagination-info {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.pagination-controls {
  display: flex;
  gap: 4px;
  align-items: center;
}

.page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 500;
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.page-btn:hover:not(:disabled) {
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  border-color: #93c5fd;
}

.page-btn.active {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}

.page-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.page-btn svg {
  width: 15px;
  height: 15px;
}

/* ==========================================================================
   Loading Spinner
   ========================================================================== */
.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--color-border);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 44px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ==========================================================================
   Detail Rows
   ========================================================================== */
.detail-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 0;
  border-bottom: 1px solid var(--color-divider);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-tertiary);
  font-weight: 700;
}

.detail-value {
  font-size: 0.94rem;
  color: var(--text-primary);
  font-weight: 500;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0 28px;
}

/* ==========================================================================
   Dashboard Grid
   ========================================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 960px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Chip
   ========================================================================== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ==========================================================================
   Empty State
   ========================================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
  text-align: center;
}

.empty-state svg {
  width: 40px;
  height: 40px;
  color: var(--text-tertiary);
}

.empty-state-title {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state-desc {
  font-size: 0.84rem;
  color: var(--text-tertiary);
}

/* ==========================================================================
   Tabs
   ========================================================================== */
.tabs {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  background: var(--color-white);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
}

.tab-btn {
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--color-bg);
}

.tab-btn.active {
  background: var(--color-white);
  color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

/* Full-Width Area Tabs for Memo Grid */
.memo-area-tabs-container {
  width: 100%;
  background: #33589C;
  border-bottom: 1px solid #cbd5e1;
  overflow: hidden;
}

.memo-area-tabs {
  display: flex;
  width: 100%;
  margin: 0;
  padding: 0;
}

.memo-area-tab-btn {
  flex: 1;
  padding: 10px 18px;
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
  border-radius: 0;
  border: none;
  background: #33589C;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
}

.memo-area-tab-btn:hover:not(.active) {
  background: #27467e;
  color: #ffffff;
}

.memo-area-tab-btn.active {
  background: #F7CF00;
  color: #0f172a;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   Loading Blocker & Animation for Service Memo Retrieval
   ========================================================================== */
.main-content.loading-blocked {
  pointer-events: none !important;
  user-select: none !important;
  position: relative;
}

.memo-loading-blocker {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  min-height: 350px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all !important;
  cursor: wait;
  border-radius: 12px;
  animation: memoFadeIn 0.2s ease-out;
}

.memo-spinner-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 26px 40px;
  border-radius: 14px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  min-width: 280px;
}

.memo-custom-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(247, 207, 0, 0.2);
  border-top-color: #F7CF00;
  border-right-color: #38bdf8;
  border-radius: 50%;
  animation: memoSpin 0.7s linear infinite;
}

@keyframes memoSpin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

@keyframes memoFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.memo-loading-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.02em;
  margin-top: 4px;
}

.memo-loading-subtitle {
  font-size: 0.80rem;
  color: #94a3b8;
  font-weight: 500;
}

/* Drag-to-select & compact table styles for Reconnection list */
.reconn-table-wrap.drag-selecting {
  user-select: none !important;
  -webkit-user-select: none !important;
}

.reconn-table tr.selected-row {
  background-color: #90C340 !important;
  color: #0f172a !important;
}

.reconn-table tr.selected-row td {
  background-color: #90C340 !important;
  border-bottom-color: #7ca835 !important;
  color: #0f172a !important;
}

/* Memo created green row highlight */
.reconn-table tr.reconn-row-memo:not(.selected-row) {
  background-color: #dcfce7 !important;
}

.reconn-table tr.reconn-row-memo:not(.selected-row) td {
  background-color: #dcfce7 !important;
}

.reconn-table tr.reconn-row-memo:not(.selected-row):hover,
.reconn-table tr.reconn-row-memo:not(.selected-row):hover td {
  background-color: #bbf7d0 !important;
}

.reconn-table tr.reconn-row-memo.selected-row,
.reconn-table tr.reconn-row-memo.selected-row td {
  background-color: #86efac !important;
  border-bottom-color: #4ade80 !important;
}

.reconn-table tbody tr:hover:not(.selected-row):not(.reconn-row-memo) {
  background-color: #f1f5f9;
}

/* ==========================================================================
   Misc Utility
   ========================================================================== */
.separator {
  height: 1px;
  background: var(--color-border);
  margin: 8px 0;
}

.notif-dot {
  width: 9px;
  height: 9px;
  background: #ef4444;
  border-radius: 50%;
  flex-shrink: 0;
}

select option {
  background: var(--color-white);
  color: var(--text-primary);
}

/* ==========================================================================
   Tripped Feeders Floating SCADA Panel Styles (Light Enterprise Theme)
   ========================================================================== */
.tf-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 340px;
  background: #ffffff;
  color: #0f172a;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);
  z-index: 9999;
  font-family: 'Inter', system-ui, sans-serif;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
  display: flex;
}

/* Snap to rightmost edge when collapsed */
.tf-panel-slide-out {
  right: 0 !important;
  left: auto !important;
  transform: translateX(calc(100% - 46px)) !important;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  box-shadow: -4px 6px 24px rgba(15, 23, 42, 0.14);
}

/* Side Tab (visible when collapsed or as side indicator) */
.tf-side-tab {
  width: 46px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 14px 6px;
  gap: 12px;
  cursor: pointer;
  border-right: 1px solid #e2e8f0;
  user-select: none;
  transition: background 0.15s ease;
}

.tf-side-tab:hover {
  background: #f1f5f9;
}

.tf-tab-icon {
  width: 18px;
  height: 18px;
  color: #dc2626;
}

/* Main Container */
.tf-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #ffffff;
}

/* Header & Drag Handle */
.tf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: #f8fafc;
  cursor: grab;
  user-select: none;
  border-bottom: 1px solid #e2e8f0;
}

.tf-header:active {
  cursor: grabbing;
}

.tf-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tf-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #0f172a;
}

.tf-icon {
  width: 16px;
  height: 16px;
  color: #dc2626;
}

/* Header Buttons */
.tf-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tf-btn {
  background: transparent;
  border: none;
  color: #64748b;
  padding: 5px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.tf-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.tf-btn i {
  width: 15px;
  height: 15px;
}

/* Spin animation for refresh button */
.tf-spin-icon {
  animation: tf-spin 0.8s linear infinite;
}

@keyframes tf-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Badges & Dots */
.tf-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  line-height: 1.2;
}

.tf-badge-alarm {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

.tf-badge-ok {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.tf-pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
  animation: tf-pulse 1.8s infinite;
}

.tf-dot-ok {
  background: #16a34a;
  animation: none;
}

@keyframes tf-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* Body & List */
.tf-body {
  padding: 12px 14px;
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #ffffff;
}

.tf-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tf-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 0.82rem;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

.tf-item:hover {
  border-color: #cbd5e1;
}

.tf-item-unack {
  border-color: #fecdd3;
  background: #fff1f2;
}

.tf-item-unack .tf-item-msg {
  color: #9f1239;
}

.tf-item-ack {
  border-color: #e2e8f0;
  background: #f8fafc;
}

.tf-item-new {
  animation: tf-highlight 2s ease-out;
}

@keyframes tf-highlight {
  0% {
    background: #fef3c7;
  }

  100% {
    background: #f8fafc;
  }
}

.tf-item-index {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 600;
}

.tf-item-msg {
  flex: 1;
  font-weight: 600;
  color: #0f172a;
}

.tf-ack-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
}

.tf-ack-ok {
  color: #16a34a;
  font-weight: 700;
  font-size: 0.8rem;
}

/* States */
.tf-state-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
  gap: 8px;
  color: #64748b;
  font-size: 0.85rem;
}

.tf-state-ok {
  color: #16a34a;
}

.tf-state-error {
  color: #dc2626;
}

.tf-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: tf-spin 0.7s linear infinite;
}

.tf-refresh-error {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecdd3;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 500;
}

/* Footer */
.tf-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
  font-size: 0.7rem;
  color: #64748b;
}

.tf-footer-icon {
  width: 12px;
  height: 12px;
}

.tf-auto-tag {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.65rem;
}

/* ==========================================================================
   Service Memo Print Preview Styles
   ========================================================================== */
#memo-report-preview-overlay,
#memo-report-preview-overlay *,
.memo-2up-sheet,
.memo-2up-sheet *,
.memo-single-sheet,
.memo-single-sheet * {
  font-family: Arial, Helvetica, sans-serif !important;
}

#memo-report-preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(4px);
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

@media print {
  @page {
    size: 12in 4in;
    margin: 3mm 6mm;
  }
  body > *:not(#memo-report-preview-overlay) {
    display: none !important;
  }
  #memo-report-preview-overlay {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    background: #fff !important;
    padding: 0 !important;
    display: block !important;
    backdrop-filter: none !important;
    z-index: auto !important;
  }
  #memo-report-preview-overlay > div {
    width: 100% !important;
    height: auto !important;
    background: #fff !important;
    border: none !important;
    box-shadow: none !important;
    display: block !important;
  }
  #memo-report-preview-overlay .memo-preview-toolbar {
    display: none !important;
  }
  #memo-report-preview-overlay .memo-preview-body {
    padding: 0 !important;
    background: #fff !important;
    display: block !important;
    overflow: visible !important;
  }
  #memo-report-preview-overlay .memo-2up-sheet {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }
}

/* ==========================================================================
   Low-Resolution & Compact Mode Optimizations
   ========================================================================== */

/* Memo Modal Grid */
.memo-modal-grid {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: #f8fafc;
  overflow-y: auto;
  flex: 1;
}
.memo-col-left {
  flex: 1.25;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #ffffff;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.memo-col-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 1. Responsive Adjustments for Low Res Monitors (e.g. 1366x768) */
@media (max-width: 1440px) {
  html { font-size: 14.5px; }
}
@media (max-width: 1366px) {
  html { font-size: 13.5px; }
  .app-container {
    padding: 10px;
  }
  /* Stack Memo Modal columns vertically */
  .memo-modal-grid {
    flex-direction: column;
    padding: 10px;
  }
  .memo-col-left, .memo-col-right {
    flex: none;
    width: 100%;
  }
  /* Reduce padding on major tables */
  .table th, .table td, .table-container th, .table-container td,
  table th, table td {
    padding: 6px 10px !important;
  }
}
@media (max-width: 1280px) {
  html { font-size: 12px; }
}

/* 2. Compact Mode (Toggled via JS on body) */
body.compact-mode table th,
body.compact-mode table td,
body.compact-mode .table th,
body.compact-mode .table td,
body.compact-mode .table-container th,
body.compact-mode .table-container td {
  padding: 4px 8px !important;
  font-size: 12px;
  line-height: 1.2;
}
body.compact-mode .btn {
  padding: 4px 10px;
}
body.compact-mode {
  --sidebar-width: 200px;
}
body.compact-mode .app-container {
  padding: 8px;
}

/* 3. Collapsible Sidebar Support */
.sidebar {
  transition: width 0.3s ease;
  overflow-x: hidden;
}
body.sidebar-collapsed {
  --sidebar-width: 72px;
}
body.sidebar-collapsed .sidebar .brand-title,
body.sidebar-collapsed .sidebar .brand-subtitle,
body.sidebar-collapsed .sidebar .nav-item span,
body.sidebar-collapsed .sidebar .nav-section-label,
body.sidebar-collapsed .sidebar .user-info {
  display: none;
}
body.sidebar-collapsed .sidebar .user-avatar {
  margin: 0 auto;
}
body.sidebar-collapsed .sidebar .nav-item {
  justify-content: center;
  padding: 12px;
}
body.sidebar-collapsed .sidebar .nav-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 4px;
  font-size: 10px;
}
body.sidebar-collapsed .sidebar .sidebar-footer {
  flex-direction: column;
  align-items: center;
  padding: 12px;
  gap: 12px;
}
.sidebar-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
body.sidebar-collapsed .sidebar-actions {
  flex-direction: column;
  margin-left: 0;
}

/* 4. Localized Scrolling */
.table-responsive-container {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  width: 100%;
}
.table-responsive-container thead th {
  position: sticky;
  top: 0;
  z-index: 10;
}

/* 5. Progressive Disclosure (Truncation) */
.text-truncate-cell {
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   ULTRA-COMPACT BILLING RECORD KWH & VARIANCE CHART
   ========================================================================== */
.kwh-analytics-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 8px 12px 10px 12px;
  margin-bottom: 10px;
}

.compact-kpi-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.kpi-item {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
  transition: border-color 0.15s;
}

.kpi-item:hover {
  border-color: #cbd5e1;
}

.kpi-item .kpi-label {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.67rem;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.kpi-item .kpi-value {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: #0f172a;
  font-size: 1.18rem;
  line-height: 1.2;
}

.kpi-item .kpi-sub {
  font-size: 0.73rem;
  font-weight: 600;
  margin-top: 3px;
}

.kpi-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  width: fit-content;
}

.kpi-tag.up { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.kpi-tag.down { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }

.behavior-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.behavior-pill.seasonal {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.behavior-pill.stable {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.behavior-pill.moderate {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.chart-body-wrapper {
  position: relative;
  height: 165px;
  display: flex;
  align-items: flex-end;
  padding-top: 32px;
  padding-bottom: 22px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding-left: 8px;
  padding-right: 8px;
}

.dashed-baseline {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed #94a3b8;
  pointer-events: none;
  z-index: 1;
}

.dashed-baseline-tag {
  position: absolute;
  right: 2px;
  transform: translateY(-100%);
  font-size: 0.62rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: #64748b;
  background: #ffffff;
  padding: 0 4px;
  border-radius: 3px;
  border: 1px solid #cbd5e1;
}

.peak-baseline {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dotted #f59e0b;
  pointer-events: none;
  z-index: 1;
}

.peak-baseline-tag {
  position: absolute;
  left: 2px;
  transform: translateY(-100%);
  font-size: 0.62rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #b45309;
  background: #fffbeb;
  padding: 0 4px;
  border-radius: 3px;
  border: 1px solid #fde68a;
}

.bars-track {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 6px;
  align-items: flex-end;
  border-bottom: 1.5px solid #cbd5e1;
  position: relative;
  z-index: 2;
}

.bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
  cursor: pointer;
}

.v-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.63rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  margin-bottom: 3px;
  white-space: nowrap;
  line-height: 1.1;
  text-align: center;
}

.v-pill.up { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.v-pill.down { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.v-pill.neutral { color: #94a3b8; font-size: 0.6rem; }
.v-pill.crown { background: #fef3c7; color: #b45309; border: 1px solid #fcd34d; font-size: 0.6rem; padding: 1px 3px; }

.bar-fill {
  width: 100%;
  max-width: 30px;
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  position: relative;
  transition: filter 0.15s, transform 0.15s;
}

.bar-fill.normal {
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
}

.bar-fill.peak {
  background: linear-gradient(180deg, #f59e0b 0%, #b45309 100%);
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
}

.bar-fill.lowest {
  background: linear-gradient(180deg, #14b8a6 0%, #0f766e 100%);
}

.bar-item:hover .bar-fill {
  filter: brightness(1.2);
  transform: scaleY(1.05);
  transform-origin: bottom;
}

.bar-item.selected .bar-fill {
  outline: 2px solid #0f172a;
  outline-offset: 1px;
}

.bar-num {
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  color: #ffffff;
  pointer-events: none;
}

.bar-lbl {
  position: absolute;
  bottom: -18px;
  font-size: 0.68rem;
  font-weight: 600;
  color: #64748b;
}

.bar-item.is-peak .bar-lbl {
  color: #b45309;
  font-weight: 800;
}

.bar-item.is-lowest .bar-lbl {
  color: #0f766e;
  font-weight: 800;
}

tr.billing-row-highlight td {
  background: #fef3c7 !important;
  font-weight: 600 !important;
}

/* ==========================================================================
   OPTION 1: SEAMLESS FOLDER TAB HIGHLIGHTING FOR CONSUMER DETAILS
   ========================================================================== */
.mem-tab-header-strip {
  background: #f8fafc;
  padding: 8px 12px 0 12px;
  border-bottom: 2px solid #2563eb !important;
}

#mem-tab-buttons {
  display: flex;
  gap: 6px;
  margin-bottom: -2px;
}

#mem-tab-buttons .tab-btn {
  border: 1px solid transparent;
  background: transparent;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #64748b;
  border-radius: 6px 6px 0 0;
  transition: all 0.15s ease;
  cursor: pointer;
}

#mem-tab-buttons .tab-btn:hover {
  color: #1e293b;
  background: #f1f5f9;
}

#mem-tab-buttons .tab-btn.active {
  background: #ffffff !important;
  color: #1d4ed8 !important;
  font-weight: 700 !important;
  border: 1.5px solid #cbd5e1 !important;
  border-top: 3.5px solid #2563eb !important;
  border-bottom: 3px solid #ffffff !important;
  box-shadow: 0 -2px 6px rgba(37,99,235,0.08);
  position: relative;
  z-index: 2;
}

#mem-tab-content {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  position: relative;
  z-index: 1;
}