:root {
  color-scheme: dark;
  --bg: #0b101b;
  --surface: #121a2b;
  --surface-2: #182238;
  --surface-3: #202d48;
  --border: #253452;
  --border-strong: #354a73;
  --ink: #e7eef8;
  --ink-soft: #a8b9d1;
  --ink-mute: #7c8fa9;
  --accent: #2dd4bf;
  --accent-strong: #5eead4;
  --accent-soft: #102e34;
  --accent-line: #1f6f6b;
  --positive: #34d399;
  --positive-bg: #0f2f26;
  --negative: #f87171;
  --negative-bg: #361822;
  --neutral: #a1b2c8;
  --neutral-bg: #1e293b;
  --warning: #fbbf24;
  --warning-bg: #33250f;
  --warning-border: #785416;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 35%);
  --shadow: 0 12px 28px -16px rgb(0 0 0 / 70%);
  --font:
    system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --mono: ui-monospace, sf-mono-regular, menlo, monospace;
  --gap: 0.75rem;
}

* {
  box-sizing: border-box;
}

/* Native hidden always wins, whatever display a component rule wants. */
[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.55 var(--font);
  -webkit-text-size-adjust: 100%;
}

h1,
h2,
h3,
h4,
h5,
p,
ul,
ol,
dl,
figure {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 550;
  line-height: 1.2;
  cursor: pointer;
}

.btn:hover:not(:disabled) {
  background: var(--surface-3);
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.btn svg {
  width: 1rem;
  height: 1rem;
  flex: none;
}

.btn-primary {
  background: #0d9488;
  border-color: #14b8a6;
  color: #f0fdfa;
}

.btn-primary:hover:not(:disabled) {
  background: #0f766e;
}

.btn-quiet {
  color: var(--ink-soft);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-soft);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--ink);
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  text-align: left;
}

.link-btn:hover {
  color: var(--accent-strong);
}

.login-view {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: clamp(1rem, 5vw, 3rem);
  background: radial-gradient(1200px 620px at 50% -12%, #182642, var(--bg) 62%);
}

.login-card {
  display: grid;
  gap: 0.85rem;
  width: min(24rem, 100%);
  padding: clamp(1.25rem, 4vw, 2rem);
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow), var(--shadow-sm);
}

.login-title {
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.login-hint {
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.login-form {
  display: grid;
  gap: 0.5rem;
}

.login-form label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.login-form input {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.login-form .btn {
  margin-top: 0.2rem;
  padding: 0.6rem 0.9rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}
.brand-link {
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.brand-link:hover .brand-name {
  color: var(--accent-strong);
}

.brand-mark {
  position: relative;
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--accent), var(--accent-strong));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 16%);
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0.7rem;
  height: 0.7rem;
  border: 2px solid rgb(255 255 255 / 92%);
  border-radius: 3px;
}

.brand-text {
  display: grid;
  min-width: 0;
}

.brand-name {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.brand-tag {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
}

#view-app {
  min-height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
  padding: 0.7rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 34rem;
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.pill::before {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.75;
}

#connection-status[data-state="live"] {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

#connection-status[data-state="stale"] {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning);
}

#connection-status[data-state="offline"] {
  border-color: #7f2d36;
  background: var(--negative-bg);
  color: var(--negative);
}

.meta-line {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--ink-mute);
}

#last-update {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  height: 100dvh;
  padding: 1.1rem 1rem 1.5rem;
  border-right: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
}

.sidebar-block {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.block-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.count-badge {
  min-width: 1.6rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 650;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.strategy-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
  cursor: pointer;
}

.strategy-item:hover {
  border-color: var(--accent-line);
}

.sidebar-note {
  font-size: 0.74rem;
  color: var(--ink-mute);
}

.sidebar-controls {
  display: grid;
  gap: 0.45rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.sidebar-control-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sidebar-control-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-mute);
  flex: none;
}

.sidebar-select {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.25rem 0.45rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.3;
  cursor: pointer;
}

.sidebar-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.76rem;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}

.sidebar-checkbox {
  width: auto;
  height: auto;
  min-height: 0;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
  flex: none;
}

.sidebar-help {
  font-size: 0.7rem;
  color: var(--ink-mute);
  line-height: 1.3;
}

