:root {
  color-scheme: light dark;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --brand: #006dff;
  --brand-dark: #004fcc;
  --text: #111827;
  --muted: #6b7280;
  --surface: #ffffff;
  --surface-muted: #f3f4f6;
  --border: #e5e7eb;
  --accent: #0ea5e9;
  --node-junction-fill: #dbeafe;
  --node-junction-stroke: #1d4ed8;
  --node-reservoir-fill: #ccfbf1;
  --node-reservoir-stroke: #0f766e;
  --node-tank-fill: #fef9c3;
  --node-tank-stroke: #a16207;
  --link-pipe: #0ea5e9;
  --link-pump: #0d9488;
  --link-valve: #7c3aed;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background: #f8fafc;
}

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

.eyebrow {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(0, 109, 255, 0.12);
  color: var(--brand);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.top-nav {
  display: flex;
  gap: 0.75rem;
}

.top-nav__link {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  transition: color 0.2s, background 0.2s;
}

.top-nav__link:hover {
  color: var(--text);
  background: var(--surface-muted);
}

.top-nav__link.is-active {
  color: var(--brand);
  background: rgba(0, 109, 255, 0.12);
}

.brand {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: inherit;
  text-decoration: none;
}

.auth-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-left: auto;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 600;
}

.link-button {
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background 0.2s, color 0.2s;
}

.link-button:hover {
  background: var(--surface-muted);
}

.action-bar {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}

.action-card {
  flex: 1;
  min-width: 240px;
  display: flex;
  gap: 0.8rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border-radius: 0.9rem;
  background: var(--surface-muted);
  border: 1px solid transparent;
  transition: border-color 0.2s, transform 0.2s;
}

.action-card:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
}

.action-card strong {
  display: block;
}

.action-card small {
  color: var(--muted);
}

.action-card.is-success .icon {
  background: #16a34a;
}

.action-card.is-running {
  opacity: 0.7;
  pointer-events: none;
}

.action-card.is-running .icon {
  background: #f59e0b;
  position: relative;
}

.action-card.is-running .icon::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-top-color: transparent;
  position: absolute;
  animation: spin 1s linear infinite;
}

.action-card.is-running strong,
.action-card.is-running small {
  color: #b45309;
}

.action-card.is-running small {
  opacity: 0.9;
}

.action-card[data-action="simulate"].is-state-ready .icon {
  background: #2563eb;
}

.action-card[data-action="simulate"].is-state-ready strong {
  color: #111827;
}

.action-card[data-action="simulate"].is-state-ready small {
  color: #1d4ed8;
}

.action-card[data-action="simulate"].is-state-finished .icon {
  background: #16a34a;
}

.action-card[data-action="simulate"].is-state-finished strong {
  color: #15803d;
}

.action-card[data-action="simulate"].is-state-finished small {
  color: #166534;
}

.action-card[data-action="simulate"].is-disabled {
  opacity: 0.6;
}

.action-card[data-action="simulate"].is-disabled .icon {
  background: #94a3b8;
}

.action-card[data-action="simulate"].is-disabled strong,
.action-card[data-action="simulate"].is-disabled small {
  color: #475569;
}

.result-table-menu {
  position: relative;
  align-self: center;
}

