/*
 * IMAGE2 APPROVED DIRECTION · SHARED VISUAL SYSTEM V1
 * Loaded last (before page-specific overlays). It converts the existing
 * operations prototype into the approved deep-water technology-blue series.
 */

:root {
  --i2-bg-0: #020b14;
  --i2-bg-1: #061522;
  --i2-bg-2: #0a2133;
  --i2-panel: rgba(5, 21, 33, .88);
  --i2-panel-strong: rgba(7, 28, 43, .95);
  --i2-panel-soft: rgba(10, 34, 50, .78);
  --i2-line: rgba(58, 184, 226, .34);
  --i2-line-soft: rgba(86, 174, 204, .16);
  --i2-line-strong: rgba(53, 216, 255, .7);
  --i2-cyan: #39d8ff;
  --i2-aqua: #55e7d2;
  --i2-blue: #4ba6ff;
  --i2-amber: #ffb84a;
  --i2-danger: #ff675d;
  --i2-text: #effaff;
  --i2-text-2: #b6ced9;
  --i2-text-3: #7899a9;
  --i2-radius: 6px;
  --i2-shadow: 0 18px 46px rgba(0, 4, 10, .36);
  --i2-ease: cubic-bezier(.22, .74, .22, 1);
  --teal: var(--i2-aqua);
  --teal-bright: #91f5e7;
  --blue: var(--i2-blue);
  --amber: var(--i2-amber);
  --red: var(--i2-danger);
  --border: var(--i2-line-soft);
  --border-strong: var(--i2-line);
  --text: var(--i2-text);
  --text-2: var(--i2-text-2);
  --text-3: var(--i2-text-3);
  --ops-cyan: var(--i2-aqua);
  --ops-blue: var(--i2-blue);
  --ops-amber: var(--i2-amber);
  --ops-red: var(--i2-danger);
  --ops-panel: var(--i2-panel);
  --ops-panel-2: var(--i2-panel-strong);
  --ops-line: var(--i2-line-soft);
  --ops-muted: var(--i2-text-3);
}

html,
body {
  background: var(--i2-bg-0) !important;
}

body {
  position: relative;
  color: var(--i2-text);
  font-size: 14px;
  font-feature-settings: "tnum" 1;
  text-rendering: geometricPrecision;
}

/* A real bitmap texture is used here so the screen never reads as a flat fill. */
body::before {
  position: fixed !important;
  inset: 0 !important;
  z-index: -2 !important;
  display: block !important;
  background-color: #03101a !important;
  background-image: url("./assets/tech-frame-v5-glass.png") !important;
  background-position: center !important;
  background-size: 100% 100% !important;
  opacity: .22 !important;
  filter: hue-rotate(10deg) saturate(1.15) brightness(.82) !important;
  pointer-events: none !important;
  content: "" !important;
}

body::after {
  position: fixed !important;
  inset: 0 !important;
  z-index: -1 !important;
  display: block !important;
  background:
    radial-gradient(ellipse at 50% 34%, rgba(26, 126, 175, .17), transparent 43%),
    radial-gradient(circle at 9% 88%, rgba(42, 169, 190, .08), transparent 26%),
    repeating-linear-gradient(0deg, transparent 0 4px, rgba(111, 205, 235, .012) 4px 5px),
    linear-gradient(180deg, rgba(2, 11, 20, .22), rgba(1, 8, 15, .76)) !important;
  pointer-events: none !important;
  content: "" !important;
}

.dashboard-shell,
.detail-shell {
  gap: 12px;
  padding: 0 14px 14px;
}

.dashboard-shell {
  grid-template-rows: 66px 100px minmax(0, 1fr) 178px;
}

.detail-shell {
  grid-template-rows: 66px 100px minmax(0, 1fr);
}

.topbar {
  margin-right: -14px;
  margin-left: -14px;
  padding-right: 20px;
  padding-left: 20px;
  border-bottom: 1px solid rgba(53, 216, 255, .25);
  background: rgba(2, 12, 21, .91) !important;
  box-shadow: 0 16px 38px rgba(0, 4, 10, .42);
  backdrop-filter: blur(18px) saturate(1.15);
}

.topbar::before {
  opacity: .34;
}

.topbar::after {
  height: 1px;
  background: linear-gradient(90deg, transparent 4%, rgba(57,216,255,.24) 28%, rgba(85,231,210,.56) 50%, rgba(57,216,255,.24) 72%, transparent 96%);
}

.brand {
  gap: 10px;
  min-width: 142px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.2), 0 10px 28px rgba(0,0,0,.34);
}