.bot-list {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bot-card {
  display: flex;
  align-items: baseline;
  gap: 0.15rem 0.5rem;
  flex-wrap: wrap;
  width: 100%;
  min-width: 0;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.bot-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.bot-card[aria-current="true"] {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.bot-card.bot-card-error {
  border-color: var(--negative);
  background: var(--negative-bg);
  box-shadow: inset 3px 0 0 var(--negative);
  opacity: 1;
}

.bot-card.bot-card-error:hover {
  border-color: var(--negative);
  background: #441c27;
  box-shadow: inset 3px 0 0 var(--negative);
}

.bot-card.bot-card-error[aria-current="true"] {
  border-color: var(--negative);
  background: #52202d;
  box-shadow:
    inset 4px 0 0 var(--negative),
    0 0 0 2px var(--accent-line);
}

.bot-card.bot-card-error[aria-current="true"]:hover {
  border-color: var(--negative);
  background: #5e2433;
  box-shadow:
    inset 4px 0 0 var(--negative),
    0 0 0 2px var(--accent-line);
}

.bot-card.bot-card-stopped {
  opacity: 0.65;
}

.bot-card.bot-card-stopped:hover {
  opacity: 0.88;
}

.bot-card.bot-card-stopped[aria-current="true"] {
  opacity: 1;
}
.nav-dashboard {
  margin-bottom: 0.65rem;
  align-items: center;
}

.bot-card-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.92rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.bot-card-status {
  flex: none;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--neutral-bg);
  color: var(--neutral);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}

.bot-card-meta {
  flex: 1 1 100%;
  min-width: 0;
  font-size: 0.74rem;
  color: var(--ink-mute);
  overflow-wrap: anywhere;
}

.bot-card-age {
  flex: none;
  margin-left: auto;
  font-size: 0.74rem;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}

.workspace {
  display: grid;
  gap: 1.15rem;
  min-width: 0;
  padding: 1.4rem clamp(1rem, 3vw, 2rem) 4rem;
}

.workspace-title {
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.workspace-sub {
  margin-top: 0.1rem;
  font-size: 0.85rem;
  color: var(--ink-mute);
}

#dashboard-workspace {
  display: grid;
  gap: 1.15rem;
  min-width: 0;
}

#bot-detail {
  min-width: 0;
}

.bot-head {
  display: flex;
  align-items: center;
  gap: 0.5rem 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

#bot-name {
  min-width: 0;
  font-size: 1.3rem;
  font-weight: 680;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

#bot-stale {
  flex: 1 1 100%;
}

.warning {
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-sm);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 0.83rem;
  overflow-wrap: anywhere;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.card {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card-label {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.card-value {
  font-size: 1.35rem;
  font-weight: 650;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.card-sub {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--ink-mute);
  overflow-wrap: anywhere;
}

.tabs {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 1rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

[role="tab"] {
  padding: 0.45rem 0.95rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 550;
  cursor: pointer;
}

[role="tab"]:hover {
  background: var(--surface-3);
  color: var(--ink);
}

[role="tab"][aria-selected="true"] {
  background: #0d9488;
  color: #f0fdfa;
}

.detail-panels {
  min-width: 0;
}

.detail-panel {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

#panel-records,
#panel-settings {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

#records-known-types {
  grid-column: 1 / -1;
}

.round-current > *,
.round-detail > * {
  min-width: 0;
}

.panel-block {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 650;
}

.round-current {
  display: grid;
  gap: 0.7rem;
  min-width: 0;
  padding: 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow), var(--shadow-sm);
}

.round-detail {
  display: grid;
  gap: 0.7rem;
  min-width: 0;
}

.empty-state {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
  padding: 1.6rem 1.15rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.9rem;
  text-align: center;
  overflow-wrap: anywhere;
}

.round-current > .empty-state,
.round-detail > .empty-state,
.bot-list > .empty-state,
.round-list > .empty-state,
.record-list > .empty-state,
.timeline > .empty-state,
#bot-config > .empty-state,
details > .empty-state {
  justify-items: start;
  padding: 0.5rem 0;
  border: 0;
  background: none;
  box-shadow: none;
  text-align: left;
}

.round-heading {
  font-size: 1.05rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.round-badges {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.12rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--neutral-bg);
  color: var(--neutral);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
  white-space: normal;
}

.badge[data-tone="positive"] {
  background: var(--positive-bg);
  color: var(--positive);
}

.badge[data-tone="negative"] {
  background: var(--negative-bg);
  color: var(--negative);
}

.badge[data-tone="warning"] {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning);
}

.badge[data-tone="neutral"] {
  background: var(--neutral-bg);
  color: var(--neutral);
}

.pnl {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.pnl[data-tone="positive"],
.round-row-profit[data-tone="positive"] {
  color: var(--positive);
}

.pnl[data-tone="negative"],
.round-row-profit[data-tone="negative"] {
  color: var(--negative);
}

.pnl[data-tone="neutral"],
.round-row-profit[data-tone="neutral"] {
  color: var(--ink-soft);
}

.round-list {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
  max-height: 28rem;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.round-row {
  display: flex;
  align-items: baseline;
  gap: 0.15rem 0.6rem;
  flex-wrap: wrap;
  width: 100%;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.round-row:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.round-row[aria-current="true"] {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.round-row-main {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex: 1 1 100%;
  flex-wrap: wrap;
  min-width: 0;
  font-size: 0.88rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.round-row-meta {
  min-width: 0;
  font-size: 0.75rem;
  color: var(--ink-mute);
  overflow-wrap: anywhere;
}

.round-row-profit {
  margin-left: auto;
  font-size: 0.85rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.3rem 0.9rem;
  margin: 0;
  align-items: baseline;
}

/* Pair wrappers join the parent grid; bare dt/dd children already fit it. */
dl > div {
  display: contents;
}

dt {
  min-width: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-mute);
  overflow-wrap: anywhere;
}

dd {
  min-width: 0;
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}

#bot-config {
  grid-template-columns: minmax(9rem, auto) minmax(0, 1fr);
}

#bot-config > p {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  color: var(--ink-mute);
}

.round-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.55rem 0.9rem;
}

.round-metrics > div {
  display: block;
  min-width: 0;
}

.round-metrics dt {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.round-metrics dd {
  font-size: 0.95rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.muted {
  font-size: 0.8rem;
  color: var(--ink-mute);
}

.note {
  font-size: 0.8rem;
  color: var(--ink-mute);
}

.round-inspection > summary {
  font-size: 0.82rem;
}

.order-inspection .table-scroll {
  margin-top: 0.1rem;
  background: var(--surface);
}

.round-facts dt {
  font-size: 0.8rem;
}

details {
  min-width: 0;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

details + details {
  margin-top: 0.5rem;
}

summary {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}

summary:hover {
  color: var(--ink);
}

details[open] > summary {
  margin-bottom: 0.55rem;
}

.table-scroll {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow-x: auto;
}

.table-scroll > table {
  min-width: 38rem;
}

table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

th,
td {
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  overflow-wrap: anywhere;
}

.table-scroll th,
.table-scroll td {
  white-space: nowrap;
}

th {
  background: var(--surface-3);
  color: var(--ink-mute);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.table-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: left;
  cursor: pointer;
}

.table-sort-btn:hover,
.table-sort-btn[data-active="true"] {
  color: var(--ink);
}

.sort-indicator {
  font-size: 0.68rem;
  color: var(--ink-mute);
  opacity: 0.65;
}

.table-sort-btn[data-active="true"] .sort-indicator {
  color: var(--accent);
  opacity: 1;
}

tbody tr:last-child td {
  border-bottom: 0;
}

#dashboard-bot-table {
  min-width: 52rem;
}

.dashboard-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.dashboard-row:hover {
  background-color: var(--surface-2);
}

.dashboard-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.cell-stack {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.cell-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.timeline {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0 0 0 1.1rem;
  border-left: 2px solid var(--border);
  list-style: none;
}

.timeline > li {
  position: relative;
  min-width: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.timeline > li::before {
  content: "";
  position: absolute;
  top: 0.5em;
  left: calc(-1.1rem - 4.5px);
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--border-strong);
}

.timeline time {
  margin: 0 0.25rem;
  color: var(--ink-mute);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.timeline .timeline-detail {
  margin-top: 0.3rem;
}

.record-list {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.record-list > li {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.83rem;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.record-list > li > strong {
  color: var(--ink);
  font-size: 0.88rem;
}

/* Nested inside a record card, so it must not draw a second box. */
.record-list .record-details {
  padding: 0;
  border: 0;
  background: none;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pager-page {
  min-width: 3.75rem;
  color: var(--ink-mute);
  font-size: 0.78rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* JS inserts this right after #round-current and empties it when there is
   nothing unresolved, so :empty must collapse it. */
#round-unresolved {
  display: grid;
  gap: 0.5rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--warning-border);
  border-radius: var(--radius);
  background: var(--warning-bg);
  color: var(--warning);
}

#round-unresolved:empty {
  display: none;
}

#round-unresolved h5 {
  font-size: 0.85rem;
  font-weight: 650;
}

#round-unresolved ul {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
}

.topbar-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}

.topbar-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.topbar-nav-link:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.topbar-nav-link[aria-current="page"] {
  background: #0d9488;
  color: #f0fdfa;
}

.topbar-nav-count {
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  background: rgb(11 16 27 / 45%);
  color: inherit;
  font-size: 0.72rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.topbar-nav-count[data-live="true"] {
  background: var(--positive-bg);
  color: var(--positive);
  box-shadow: inset 0 0 0 1px rgb(52 211 153 / 35%);
}

.topbar-nav-link[aria-current="page"] .topbar-nav-count[data-live="true"] {
  background: rgb(6 78 59 / 85%);
  color: #a7f3d0;
}

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

#rounds-dashboard-workspace {
  display: grid;
  gap: 1.15rem;
  min-width: 0;
}

.rounds-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1.25rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.rounds-filter-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.rounds-filter-label {
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.rounds-window-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}

.window-pill {
  padding: 0.28rem 0.7rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.window-pill:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.window-pill[aria-pressed="true"] {
  background: #0d9488;
  color: #f0fdfa;
}

.rounds-filter-selects {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.rounds-select-field {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.panel-head-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  flex-wrap: wrap;
}

.spotlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 0.75rem;
}

.round-spotlight-card {
  display: grid;
  gap: 0.6rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease;
}

.round-spotlight-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.round-spotlight-card[data-status="running"] {
  border-color: var(--accent-line);
  box-shadow: inset 3px 0 0 var(--accent);
}

.round-spotlight-card[data-status="pending"] {
  border-color: var(--warning-border);
  box-shadow: inset 3px 0 0 var(--warning);
}

.round-spotlight-card[aria-current="true"] {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
  box-shadow:
    inset 3px 0 0 var(--accent-strong),
    0 0 0 1px var(--accent-line);
}

.spotlight-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.spotlight-card-Identity {
  display: grid;
  gap: 0.25rem;
}

.spotlight-bot-line {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.round-id-code {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--ink-soft);
}

.spotlight-card-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.spotlight-card-metrics > div {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.spotlight-metric-label {
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.spotlight-metric-val {
  font-size: 0.82rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.spotlight-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-size: 0.74rem;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}

#rounds-dashboard-table {
  min-width: 58rem;
}

.dashboard-row[aria-current="true"] {
  background-color: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.inspector-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 1rem;
  align-items: start;
}

.inspector-summary-col,
.inspector-timeline-col {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
}

@media (max-width: 980px) {
  .inspector-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .topbar-nav {
    width: 100%;
  }

  .topbar-nav-link {
    flex: 1 1 auto;
    justify-content: center;
  }

  .topbar-controls {
    width: 100%;
    margin-left: 0;
  }

  .workspace {
    padding: 1rem 1rem 3rem;
  }

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

  #panel-records,
  #panel-settings {
    grid-template-columns: minmax(0, 1fr);
  }

  .tabs {
    width: 100%;
    border-radius: var(--radius);
  }

  [role="tab"] {
    flex: 1 1 auto;
    text-align: center;
  }

  .btn,
  [role="tab"],
  .bot-card,
  .round-row {
    min-height: 2.75rem;
  }

  dl {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.1rem 0;
  }

  dt {
    margin-top: 0.3rem;
  }
}
