:root {
  color-scheme: light;
  --bg: #f3f6f7;
  --surface: #ffffff;
  --surface-2: #f6f8f8;
  --surface-3: #edf3f4;
  --ink: #142128;
  --muted: #5d6f78;
  --soft: #81939a;
  --line: #dde6e8;
  --line-strong: #c3d1d6;
  --topbar: #14242c;
  --topbar-2: #1d333d;
  --topbar-muted: #a7c1ca;
  --blue: #2375a5;
  --blue-soft: #e7f3f8;
  --teal: #15947f;
  --teal-soft: #e3f5f1;
  --green: #3c8d4c;
  --green-soft: #e8f4ea;
  --amber: #c9861b;
  --amber-soft: #fff3dc;
  --red: #c7544b;
  --red-soft: #fff0ee;
  --purple: #6d5ab0;
  --purple-soft: #f0eef9;
  --target-bg: #eef8f6;
  --target-border: #bfe0d9;
  --target-ink: #123f3a;
  --hover-bg: #edf6f8;
  --hover-border: #9fc7d3;
  --map-terrain: #dfe8e4;
  --map-pipe: #63818b;
  --map-flow: #15947f;
  --map-fill: #f8fbfb;
  --map-fill-2: #d5e6e9;
  --map-stroke: #93aab2;
  --map-text: #263f48;
  --well-body: #ffffff;
  --well-stem: #365862;
  --well-text: #162d35;
  --offline-bg: #fff4f2;
  --offline-border: #e8c2bd;
  --offline-fill: #fae8e5;
  --selected-bg: #e9f5fb;
  --chart-bg: #f8fbfb;
  --chart-grid: #dbe5e8;
  --chart-axis: #9fb2b8;
  --chart-text: #60717b;
  --shadow: 0 16px 34px rgba(31, 55, 64, 0.08);
  --shadow-soft: 0 8px 22px rgba(31, 55, 64, 0.055);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1216;
  --surface: #151f26;
  --surface-2: #1b2a32;
  --surface-3: #20333c;
  --ink: #eef6f7;
  --muted: #a2b5bd;
  --soft: #7f939b;
  --line: #2b3e48;
  --line-strong: #435d68;
  --topbar: #081116;
  --topbar-2: #10222a;
  --topbar-muted: #8fb4c0;
  --blue: #62bbe9;
  --blue-soft: #102d3b;
  --teal: #37bda6;
  --teal-soft: #10332f;
  --green: #66bd72;
  --green-soft: #173420;
  --amber: #e4aa47;
  --amber-soft: #392a12;
  --red: #e5786e;
  --red-soft: #3b1e20;
  --purple: #a99be6;
  --purple-soft: #282440;
  --target-bg: #112d2e;
  --target-border: #26595a;
  --target-ink: #defefd;
  --hover-bg: #213842;
  --hover-border: #4f8191;
  --map-terrain: #20302d;
  --map-pipe: #6d8993;
  --map-flow: #37bda6;
  --map-fill: #192a31;
  --map-fill-2: #2a444e;
  --map-stroke: #5d7b86;
  --map-text: #d9e8eb;
  --well-body: #172a32;
  --well-stem: #86a7b1;
  --well-text: #edf6f8;
  --offline-bg: #351e20;
  --offline-border: #743b3d;
  --offline-fill: #3b2426;
  --selected-bg: #153044;
  --chart-bg: #101d23;
  --chart-grid: #2d434c;
  --chart-axis: #5d7781;
  --chart-text: #a7bbc2;
  --shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
  --shadow-soft: 0 8px 22px rgba(0, 0, 0, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  text-rendering: geometricPrecision;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1760px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(340px, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  min-height: 82px;
  margin-bottom: 16px;
  padding: 16px;
  color: #fff;
  background: var(--topbar);
  border: 1px solid color-mix(in srgb, var(--topbar-muted) 24%, transparent);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  background: var(--topbar-2);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  border-radius: 999px;
}

.brand-mark::before {
  width: 23px;
  height: 23px;
  border: 3px solid var(--teal);
  border-right-color: var(--blue);
}

.brand-mark::after {
  width: 5px;
  height: 28px;
  background: var(--amber);
  transform: rotate(42deg);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--topbar-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 25px;
  font-weight: 780;
  line-height: 1.12;
}

h2 {
  font-size: 15px;
  font-weight: 780;
}

.system-strip {
  display: flex;
  align-items: center;
  gap: 8px;
}

.system-strip span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px;
  color: #e6f2f5;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.signal-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 20%, transparent);
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.icon-pause,
.icon-reset,
.icon-theme,
.mini-icon,
.panel-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.icon-theme::before {
  content: "";
  position: absolute;
  inset: 2px;
  background: currentColor;
  border-radius: 50%;
  box-shadow: inset -5px -3px 0 var(--topbar);
}

[data-theme="dark"] .icon-theme::before {
  inset: 3px;
  background: transparent;
  border: 2px solid currentColor;
  box-shadow: 0 -8px 0 -6px currentColor, 0 8px 0 -6px currentColor, 8px 0 0 -6px currentColor, -8px 0 0 -6px currentColor;
}

.icon-pause::before,
.icon-pause::after {
  content: "";
  position: absolute;
  top: 3px;
  width: 4px;
  height: 12px;
  background: currentColor;
  border-radius: 2px;
}

.icon-pause::before {
  left: 4px;
}

.icon-pause::after {
  right: 4px;
}

.is-paused .icon-pause::before {
  left: 5px;
  width: 0;
  height: 0;
  background: transparent;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid currentColor;
  border-radius: 0;
}

.is-paused .icon-pause::after {
  display: none;
}

.icon-reset::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
}

.icon-reset::after {
  content: "";
  position: absolute;
  top: 1px;
  right: 2px;
  border-left: 7px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transform: rotate(35deg);
}

.dashboard {
  display: grid;
  grid-template-columns: 318px minmax(650px, 1fr) 368px;
  gap: 16px;
  align-items: start;
}

.control-panel,
.right-panel,
.kpi-card,
.asset-map,
.chart-card,
.gantt-panel,
.well-detail,
.event-log,
.pid-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.control-panel,
.right-panel {
  position: sticky;
  top: 12px;
  padding: 15px;
}

.overview-panel {
  min-width: 0;
}

.panel-heading,
.chart-title,
.map-heading,
.detail-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading {
  justify-content: flex-start;
  margin-bottom: 14px;
}

.panel-heading.compact {
  margin-bottom: 10px;
}

.panel-icon {
  width: 24px;
  height: 24px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.panel-icon-target::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 2px solid var(--teal);
  border-radius: 50%;
}

.panel-icon-target::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 2px;
  width: 2px;
  height: 18px;
  background: var(--teal);
  transform: rotate(45deg);
}