.brand-mark img { width: 37px; height: 37px; }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: .1em; }

.main-nav { min-width: 610px; }
.nav-item { padding: 0 13px; color: #9cb3bd; font-size: 14px; }
.nav-item:hover,
.nav-item:focus-visible { color: #f2fbff; background: rgba(37, 149, 190, .07); }
.nav-item.active { color: #f4fdff; background: rgba(40, 159, 196, .08); }
.nav-item.active::after { right: 10px; left: 10px; background: linear-gradient(90deg, transparent, var(--i2-cyan) 16% 84%, transparent); box-shadow: 0 0 12px rgba(57,216,255,.35); }

.header-title h1 {
  font-size: clamp(24px, 1.56cqw, 30px);
  letter-spacing: .07em;
  filter: drop-shadow(0 4px 18px rgba(57,216,255,.16));
}

.header-title::before { opacity: .6; }
.topbar-meta { min-width: 400px; color: #9bb4bf; }
.clock-block strong { color: #e5f4fa; font-size: 14px; }
.clock-block span,
.weather,
.system-status { font-size: 12px; }

/* KPI cards are deliberately separated so they no longer look like one flat strip. */
.kpi-rail {
  display: grid;
  gap: 10px;
  overflow: visible;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.kpi-rail::before,
.kpi-rail::after { content: none !important; }

.kpi-item {
  overflow: hidden;
  padding: 13px 16px 11px;
  border: 1px solid rgba(58, 184, 226, .28);
  border-radius: var(--i2-radius);
  background: rgba(7, 28, 43, .82);
  box-shadow: inset 0 1px rgba(166, 227, 247, .035), 0 12px 30px rgba(0, 5, 12, .24);
  backdrop-filter: blur(9px);
  transition: border-color .22s var(--i2-ease), background-color .22s var(--i2-ease), transform .22s var(--i2-ease);
}

.kpi-item:hover,
.kpi-item:focus-within,
.kpi-item.ui-selected {
  border-color: rgba(57, 216, 255, .55);
  background: rgba(8, 37, 55, .92);
  transform: translateY(-1px);
}

.kpi-item + .kpi-item::before { content: none !important; }
.kpi-label { color: #b7cdd6; font-size: 13px; }
.kpi-value { margin-top: 5px; }
.kpi-value strong { color: #f0fbff; font-size: clamp(28px, 1.82cqw, 35px); font-weight: 720; text-shadow: 0 0 18px rgba(57,216,255,.12); }
.kpi-value span { color: #91aeba; font-size: 11px; }
.kpi-meta { margin-top: 7px; color: #7f9aa6; font-size: 10px; }
.progress { right: 15px; bottom: 8px; left: 15px; height: 3px; background: rgba(114, 174, 195, .1); }
.progress i { background: linear-gradient(90deg, rgba(52,137,207,.55), var(--i2-aqua)); box-shadow: 0 0 10px rgba(85,231,210,.2); }
.alarm-kpi { background: rgba(33, 28, 25, .78); }

/* One quiet frame per module. All inherited decorative double frames are removed. */
.panel,
.scene-panel,
.ops-panel {
  border: 1px solid rgba(58, 184, 226, .27) !important;
  border-radius: var(--i2-radius) !important;
  background-color: var(--i2-panel) !important;
  background-image: none !important;
  box-shadow: inset 0 1px rgba(178, 228, 244, .025), var(--i2-shadow) !important;
  backdrop-filter: blur(8px);
}

.panel::before,
.panel::after,
.scene-panel::before,
.scene-panel::after,
.ops-panel::before,
.ops-panel::after { content: none !important; }

.panel:hover,
.panel:focus-within,
.ops-panel:hover,
.ops-panel:focus-within {
  border-color: rgba(57, 216, 255, .42) !important;
}

.scene-panel,
.process-flow-panel,
.quality-center,
.devices-center,
.sludge-center {
  border-color: rgba(57, 216, 255, .47) !important;
  box-shadow: inset 0 1px rgba(165, 231, 251, .04), 0 22px 58px rgba(0, 4, 12, .42), 0 0 28px rgba(25, 134, 179, .06) !important;
}

.panel-heading,
.ops-panel-head,
.scene-heading {
  border-bottom-color: rgba(60, 176, 215, .2) !important;
  background: rgba(10, 37, 53, .54) !important;
}

.panel-heading { margin: -2px -2px 10px; padding: 8px 8px 9px; }
.panel-heading::after,
.ops-panel-head::after {
  background: linear-gradient(90deg, var(--i2-cyan), rgba(70,155,210,.15) 44%, transparent 84%) !important;
  opacity: .58;
}

.panel-heading h2,
.scene-heading h2,
.ops-panel-head h2 {
  color: #f0faff;
  font-size: 16px;
  font-weight: 680;
  letter-spacing: .035em;
}

.ops-panel-head { min-height: 48px; padding: 0 15px; }
.ops-panel-body { height: calc(100% - 48px); }

.scene-heading {
  min-height: 52px;
  padding: 0 16px;
}

.scene-canvas {
  background: rgba(1, 11, 18, .94) !important;
}

.scene-canvas::before {
  background-image:
    linear-gradient(rgba(57,216,255,.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57,216,255,.022) 1px, transparent 1px) !important;
  background-position: 0 0 !important;
  background-size: 42px 42px !important;
  opacity: .52;
}

.scene-vignette {
  background: radial-gradient(circle at 50% 48%, transparent 44%, rgba(1,8,14,.58) 100%), linear-gradient(180deg, rgba(3,15,24,.06), transparent 18%, transparent 74%, rgba(1,7,12,.42));
}

.scene-toolbar,
.model-badge,
body .plant-device-card,
body .plant-label {
  border-color: rgba(57,216,255,.36) !important;
  background: rgba(2, 16, 26, .88) !important;
  box-shadow: 0 14px 34px rgba(0,4,10,.34) !important;
  backdrop-filter: blur(12px);
}

.model-badge { display: none !important; }

.tool-button,
.icon-button,
.ghost-select,
.panel-link,
.view-all,
.segmented button,
.text-button,
.mini-action,
.primary-action,
.filter-chip {
  transition: color .2s var(--i2-ease), background-color .2s var(--i2-ease), border-color .2s var(--i2-ease), opacity .2s var(--i2-ease), transform .2s var(--i2-ease);
}

.tool-button:active,
.text-button:active,
.mini-action:active,
.primary-action:active { transform: translateY(1px); }

.segmented,
.status-pill,
.source-pill,
.severity-pill,
.normal-pill,
.saving-pill,
.count-badge {
  border-color: rgba(57,216,255,.24);
  background: rgba(30,125,160,.08);
  color: #8fe9ff;
}

.ops-table { color: #b7cad2; font-size: 12px; }
.ops-table th { color: #7f9ba7; font-size: 10px; }
.ops-table td { border-bottom-color: rgba(86,174,204,.08); }
.grid-lines { stroke: rgba(93,160,188,.16); }
.axis-text { fill: #7898a7; }
.series { stroke-width: 2.15; }
.teal-series { stroke: var(--i2-aqua); }
.blue-series { stroke: #5aaeff; }
.amber-series { stroke: var(--i2-amber); }

.page-toast {
  border-color: rgba(57,216,255,.48);
  background: rgba(3,19,29,.96);
  color: #e9f9ff;
}

@container console-screen (max-width: 1500px) {
  .dashboard-shell,
  .detail-shell { gap: 9px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; }
  .dashboard-shell { grid-template-rows: 60px 88px minmax(0,1fr) 166px; }
  .detail-shell { grid-template-rows: 60px 88px minmax(0,1fr); }
  .topbar { margin-right: -10px; margin-left: -10px; padding-right: 14px; padding-left: 14px; }
  .brand { min-width: 128px; }
  .brand-mark { width: 40px; height: 40px; }
  .brand-mark img { width: 34px; height: 34px; }
  .brand-name { font-size: 15px; }
  .main-nav { min-width: 560px; }
  .nav-item { padding: 0 10px; font-size: 13px; }
  .header-title h1 { font-size: 23px; }
  .topbar-meta { min-width: 340px; gap: 8px; }
  .kpi-rail { gap: 8px; }
  .kpi-item { padding: 10px 12px 9px; }
  .kpi-value strong { font-size: 27px; }
  .panel-heading h2,
  .scene-heading h2,
  .ops-panel-head h2 { font-size: 14px; }
  .ops-panel-head { min-height: 42px; padding: 0 11px; }
  .ops-panel-body { height: calc(100% - 42px); }
  .scene-heading { min-height: 46px; }
}

@container console-screen (max-height: 820px) {
  .dashboard-shell { grid-template-rows: 58px 82px minmax(0,1fr) 154px; }
  .detail-shell { grid-template-rows: 58px 82px minmax(0,1fr); }
  .kpi-value strong { font-size: 25px; }
  .kpi-label { font-size: 11px; }
  .kpi-meta { font-size: 9px; }
  .progress { bottom: 2px; }
  .panel-heading { margin-bottom: 2px; padding-top: 6px; padding-bottom: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
