/* ==========================================================================
   muRata HVAC SCADA System - Industrial EMS Stylesheet
   Author: AI Senior Front-End & SCADA Architect
   ========================================================================== */

:root {
  /* Brand Identity Colors */
  --murata-red: #E60012;
  --novas-red: #A61C1C;
  --novas-dark: #1E222D;
  --ems-green: #38B249;
  --ems-green-dark: #2E943D;
  --ems-green-light: #E8F5E9;

  /* Neutral & Canvas Colors */
  --bg-app: #F0F3F7;
  --bg-card: #FFFFFF;
  --bg-sidebar: #FFFFFF;
  --text-main: #1E293B;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --border-color: #E2E8F0;
  --border-dark: #CBD5E1;

  /* SCADA Industrial Status Colors */
  --status-running: #10B981;
  /* Emerald Green */
  --status-running-bg: #ECFDF5;
  --status-standby: #3B82F6;
  /* Industrial Blue */
  --status-standby-bg: #EFF6FF;
  --status-stopped: #94A3B8;
  /* Slate Gray */
  --status-stopped-bg: #F8FAFC;
  --status-warning: #F59E0B;
  /* Amber */
  --status-warning-bg: #FFFBEB;
  --status-critical: #EF4444;
  /* Bright Alarm Red */
  --status-critical-bg: #FEF2F2;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Shadows & Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Global Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  font-size: 13.5px;
  color: var(--text-main);
  background-color: var(--bg-app);
  line-height: 1.5;
  overflow-x: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
  transition: all 0.2s ease;
}

select,
input {
  font-family: inherit;
  font-size: 13px;
}

/* ==========================================================================
   1. TOP GLOBAL HEADER (EMS HEADER - 48px)
   ========================================================================== */
.global-header {
  height: 48px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.murata-logo-img {
  height: 28px;
  display: block;
  object-fit: contain;
}

.plant-location-badge {
  font-size: 11.5px;
  font-weight: 600;
  background: #F1F5F9;
  color: #475569;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid #E2E8F0;
}

/* Alarm Horn Pill in Center Header */
.header-center {
  display: flex;
  align-items: center;
}

.alarm-horn-pill {
  display: flex;
  align-items: center;
  background: #F8FAFC;
  border: 1px solid var(--border-dark);
  border-radius: 20px;
  padding: 2px 10px 2px 6px;
  gap: 12px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.horn-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #E2E8F0;
  color: #475569;
  transition: transform 0.2s, background 0.2s;
}

.horn-btn:hover {
  transform: scale(1.1);
  background: #CBD5E1;
}

.alarm-tier {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 13px;
}

.alarm-tier .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.tier-normal {
  color: #16A34A;
}

.tier-normal .dot {
  background: #16A34A;
  box-shadow: 0 0 6px #16A34A;
}

.tier-warning {
  color: #D97706;
}

.tier-warning .dot {
  background: #D97706;
  box-shadow: 0 0 6px #D97706;
}

.tier-critical {
  color: #DC2626;
}

.tier-critical .dot {
  background: #DC2626;
  box-shadow: 0 0 8px #DC2626;
}

.pulse-crit {
  animation: critPulse 1s infinite alternate;
}

@keyframes critPulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  100% {
    transform: scale(1.4);
    opacity: 0.7;
  }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.live-clock {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.user-avatar-icon {
  width: 16px;
  height: 16px;
  color: var(--ems-green);
}

.username {
  font-weight: 600;
  color: var(--text-main);
}

.divider {
  color: #CBD5E1;
}

.header-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12.5px;
}

.header-link:hover {
  color: var(--murata-red);
}

.novas-brand .novas-logo {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--novas-dark);
}

.novas-circle {
  display: inline-block;
  color: var(--novas-red);
}

/* ==========================================================================
   2. MAIN TOP NAVIGATION BAR (EMS TOPBAR - 42px)
   ========================================================================== */
.main-top-navbar {
  height: 42px;
  background: var(--ems-green);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 990;
  flex-shrink: 0;
}

.nav-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2px;
  align-items: center;
}

.nav-item {
  color: #FFFFFF;
  text-decoration: none;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.4px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.nav-item:hover {
  background: var(--ems-green-dark);
}

/* Active HVAC Tab Style */
.active-hvac-container {
  position: relative;
}

.nav-item-hvac.active {
  background: #FFFFFF !important;
  color: #1E293B !important;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  border: 1.5px solid var(--murata-red);
}

.spin-fan-icon {
  width: 16px;
  height: 16px;
  color: var(--ems-green);
  animation: spinFan 4s linear infinite;
}

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

.active-dot {
  width: 6px;
  height: 6px;
  background: var(--murata-red);
  border-radius: 50%;
}

.system-health-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.15);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  color: #FFFFFF;
  letter-spacing: 0.5px;
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ADE80;
  box-shadow: 0 0 8px #4ADE80;
}

/* ==========================================================================
   3. WORKSPACE LAYOUT (SIDEBAR + MAIN CANVAS)
   ========================================================================== */
.app-workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 90px);
}

/* Left Sidebar (250px) */
.hvac-sidebar {
  width: 250px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-header {
  padding: 14px 16px 8px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 13.5px;
  font-weight: 700;
  color: #334155;
  letter-spacing: 0.3px;
}

/* Filter Box in Sidebar */
.sidebar-filter-box {
  padding: 12px 16px;
  background: #F8FAFC;
  border-bottom: 1px solid var(--border-color);
}

.filter-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.filter-select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  color: var(--text-main);
  outline: none;
}