.panel-icon-pid::before,
.panel-icon-loop::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 2px solid var(--blue);
  border-left-color: transparent;
  border-radius: 50%;
}

.panel-icon-log::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  width: 12px;
  height: 2px;
  background: var(--purple);
  box-shadow: 0 5px 0 var(--purple), 0 10px 0 var(--purple);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  height: 44px;
  margin-bottom: 16px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segment {
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-weight: 780;
}

.segment.active {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 7px 18px color-mix(in srgb, var(--blue) 24%, transparent);
}

.target-readout {
  position: relative;
  display: grid;
  gap: 7px;
  padding: 14px 15px;
  overflow: hidden;
  background: var(--target-bg);
  border: 1px solid var(--target-border);
  border-radius: 8px;
}

.target-readout::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--teal);
}

.target-readout span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
}

.target-readout strong {
  color: var(--target-ink);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 25px;
  line-height: 1.05;
}

.target-readout strong em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 780;
  white-space: nowrap;
}

.target-stack {
  display: grid;
  gap: 12px;
}

.priority-group {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.priority-option {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
}

.priority-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--blue);
}

.priority-option span {
  min-width: 0;
  line-height: 1.25;
}

.priority-option:has(input:checked) {
  background: var(--hover-bg);
  border-color: var(--hover-border);
}

.range-field,
.tiny-range {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.range-field-side {
  grid-template-columns: minmax(92px, 1fr) minmax(156px, auto);
  grid-template-areas:
    "label value"
    "slider slider";
  align-items: center;
  padding: 12px 14px;
  background: var(--target-bg);
  border: 1px solid var(--target-border);
  border-radius: 8px;
}

.range-field-side > span {
  grid-area: label;
}

.range-field-side > strong {
  grid-area: value;
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 8px;
  color: var(--target-ink);
  font-size: 22px;
  line-height: 1;
  min-width: 0;
}

.range-field-side > strong em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 780;
  white-space: normal;
  text-align: right;
}

