:root {
  --bg: #101310;
  --panel: #171c18;
  --panel-light: #1d241e;
  --line: #303a31;
  --text: #eef2e9;
  --muted: #8f9a8e;
  --acid: #c8f65d;
  --amber: #f0ad4e;
  --red: #f07563;
  --display: "Unbounded", sans-serif;
  --mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 90% 0%, rgba(200, 246, 93, .055), transparent 28rem),
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 40px 40px, 40px 40px, auto;
  color: var(--text);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
}
.noise {
  position: fixed; inset: 0; pointer-events: none; opacity: .16; z-index: 10;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.13'/%3E%3C/svg%3E");
}
.shell { width: min(1500px, calc(100% - 64px)); margin: 0 auto; }
.dashboard-shell { width: min(1800px, calc(100% - 64px)); }
.masthead { display: flex; justify-content: space-between; gap: 40px; align-items: flex-end; padding: 50px 0 38px; }
.eyebrow { color: var(--acid); font-size: 11px; letter-spacing: .16em; display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.live-dot { width: 7px; height: 7px; background: var(--acid); border-radius: 50%; box-shadow: 0 0 16px var(--acid); }
h1 { font: 600 clamp(30px, 3.3vw, 54px)/1.08 var(--display); letter-spacing: -.045em; margin: 0; }
h1 span { color: var(--muted); }
.control-block { min-width: 365px; }
.state-line { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.state-tools { display: flex; align-items: center; gap: 15px; }
.settings-link { color: var(--text); font-size: 10px; text-decoration: none; border-bottom: 1px solid var(--muted); padding-bottom: 2px; }
.settings-link:hover { color: var(--acid); border-color: var(--acid); }
.state-badge { display: inline-flex; align-items: center; min-height: 27px; padding: 0 11px; border: 1px solid currentColor; font-size: 10px; font-weight: 600; letter-spacing: .13em; }
.state-badge.running { color: var(--acid); background: rgba(200,246,93,.06); }
.state-badge.completed { color: var(--acid); background: rgba(200,246,93,.1); }
.state-badge.paused { color: var(--amber); background: rgba(240,173,78,.06); }
.state-badge.stopped { color: var(--muted); }
.connection { color: var(--muted); font-size: 10px; }
.connection::before { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: currentColor; margin-right: 7px; vertical-align: 2px; }
.connection.online { color: var(--acid); }
.connection.error { color: var(--red); }
.controls { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1fr; gap: 8px; }
.button { border: 1px solid var(--line); background: var(--panel); color: var(--text); height: 51px; padding: 0 18px; font: 500 12px var(--mono); cursor: pointer; transition: transform .15s, border-color .15s, background .15s; }
.button:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--muted); }
.button:active:not(:disabled) { transform: translateY(0); }
.button.primary { background: var(--acid); color: #17200d; border-color: var(--acid); font-weight: 600; }
.button.primary:hover:not(:disabled) { background: #d6ff72; }
.button.danger:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.button:disabled { opacity: .32; cursor: not-allowed; }
.button-icon { margin-right: 8px; }
.stop-square { display: inline-block; width: 8px; height: 8px; background: currentColor; margin-right: 9px; }
.summary { display: grid; grid-template-columns: .75fr .75fr 1fr 1.7fr; border: 1px solid var(--line); background: rgba(23,28,24,.85); }
.summary-item { padding: 25px 28px; border-right: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr; align-items: end; }
.summary-label { grid-column: 1 / -1; color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 10px; }
.summary-item strong { font: 500 35px var(--display); letter-spacing: -.05em; }
.summary-note { color: var(--muted); font-size: 10px; padding: 0 0 5px 13px; }
.eta-item strong { color: var(--acid); }
.progress-item { padding: 27px 28px 22px; }
.progress-caption { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; letter-spacing: .08em; margin-bottom: 18px; }
#progress-value { color: var(--text); }
.progress-track { height: 8px; background: #293029; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--acid); box-shadow: 0 0 15px rgba(200,246,93,.4); transition: width .7s ease; }
.progress-ticks { display: flex; justify-content: space-between; color: #626c61; font-size: 9px; margin-top: 9px; }
.pipeline-section { padding: 48px 0 38px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.section-heading > div { display: flex; align-items: center; gap: 14px; }
.section-index { color: var(--acid); font-size: 10px; }
h2 { font: 500 16px var(--display); margin: 0; letter-spacing: -.02em; }
.section-meta { color: var(--muted); font-size: 9px; letter-spacing: .1em; }
.pipeline { display: grid; grid-template-columns: .65fr 20px 1fr 20px 1fr 20px 1fr 20px 1fr 20px .75fr; align-items: stretch; }
.stage { position: relative; background: rgba(23,28,24,.9); border: 1px solid var(--line); padding: 21px; min-width: 0; overflow: hidden; }
.completion-stage { background: rgba(200,246,93,.045); }
.completion-stage .queue-value { padding-bottom: 26px; }
.completion-percent { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 18px; font-size: 10px; }
.completion-percent span { color: var(--muted); }
.completion-percent strong { color: var(--acid); font: 500 18px var(--display); }
.stage::after { content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 2px; background: var(--acid); transform: scaleX(0); transform-origin: left; transition: transform .3s; }
.stage.busy::after { transform: scaleX(1); }
.stage-top { display: flex; justify-content: space-between; margin-bottom: 24px; }
.stage-number { color: var(--muted); font-size: 10px; }
.stage-tag { color: var(--acid); border: 1px solid #39472d; padding: 3px 7px; font-size: 8px; letter-spacing: .12em; }
.stage h3 { font: 500 13px/1.5 var(--display); margin: 0 0 6px; letter-spacing: -.03em; }
.stage p { color: var(--muted); font-size: 10px; margin: 0; }
.queue-value { display: flex; align-items: flex-end; gap: 11px; padding: 22px 0 20px; }
.queue-value strong { font: 500 43px/1 var(--display); color: var(--acid); }
.queue-value span { color: var(--muted); font-size: 9px; padding-bottom: 4px; }
.stage-stats { border-top: 1px solid var(--line); padding: 13px 0; display: grid; gap: 8px; }
.stage-stats > div { display: flex; justify-content: space-between; font-size: 10px; }
.stage-stats span { color: var(--muted); }
.stage-stats b { font-weight: 500; }
.replica-line { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 14px; font-size: 10px; }
.replica-line span { color: var(--muted); }
.replica-line strong { color: var(--acid); font-weight: 500; }
.replica-track { margin-top: 10px; height: 3px; background: #2b332b; }
.replica-track div { height: 100%; background: var(--acid); width: 0; transition: width .5s; }
.replica-squares { display: flex; flex-wrap: wrap; gap: 6px; min-height: 12px; margin-top: 12px; }
.replica-square { width: 12px; height: 12px; border: 1px solid #71805d; background: transparent; transition: background .2s, border-color .2s, box-shadow .2s; }
.replica-square.active { border-color: var(--acid); background: var(--acid); box-shadow: 0 0 8px rgba(200,246,93,.3); }
.scanner-stage { display: flex; flex-direction: column; }
.scanner-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 25px 0 22px; }
.scanner-counts div { display: grid; gap: 7px; }
.scanner-counts span { color: var(--muted); font-size: 9px; }
.scanner-counts strong { color: var(--acid); font: 500 25px var(--display); }
.scanner-stage .replica-line { margin-top: auto; }
.stage-icon { width: 55px; height: 55px; border: 1px solid #4a5a40; margin: 0 0 24px; padding: 12px; display: grid; gap: 5px; }
.scan-icon span { display: block; background: #526148; height: 3px; }
.scan-icon span:nth-child(2) { width: 65%; background: var(--acid); }
.connector { display: flex; align-items: center; position: relative; color: var(--acid); }
.connector span { width: 100%; height: 1px; background: #43503b; }
.connector i { position: absolute; right: -2px; font-style: normal; font-size: 25px; background: var(--bg); line-height: 1; }
.activity-section { padding-bottom: 45px; }
.section-heading.compact { margin-bottom: 15px; }
.activity-table { border-top: 1px solid var(--line); }
.activity-head, .activity-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1.6fr; gap: 20px; align-items: center; min-height: 48px; border-bottom: 1px solid var(--line); font-size: 11px; }
.activity-head { min-height: 37px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.activity-row .filename { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-badge { color: var(--acid); }
.confidence { color: var(--muted); }
.objects { color: var(--muted); font-size: 10px; }
.empty-state { color: var(--muted); padding: 30px 0; font-size: 11px; }
footer { border-top: 1px solid var(--line); display: flex; justify-content: space-between; padding: 20px 0 30px; color: #626c61; font-size: 9px; letter-spacing: .1em; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: 400px; padding: 15px 18px; background: #301f1c; border: 1px solid var(--red); color: #ffd9d2; font-size: 11px; transform: translateY(20px); opacity: 0; pointer-events: none; transition: .2s; }
.toast.visible { transform: translateY(0); opacity: 1; }

@keyframes arrive { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.masthead, .summary, .pipeline-section, .activity-section { animation: arrive .55s both; }
.summary { animation-delay: .08s; }
.pipeline-section { animation-delay: .16s; }
.activity-section { animation-delay: .24s; }

@media (max-width: 1100px) {
  .shell { width: min(940px, calc(100% - 36px)); }
  .summary { grid-template-columns: repeat(3, 1fr); }
  .progress-item { grid-column: 1 / -1; border-top: 1px solid var(--line); }
  .pipeline-section { overflow-x: auto; padding-bottom: 20px; }
  .pipeline { min-width: 1200px; }
}
@media (max-width: 720px) {
  .shell { width: calc(100% - 24px); }
  .masthead { display: block; padding-top: 30px; }
  .control-block { min-width: 0; margin-top: 30px; }
  .summary { grid-template-columns: 1fr 1fr; }
  .summary-item { padding: 20px 16px; }
  .summary-item:nth-child(2) { border-right: 0; }
  .eta-item { border-top: 1px solid var(--line); grid-column: 1 / -1; }
  .pipeline-section { overflow: visible; }
  .pipeline { display: block; min-width: 0; }
  .stage { margin-bottom: 12px; }
  .connector { display: none; }
  .section-meta { display: none; }
  .activity-head, .activity-row { grid-template-columns: 1.5fr 1fr 1fr; }
  .activity-head span:last-child, .activity-row .objects { display: none; }
  .summary-note { font-size: 8px; }
}