.filter-select:focus {
  border-color: var(--ems-green);
}

.filter-apply-btn {
  margin-top: 10px;
  width: 100%;
  padding: 6px;
  background: #FFFFFF;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.filter-apply-btn:hover {
  background: var(--ems-green-light);
  color: var(--ems-green-dark);
  border-color: var(--ems-green);
}

/* Menu Items List */
.hvac-menu-list {
  list-style: none;
  padding: 10px 8px;
  flex: 1;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.menu-item:hover {
  background: #F1F5F9;
  color: var(--text-main);
}

.menu-item.active {
  background: var(--ems-green-light);
  color: var(--ems-green-dark);
  font-weight: 600;
}

.menu-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3.5px;
  background: var(--ems-green);
  border-radius: 0 4px 4px 0;
}

.badge-tag {
  margin-left: auto;
  font-size: 9.5px;
  font-weight: 700;
  background: #E0E7FF;
  color: #4338CA;
  padding: 1px 6px;
  border-radius: 10px;
}

.badge-alarm-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  background: var(--status-critical);
  color: #FFFFFF;
  padding: 1px 7px;
  border-radius: 10px;
  font-family: var(--font-mono);
}

/* Sidebar Fleet Summary Box */
.sidebar-fleet-summary {
  padding: 12px 14px;
  margin: 10px;
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 11.5px;
}

.summary-head {
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 4px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

/* Main Content Canvas (Fluid Right Area) */
.hvac-main-canvas {
  flex: 1;
  background: var(--bg-app);
  overflow-y: auto;
  padding: 18px 24px;
}

.view-section {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

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

/* View Header Bar */
.view-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.title-group h2 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: #0F172A;
  letter-spacing: -0.3px;
}

.title-group p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-action-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.weather-mini-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #FFFFFF;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 12px;
  color: #334155;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.weather-mini-badge strong:first-of-type {
  color: #EA580C;
}

.weather-mini-badge strong:last-of-type {
  color: #0284C7;
}

.weather-icon-sun {
  width: 16px;
  height: 16px;
  color: #F59E0B;
  flex-shrink: 0;
  animation: sunGlow 3s ease-in-out infinite alternate;
}