.range-field-side > input {
  grid-area: slider;
}

.range-field-cond {
  background: color-mix(in srgb, var(--purple-soft) 65%, var(--surface));
  border-color: color-mix(in srgb, var(--purple) 28%, var(--line));
}

input[type="range"] {
  width: 100%;
  height: 18px;
  accent-color: var(--teal);
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  background: var(--line);
  border-radius: 999px;
}

input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.scenario-btn {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 9px 10px;
  color: var(--ink);
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 780;
}

.scenario-btn:hover {
  background: var(--hover-bg);
  border-color: var(--hover-border);
  transform: translateY(-1px);
}

.mini-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 6px;
}

.icon-up::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 5px;
  width: 3px;
  height: 14px;
  background: currentColor;
  border-radius: 2px;
}

.icon-up::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 4px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 6px solid currentColor;
}

.icon-drop::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 5px;
  width: 10px;
  height: 13px;
  background: var(--teal);
  border-radius: 8px 8px 8px 2px;
  transform: rotate(45deg);
}

.icon-alert {
  color: var(--amber);
  background: var(--amber-soft);
}

.icon-alert::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 5px;
  width: 14px;
  height: 14px;
  background: currentColor;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.icon-valve {
  color: var(--purple);
  background: var(--purple-soft);
}

.icon-valve::before,
.icon-valve::after {
  content: "";
  position: absolute;
  top: 8px;
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
}

.icon-valve::before {
  left: 2px;
  transform: skewY(28deg);
}

.icon-valve::after {
  right: 2px;
  transform: skewY(-28deg);
}

.pid-box {
  margin-top: 18px;
  padding: 14px;
  background: var(--surface-2);
  box-shadow: none;
}

.tiny-range {
  grid-template-columns: 28px 1fr 52px;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.tiny-range b {
  color: var(--ink);
  text-align: right;
  font-size: 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(132px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr auto;
  gap: 5px 10px;
  min-height: 106px;
  padding: 15px;
  overflow: hidden;
}

.kpi-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--blue);
}

.kpi-card::after {
  content: "";
  grid-column: 2;
  grid-row: 1 / 4;
  align-self: start;
  width: 32px;
  height: 32px;
  background: var(--blue-soft);
  border: 1px solid color-mix(in srgb, var(--blue) 22%, transparent);
  border-radius: 8px;
}

.kpi-cond::before {
  background: var(--teal);
}

.kpi-cond::after {
  background: var(--teal-soft);
  border-color: color-mix(in srgb, var(--teal) 22%, transparent);
}

.kpi-error::before {
  background: var(--amber);
}

.kpi-error::after {
  background: var(--amber-soft);
  border-color: color-mix(in srgb, var(--amber) 24%, transparent);
}

.kpi-command::before {
  background: var(--purple);
}

.kpi-command::after {
  background: var(--purple-soft);
  border-color: color-mix(in srgb, var(--purple) 24%, transparent);
}

.kpi-card span,
.kpi-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.kpi-card strong {
  grid-column: 1;
  align-self: end;
  color: var(--ink);
  font-size: 29px;
  line-height: 1;
}

.kpi-pair {
  display: grid;
  gap: 7px;
  align-self: end;
}

.kpi-pair strong {
  grid-column: 1;
  align-self: auto;
  font-size: 17px;
  line-height: 1.15;
}

.asset-map {
  overflow: hidden;
}

.map-heading {
  align-items: flex-start;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--line);
}

.map-heading p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  height: 32px;
  padding: 0 12px;
  color: #fff;
  background: var(--green);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 820;
}

.status-pill.warn {
  background: var(--amber);
}

.status-pill.alert {
  background: var(--red);
}

.process-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 300px;
  background: var(--surface);
}

.process-svg marker path {
  fill: var(--map-pipe);
}

.terrain path {
  fill: var(--map-terrain);
}