.action-table-button {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
  border: none;
  display: grid;
  place-items: center;
  box-shadow: 0 15px 40px rgba(0, 109, 255, 0.25);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.action-table-button.is-loading {
  background: #94a3b8;
  box-shadow: none;
}

.action-table-button.is-success {
  background: #16a34a;
  box-shadow: 0 15px 40px rgba(22, 163, 74, 0.3);
}

.action-table-button.is-error {
  background: #b91c1c;
  box-shadow: 0 15px 40px rgba(185, 28, 28, 0.3);
}

.action-table-button svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

.action-table-button:hover:not(:disabled) {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

.action-table-button:focus-visible {
  outline: 3px solid rgba(0, 109, 255, 0.35);
  outline-offset: 3px;
}

.action-table-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.action-table-button[aria-expanded="true"] {
  background: var(--brand-dark);
  box-shadow: 0 12px 32px rgba(0, 109, 255, 0.28);
}

.action-eps-button {
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 15px 40px rgba(0, 109, 255, 0.25);
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.action-eps-button svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action-eps-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(0, 109, 255, 0.28);
  background: var(--brand-dark);
}

.action-eps-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.action-eps-button[aria-pressed="true"] {
  background: var(--brand-dark);
  color: #fff;
  box-shadow: 0 12px 32px rgba(0, 109, 255, 0.28);
}

.result-table-menu__popover {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 210px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
  padding: 0.65rem;
  display: grid;
  gap: 0.35rem;
  z-index: 900;
}

.result-table-menu__label {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.result-table-menu__item {
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--surface-muted);
  color: var(--text);
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.result-table-menu__item:hover {
  background: #e0f2fe;
  border-color: #bae6fd;
  transform: translateY(-1px);
}

.action-info-button {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
  border: none;
  font-size: 1.25rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 15px 40px rgba(0, 109, 255, 0.2);
  transition: background 0.2s, transform 0.2s;
  flex: 0 0 auto;
  align-self: center;
}

.action-info-button:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

.action-info-button:focus-visible {
  outline: 3px solid rgba(0, 109, 255, 0.5);
  outline-offset: 3px;
}

.action-info-button:disabled {
  background: #94a3b8;
  color: #f8fafc;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.8;
  transform: none;
}

.action-info-button:disabled:hover {
  background: #94a3b8;
  transform: none;
}

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

.icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--brand);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: white;
}

.icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

main {
  width: 100%;
  padding: 0 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.network-area {
  flex: 1;
  padding: 0 2rem 2rem;
  display: flex;
  min-height: clamp(420px, 65vh, 760px);
  position: relative;
}

.network-section {
  flex: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  background: var(--surface);
  border-radius: 0;
  border: none;
  box-shadow: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.section-header {
  padding: 2rem;
  border-bottom: 1px solid var(--border);
}

.section-header h1 {
  margin: 0;
  font-size: 1.8rem;
}

.section-header p {
  color: var(--muted);
  margin-top: 0.5rem;
}

.network-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
}

.network-section.has-context .network-placeholder {
  display: none;
}

.network-status {
  display: flex;
  gap: 2rem;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.network-status__item {
  min-width: 160px;
}

.network-status__item span {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.network-status__item strong {
  font-size: 1rem;
  color: var(--text);
}

.network-message {
  padding: 0 2rem 1rem;
  color: var(--muted);
}

.network-message {
  padding: 0 2rem 1rem;
  color: var(--muted);
}

.network-canvas {
  flex: 1;
  min-height: 0;
  padding: 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  position: relative;
}

.network-canvas svg {
  width: 100%;
  height: 100%;
  max-height: none;
}

.network-controls {
  position: absolute;
  right: 0.9rem;
  top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(6px);
  width: auto;
}

.network-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0.65rem;
  border-radius: 12px;
  background: var(--surface-muted);
  border: 1px solid transparent;
  font-weight: 600;
  color: var(--text);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.network-controls button:hover:not(:disabled) {
  background: #e0e7ff;
  border-color: #c7d2fe;
  transform: translateY(-1px);
}

.network-controls button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.network-controls button.is-active {
  background: #dbeafe;
  border-color: #93c5fd;
  box-shadow: inset 0 0 0 1px #93c5fd;
}

.network-controls .control-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: var(--brand-dark);
}

.network-controls svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.link-flow-arrows {
  pointer-events: none;
}

.link-flow-arrow {
  opacity: 0.9;
  filter: drop-shadow(0 2px 6px rgba(15, 23, 42, 0.2));
}

.link-flow-arrow--pipe {
  fill: var(--link-pipe);
}

.link-flow-arrow--pump {
  fill: var(--link-pump);
}

.link-flow-arrow--valve {
  fill: var(--link-valve);
}

.network-legend {
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem 1.25rem;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.55), var(--surface) 38%);
  display: grid;
  gap: 0.65rem;
}

.network-legend__title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.network-legend__items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.65rem 1rem;
}

.network-legend__item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.35rem;
  border-radius: 0.8rem;
}

.network-legend__icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.eps-panel {
  position: fixed;
  top: 1.5rem;
  right: 1rem;
  width: clamp(280px, 24vw, 340px);
  max-height: calc(100% - 3rem);
  background: #0b1224;
  color: #e2e8f0;
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.28);
  padding: 1.25rem 1.25rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transform: translateX(120%);
  transition: transform 220ms ease, opacity 180ms ease;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

.eps-panel.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.eps-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: move;
  user-select: none;
}

.eps-panel__eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7dd3fc;
}

.eps-panel__header h3 {
  margin: 0.1rem 0 0;
  font-size: 1.2rem;
}

.eps-panel__close {
  border: none;
  background: rgba(226, 232, 240, 0.12);
  color: inherit;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.1rem;
}

.eps-panel__body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.eps-panel__meta {
  margin: 0;
  color: #cbd5e1;
  font-size: 0.95rem;
}

.eps-slider {
  display: grid;
  gap: 0.5rem;
}

