:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #617089;
  --line: #d9e1ea;
  --panel: #ffffff;
  --bg: #eef5fb;
  --accent: #078bd3;
  --accent-dark: #073a78;
  --accent-soft: #eaf7ff;
  --accent-line: #b8dcf3;
  --cyan: #16c7df;
  --warn: #b45309;
  --bad: #b42318;
  --good: #107c41;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(7, 139, 211, 0.12), transparent 34%),
    linear-gradient(220deg, rgba(22, 199, 223, 0.10), transparent 28%),
    var(--bg);
}

.shell {
  width: min(1680px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

.hero {
  min-height: 220px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
  align-items: stretch;
  padding: 18px;
  border: 1px solid rgba(23, 32, 51, 0.12);
  background: linear-gradient(135deg, #ffffff 0%, #f7fbff 55%, #e6f5ff 100%);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(23, 32, 51, 0.10);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-stats {
  display: flex;
  align-items: stretch;
}

.brand-logo {
  width: min(360px, 100%);
  height: auto;
  display: block;
  margin: 0 0 10px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 4.2vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.intro {
  max-width: 820px;
  margin-bottom: 0;
  color: #344258;
  font-size: 0.9rem;
  line-height: 1.45;
}

.intro-secondary {
  margin-top: 8px;
  color: #465873;
}

.hero-benefits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.hero-benefit {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  background: rgba(234, 247, 255, 0.72);
}

.hero-benefit-icon {
  width: 36px;
  height: 36px;
  display: block;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(23, 32, 51, 0.10);
}

.hero-benefit strong {
  display: block;
  color: var(--accent-dark);
  font-size: 0.92rem;
}

.hero-benefit span {
  display: block;
  color: #52647e;
  font-size: 0.84rem;
  line-height: 1.35;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
  width: 100%;
}

.metric, .panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
}

.metric {
  min-height: 72px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hero-metrics {
  align-self: stretch;
}

.metric.primary {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #fff;
  border-color: var(--accent);
}

.metric span {
  color: inherit;
  opacity: 0.78;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  font-size: clamp(1.15rem, 1.9vw, 1.7rem);
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.32fr);
  gap: 24px;
  margin-top: 18px;
  align-items: start;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.tab-button {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #344258;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.tab-button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
}

.panel.tab-panel.active {
  display: block;
}

.tutorial-panel {
  margin-top: 18px;
}

.tutorial-intro {
  padding: 4px 0 16px;
  border-bottom: 1px solid var(--line);
}

.tutorial-kicker {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.tutorial-intro h2 {
  margin-bottom: 6px;
  font-size: clamp(1.65rem, 2.5vw, 2.4rem);
  line-height: 1.05;
  color: var(--accent-dark);
}

.tutorial-intro p {
  max-width: 940px;
  margin-bottom: 0;
  color: #40516a;
  font-size: 0.92rem;
  line-height: 1.5;
}

.tutorial-steps {
  display: grid;
  gap: 18px;
}

.workflow-graphic {
  width: min(100%, 920px);
  margin: 18px auto 18px;
  overflow: hidden;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  background: #f8fcff;
  box-shadow: 0 18px 45px rgba(7, 58, 120, 0.10);
}

.workflow-graphic img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  height: auto;
}

.tutorial-card {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 0.7fr);
  gap: 24px;
  align-items: stretch;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.tutorial-card:nth-child(even) {
  background: #f7fbff;
}

.tutorial-copy {
  align-self: center;
}

.step-number {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
}

.tutorial-copy h3 {
  margin: 12px 0 8px;
  color: var(--ink);
  font-size: 1.28rem;
}

.tutorial-copy p {
  margin-bottom: 12px;
  color: #40516a;
  line-height: 1.5;
}

.tutorial-copy ul {
  margin: 0;
  padding-left: 18px;
  color: #4b5d76;
  line-height: 1.55;
}

.tutorial-copy li + li {
  margin-top: 5px;
}

.tutorial-shot {
  min-height: 240px;
  display: grid;
  grid-template-rows: 30px 1fr;
  overflow: hidden;
  border: 1px solid #c8d8e6;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(23, 32, 51, 0.10);
}

.entry-mini,
.result-mini,
.run-mini {
  margin: 18px;
}

.entry-mini {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.entry-card,
.result-mini-row,
.run-mini-output div,
.run-mini-actions span,
.run-mini-status {
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #f8fafc;
}

.entry-card {
  padding: 16px;
  display: grid;
  gap: 6px;
  align-content: start;
}

.entry-card b,
.run-mini-status strong,
.result-mini-row b,
.run-mini-output b {
  color: var(--accent-dark);
}

.entry-card span,
.entry-card small,
.result-mini-row span,
.run-mini-output span,
.run-mini-status span {
  color: #52647e;
}

.entry-card b,
.result-mini-row b,
.run-mini-output b,
.run-mini-status strong {
  font-size: 0.96rem;
}

.entry-card span,
.result-mini-row span,
.run-mini-output span,
.run-mini-status span {
  font-size: 0.84rem;
  line-height: 1.35;
}

.shot-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
}

.shot-toolbar span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
}

.shot-panel,
.network-mini,
.variable-grid,
.advanced-mini {
  margin: 18px;
}

.draw-mini {
  display: grid;
  grid-template-rows: minmax(140px, 1fr) auto;
  gap: 14px;
  margin: 18px;
}

.draw-map {
  position: relative;
  min-height: 180px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background:
    linear-gradient(rgba(7, 139, 211, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(7, 139, 211, 0.08) 1px, transparent 1px),
    #f8fcff;
  background-size: 34px 34px;
  overflow: hidden;
}

.draw-node,
.draw-line {
  position: absolute;
}

.draw-node {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 4px 10px rgba(23, 32, 51, 0.24);
  background: var(--accent);
}

.draw-node.a { left: 18%; top: 28%; }
.draw-node.b { left: 48%; top: 44%; }
.draw-node.c { left: 72%; top: 18%; }

.draw-line {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, #0a7cd8, #16c7df);
}

.draw-line.l1 {
  left: 26%;
  top: 33%;
  width: 24%;
  transform: rotate(16deg);
  transform-origin: left center;
}

.draw-line.l2 {
  left: 56%;
  top: 26%;
  width: 20%;
  transform: rotate(-28deg);
  transform-origin: left center;
}

.draw-table {
  display: grid;
  gap: 8px;
}

.draw-table div {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #fff;
}

.draw-table b {
  color: var(--accent-dark);
  font-size: 0.88rem;
}

.draw-table span {
  color: #52647e;
  font-size: 0.82rem;
}

.shot-heading {
  margin-bottom: 12px;
  color: var(--accent-dark);
  font-size: 1.04rem;
  font-weight: 900;
}

.shot-drop {
  min-height: 120px;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 2px dashed #9eb7ce;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 900;
  text-align: center;
}

.shot-drop small {
  display: block;
  margin-top: 8px;
  color: #52647e;
  font-weight: 700;
}

.shot-button {
  margin-top: 12px;
  padding: 12px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  text-align: center;
}

.network-mini {
  display: grid;
  gap: 12px;
}

.mini-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #fff;
}

.mini-row.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.mini-row b {
  color: var(--accent-dark);
}

.mini-row em,
.mini-row i {
  color: #52647e;
  font-style: normal;
  font-size: 0.84rem;
  font-weight: 800;
}

.mini-grid,
.variable-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mini-grid span,
.variable-grid label,
.advanced-mini div,
.finish-actions span {
  padding: 13px;
  border: 1px solid #dbe5ef;
  border-radius: 7px;
  background: #f8fafc;
  color: #3a4b64;
  font-weight: 800;
}

.variable-grid label {
  min-height: 82px;
  display: grid;
  align-content: center;
}

.variable-grid strong {
  display: block;
  margin-top: 7px;
  color: var(--accent-dark);
  font-size: 1.14rem;
}

.advanced-mini {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.advanced-mini div {
  min-height: 96px;
  display: grid;
  align-content: start;
}

.advanced-mini b {
  display: block;
  margin-bottom: 8px;
  color: var(--accent-dark);
}

.advanced-mini span {
  color: #52647e;
  font-size: 0.9rem;
  line-height: 1.35;
}

.run-mini {
  display: grid;
  gap: 12px;
}

.run-mini-status {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #eff7ff, #f9fcff);
}

.run-mini-output {
  display: grid;
  gap: 8px;
}

.run-mini-output div {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
}

.run-mini-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.run-mini-actions span {
  display: grid;
  place-items: center;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
  background: var(--accent-soft);
}

.tutorial-finish {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.55fr);
  gap: 20px;
  align-items: center;
  margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  background: linear-gradient(135deg, #f8fcff, var(--accent-soft));
}

.tutorial-finish h3 {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 1.35rem;
}

.tutorial-finish p {
  margin: 0;
  color: #40516a;
  line-height: 1.58;
}

.finish-actions {
  display: grid;
  gap: 9px;
}

.panel {
  padding: 22px;
  box-shadow: 0 14px 40px rgba(23, 32, 51, 0.07);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.panel-heading h2 {
  margin-bottom: 4px;
  font-size: 1.18rem;
}

.panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.status {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  background: #eef2f6;
  color: #48566b;
}

.status.running { background: #fff7ed; color: var(--warn); }
.status.complete { background: #ecfdf3; color: var(--good); }
.status.failed { background: #fef3f2; color: var(--bad); }

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 132px;
  padding: 18px;
  border: 2px dashed #aab8c8;
  border-radius: 8px;
  background: #f8fbfd;
  cursor: pointer;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop-zone input { display: none; }
.drop-title { display: block; font-weight: 800; font-size: 0.98rem; }
.drop-subtitle { display: block; margin-top: 8px; color: var(--muted); }

.secondary-button {
  width: 100%;
  min-height: 42px;
  margin-top: 12px;
  border: 1px solid var(--accent-line);
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.secondary-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.mode-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.mode-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  font-weight: 800;
}

.mode-option span {
  margin: 0;
}

.network-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.network-tab-panel {
  margin-top: 18px;
}

.network-load-card {
  max-width: 780px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.network-status {
  margin: 12px 0 0;
  padding: 9px 11px;
  border: 1px solid #dbe5ef;
  border-radius: 7px;
  background: #fff;
  color: #52647e;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.4;
}

.network-designer {
  display: grid;
  gap: 16px;
  margin-top: 20px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.hydrology-section {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fcff;
}

.hydrology-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.hydrology-grid label,
.hydrology-note {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #fff;
}

.hydrology-grid span {
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 800;
}

.hydrology-note strong {
  color: var(--accent-dark);
}

.hydrology-note span {
  color: #40516a;
  font-weight: 800;
}

.hydrology-note small {
  color: #5c6f89;
  line-height: 1.5;
}

.designer-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.designer-heading h3 {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 1.18rem;
}

.designer-heading p {
  max-width: 860px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.designer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.designer-shell {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.map-toolbar {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #fff;
}

.tool-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.tool-button {
  min-height: 38px;
  border: 1px solid #c5d0dd;
  border-radius: 6px;
  background: #fff;
  color: #344258;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 900;
  cursor: pointer;
}

.tool-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.compact {
  min-height: 42px;
  margin-top: 0;
}

.designer-status {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #dbe5ef;
  border-radius: 7px;
  background: #f8fafc;
  color: #52647e;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.45;
}

.designer-mode-actions {
  display: grid;
  gap: 7px;
  padding: 11px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-soft);
}

.designer-mode-actions[hidden] { display: none; }
.designer-mode-actions strong { color: var(--accent-dark); }
.designer-mode-actions span { color: #40516a; font-size: 0.82rem; line-height: 1.35; }
.designer-mode-actions div { display: flex; flex-wrap: wrap; gap: 6px; }
.designer-mode-actions .mini-button { flex: 1 1 auto; }

.selection-delete:disabled {
  opacity: 0.55;
  cursor: default;
}

.designer-keyboard-help {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.network-delete-button {
  margin-top: 6px;
  border-top: 1px solid #efc0bc;
}

.map-workspace {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  border: 1px solid #c8d8e6;
  border-radius: 8px;
  background: #e5eef6;
}

.map-search {
  position: absolute;
  z-index: 1200;
  top: 12px;
  left: 64px;
  width: min(420px, calc(100% - 76px));
  box-shadow: 0 10px 28px rgba(23, 32, 51, 0.20);
}

.map-network-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1200;
  display: grid;
  gap: 10px;
  width: min(320px, calc(100% - 24px));
  max-height: 300px;
  overflow: auto;
  padding: 10px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 28px rgba(23, 32, 51, 0.16);
}

.map-network-group {
  display: grid;
  gap: 6px;
}

.map-network-heading {
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.map-network-toggle {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid #e4ecf4;
  border-radius: 7px;
  background: #f9fbfd;
  cursor: pointer;
}

.map-network-toggle input {
  margin: 0;
}

.map-network-toggle .swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.map-network-toggle .toggle-text {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.map-network-toggle strong {
  color: var(--accent-dark);
  font-size: 0.84rem;
  line-height: 1.2;
}

.map-network-toggle small {
  color: #52647e;
  font-size: 0.72rem;
  font-weight: 800;
}

.map-network-empty {
  padding: 8px;
  color: #52647e;
  font-size: 0.8rem;
  line-height: 1.4;
}

.custom-map {
  width: 100%;
  height: 100%;
  min-height: 560px;
}

.custom-map.drawing-active,
.custom-map.drawing-active .leaflet-interactive { cursor: crosshair; }

.map-empty {
  height: 100%;
  min-height: 560px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 28px;
  text-align: center;
  color: #40516a;
  background:
    linear-gradient(135deg, rgba(7, 139, 211, 0.16), transparent 38%),
    linear-gradient(220deg, rgba(22, 199, 223, 0.12), transparent 32%),
    #eef5fb;
}

.map-empty strong {
  color: var(--accent-dark);
  font-size: 1.08rem;
}

.map-empty span {
  max-width: 420px;
  line-height: 1.45;
}

.network-data-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr);
  gap: 14px;
}

.data-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #fff;
}

.custom-table-wrap {
  max-height: 340px;
  overflow: auto;
  border: 1px solid #edf2f7;
  border-radius: 7px;
}

.custom-table {
  min-width: 100%;
  width: 100%;
  font-size: 0.8rem;
}

.custom-table input,
.custom-table select {
  min-width: 72px;
  height: 30px;
  padding: 0 6px;
  font-size: 0.78rem;
}

.custom-table .short-input {
  min-width: 64px;
}

.custom-table .wide-input {
  min-width: 102px;
}

.custom-table .delete-row {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid #f1b7b3;
  border-radius: 6px;
  background: #fef3f2;
  color: var(--bad);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 900;
  cursor: pointer;
}

.custom-table th,
.custom-table td {
  padding: 8px 6px;
  white-space: nowrap;
}

.custom-table th {
  font-size: 0.68rem;
}

.loaded-model-row {
  background: #f7fbff;
}

.table-source-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid #b9d8f0;
  border-radius: 999px;
  background: #e8f4ff;
  color: #075985;
  font-size: 0.68rem;
  font-weight: 900;
}

.custom-map-marker {
  background: transparent;
  border: 0;
}

.custom-map-marker span {
  width: 22px;
  height: 22px;
  display: block;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(23, 32, 51, 0.32);
}

.custom-map-label {
  background: transparent;
  border: 0;
}

.custom-map-label span {
  display: inline-block;
  padding: 3px 6px;
  border: 1px solid rgba(7, 58, 120, 0.24);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 12px rgba(23, 32, 51, 0.16);
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.network-rows {
  display: grid;
  gap: 10px;
}

.network-placeholder {
  margin: 0;
  padding: 12px;
  border: 1px dashed #c5d0dd;
  border-radius: 7px;
  color: var(--muted);
  background: #f8fafc;
  font-weight: 700;
}

.network-row {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #fff;
}

.network-card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf2f7;
}

.network-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.network-name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  font-weight: 800;
}

.network-name input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.network-type {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.network-settings,
.backdrop-settings {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
}

.network-settings .wide-field {
  grid-column: span 2;
}

.backdrop-settings {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  padding: 12px;
  border: 1px solid var(--accent-line);
  border-radius: 7px;
  background: var(--accent-soft);
}

.network-row .target-field {
  display: none;
}

.network-row .backdrop-settings {
  display: none;
}

.network-row.end-il .target-field {
  display: block;
}

.network-row.end-il .velocity-field {
  display: none;
}

.network-row.backdrops-enabled .backdrop-settings {
  display: grid;
}

.network-row .cover-disabled {
  opacity: 0.52;
}

.network-row .cover-disabled input:disabled {
  cursor: not-allowed;
  background: #edf2f7;
  color: #6b7280;
}

.network-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: #38465b;
  font-weight: 800;
}

.network-toggle span {
  margin: 0;
}

.network-toggle input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.result-panel {
  position: sticky;
  top: 18px;
}

.small-note {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.end-il-controls {
  display: none;
}

.end-il-controls.active {
  display: grid;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: #38465b;
  font-size: 0.84rem;
  font-weight: 700;
}

input, select {
  width: 100%;
  height: 42px;
  border: 1px solid #c5d0dd;
  border-radius: 6px;
  padding: 0 11px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

input:focus, select:focus {
  outline: 3px solid rgba(7, 139, 211, 0.20);
  border-color: var(--accent);
}

.switch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 18px 0;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #344258;
  font-weight: 700;
}

.switch input { display: none; }

.switch span {
  width: 42px;
  height: 24px;
  margin: 0;
  border-radius: 999px;
  background: #c8d2df;
  position: relative;
}

.switch span::after {
  content: "";
  width: 18px;
  height: 18px;
  position: absolute;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
}

.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }

.run-button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
}

.run-button:disabled {
  opacity: 0.62;
  cursor: wait;
}

.button-icon {
  margin-right: 8px;
  font-size: 0.9rem;
}

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.advanced-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px;
}

.cover-override-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.cover-override-modal[hidden] {
  display: none;
}

.cover-override-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
}

.cover-override-card {
  z-index: 1;
  position: relative;
  width: min(1100px, 100%);
  max-height: min(84vh, 900px);
  overflow: hidden;
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
}

.cover-table-wrap {
  max-height: 56vh;
  overflow: auto;
}

.cover-table th,
.cover-table td {
  white-space: nowrap;
}

.cover-table input {
  height: 36px;
}

.cover-override-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.advanced-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.advanced-heading h3 {
  margin: 0;
  font-size: 0.95rem;
}

.mini-button,
.remove-row {
  min-height: 32px;
  border: 1px solid #c5d0dd;
  border-radius: 6px;
  background: #fff;
  color: #344258;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.mini-button {
  padding: 0 12px;
}

.rows {
  display: grid;
  gap: 8px;
}

.advanced-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #fff;
}

.advanced-row select,
.advanced-row input,
.advanced-row button {
  height: 38px;
}

.advanced-row .remove-row {
  grid-column: 1 / -1;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.result-stats div {
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}

.result-stats span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.result-stats strong {
  display: block;
  margin-top: 8px;
  font-size: 1.25rem;
}

.downloads {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  margin-top: 16px;
}

.downloads a,
.download-button {
  display: block;
  padding: 10px 11px;
  border: 1px solid var(--accent-line);
  border-radius: 7px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 800;
  text-decoration: none;
}

.table-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.table-download {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 6px 9px;
  border: 1px solid var(--accent-line);
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
}

.download-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.log {
  min-height: 200px;
  max-height: 380px;
  overflow: auto;
  margin: 16px 0 0;
  padding: 12px;
  border: 1px solid #dce3eb;
  border-radius: 7px;
  background: #101828;
  color: #e6edf7;
  white-space: pre-wrap;
  line-height: 1.5;
}

.recent-panel {
  margin-top: 24px;
}

.issue-panel {
  margin-top: 24px;
}

.contact-panel {
  margin-top: 24px;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.contact-card {
  display: block;
  padding: 18px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  background: #f7fbff;
  color: var(--ink);
  text-decoration: none;
}

.contact-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.contact-card strong {
  color: var(--accent-dark);
  font-size: 1rem;
}

.engineering-disclaimer {
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid #f2b8b5;
  border-radius: 8px;
  background: #fff5f5;
  color: #b42318;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.4;
}

.issue-form {
  display: grid;
  grid-template-columns: minmax(220px, 0.35fr) minmax(0, 1fr) minmax(160px, 0.2fr);
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
}

textarea {
  width: 100%;
  border: 1px solid #c5d0dd;
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  resize: vertical;
}

textarea:focus {
  outline: 3px solid rgba(7, 139, 211, 0.20);
  border-color: var(--accent);
}

.issue-list {
  display: grid;
  gap: 14px;
}

.issue-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 14px;
}

.issue-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.84rem;
}

.issue-meta strong {
  color: var(--ink);
}

.issue-status {
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef2f6;
  color: #48566b;
  font-weight: 800;
}

.issue-status.open { background: #fef3f2; color: var(--bad); }
.issue-status.in-progress { background: #fff7ed; color: var(--warn); }
.issue-status.resolved { background: #ecfdf3; color: var(--good); }
.issue-status.closed { background: #eef2f6; color: #48566b; }

.issue-text {
  margin: 10px 0 12px;
  white-space: pre-wrap;
  line-height: 1.45;
}

.issue-card label {
  display: block;
  margin-top: 10px;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th, td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: #506078;
  font-size: 0.82rem;
  text-transform: uppercase;
}

td {
  color: #26344a;
}

@media (max-width: 980px) {
  .hero, .workspace, .tutorial-card, .tutorial-finish, .designer-shell, .network-data-grid {
    grid-template-columns: 1fr;
  }
  .contact-grid {
    grid-template-columns: 1fr;
  }
  .metric-grid, .controls-grid, .advanced-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .network-settings,
  .backdrop-settings {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .result-panel {
    position: static;
  }
  .designer-heading {
    display: grid;
  }
  .designer-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1680px);
    padding-top: 10px;
  }
  .map-search {
    left: 12px;
    width: calc(100% - 24px);
  }
  .hero, .panel {
    padding: 16px;
  }
  .metric-grid, .controls-grid, .result-stats, .mode-row, .advanced-grid, .issue-form, .network-settings, .backdrop-settings, .mini-grid, .variable-grid, .advanced-mini, .tool-buttons {
    grid-template-columns: 1fr;
  }
  .workflow-graphic {
    overflow-x: auto;
  }
  .workflow-graphic img {
    width: max(760px, 100%);
  }
  .tutorial-card,
  .tutorial-finish {
    padding: 14px;
  }
  .tutorial-shot {
    min-height: 240px;
  }
  .mini-row {
    grid-template-columns: 1fr;
  }
  .network-card-head {
    display: grid;
  }
  .network-settings .wide-field {
    grid-column: auto;
  }
  .map-workspace,
  .custom-map,
  .map-empty {
    min-height: 420px;
  }
  .panel-heading {
    display: block;
  }
  .status {
    display: inline-block;
    margin-top: 12px;
  }
}

/* Compact workspace refinements */
.hero {
  min-height: 0;
  grid-template-columns: minmax(0, 1.45fr) minmax(380px, 0.55fr);
  padding: 14px;
}

.brand-logo { width: min(260px, 100%); margin-bottom: 6px; }
.hero-benefits { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.hero-benefit { min-height: 58px; padding: 7px 8px; grid-template-columns: 42px minmax(0, 1fr); gap: 8px; }
.hero-benefit-icon { width: 42px; height: 42px; box-shadow: none; }
.hero-benefit strong { font-size: 0.84rem; }
.hero-benefit span { font-size: 0.75rem; line-height: 1.25; }
.metric { min-height: 60px; padding: 8px; }

.network-load-card {
  max-width: none;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) auto minmax(260px, 0.7fr);
  gap: 10px;
  align-items: center;
}
.drop-zone { min-height: 64px; padding: 10px 16px; place-items: start; text-align: left; align-content: center; }
.drop-subtitle { margin-top: 3px; }
.network-load-card .secondary-button { width: auto; min-height: 40px; margin: 0; padding: 0 18px; }
.network-load-card .network-status { margin: 0; }

.designer-shell { grid-template-columns: minmax(210px, 240px) minmax(0, 1fr); }
.map-toolbar { padding: 11px; gap: 9px; }
.tool-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.map-workspace, .custom-map, .map-empty { min-height: 680px; }
.network-data-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
.area-data-card { grid-column: 1 / -1; }
.area-table { min-width: 680px; }
.data-card { padding: 11px; }
.custom-table-wrap { max-height: 410px; }
.custom-table thead { position: sticky; top: 0; z-index: 2; background: #f7fbff; }
.custom-table tbody tr:hover { background: #f0f8fd; }

.danger-button { border-color: #efc0bc; color: var(--bad); background: #fff7f6; }
.hydrology-grid label[hidden], .idf-summary[hidden] { display: none; }
.idf-summary {
  grid-column: span 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  background: var(--accent-soft);
}
.idf-summary div { display: grid; gap: 4px; }
.idf-summary strong { color: var(--accent-dark); }
.idf-summary small, #fehFileSection small { color: var(--muted); line-height: 1.4; }
.idf-summary .secondary-button { width: auto; white-space: nowrap; padding: 0 16px; }
.idf-matrix-card { width: min(1040px, calc(100vw - 40px)); }
.idf-table-wrap { max-height: 66vh; }
.idf-table th:first-child { position: sticky; left: 0; z-index: 3; background: #f7fbff; }
.idf-table input { width: 88px; }
.idf-validation { margin: 12px 0 0; color: var(--bad); font-weight: 800; }
.idf-validation.valid { color: var(--good); }
.custom-map-marker span { border-color: #fff; }
.area-vertex-marker {
  background: transparent;
  border: 0;
}
.area-vertex-marker span {
  display: block;
  width: 14px;
  height: 14px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #15803d;
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.55);
  cursor: move;
}
.area-vertex-marker span.selected {
  background: #b42318;
  transform: scale(1.25);
}

@media (max-width: 1250px) {
  .hero-benefits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .network-load-card { grid-template-columns: 1fr auto; }
  .network-load-card .network-status { grid-column: 1 / -1; }
  .network-data-grid { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .network-load-card { grid-template-columns: 1fr; }
  .network-load-card .secondary-button { width: 100%; }
  .map-workspace, .custom-map, .map-empty { min-height: 560px; }
  .idf-summary { grid-column: auto; }
}
