@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: dark;
  --bg: #071014;
  --panel: rgba(12, 24, 31, 0.94);
  --panel-2: rgba(16, 34, 42, 0.98);
  --line: rgba(141, 176, 183, 0.22);
  --line-strong: rgba(141, 176, 183, 0.4);
  --text: #e7f3f1;
  --muted: #91a8aa;
  --green: #52d273;
  --yellow: #f5c84b;
  --red: #ff6868;
  --cyan: #5cc8ff;
  --blue: #2f85ff;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #071014;
  color: var(--text);
  font-family: var(--font-ui);
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line-strong);
  background: #102b35;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 12px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
}

button:hover {
  border-color: var(--cyan);
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #08171d;
  color: var(--text);
  min-height: 34px;
  padding: 7px 9px;
  outline: none;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 58px 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: #081219;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 0;
}

.brand span,
.top-status {
  color: var(--muted);
  font-size: 12px;
}

.top-status {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--text);
  background: #0c2028;
  font-family: var(--font-display);
  font-size: 12px;
}

.pill.neutral {
  color: var(--yellow);
}

.pill.good {
  color: var(--green);
}

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

.console {
  display: grid;
  grid-template-columns: 290px minmax(520px, 1fr) 360px;
  gap: 10px;
  padding: 10px;
  min-height: calc(100vh - 58px);
}

.sidebar,
.rightbar {
  display: grid;
  gap: 10px;
  align-content: start;
}

.rightbar {
  max-height: calc(100vh - 78px);
  overflow: auto;
}

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

.panel-title {
  color: #c8f0ef;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-bottom: 10px;
}

.asset-panel {
  display: grid;
  gap: 8px;
}

.asset {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: #091b22;
  min-height: 58px;
}

.asset.active {
  border-color: var(--cyan);
  background: #0e2a34;
}

.asset strong {
  display: block;
  font-family: var(--font-display);
  font-size: 14px;
}

.asset small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.green {
  background: var(--green);
}

.yellow {
  background: var(--yellow);
}

.red {
  background: var(--red);
}

.gray {
  background: #66777a;
}

.config-panel {
  display: grid;
  gap: 10px;
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 8px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check input {
  width: auto;
  min-height: auto;
}

.mainstage {
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) 170px;
  gap: 10px;
}

.video-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.video-toolbar span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.video-toolbar strong {
  font-family: var(--font-display);
  font-size: 14px;
}

.actions {
  display: flex;
  gap: 8px;
}

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

.viewport {
  position: relative;
  overflow: hidden;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(92, 200, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 200, 255, 0.04) 1px, transparent 1px),
    #071116;
  background-size: 28px 28px;
}

video,
canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

canvas {
  display: none;
}

.reticle {
  position: absolute;
  inset: 12%;
  border: 1px solid rgba(92, 200, 255, 0.5);
  border-radius: 8px;
  pointer-events: none;
}

.reticle::before,
.reticle::after {
  content: "";
  position: absolute;
  background: rgba(92, 200, 255, 0.45);
}

.reticle::before {
  width: 1px;
  height: 100%;
  left: 50%;
}

.reticle::after {
  height: 1px;
  width: 100%;
  top: 50%;
}

.overlay-label {
  position: absolute;
  left: 16px;
  bottom: 16px;
  background: rgba(7, 16, 20, 0.86);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 13px;
}

.state-badge {
  min-height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1d24;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 750;
  text-align: center;
}

.state-badge.ok {
  color: var(--green);
}

.state-badge.watch {
  color: var(--yellow);
}

.state-badge.risk {
  color: var(--red);
}

.state-panel p {
  color: var(--muted);
  line-height: 1.45;
  min-height: 42px;
}

.metric,
.signal {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.metric span,
.signal span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong,
.signal strong {
  font-family: var(--font-display);
  font-size: 13px;
  text-align: right;
}

.band {
  height: 9px;
  background: #051016;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 5px;
}

.band-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--red), var(--yellow), var(--green));
}

.action-text {
  color: var(--text);
  line-height: 1.45;
  margin-bottom: 10px;
}

.upgrade-list {
  display: grid;
  gap: 8px;
}

.upgrade {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
  background: #081820;
}

.upgrade strong {
  display: block;
  font-family: var(--font-display);
  margin-bottom: 4px;
}

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

.research-panel pre {
  max-height: 280px;
  overflow: auto;
  margin: 0;
  color: #b4d6d5;
  font-size: 11px;
  white-space: pre-wrap;
}

.timeline {
  overflow: auto;
}

.timeline-rows {
  display: grid;
  gap: 7px;
}

.timeline-row,
.empty {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #081820;
  padding: 8px;
  font-size: 12px;
}

.timeline-row strong {
  display: block;
  font-family: var(--font-display);
}

.timeline-row span,
.empty {
  color: var(--muted);
}

@media (max-width: 1100px) {
  .console {
    grid-template-columns: 1fr;
  }

  .rightbar {
    max-height: none;
  }
}