@keyframes sunGlow {
  0% { transform: scale(0.95); opacity: 0.85; }
  100% { transform: scale(1.1); opacity: 1; filter: drop-shadow(0 0 4px #FBBF24); }
}

.time-range-picker {
  display: flex;
  background: #FFFFFF;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.time-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
}

.time-btn.active {
  background: var(--ems-green);
  color: #FFFFFF;
  font-weight: 600;
}

.btn-refresh,
.btn-primary,
.btn-secondary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
}

.btn-refresh {
  background: #FFFFFF;
  border: 1px solid var(--border-dark);
  color: #334155;
}

.btn-refresh:hover {
  background: #F8FAFC;
}

.btn-primary {
  background: var(--ems-green);
  color: #FFFFFF;
}

.btn-primary:hover {
  background: var(--ems-green-dark);
}

.btn-secondary {
  background: #FFFFFF;
  border: 1px solid var(--border-dark);
  color: #334155;
}

.btn-secondary:hover {
  background: #F1F5F9;
}

/* ==========================================================================
   4. DASHBOARD VIEW (CARDS, CHARTS, TABLES)
   ========================================================================== */
.kpi-cards-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 1440px) {
  .kpi-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 992px) {
  .kpi-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .kpi-cards-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.icon-blue {
  background: #EFF6FF;
  color: #2563EB;
}

.icon-amber {
  background: #FFFBEB;
  color: #D97706;
}

.icon-purple {
  background: #FAF5FF;
  color: #9333EA;
}

.icon-green {
  background: #ECFDF5;
  color: #059669;
}

.icon-weather {
  background: #FFF7ED;
  color: #EA580C;
}

.kpi-card-weather {
  border-left: 3px solid #F97316;
}

.kpi-content {
  flex: 1;
  min-width: 0;
}

.kpi-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-val {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: #0F172A;
  line-height: 1.2;
  margin: 2px 0 4px;
}

.kpi-val-weather {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.weather-temp-val {
  color: #EA580C;
  font-weight: 700;
}

.weather-val-sep {
  color: #94A3B8;
  font-weight: 300;
  font-size: 16px;
  margin: 0 3px;
}

.weather-hum-val {
  color: #0284C7;
  font-weight: 700;
}

.kpi-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-unit {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 1px;
}

.kpi-breakdown {
  display: flex;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 600;
  flex-wrap: wrap;
}

.tag-weather-load {
  background: #FEF3C7;
  color: #92400E;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.tag-heat-index {
  background: #FFEDD5;
  color: #9A3412;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.tag-run {
  color: #16A34A;
}

.tag-stop {
  color: #64748B;
}

.tag-alm {
  color: #DC2626;
}

.kpi-progress {
  margin-top: 4px;
}

.progress-bar-bg {
  height: 6px;
  background: #E2E8F0;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: #3B82F6;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.kpi-sub-text {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-cop-good {
  font-size: 10.5px;
  font-weight: 700;
  background: #DCFCE7;
  color: #15803D;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  margin-left: 6px;
}

/* Charts Two Columns */
.charts-two-cols,
.tables-two-cols {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
}

.flex-1 {
  flex: 1;
}

.flex-2 {
  flex: 2;
}

.chart-card,
.data-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FAFAFA;
}

.chart-head-with-toggles {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.head-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chart-metric-toggles {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chart-toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 12px;
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.chart-toggle-pill input[type="checkbox"] {
  display: none;
}

.chart-toggle-pill .toggle-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  transition: transform 0.2s ease;
}

.chart-toggle-pill.active.toggle-power {
  background: #EFF6FF;
  border-color: #93C5FD;
  color: #1E40AF;
}

.chart-toggle-pill.active.toggle-cop {
  background: #ECFDF5;
  border-color: #6EE7B7;
  color: #065F46;
}

.chart-toggle-pill.active.toggle-temp-outdoor {
  background: #FFF7ED;
  border-color: #FDBA74;
  color: #9A3412;
}

.chart-toggle-pill.active.toggle-hum-outdoor {
  background: #ECFEFF;
  border-color: #67E8F9;
  color: #155E75;
}

.chart-toggle-pill:not(.active) {
  opacity: 0.45;
  text-decoration: line-through;
  background: #F1F5F9;
  border-color: #E2E8F0;
}

.chart-toggle-pill:hover {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.card-head h3 {
  font-size: 13px;
  font-weight: 700;
  color: #1E293B;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.2px;
}

.card-hint {
  font-size: 11.5px;
  color: var(--text-muted);
}

.chart-canvas-wrap {
  padding: 14px;
  position: relative;
}

/* SCADA Tables */
.table-responsive {
  overflow-x: auto;
}

.scada-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
}

.scada-table th {
  background: #F1F5F9;
  color: #475569;
  font-weight: 600;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.scada-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #F1F5F9;
  color: #334155;
  white-space: nowrap;
}

.scada-table tbody tr:hover {
  background: #F8FAFC;
}

.pill-switch {
  display: flex;
  background: #E2E8F0;
  border-radius: var(--radius-sm);
  padding: 2px;
}

.pill-btn {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  border-radius: var(--radius-sm);
}

.pill-btn.active {
  background: #FFFFFF;
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   5. FLOOR PLAN SCADA VIEW
   ========================================================================== */
.floor-tabs {
  display: flex;
  gap: 4px;
  background: #E2E8F0;
  padding: 3px;
  border-radius: var(--radius-sm);
}

.floor-tab-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  border-radius: var(--radius-sm);
}

.floor-tab-btn.active {
  background: var(--ems-green);
  color: #FFFFFF;
}

.floor-toolbar {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tb-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tb-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.cb-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
}

.tb-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11.5px;
  color: #475569;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.badge-dot-green,
.badge-dot-gray,
.badge-dot-yellow,
.badge-dot-red {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.badge-dot-green {
  background: #10B981;
}

.badge-dot-gray {
  background: #94A3B8;
}

.badge-dot-yellow {
  background: #F59E0B;
}

.badge-dot-red {
  background: #EF4444;
}

.tb-zoom {
  display: flex;
  gap: 4px;
}

.btn-sm {
  padding: 4px 8px;
  background: #F1F5F9;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.btn-sm:hover {
  background: #E2E8F0;
}

/* Floorplan Viewport & Canvas */
.floorplan-viewport {
  background: #1E293B;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  overflow: auto;
  position: relative;
  height: calc(100vh - 250px);
  min-height: 520px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.floorplan-canvas {
  position: relative;
  display: inline-block;
  min-width: 1300px;
  transform-origin: 0 0;
  transition: transform 0.2s ease-out;
}

.blueprint-img {
  display: block;
  width: 100%;
  height: auto;
  filter: contrast(105%) brightness(98%);
}

.heatmap-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: radial-gradient(circle at 30% 30%, rgba(59, 130, 246, 0.25) 0%, transparent 40%),
    radial-gradient(circle at 60% 50%, rgba(16, 185, 129, 0.25) 0%, transparent 45%),
    radial-gradient(circle at 85% 70%, rgba(239, 68, 68, 0.3) 0%, transparent 40%);
}

.heatmap-overlay.visible {
  opacity: 1;
}

.nodes-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

/* SCADA Floating Device Node */
.scada-node-badge {
  position: absolute;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(4px);
  border: 1px solid #CBD5E1;
  border-radius: var(--radius-sm);
  padding: 4px 7px;
  font-size: 11px;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.15s ease;
  min-width: 105px;
  user-select: none;
}

.scada-node-badge:hover {
  transform: translate(-50%, -50%) scale(1.1);
  z-index: 50;
  border-color: var(--ems-green);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.node-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #E2E8F0;
  padding-bottom: 2px;
  margin-bottom: 3px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.node-status-led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

.node-fan-spin {
  width: 12px;
  height: 12px;
  animation: spinFan 3s linear infinite;
  color: var(--ems-green);
}

.node-body {
  font-size: 10px;
  line-height: 1.3;
}

.node-temp-line {
  font-weight: 600;
  color: #0F172A;
}

.node-sub-line {
  color: var(--text-muted);
}

.node-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 3px;
  padding-top: 2px;
  border-top: 1px dashed #E2E8F0;
}

.water-leak-indicator {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 9.5px;
  font-weight: 600;
  color: #0284C7;
}

/* Alarm States on Node */
.scada-node-badge.state-alarm {
  border: 2px solid var(--status-critical) !important;
  background: #FFF1F2 !important;
  animation: nodeAlarmGlow 1s infinite alternate;
}

@keyframes nodeAlarmGlow {
  0% {
    box-shadow: 0 0 4px #EF4444;
  }

  100% {
    box-shadow: 0 0 16px #EF4444;
  }
}

.scada-node-badge.state-alarm .water-leak-indicator {
  color: var(--status-critical) !important;
  font-weight: 800;
  animation: critPulse 0.5s infinite alternate;
}

/* ==========================================================================
   6. CENTRALIZED CONTROL VIEW
   ========================================================================== */
.control-grid-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 16px;
}

.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-select,
.form-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
}

.unit-quick-info {
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 14px;
  font-size: 12px;
}

.q-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.badge-run {
  background: #DCFCE7;
  color: #15803D;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.badge-stop {
  background: #F1F5F9;
  color: #64748B;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.badge-warn {
  background: #FEF3C7;
  color: #B45309;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.badge-crit {
  background: #FEE2E2;
  color: #B91C1C;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.ctrl-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-ctrl-action {
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #FFFFFF;
}

.btn-power-on {
  background: var(--status-running);
}

.btn-power-on:hover {
  background: #059669;
}

.btn-power-off {
  background: var(--status-critical);
}

.btn-power-off:hover {
  background: #DC2626;
}

/* Setpoint Stepper */
.setpoint-stepper-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
}

