:root {
  color-scheme: dark;
  --bg: #0d1315;
  --panel: #161f22;
  --line: #25353a;
  --ink: #e3ebec;
  --muted: #8da1a6;
  --accent: #4fc7d3;
  --warn: #dba662;
  --bad: #e2867f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand {
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.82rem;
}

select,
button {
  font: inherit;
  color: var(--ink);
  background: #101a1d;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.28rem 0.6rem;
}

button { cursor: pointer; }
button:hover { border-color: var(--accent); }
select:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.status {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--muted);
}

.provisional {
  padding: 0.45rem 1rem;
  background: #2c2114;
  border-bottom: 1px solid #4a3a1f;
  color: var(--warn);
  font-size: 0.78rem;
}

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
  padding: 0.5rem;
}

@media (min-width: 1000px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 22rem; }
}

.terminal-host {
  min-height: 0;
  min-width: 0;
}

.inspector {
  min-height: 0;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.75rem 0.85rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.inspector h2 {
  margin: 0 0 0.4rem;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.grid {
  width: 100%;
  border-collapse: collapse;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.grid th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding: 0.2rem 0.35rem 0.3rem 0;
}

.grid td {
  padding: 0.22rem 0.35rem 0.22rem 0;
  border-bottom: 1px solid rgba(37, 53, 58, 0.5);
  color: var(--ink);
  white-space: nowrap;
}

.grid tr:last-child td { border-bottom: none; }

.status-connected td:nth-child(2) { color: var(--accent); }
.status-notconnect td:nth-child(2) { color: var(--muted); }
.status-disabled td:nth-child(2) { color: var(--warn); }

/* A port with errors is the row the whole panel exists to surface. */
.has-errors td { color: var(--bad); }
.has-errors td:first-child { color: var(--ink); }

.empty {
  margin: 0.35rem 0 0;
  font-size: 0.74rem;
  color: var(--muted);
}

.sim-time {
  margin: auto 0 0;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  color: var(--muted);
}

.sim-time span {
  color: var(--accent);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.xterm { height: 100%; }

.fatal {
  margin: 0;
  padding: 1rem;
  max-width: 60ch;
  border: 1px solid #6b3b3b;
  border-left: 3px solid #c9736f;
  border-radius: 4px;
  background: #2a1a1a;
  color: #f0d7d5;
}