.pipe-lines path {
  fill: none;
  stroke: var(--map-pipe);
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  marker-end: url(#arrow);
  opacity: 0.72;
}

.flow-lines path {
  fill: none;
  stroke: var(--map-flow);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 1 18;
  stroke-dashoffset: 0;
  opacity: 0.88;
  animation: flowPulse 2.2s linear infinite;
}

.flow-lines path:nth-child(2) {
  animation-delay: -0.35s;
}

.flow-lines path:nth-child(3) {
  animation-delay: -0.7s;
}

.flow-lines path:nth-child(4) {
  animation-delay: -1.05s;
}

.flow-lines path:nth-child(5) {
  animation-delay: -1.4s;
}

.flow-lines path:nth-child(6) {
  animation-delay: -1.75s;
}

@keyframes flowPulse {
  to {
    stroke-dashoffset: -38;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flow-lines path {
    animation: none;
    opacity: 0.45;
  }
}

.facility rect,
.manifold circle,
.manifold rect {
  fill: var(--map-fill);
  stroke: var(--map-stroke);
  stroke-width: 2;
}

.facility path {
  fill: var(--map-fill-2);
  stroke: var(--map-stroke);
  stroke-width: 2;
}

.facility text,
.manifold text {
  fill: var(--map-text);
  font-size: 17px;
  font-weight: 820;
  text-anchor: middle;
}

.facility .facility-sub {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.facility .facility-sub-strong {
  fill: var(--map-text);
  font-size: 11px;
  font-weight: 820;
}

.facility .facility-sub-tight {
  font-size: 10px;
  font-weight: 760;
}

.well-node {
  cursor: pointer;
}

.well-node .body {
  fill: var(--well-body);
  stroke: var(--map-stroke);
  stroke-width: 2;
}

.well-node.selected .body {
  stroke: var(--blue);
  stroke-width: 4;
}

.well-node.offline .body {
  fill: var(--offline-fill);
  stroke: var(--red);
}

.well-node .stem {
  stroke: var(--well-stem);
  stroke-width: 6;
  stroke-linecap: round;
}

.well-node .choke {
  fill: var(--teal);
}

.well-node.limited .choke {
  fill: var(--amber);
}

.well-node.offline .choke {
  fill: var(--red);
}

.well-node text {
  fill: var(--well-text);
  font-size: 13px;
  font-weight: 820;
  text-anchor: middle;
}

.well-node .pressure {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(280px, 0.54fr);
  gap: 16px;
  margin-top: 16px;
}

.chart-card {
  min-height: 320px;
  padding: 14px;
}

.chart-title {
  margin-bottom: 10px;
  align-items: flex-start;
}

.chart-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
  text-align: right;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 12px;
  max-width: 420px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.legend-line {
  display: inline-block;
  width: 18px;
  height: 0;
  border-top: 3px solid var(--blue);
  border-radius: 999px;
}

.legend-line.dashed {
  border-top-style: dashed;
}

.legend-line.gas {
  border-top-color: var(--blue);
}

.legend-line.condensate {
  border-top-color: var(--purple);
}

canvas {
  display: block;
  width: 100%;
  height: 248px;
  background: var(--chart-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.gantt-panel {
  margin-top: 16px;
  padding: 16px;
}

.gantt-heading {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 12px;
  min-width: 0;
}

.gantt-heading p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.schedule-form {
  display: grid;
  grid-template-columns: 1.18fr 0.7fr 0.7fr 0.8fr 1fr;
  gap: 8px;
  align-items: end;
  min-width: 0;
  width: 100%;
}

.schedule-form label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.schedule-form span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
}

.schedule-form select,
.schedule-form input {
  width: 100%;
  height: 36px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  outline: none;
}

.schedule-form select:focus,
.schedule-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 16%, transparent);
}

.schedule-add {
  height: 36px;
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  white-space: nowrap;
  color: #fff;
  background: var(--blue);
  border: 0;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 820;
}

.gantt-scale {
  display: grid;
  grid-template-columns: 74px repeat(6, 1fr);
  gap: 0;
  margin-bottom: 6px;
  color: var(--soft);
  font-size: 11px;
  font-weight: 780;
}

.gantt-scale span {
  text-align: right;
}

.gantt-scale span:first-child {
  grid-column: 2;
}

.gantt-chart {
  display: grid;
  gap: 7px;
}

.gantt-row {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
  align-items: center;
}

.gantt-row-label {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.gantt-row-label strong {
  font-size: 13px;
}

.gantt-row-label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.gantt-track {
  position: relative;
  height: 38px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.gantt-track::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.72;
  background:
    linear-gradient(to right, transparent calc(16.666% - 1px), var(--line) calc(16.666% - 1px), var(--line) 16.666%, transparent 16.666%),
    linear-gradient(to right, transparent calc(33.333% - 1px), var(--line) calc(33.333% - 1px), var(--line) 33.333%, transparent 33.333%),
    linear-gradient(to right, transparent calc(50% - 1px), var(--line) calc(50% - 1px), var(--line) 50%, transparent 50%),
    linear-gradient(to right, transparent calc(66.666% - 1px), var(--line) calc(66.666% - 1px), var(--line) 66.666%, transparent 66.666%),
    linear-gradient(to right, transparent calc(83.333% - 1px), var(--line) calc(83.333% - 1px), var(--line) 83.333%, transparent 83.333%);
}

.gantt-now {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--red);
  opacity: 0.8;
  z-index: 2;
}

.gantt-bar {
  position: absolute;
  top: 7px;
  height: 22px;
  min-width: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 7px;
  color: #fff;
  background: var(--teal);
  border: 1px solid color-mix(in srgb, #fff 34%, transparent);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 820;
  z-index: 3;
  box-shadow: 0 5px 14px color-mix(in srgb, var(--teal) 20%, transparent);
}

.gantt-bar.active {
  background: var(--amber);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 20%, transparent);
}

.gantt-bar button {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: inherit;
  background: rgba(255, 255, 255, 0.16);
  border: 0;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1;
}

.right-panel {
  display: grid;
  gap: 14px;
}

.loop-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: loop;
}

.loop-list li {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  min-height: 38px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
}

.loop-list li::before {
  counter-increment: loop;
  content: counter(loop);
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 50%;
}

.loop-list li.active {
  color: var(--ink);
}

.loop-list li.active::before {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 13%, transparent);
}