.eps-slider__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #cbd5e1;
  font-weight: 600;
}

.eps-slider__value {
  font-variant-numeric: tabular-nums;
}

.eps-panel input[type="range"] {
  accent-color: #0ea5e9;
}

.eps-panel__hint {
  margin: 0;
  color: #94a3b8;
  font-size: 0.85rem;
}

.network-legend__icon svg {
  width: 34px;
  height: 34px;
}

.network-legend__label {
  display: inline-flex;
  flex-direction: column;
  gap: 0.1rem;
  font-weight: 600;
  color: var(--text);
}

.network-legend__line {
  stroke-width: 5;
  stroke-linecap: round;
  fill: none;
}

.network-legend__line--pipe {
  stroke: var(--link-pipe);
}

.network-legend__line--pump {
  stroke: var(--link-pump);
  stroke-dasharray: 10 6;
}

.network-legend__line--valve {
  stroke: var(--link-valve);
  stroke-dasharray: 3 6;
}

.network-legend__arrow {
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.network-legend__arrow--pump {
  fill: rgba(13, 148, 136, 0.12);
  stroke: var(--link-pump);
}

.network-legend__arrow--valve {
  fill: rgba(124, 58, 237, 0.12);
  stroke: var(--link-valve);
}

.grid {
  fill: #fdfdfd;
  stroke: var(--border);
  stroke-width: 1;
}

.pump-overlays {
  pointer-events: none;
  font-size: 0.78rem;
  text-anchor: middle;
}

.pump-symbol {
  filter: drop-shadow(0 2px 6px rgba(15, 23, 42, 0.12));
}

.pump-flow {
  fill: var(--link-pump);
  stroke: #0f766e;
  stroke-width: 2;
}

.pump-label {
  fill: #0f766e;
  stroke: #fff;
  stroke-width: 3;
  paint-order: stroke fill;
  font-weight: 700;
  letter-spacing: 0.01em;
  dominant-baseline: middle;
  text-anchor: middle;
}

.node {
  text-anchor: middle;
  font-size: 0.8rem;
  fill: var(--text);
}

.node text {
  fill: var(--muted);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.node .node-shape {
  stroke: var(--brand-dark);
  stroke-width: 2.4;
  fill: #fff;
}

.node .node-glyph {
  stroke: var(--brand-dark);
  stroke-width: 1.6;
  fill: var(--surface);
}

.node[data-node-type="junction"] .node-shape {
  fill: var(--node-junction-fill);
  stroke: var(--node-junction-stroke);
}

.node[data-node-type="junction"] .node-glyph {
  fill: var(--node-junction-stroke);
  stroke: #fff;
}

.node[data-node-type="reservoir"] .node-shape {
  fill: var(--node-reservoir-fill);
  stroke: var(--node-reservoir-stroke);
}

.node[data-node-type="reservoir"] .node-glyph {
  fill: var(--node-reservoir-stroke);
  stroke: #fff;
}

.node[data-node-type="tank"] .node-shape {
  fill: var(--node-tank-fill);
  stroke: var(--node-tank-stroke);
}

.node[data-node-type="tank"] .node-glyph {
  fill: var(--node-tank-stroke);
  stroke: #fff8dc;
}

.network-section.is-panning .network-canvas,
.network-section.is-panning .network-canvas svg {
  cursor: grab;
}

.network-section.is-panning .network-canvas svg:active {
  cursor: grabbing;
}

.job-list-section {
  width: 100%;
  background: var(--surface);
  border-radius: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.job-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  padding: 1.5rem 2rem 2rem;
}

.job-card {
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  padding: 1rem;
  background: var(--surface-muted);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.job-card header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.job-card header h3 {
  margin: 0;
  font-size: 1rem;
}

.job-card header span {
  font-size: 0.85rem;
  color: var(--muted);
  word-break: break-all;
}

.job-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.job-card__button {
  align-self: flex-start;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--brand);
  color: var(--brand);
  background: transparent;
  transition: background 0.2s, color 0.2s;
}

.job-card__button:hover {
  background: var(--brand);
  color: white;
}

.job-card__button--delete {
  border-color: var(--danger, #ef4444);
  color: var(--danger, #ef4444);
}

.job-card__button--delete:hover {
  background: var(--danger, #ef4444);
  color: white;
}

.job-list__empty {
  padding: 0 2rem 2rem;
  color: var(--muted);
}

footer {
  text-align: center;
  padding: 1rem;
  color: var(--muted);
}

.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.auth-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.auth-modal__dialog {
  position: relative;
  width: min(360px, 100%);
  background: var(--surface);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 25px 50px rgba(15, 23, 42, 0.2);
  border: 1px solid var(--border);
}

.auth-modal__dialog h2 {
  margin: 0;
  font-size: 1.5rem;
}

.auth-helper {
  margin: 0.35rem 0 1.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.auth-modal__close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 1.1rem;
  line-height: 1;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.auth-field span {
  font-size: 0.9rem;
  color: var(--muted);
}

.auth-field input {
  padding: 0.7rem 0.85rem;
  border-radius: 0.6rem;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  font-size: 1rem;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(0, 109, 255, 0.15);
}

.auth-error {
  margin: 0 0 0.75rem;
  color: #b91c1c;
  font-size: 0.9rem;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  border-radius: 0.75rem;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  border: none;
  text-decoration: none;
  transition: background 0.2s;
}

.primary-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.primary-button:not(:disabled):hover {
  background: var(--brand-dark);
}

.auth-modal .primary-button {
  width: 100%;
  text-align: center;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.78rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ghost-button:hover {
  border-color: var(--brand);
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.12);
}

.project-info-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1100;
}

.project-info-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.project-info-modal__dialog {
  position: relative;
  width: min(420px, 100%);
  background: var(--surface);
  border-radius: 1rem;
  padding: 1.75rem 2rem;
  box-shadow: 0 25px 65px rgba(15, 23, 42, 0.25);
  border: 1px solid var(--border);
}

.project-info-modal__close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 1.1rem;
  line-height: 1;
}

.project-info-modal__header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.project-info-modal__badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.2rem;
}

.project-info-modal__header h2 {
  margin: 0;
  font-size: 1.3rem;
}

.project-info-modal__header p {
  margin: 0.15rem 0 0;
  color: var(--muted);
}

.project-info-modal .network-status {
  border: none;
  padding: 0;
}

.project-info-modal .network-message {
  padding: 0;
}

.table-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1150;
}

.table-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.table-modal__dialog {
  position: relative;
  width: min(760px, 100%);
  max-height: min(80vh, 840px);
  background: var(--surface);
  border-radius: 1rem;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 25px 70px rgba(15, 23, 42, 0.25);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.table-modal__close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 1.1rem;
  line-height: 1;
}

.table-modal__header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.table-modal__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #0f172a;
  color: #fff;
  display: grid;
  place-items: center;
}

.table-modal__icon svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

.table-modal__header h2 {
  margin: 0;
}

.table-modal__header p {
  margin: 0.1rem 0 0;
  color: var(--muted);
}

.table-modal__status {
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text);
}