.btn-step {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1px solid var(--border-dark);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-step:hover {
  background: #E2E8F0;
}

.temp-display {
  display: flex;
  align-items: baseline;
}

.temp-val {
  font-family: var(--font-heading);
  font-size: 34px;
  font-weight: 800;
  color: #0F172A;
}

.temp-unit {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 4px;
}

.temp-limit-slider-box {
  background: #F1F5F9;
  padding: 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.limit-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 6px;
}

.limit-slider-track {
  height: 8px;
  background: #CBD5E1;
  border-radius: 4px;
  position: relative;
  margin-bottom: 6px;
}

.slider-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--ems-green);
  border-radius: 4px;
}

.mode-select-row {
  margin-bottom: 12px;
}

.mode-select-row label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.mode-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.btn-mode {
  padding: 6px;
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-mode.active {
  background: #EFF6FF;
  border-color: #3B82F6;
  color: #2563EB;
}

.btn-apply-full {
  width: 100%;
  padding: 9px;
  background: var(--ems-green);
  color: #FFFFFF;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-apply-full:hover {
  background: var(--ems-green-dark);
}

.role-badge {
  font-size: 10.5px;
  font-weight: 600;
  background: #FEF3C7;
  color: #92400E;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.group-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.btn-grp {
  padding: 8px 6px;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-grp-on {
  background: #DCFCE7;
  color: #15803D;
  border: 1px solid #86EFAC;
}

.btn-grp-off {
  background: #FEE2E2;
  color: #B91C1C;
  border: 1px solid #FCA5A5;
}

.btn-grp-temp {
  background: #E0E7FF;
  color: #4338CA;
  border: 1px solid #A5B4FC;
}

/* Shift Tags & Schedule Matrix */
.shift-tags {
  display: flex;
  gap: 6px;
}

.shift-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.s1 {
  background: #DCFCE7;
  color: #15803D;
}

.s2 {
  background: #DBEAFE;
  color: #1D4ED8;
}

.s3 {
  background: #F3E8FF;
  color: #7E22CE;
}

.schedule-matrix-wrap {
  overflow-x: auto;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.schedule-table th {
  background: #F1F5F9;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  text-align: center;
}

.schedule-table td {
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  text-align: center;
}

.cell-on {
  background: #DCFCE7;
  color: #166534;
  font-weight: 600;
}

.cell-eco {
  background: #FEF3C7;
  color: #92400E;
  font-weight: 600;
}

.cell-off {
  background: #F8FAFC;
  color: #94A3B8;
}

.schedule-actions-bar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.search-box-wrap input {
  padding: 5px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 220px;
}

/* ==========================================================================
   7. MONITORING & COP VIEW
   ========================================================================== */
.mon-view-header {
  margin-bottom: 10px;
}

.monitoring-split-layout {
  display: grid;
  grid-template-columns: 70% calc(30% - 12px);
  gap: 12px;
  align-items: start;
}

@media (max-width: 1280px) {
  .monitoring-split-layout {
    grid-template-columns: 1fr;
  }
}

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

.mon-col-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drilldown-hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-top-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1.5px solid var(--border-color);
  padding-bottom: 8px;
}

.machine-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.machine-title h3 {
  font-family: var(--font-heading);
  font-size: 14.5px;
  font-weight: 700;
  color: #0F172A;
  margin: 0;
}

.machine-title span {
  font-size: 11px;
  color: var(--text-muted);
}

/* Vertical Stack Sections inside drilldown-hero-card */
.mon-sec-block {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.mon-sec-head {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #334155;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 4px;
  margin-bottom: 6px;
  border-bottom: 1.5px solid #E2E8F0;
}

.mon-sec-head i {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

.mon-param-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mon-param-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 3px 0;
  font-size: 12.5px;
  border-bottom: 1px dashed rgba(226, 232, 240, 0.7);
}

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

.mon-param-label {
  color: #475569;
  font-weight: 500;
}

.mon-param-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #0F172A;
}

.cop-hero-display {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2px;
}

.cop-number-big {
  font-family: var(--font-heading);
  font-size: 34px;
  font-weight: 800;
  color: #10B981;
  line-height: 1;
}

.cop-tag-state {
  font-size: 11px;
  font-weight: 700;
  background: #FEF3C7;
  color: #92400E;
  padding: 3px 10px;
  border-radius: 9999px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.cop-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin: 2px 0 6px 0;
}

.cop-chart-legend {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  margin-top: 4px;
  color: var(--text-muted);
}

.sensor-safety-status-inline {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.sensor-safety-status-inline .sensor-badge {
  flex: 1;
  padding: 3px 6px;
  font-size: 10px;
}

.formula-guide-box {
  padding: 14px 16px;
  background: #F8FAFC;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.formula-guide-box code {
  font-family: var(--font-mono);
  background: #E2E8F0;
  padding: 2px 6px;
  border-radius: 3px;
  color: #0F172A;
  margin-left: 8px;
}

/* SCADA Package Diagram Card */
.scada-diagram-card {
  margin-top: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.scada-card-head {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.scada-card-head h3 {
  font-size: 12.5px;
  font-weight: 700;
  color: #0F172A;
  display: flex;
  align-items: center;
  gap: 6px;
}

.scada-pill-badge {
  font-size: 11px;
  padding: 2px 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-xs-scada {
  padding: 3px 8px;
  font-size: 11.5px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.scada-svg-container {
  background: #0f172a;
  padding: 6px 10px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  flex: 1;
}

.scada-svg-container svg {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: calc(100vh - 205px);
  display: block;
}

.formula-compact-details {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.formula-compact-details summary {
  padding: 6px 12px;
  background: #F8FAFC;
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
}

/* Animations for SCADA Diagram */
@keyframes scadaFanSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.scada-fan-blade {
  animation: scadaFanSpin 1.5s linear infinite;
  transform-origin: 0px 0px;
}

@keyframes scadaDashFlow {
  from { stroke-dashoffset: 28; }
  to { stroke-dashoffset: 0; }
}

.scada-flow-3p {
  stroke-dasharray: 10, 4;
  animation: scadaDashFlow 0.8s linear infinite;
}

.scada-flow-1p {
  stroke-dasharray: 8, 4;
  animation: scadaDashFlow 1s linear infinite;
}

.scada-flow-f1f2 {
  stroke-dasharray: 6, 3;
  animation: scadaDashFlow 0.6s linear infinite;
}

.scada-flow-gas {
  stroke-dasharray: 12, 6;
  animation: scadaDashFlow 1.2s linear infinite;
}

.scada-flow-liquid {
  stroke-dasharray: 8, 4;
  animation: scadaDashFlow 1s linear infinite reverse;
}

@keyframes scadaAirPulse {
  0% { opacity: 0.35; }
  50% { opacity: 1; }
  100% { opacity: 0.35; }
}

.scada-air-flow,
.scada-return-air-flow {
  animation: scadaAirPulse 1.8s ease-in-out infinite;
}

@keyframes scadaLedPulse {
  0% { opacity: 0.7; filter: drop-shadow(0 0 2px #22c55e); }
  50% { opacity: 1; filter: drop-shadow(0 0 8px #22c55e); }
  100% { opacity: 0.7; filter: drop-shadow(0 0 2px #22c55e); }
}

.scada-led-active {
  animation: scadaLedPulse 2s ease-in-out infinite;
}

.scada-no-anim .scada-fan-blade,
.scada-no-anim .scada-flow-3p,
.scada-no-anim .scada-flow-1p,
.scada-no-anim .scada-flow-f1f2,
.scada-no-anim .scada-flow-gas,
.scada-no-anim .scada-flow-liquid,
.scada-no-anim .scada-air-flow,
.scada-no-anim .scada-return-air-flow,
.scada-no-anim .scada-led-active {
  animation: none !important;
}

/* ==========================================================================
   8. ALARMS VIEW
   ========================================================================== */
.alarm-stats-strip {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.stat-pill {
  flex: 1;
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-pill strong {
  font-family: var(--font-mono);
  font-size: 16px;
}

.stat-pill.crit {
  border-left: 4px solid var(--status-critical);
}

.stat-pill.warn {
  border-left: 4px solid var(--status-warning);
}

.stat-pill.norm {
  border-left: 4px solid var(--status-running);
}

.alarm-layout-split {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
}

.filter-pills {
  display: flex;
  gap: 4px;
}

.filter-pill {
  padding: 3px 8px;
  background: #F1F5F9;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  color: #475569;
}

.filter-pill.active {
  background: #E2E8F0;
  color: #0F172A;
}

.alarm-detail-banner-crit {
  background: #FEE2E2;
  border: 1px solid #FCA5A5;
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.alarm-big-icon {
  width: 32px;
  height: 32px;
  color: #DC2626;
}

.alarm-detail-banner-crit h4 {
  font-size: 13.5px;
  font-weight: 700;
  color: #991B1B;
}

.detail-field-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
  margin-bottom: 16px;
}

.d-field span {
  color: var(--text-muted);
  display: inline-block;
  width: 140px;
}

.d-field p {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.4;
}

.btn-ack-huge {
  width: 100%;
  padding: 12px;
  background: #DC2626;
  color: #FFFFFF;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.3);
}

.btn-ack-huge:hover {
  background: #B91C1C;
}

.alarm-bottom-charts {
  display: flex;
  gap: 14px;
}

/* ==========================================================================
   9. REPORTS VIEW (A4 SHEET PREVIEW)
   ========================================================================== */
.report-overview-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.r-item {
  font-size: 12px;
}

.r-item strong {
  font-size: 14px;
  margin-left: 4px;
}

.trend-up {
  color: #16A34A;
  font-weight: 700;
  font-size: 11px;
}

.trend-down {
  color: #DC2626;
  font-weight: 700;
  font-size: 11px;
}

.report-main-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}

.report-nav-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.report-nav-card h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}

.report-types-list {
  list-style: none;
}

.r-type-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 6px;
}

.r-type-item:hover {
  background: #F8FAFC;
}

.r-type-item.active {
  background: var(--ems-green-light);
  border-left: 3px solid var(--ems-green);
}

.r-type-item strong {
  display: block;
  font-size: 12.5px;
  color: #1E293B;
}

.r-type-item small {
  display: block;
  font-size: 10.5px;
  color: var(--text-muted);
}

.report-preview-canvas {
  background: #FFFFFF;
  padding: 24px;
}

.report-sheet-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 2px solid #0F172A;
  padding-bottom: 10px;
  margin-bottom: 16px;
}

.rs-company {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--murata-red);
}

.rs-facility {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
}

.rs-doc-id {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.rs-date {
  font-size: 11px;
  color: var(--text-muted);
}

.rs-title-block {
  text-align: center;
  margin-bottom: 20px;
}

.rs-title-block h3 {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 800;
  color: #0F172A;
}

.rs-title-block p {
  font-size: 12px;
  color: var(--text-muted);
}

.rs-table th {
  background: #F8FAFC !important;
}

.tr-total td {
  background: #F1F5F9;
}

.rs-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  margin-top: 36px;
  text-align: center;
}

.sig-space {
  height: 60px;
}

/* ==========================================================================
   10. SYSTEM ARCHITECTURE VIEW
   ========================================================================== */
.arch-img-wrap {
  padding: 20px;
  text-align: center;
  background: #FFFFFF;
}

.arch-full-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   11. MODAL QUICK CONTROL & DEMO CONTROLLER
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  width: 420px;
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalScale 0.2s ease-out;
}

@keyframes modalScale {
  from {
    transform: scale(0.94);
  }

  to {
    transform: scale(1);
  }
}

.modal-header {
  padding: 12px 18px;
  background: #F8FAFC;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: #0F172A;
}

.btn-close-modal {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.btn-close-modal:hover {
  background: #E2E8F0;
}

.modal-body {
  padding: 18px;
}

.mdl-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12.5px;
}

.mdl-telemetry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.mdl-t-card {
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.mdl-t-card span {
  display: block;
  font-size: 10.5px;
  color: var(--text-muted);
}

.mdl-t-card strong {
  font-size: 14px;
  font-family: var(--font-mono);
  color: #0F172A;
}

.mdl-mode-row {
  margin-bottom: 12px;
}

.mdl-mode-buttons {
  display: flex;
  gap: 6px;
}

.mdl-mode-buttons .btn-mode {
  flex: 1;
  padding: 6px 4px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.mdl-setpoint-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #F1F5F9;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 14px;
}

.mdl-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mdl-temp-val {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  color: #0F172A;
}

.mdl-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Floating Demo Controller - Chỉ hiển thị tại trang 2. Mặt bằng SCADA 2D */
.demo-floating-bar {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1E293B;
  color: #FFFFFF;
  border: 1px solid #334155;
  border-radius: 28px;
  padding: 8px 16px;
  display: none; /* Mặc định ẩn, chỉ hiển thị tại trang 2. Mặt bằng SCADA 2D */
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 1500;
  backdrop-filter: blur(8px);
}

.demo-bar-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: #94A3B8;
  border-right: 1px solid #334155;
  padding-right: 12px;
}

.demo-buttons-row {
  display: flex;
  gap: 8px;
}

.btn-demo-sim {
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 11.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #FFFFFF;
  transition: transform 0.15s;
}

.btn-demo-sim:hover {
  transform: translateY(-2px);
}

.btn-demo-leak {
  background: #DC2626;
}

.btn-demo-filter {
  background: #D97706;
}

.btn-demo-reset {
  background: #16A34A;
}

/* Custom Toast Container */
.toast-container {
  position: fixed;
  top: 60px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  background: #1E293B;
  color: #FFFFFF;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  animation: toastIn 0.25s ease-out;
  pointer-events: auto;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

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

/* Report Content Panels & KPI Summary */
.report-content-panel {
  display: none;
  animation: fadeIn 0.2s ease-out;
}

.report-content-panel.active {
  display: block;
}

.rs-kpi-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.rs-kpi-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
}

.rs-kpi-box span {
  font-size: 11px;
  font-weight: 600;
  color: #64748B;
  margin-bottom: 4px;
}

.rs-kpi-box strong {
  font-size: 19px;
  font-family: var(--font-mono);
  color: #0F172A;
}

.rs-kpi-box small {
  font-size: 11px;
  color: #94A3B8;
  margin-top: 2px;
}

.rs-subhead {
  font-size: 12.5px;
  font-weight: 700;
  color: #1E293B;
  margin: 14px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   TREND ANALYTICS (VIEW 6 EXTENSION)
   ========================================================================== */
.trend-control-bar {
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.trend-ctrl-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.trend-ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.trend-ctrl-group .ctrl-label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 6px;
}

.trend-scope-pills {
  display: inline-flex;
  background: #E2E8F0;
  padding: 3px;
  border-radius: 8px;
  gap: 3px;
}

.trend-scope-pills .scope-pill {
  border: none;
  background: transparent;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.trend-scope-pills .scope-pill:hover {
  color: #0F172A;
}

.trend-scope-pills .scope-pill.active {
  background: #FFFFFF;
  color: #065F46;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  font-weight: 700;
}

.trend-metrics-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
  flex-wrap: wrap;
}

.metrics-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #64748B;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-right: 4px;
}

.trend-metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.trend-metric-pill:hover {
  border-color: #94A3B8;
  background: #F1F5F9;
}

.trend-metric-pill input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--ems-green);
}

.trend-metric-pill .color-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.trend-chart-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 14px;
  margin-bottom: 16px;
}

.trend-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #F1F5F9;
}

.trend-chart-head h4 {
  font-size: 13px;
  font-weight: 700;
  color: #0F172A;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-legend-hints .badge-hint {
  font-size: 11px;
  color: #64748B;
  display: flex;
  align-items: center;
  gap: 4px;
  background: #F1F5F9;
  padding: 4px 8px;
  border-radius: 4px;
}

/* ==========================================================================
   12. LOGIN SCREEN (ECOSTRUXURE PME BRANDING - LOGIN.PNG SPECIFICATION)
   ========================================================================== */
.login-screen-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 40%, #1e293b 0%, #0b132b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.login-screen-wrapper.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.login-card-container {
  max-width: 957px;
  width: 100%;
  padding: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-card-box {
  width: 957px;
  height: 498px;
  background: url('../images/login.png') no-repeat center center;
  background-size: 957px 498px;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  overflow: hidden;
}

.login-form-overlay {
  position: absolute;
  left: 672px;
  top: 341px;
  width: 240px;
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.login-input {
  width: 240px;
  height: 32px;
  font-size: 13px;
  font-style: italic;
  font-family: inherit;
  border: 1px solid #767676;
  border-radius: 2px;
  padding: 0 8px;
  background: #ffffff;
  color: #1e293b;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-input:focus {
  border-color: #4ebf53;
  box-shadow: 0 0 0 2px rgba(78, 191, 83, 0.25);
}

.login-input+.login-input {
  margin-top: 8px;
}

.login-btn-submit {
  width: 240px;
  height: 33px;
  margin-top: 9px;
  font-size: 14px;
  font-style: italic;
  font-weight: 700;
  font-family: inherit;
  color: #ffffff;
  background: #4ebf53;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease;
  box-sizing: border-box;
}

.login-btn-submit:hover {
  background: #43a847;
}

.login-btn-submit:active {
  background: #38923c;
  transform: translateY(1px);
}

.login-error-text {
  width: 240px;
  font-size: 11px;
  font-weight: 600;
  color: #dc2626;
  margin-top: 6px;
  background: #fef2f2;
  padding: 4px 8px;
  border-radius: 3px;
  border: 1px solid #fca5a5;
  box-sizing: border-box;
  text-align: left;
  animation: fadeInError 0.2s ease;
}

@keyframes fadeInError {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

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

@media (max-width: 992px) {
  .login-card-container {
    transform-origin: center center;
    transform: scale(calc((100vw - 32px) / 957));
  }
}

/* =========================================================================
   VIEW 8: TRUNG TÂM PHÂN TÍCH & DỰ ĐOÁN DỰA VÀO AI (AI PREDICTIVE SCADA)
   ========================================================================= */

.badge-tag-ai {
  background: linear-gradient(135deg, #7C3AED, #2563EB);
  color: #FFFFFF;
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  margin-left: auto;
  letter-spacing: 0.6px;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.35);
  animation: pulseAiBadge 2.4s infinite;
}

@keyframes pulseAiBadge {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0);
  }
}

/* AI Hero Strip */
.ai-hero-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.ai-kpi-card {
  background: var(--card-bg, #FFFFFF);
  border: 1px solid var(--border-color, #E2E8F0);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s, box-shadow 0.2s;
}

.ai-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.07);
}

.ai-kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-kpi-icon i {
  width: 22px;
  height: 22px;
}

.icon-cyan {
  background: #E0F2FE;
  color: #0284C7;
}

.icon-amber {
  background: #FEF3C7;
  color: #D97706;
}

.icon-green {
  background: #DCFCE7;
  color: #16A34A;
}

.icon-red {
  background: #FEE2E2;
  color: #DC2626;
}

.ai-kpi-content {
  flex: 1;
  min-width: 0;
}

.ai-kpi-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted, #64748B);
  letter-spacing: 0.5px;
}

.ai-kpi-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main, #0F172A);
  line-height: 1.2;
  margin: 2px 0;
}

.ai-kpi-val small {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, #64748B);
}

.ai-kpi-sub {
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* AI Workspace Grid Layout */
.ai-workspace-grid {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.ai-col-left {
  flex: 1;
  min-width: 0;
}

.ai-col-right {
  width: 440px;
  flex-shrink: 0;
}

.ai-card {
  border-radius: 8px;
  border: 1px solid var(--border-color, #E2E8F0);
  background: var(--card-bg, #FFFFFF);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ai-badge-model {
  font-size: 11px;
  color: #475569;
  background: #F1F5F9;
  padding: 3px 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
  border: 1px solid #E2E8F0;
}

.ai-badge-copilot {
  font-size: 11px;
  color: #16A34A;
  background: #DCFCE7;
  padding: 3px 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  border: 1px solid #BBF7D0;
}

/* Custom Forecast Chart Legend */
.chart-legend-custom {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 11px;
  color: #64748B;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.legend-line {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
}

.line-actual {
  background: #0284C7;
}

.line-baseline {
  background: #94A3B8;
  border-top: 1px dashed #64748B;
}

.line-predicted {
  background: #10B981;
  border-top: 1px dashed #059669;
}

.line-weather {
  background: #F59E0B;
}

/* Forecast Insight Bar */
.ai-forecast-insight-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 10px 14px;
  margin-top: 12px;
  font-size: 12px;
  color: #334155;
}

.insight-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.insight-item i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Health Filter Pills */
.ai-health-filter-pills {
  display: flex;
  gap: 6px;
  align-items: center;
}

.health-pill {
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}

.health-pill:hover {
  background: #E2E8F0;
}

.health-pill.active {
  background: #1E293B;
  color: #FFFFFF;
  border-color: #1E293B;
}

.health-pill.pill-alert {
  color: #DC2626;
  border-color: #FECACA;
  background: #FEF2F2;
}

.health-pill.pill-alert.active {
  background: #DC2626;
  color: #FFFFFF;
  border-color: #DC2626;
}

/* Health Table Cells */
.health-score-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 90px;
}

.health-number {
  font-weight: 800;
  font-size: 12.5px;
  width: 38px;
}

.health-bar-track {
  flex: 1;
  height: 6px;
  background: #E2E8F0;
  border-radius: 3px;
  overflow: hidden;
}

.health-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.tr-highlight-alert {
  background: #FFFBEB !important;
}

.rul-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 10px;
  background: #F1F5F9;
  color: #475569;
  font-weight: 500;
  white-space: nowrap;
}

.rul-badge.rul-urgent {
  background: #FEE2E2;
  color: #DC2626;
  font-weight: 700;
  border: 1px solid #FCA5A5;
}

/* Scenario Optimization Box */
.ai-scenario-tabs {
  display: flex;
  gap: 6px;
}

.ai-sc-btn {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}

.ai-sc-btn:hover {
  background: #E2E8F0;
}

.ai-sc-btn.active {
  background: #0284C7;
  color: #FFFFFF;
  border-color: #0284C7;
}

.scenario-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.scenario-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0F172A;
  margin-bottom: 4px;
}

.scenario-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-block;
}

.badge-peak {
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid #FDE68A;
}

.badge-smart {
  background: #E0F2FE;
  color: #0369A1;
  border: 1px solid #BAE6FD;
}

.badge-night {
  background: #F3E8FF;
  color: #7E22CE;
  border: 1px solid #E9D5FF;
}

.scenario-desc {
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 12px;
}

.scenario-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.sc-metric-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 10px;
  font-size: 11px;
}

.sc-metric-box span {
  display: block;
  color: #64748B;
  margin-bottom: 2px;
}

.sc-metric-box strong {
  font-size: 14px;
  font-weight: 700;
}

.ai-guardrail-notice {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 11px;
  color: #166534;
  margin-bottom: 14px;
}

.ai-guardrail-notice i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.ai-guardrail-notice strong {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
}

.ai-guardrail-notice p {
  margin: 0;
  line-height: 1.4;
  color: #15803D;
}

.btn-apply-ai-recom {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFFFFF;
  border: none;
  font-weight: 700;
  font-size: 13px;
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-apply-ai-recom:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

/* AI Copilot Card & Chat Interface */
.ai-copilot-body {
  display: flex;
  flex-direction: column;
  height: 380px;
  padding: 12px !important;
}

.ai-prompt-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid #E2E8F0;
  scrollbar-width: none;
}

.ai-prompt-chips::-webkit-scrollbar {
  display: none;
}

.prompt-chip {
  padding: 5px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  color: #334155;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
}

.prompt-chip:hover {
  background: #0284C7;
  color: #FFFFFF;
  border-color: #0284C7;
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
  margin-bottom: 10px;
}

.chat-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  max-width: 95%;
  animation: fadeIn 0.2s ease-out;
}

.msg-ai {
  align-self: flex-start;
}

.msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1E293B;
  color: #38BDF8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.msg-avatar i {
  width: 16px;
  height: 16px;
}

.msg-bubble {
  background: #F1F5F9;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: #1E293B;
  line-height: 1.5;
  border: 1px solid #E2E8F0;
}

.msg-user .msg-bubble {
  background: #0284C7;
  color: #FFFFFF;
  border-color: #0284C7;
}

.msg-bubble p {
  margin: 0 0 6px 0;
}

.msg-bubble p:last-child {
  margin: 0;
}

.msg-time {
  display: block;
  font-size: 10px;
  color: #94A3B8;
  text-align: right;
  margin-top: 4px;
}

.msg-user .msg-time {
  color: #BAE6FD;
}

.msg-sources {
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px dashed #CBD5E1;
  font-size: 10.5px;
  color: #64748B;
}

.typing-dots {
  color: #64748B;
  font-style: italic;
  font-size: 11.5px;
}

.ai-chat-input-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 4px 6px;
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 10px;
  font-size: 12px;
  color: #0F172A;
  outline: none;
}

.btn-chat-send {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #0284C7;
  color: #FFFFFF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-chat-send:hover {
  background: #0369A1;
}

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