:root {
  color-scheme: light;
  --background: #f3f6fa;
  --surface: #fff;
  --ink: #14213a;
  --muted: #54657b;
  --line: #dce4ee;
  --nav: #101d31;
  --nav-muted: #aab9cd;
  --accent: #086a65;
  --accent-hover: #065450;
  --training: #087d73;
  --validation: #385fbe;
  --danger: #a82a3b;
  --radius: 14px;
  font: 15px/1.5 "Segoe UI", system-ui, sans-serif;
  background: var(--background);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea { font: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.7rem, 3vw, 2.35rem); line-height: 1.15; letter-spacing: -.035em; }
h2 { font-size: 1.15rem; letter-spacing: -.015em; }
small, .muted { color: var(--muted); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #2e84d9; outline-offset: 3px; }

.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--nav); color: white; padding: 28px 18px; display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 750; color: inherit; line-height: 1.2; }
.brand-mark { color: #092c2b; background: #8cddcb; border-radius: 10px; width: 38px; height: 38px; display: grid; place-items: center; font: 750 13px/1 system-ui; flex-shrink: 0; }
.brand small { display: block; margin-top: 3px; font-size: .76rem; font-weight: 500; color: var(--nav-muted); }
.side-heading { display: flex; align-items: center; justify-content: space-between; color: var(--nav-muted); font-size: .82rem; margin: 0 5px 8px; }
.pool-list { display: grid; gap: 5px; }
.pool-link { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 8px; color: #dbe5f3; overflow-wrap: anywhere; }
.pool-link:hover, .pool-link[aria-current="page"] { color: white; background: #263a55; text-decoration: none; }
.side-end { margin-top: auto; display: flex; gap: 16px; flex-wrap: wrap; border-top: 1px solid #34455e; padding: 15px 5px 0; }
.side-end a { color: #bdcce1; font-size: .83rem; }
.dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; background: #91a0b6; flex: 0 0 auto; }
.dot.running, .dot.online { background: #23b491; }
.dot.queued, .dot.paused, .dot.pausing { background: #e4a343; }
.dot.completed { background: #819ff2; }
.dot.failed { background: #e56b77; }

.main { width: 100%; max-width: 1350px; padding: 37px clamp(20px, 4vw, 56px); margin: 0 auto; }
.hub-bar { background: var(--nav); color: white; }
.hub-bar > div { max-width: 1270px; padding: 17px clamp(20px, 4vw, 56px); margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.hub-bar a { color: #e4f0f8; }
.hub-main { max-width: 1270px; }
.page-heading { display: flex; align-items: start; justify-content: space-between; gap: 15px; margin: 0 0 24px; }
.page-heading p { margin-top: 6px; color: var(--muted); overflow-wrap: anywhere; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; padding: 8px 13px; min-height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 650; white-space: nowrap; }
.button:hover { background: #eef4fa; text-decoration: none; }
.button.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.button.primary:hover { background: var(--accent-hover); }
.button.danger { color: var(--danger); }
.button:disabled { opacity: .53; cursor: default; }
.sidebar .button { width: 100%; }

.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); margin: 0 0 21px; }
.tabs button { color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer; padding: 8px 1px 12px; font-weight: 650; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 21px; min-width: 0; }
.panel + .panel { margin-top: 15px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin-bottom: 16px; }
.metrics > .panel { margin: 0; }
.metric { display: flex; flex-direction: column; justify-content: space-between; align-items: start; gap: 6px; }
.metric strong { font-size: clamp(1.2rem, 3vw, 1.85rem); line-height: 1.24; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric strong span { font-size: .83rem; font-weight: 550; color: var(--muted); }
.healthline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 11px; color: var(--muted); font-size: .88rem; }
.badge { width: max-content; display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 20px; font-size: .78rem; font-weight: 700; background: #e9eef6; color: #354b64; }
.badge.running, .badge.online { background: #d9f2e9; color: #0a5c4b; }
.badge.queued, .badge.paused, .badge.pausing { background: #fff0cf; color: #79540d; }
.badge.completed { background: #e5ecfc; color: #2a4c9d; }
.badge.failed { background: #fde6e9; color: var(--danger); }
.badge.offline { background: #edf0f5; color: #495970; }
progress { height: 8px; width: 100%; accent-color: var(--accent); }
.section-heading { display: flex; justify-content: space-between; align-items: start; gap: 15px; margin-bottom: 13px; }
.legend { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; color: var(--muted); font-size: .82rem; }
.key { width: 11px; height: 3px; display: inline-block; border-radius: 2px; vertical-align: middle; background: var(--training); }
.key.validation { background: var(--validation); }
.chart { width: 100%; height: 229px; display: block; }
.empty { padding: 28px 5px; text-align: center; color: var(--muted); }
.alert { padding: 10px 13px; border-radius: 8px; background: #e5f4f0; color: #07554d; margin: 0 0 14px; overflow-wrap: anywhere; }
.alert.error { background: #fbe8eb; color: #862134; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; }
td:last-child, th:last-child { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
.runs-table th[scope="row"] { min-width: 155px; text-align: left; overflow-wrap: anywhere; }
.runs-table progress { display: block; min-width: 66px; margin-top: 4px; }
.individual-layers { min-width: 11rem; }
.individual-layers span { display: block; overflow-wrap: anywhere; }
.run-actions { justify-content: flex-end; min-width: 180px; }
.run-actions .button { min-height: 32px; padding: 4px 9px; font-size: .83rem; }

.settings { display: grid; gap: 13px; }
.settings .panel { margin: 0; }
.settings h2, .settings summary { margin-bottom: 10px; }
.fields, .edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: grid; align-content: start; gap: 6px; min-width: 0; margin-bottom: 6px; }
.field.wide { grid-column: 1 / -1; }
.field > span { font-size: .88rem; font-weight: 650; }
input, textarea { width: 100%; color: var(--ink); background: #fcfdff; border: 1px solid #c9d5e2; border-radius: 7px; padding: 8px 9px; }
textarea { min-height: 86px; resize: vertical; }
textarea.code { min-height: 205px; font: .83rem/1.5 Consolas, "Cascadia Mono", monospace; tab-size: 2; }
details summary { font-weight: 700; cursor: pointer; }
details:not([open]) summary { margin-bottom: 0; }
.settings p { margin-bottom: 10px; }
.instances { display: grid; gap: 15px; }
.instances > .panel { margin: 0; }
.instances h2 { overflow-wrap: anywhere; }
.instance-status { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

@media (max-width: 820px) {
  .shell { display: block; }
  .sidebar { padding: 16px 20px; gap: 13px; }
  .sidebar .button { width: max-content; }
  .pool-list { display: flex; flex-wrap: wrap; }
  .page-heading, .section-heading { flex-wrap: wrap; }
  .side-end { padding-top: 9px; }
}
@media (max-width: 540px) {
  .metrics, .fields, .edit-grid { grid-template-columns: 1fr; }
  .metric { padding: 13px 15px; }
  .main { padding-top: 24px; }
  .panel { padding: 15px; }
  .chart { height: 195px; }
}

.parameters input, .parameters select { min-width: 95px; width: 100%; }
.parameters select { font: inherit; padding: 8px; border: 1px solid #c9d5e2; border-radius: 7px; background: #fcfdff; }
.parameters th { white-space: nowrap; }
.parameter-group { margin: 12px 0; padding: 10px 0; border-bottom: 1px solid var(--line); }
.parameter-group h3, #parameter-tables h3 { font-size: .95rem; margin: 14px 0 5px; }
#parameter-tables .table-wrap + .button, #parameter-tables .table-wrap + .actions { margin-top: 8px; }