.table-modal__status.is-error {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #b91c1c;
}

.table-modal__timeline {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.table-modal__timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.table-modal__timeline-header strong {
  color: var(--text);
}

.table-modal__timeline input[type="range"] {
  width: 100%;
}

.table-modal__table-wrapper {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-muted);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  max-height: 60vh;
  overflow: auto;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.result-table thead {
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 1;
}

.result-table th,
.result-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 0.95rem;
}

.result-table th {
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.result-table tbody tr:nth-child(even) {
  background: rgba(248, 250, 252, 0.7);
}

.result-table__empty {
  text-align: center;
  color: var(--muted);
}

.about-page {
  padding: 1rem 2rem 3rem;
  gap: 2.25rem;
}

.about-hero {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.5rem;
  align-items: center;
  padding: 2rem;
  border-radius: 1.4rem;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 18px 55px rgba(15, 23, 42, 0.12);
}

.about-hero__text h1 {
  margin: 0.3rem 0 0.65rem;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.about-hero__text p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

.about-hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.about-hero__panel {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 1.5rem 1.75rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65), 0 10px 34px rgba(15, 23, 42, 0.08);
}

.about-hero__panel h3 {
  margin: 0 0 0.75rem;
}

.about-hero__panel ul {
  padding-left: 1.1rem;
  color: var(--muted);
  line-height: 1.5;
}

.about-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0, 109, 255, 0.1);
  color: var(--brand);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 0.75rem;
}

.about-hero__hint {
  color: var(--muted);
  font-size: 0.95rem;
}