.well-detail {
  padding: 14px;
  box-shadow: none;
}

.detail-title {
  align-items: flex-start;
  margin-bottom: 12px;
}

.detail-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 12px;
  font-size: 13px;
}

.detail-grid span {
  color: var(--muted);
}

.detail-grid strong {
  text-align: right;
}

.well-list {
  display: grid;
  gap: 8px;
}

.well-card {
  display: grid;
  grid-template-columns: 64px 1fr 104px;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 10px;
  color: inherit;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.well-card:hover {
  border-color: var(--hover-border);
}

.well-card.selected {
  background: var(--selected-bg);
  border-color: var(--blue);
}

.well-card.offline {
  background: var(--offline-bg);
  border-color: var(--offline-border);
}

.well-card strong {
  font-size: 14px;
}

.well-card span,
.well-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.pressure-badge {
  display: grid;
  place-items: center;
  height: 36px;
  padding: 0 6px;
  color: #fff;
  background: var(--teal);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 820;
  text-align: center;
}

.pressure-badge.limited {
  background: var(--amber);
}

.pressure-badge.offline {
  background: var(--red);
}

.event-log {
  min-height: 170px;
  padding: 14px;
  box-shadow: none;
}

.event-log ul {
  display: grid;
  gap: 8px;
  max-height: 212px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.event-log li {
  position: relative;
  padding-left: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.38;
}

.event-log li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 3px;
  width: 3px;
  background: var(--line-strong);
  border-radius: 999px;
}

.event-log b {
  color: var(--ink);
}

@media (max-width: 1380px) {
  .dashboard {
    grid-template-columns: 312px minmax(560px, 1fr);
  }

  .right-panel {
    position: static;
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
    align-items: start;
  }

  .right-panel > .panel-heading {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .system-strip {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .gantt-heading {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 10px;
  }

  .topbar,
  .dashboard,
  .chart-row,
  .right-panel {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    justify-self: start;
  }

  .control-panel {
    position: static;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .chart-legend {
    justify-content: flex-start;
    max-width: none;
  }

  .schedule-form {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .schedule-add {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .brand-area {
    align-items: flex-start;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  h1 {
    font-size: 22px;
  }

  .system-strip {
    display: grid;
    grid-template-columns: 1fr;
  }

  .quick-grid,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .schedule-form {
    grid-template-columns: 1fr;
  }

  .gantt-panel {
    padding: 12px;
  }

  .gantt-scale {
    grid-template-columns: 58px repeat(6, 1fr);
  }

  .gantt-row {
    grid-template-columns: 58px 1fr;
    gap: 8px;
  }

  .gantt-bar {
    padding: 0 5px;
    font-size: 10px;
  }

  .well-card {
    grid-template-columns: 58px 1fr;
  }

  .pressure-badge {
    grid-column: 1 / -1;
  }
}
