:root {
  color-scheme: dark;
  --ink: #eef4f3;
  --muted: #91a3a0;
  --faint: #60716e;
  --surface: #101816;
  --surface-2: #15201d;
  --line: rgba(182, 210, 203, .12);
  --mint: #4ce0ad;
  --mint-soft: rgba(76, 224, 173, .12);
  --amber: #f0bd63;
  --red: #ff766d;
  --blue: #69a8ff;
  --shadow: 0 18px 70px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 1120px;
  background:
    radial-gradient(circle at 20% -10%, rgba(63, 160, 127, .16), transparent 34rem),
    linear-gradient(180deg, #0b1110, #0d1412 28rem, #0b1210);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1540px, calc(100% - 56px)); margin: 0 auto; padding-bottom: 64px; }
.topbar { height: 92px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand-block { display: flex; gap: 15px; align-items: center; }
.brand-mark { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: linear-gradient(140deg, var(--mint), #1d795c); color: #07110d; font-weight: 900; box-shadow: 0 10px 30px rgba(76, 224, 173, .17); }
.brand-mark span { letter-spacing: -.05em; }
.eyebrow { margin: 0 0 4px; color: var(--mint); font-size: 10px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 22px; letter-spacing: -.025em; }
h1 span { color: var(--muted); font-weight: 500; }
.connection { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; font-weight: 650; }
.connection i { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 5px rgba(240, 189, 99, .08); }
.connection.online i { background: var(--mint); box-shadow: 0 0 0 5px var(--mint-soft); }
.connection.offline i { background: var(--red); }

main { padding-top: 30px; }
.control-panel { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 44px; padding: 28px 30px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(115deg, rgba(23, 39, 34, .94), rgba(15, 25, 22, .94)); box-shadow: var(--shadow); overflow: hidden; }
.control-panel::after { content: ""; position: absolute; width: 240px; height: 240px; right: 26%; top: -170px; border-radius: 50%; background: rgba(76, 224, 173, .12); filter: blur(50px); pointer-events: none; }
.control-copy h2 { margin-bottom: 7px; font-size: 24px; letter-spacing: -.03em; }
.control-copy > p:last-child { margin: 0; color: var(--muted); }
.run-form { position: relative; z-index: 1; display: flex; align-items: end; gap: 10px; }
.run-form label { display: grid; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
input, select { color: var(--ink); border: 1px solid var(--line); background: #0c1412; outline: none; }
.run-form input { height: 42px; min-width: 150px; padding: 0 12px; border-radius: 9px; color-scheme: dark; }
.run-form label:nth-child(3) input { min-width: 90px; width: 90px; }
input:focus, select:focus { border-color: rgba(76, 224, 173, .55); box-shadow: 0 0 0 3px rgba(76, 224, 173, .08); }
.run-form button { height: 42px; display: flex; gap: 24px; align-items: center; border: 0; border-radius: 9px; padding: 0 15px 0 18px; background: var(--mint); color: #07110d; font-weight: 850; }
.run-form button:hover { filter: brightness(1.06); }
.run-form button:disabled { opacity: .5; cursor: not-allowed; }
.form-message { position: absolute; right: 30px; bottom: 4px; margin: 0; color: var(--amber); font-size: 11px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0; }
.metric-grid article { padding: 20px 22px; border: 1px solid var(--line); border-radius: 14px; background: rgba(16, 24, 22, .86); }
.metric-grid p { margin-bottom: 10px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.metric-grid strong { display: block; margin-bottom: 5px; font-size: 32px; line-height: 1; letter-spacing: -.04em; }
.metric-grid small { color: var(--faint); }
.metric-grid .metric-alert strong { color: var(--amber); }

.workspace { border: 1px solid var(--line); border-radius: 18px; background: rgba(15, 23, 21, .92); box-shadow: var(--shadow); overflow: hidden; }
.workspace-head { display: flex; justify-content: space-between; align-items: center; padding: 24px 26px 20px; }
.workspace-head h2 { margin-bottom: 5px; font-size: 21px; letter-spacing: -.025em; }
.workspace-head > div > p:last-child { margin: 0; color: var(--muted); font-size: 12px; }
.run-nav { display: flex; align-items: center; gap: 8px; }
.run-nav select { height: 38px; min-width: 330px; padding: 0 10px; border-radius: 8px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 8px; background: #0c1412; color: var(--ink); }
.icon-button:disabled { color: var(--faint); cursor: default; }
.toolbar { display: flex; align-items: center; gap: 16px; min-height: 58px; padding: 9px 26px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(7, 13, 11, .36); }
.discipline-tabs { display: flex; gap: 4px; }
.tab { padding: 8px 12px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; }
.tab.active { color: #08110e; background: var(--mint); }
.search { width: 245px; height: 34px; margin-left: auto; display: flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #0c1412; color: var(--faint); }
.search input { width: 100%; height: 100%; padding: 0; border: 0; background: transparent; box-shadow: none; }
.refresh-label { width: 150px; margin: 0; color: var(--faint); font-size: 11px; text-align: right; }

.table-wrap { position: relative; min-height: 320px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { height: 42px; padding: 0 13px; color: var(--faint); background: rgba(7, 13, 11, .38); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-align: left; text-transform: uppercase; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 26px; }
th:last-child, td:last-child { padding-right: 26px; }
td { height: 66px; padding: 8px 13px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: rgba(76, 224, 173, .025); }
.source-name { display: block; margin-bottom: 3px; font-size: 13px; font-weight: 750; }
.source-id, .subtle { color: var(--faint); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; }
.discipline { display: inline-grid; width: 27px; height: 27px; place-items: center; border-radius: 7px; color: #07110d; background: var(--blue); font-size: 11px; font-weight: 900; }
.discipline.H { background: var(--mint); }
.discipline.G { background: var(--amber); }
.phase { display: block; margin-bottom: 3px; font-weight: 700; text-transform: capitalize; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 99px; background: rgba(145, 163, 160, .09); color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.running, .status.completed { color: var(--mint); background: var(--mint-soft); }
.status.queued { color: var(--blue); background: rgba(105, 168, 255, .1); }
.status.partial, .status.no_data { color: var(--amber); background: rgba(240, 189, 99, .1); }
.status.failed { color: var(--red); background: rgba(255, 118, 109, .1); }
.status.not_available { color: var(--faint); }
.count { font-size: 16px; font-weight: 800; }
.queue-stack { min-width: 115px; }
.queue-labels { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--faint); font-size: 10px; }
progress { display: block; width: 100%; height: 4px; border: 0; border-radius: 4px; overflow: hidden; background: rgba(145, 163, 160, .12); }
progress::-webkit-progress-bar { background: rgba(145, 163, 160, .12); }
progress::-webkit-progress-value { background: var(--mint); }
progress::-moz-progress-bar { background: var(--mint); }
.detail-button { border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 700; }
.detail-button:hover { color: var(--ink); border-color: rgba(76, 224, 173, .4); }
.empty-state { display: none; min-height: 320px; place-content: center; text-align: center; color: var(--muted); }
.empty-state.visible { display: grid; }
.empty-state div { color: var(--mint); font-size: 35px; }
.empty-state h3 { margin: 8px 0 5px; color: var(--ink); }
.empty-state p { margin: 0; }

dialog { width: min(900px, calc(100% - 80px)); border: 1px solid var(--line); border-radius: 15px; padding: 0; background: #101816; color: var(--ink); box-shadow: 0 25px 120px rgba(0, 0, 0, .7); }
dialog::backdrop { background: rgba(2, 7, 5, .72); backdrop-filter: blur(5px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog-head button { border: 0; background: transparent; color: var(--muted); font-size: 27px; }
pre { min-height: 240px; max-height: 560px; overflow: auto; margin: 0; padding: 22px; color: #b9cac6; background: #09100e; font: 11px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }

@media (max-width: 1250px) {
  .shell { width: calc(100% - 32px); }
  .control-panel { gap: 20px; }
  .run-form input { min-width: 132px; }
}