.about-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.about-section--muted {
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.about-section .section-header {
  padding: 1.75rem 1.75rem 0.5rem;
  border: none;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  padding: 0 1.5rem 1.5rem;
}

.about-grid--two {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.about-card {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.2rem 1.3rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.about-card h3 {
  margin-top: 0;
  margin-bottom: 0.4rem;
}

.about-card p {
  color: var(--muted);
  margin: 0;
  line-height: 1.55;
}

.about-steps {
  margin: 0 1.75rem 1.75rem;
  padding-left: 1.25rem;
  color: var(--muted);
  display: grid;
  gap: 0.75rem;
  line-height: 1.6;
}

.about-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  display: grid;
  gap: 0.45rem;
}

.about-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.8rem 2rem;
  margin-top: -0.5rem;
  background: var(--brand);
  color: #fff;
  border-radius: 1.25rem;
  box-shadow: 0 20px 46px rgba(0, 109, 255, 0.25);
  flex-wrap: wrap;
}

.about-cta p {
  margin: 0.35rem 0 0;
  color: rgba(255, 255, 255, 0.92);
}

.about-cta__actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.about-cta .primary-button {
  background: #0b63e6;
}

.about-cta .ghost-button {
  border-color: rgba(255, 255, 255, 0.6);
  color: #fff;
  background: transparent;
}

.about-cta .ghost-button:hover {
  border-color: #fff;
  box-shadow: none;
}

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

.label {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 0.65rem;
  background: rgba(0, 109, 255, 0.12);
  color: var(--brand);
  font-weight: 700;
}

.badge-muted {
  background: var(--surface-muted);
  color: var(--muted);
}

.developer-page footer {
  margin-top: 2rem;
}

.developer-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem 2rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.developer-hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
  align-items: stretch;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.08);
}

.developer-hero h1 {
  margin: 0.1rem 0 0.35rem;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.developer-hero p {
  margin: 0 0 0.65rem;
  line-height: 1.6;
}

.state-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.state-card {
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.state-card strong {
  display: block;
  font-size: 1.2rem;
}

.developer-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1rem;
  align-items: start;
}

.developer-sidebar {
  display: grid;
  gap: 0.9rem;
}

.sidebar-card {
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.07);
  display: grid;
  gap: 0.6rem;
}

.sidebar-card h3 {
  margin: 0;
}

.sidebar-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  display: grid;
  gap: 0.45rem;
}

.sidebar-meta {
  display: grid;
  gap: 0.4rem;
}

.developer-chat {
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.1rem;
  box-shadow: 0 16px 44px rgba(15, 23, 42, 0.1);
  display: grid;
  gap: 0.85rem;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.chat-log {
  min-height: 320px;
  max-height: 560px;
  overflow-y: auto;
  padding: 1rem;
  border-radius: 1rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.chat-message {
  margin-bottom: 0.85rem;
}

.chat-message__meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.chat-bubble {
  padding: 0.8rem 0.9rem;
  border-radius: 0.9rem;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  line-height: 1.55;
  white-space: pre-wrap;
}

.chat-message--assistant .chat-bubble {
  background: #ecf5ff;
  border-color: rgba(0, 109, 255, 0.35);
}

.chat-message--error .chat-bubble {
  background: #fff1f2;
  border-color: #fecdd3;
}

.chat-composer {
  display: grid;
  gap: 0.5rem;
}

.chat-composer textarea {
  width: 100%;
  border-radius: 0.9rem;
  border: 1px solid var(--border);
  padding: 0.9rem 1rem;
  font: inherit;
  resize: vertical;
  min-height: 110px;
  background: var(--surface-muted);
}

.chat-composer textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 109, 255, 0.15);
  background: #fff;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.developer-auth {
  padding: 0 0.5rem;
}

.developer-auth__card {
  max-width: 560px;
  margin: 0 auto;
  padding: 1.4rem 1.6rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 12px 38px rgba(15, 23, 42, 0.08);
  display: grid;
  gap: 0.65rem;
}

.developer-auth__card h2 {
  margin: 0;
}

.developer-auth__card code {
  background: var(--surface-muted);
  padding: 0.1rem 0.35rem;
  border-radius: 0.35rem;
  border: 1px solid var(--border);
}

@media (max-width: 1024px) {
  .developer-hero {
    grid-template-columns: 1fr;
  }

  .developer-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .top-bar,
  .action-bar {
    padding: 1rem;
  }

  .network-area {
    padding: 0 1rem 1rem;
    min-height: 360px;
  }

  .about-page {
    padding: 1rem;
  }

  .about-hero {
    grid-template-columns: 1fr;
    padding: 1.5rem;
  }

  .about-section .section-header {
    padding: 1.5rem 1.25rem 0.5rem;
  }

  .about-grid {
    padding: 0 1.25rem 1.25rem;
  }

  .about-steps {
    margin: 0 1.25rem 1.25rem;
  }

  main {
    padding: 0 1rem 1rem;
    gap: 1.5rem;
  }

  .network-controls {
    grid-template-columns: 1fr;
    right: 1rem;
    top: 1rem;
    width: calc(100% - 2rem);
  }
}
