:root {
  --bg: #0c1116;
  --panel: #141b22;
  --panel-2: #1b242d;
  --border: #2a3845;
  --text: #d8e0e8;
  --muted: #88909a;
  --accent: #f4a623;
  --accent-2: #e87f1d;
  --pass: #4caf50;
  --fail: #ef5350;
  --running: #2196f3;
  --code-bg: #0a0e12;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 14px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
}

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

.brand-mark {
  font-size: 32px;
  filter: drop-shadow(0 0 6px rgba(244, 166, 35, 0.6));
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.02em;
}

.brand .sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.actions button {
  margin-left: 8px;
  padding: 8px 14px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}

.actions button.primary {
  background: var(--accent);
  color: #1a1004;
  border-color: var(--accent);
  font-weight: 600;
}

.actions button.primary:hover {
  background: var(--accent-2);
}

.actions button.secondary:hover {
  background: var(--bg);
}

main {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 16px;
  padding: 16px 24px;
}

.terminals {
  grid-column: 1 / -1;
  min-height: auto;
  max-height: none;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.section-head h2 {
  margin: 0;
}

.terminal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.terminal-table th,
.terminal-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.terminal-table th {
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.terminal-table .pair-code {
  font-family: ui-monospace, monospace;
  color: var(--accent);
}

.terminal-table .muted {
  color: var(--muted);
}

.terminal-table button {
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  margin-right: 4px;
}

.terminal-table button.danger:hover {
  border-color: var(--fail);
  color: var(--fail);
}

dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0;
  min-width: 420px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

dialog form {
  padding: 18px;
}

dialog h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

dialog label {
  display: block;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}

dialog input {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--code-bg);
  color: var(--text);
  font-size: 13px;
}

dialog .form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

dialog button {
  padding: 8px 14px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

dialog button.primary {
  background: var(--accent);
  color: #1a1004;
  border-color: var(--accent);
  font-weight: 600;
}

.muted {
  color: var(--muted);
  font-weight: normal;
}

section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  min-height: 50vh;
  max-height: 75vh;
  overflow-y: auto;
}

section h2 {
  margin: 0 0 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.case {
  display: grid;
  grid-template-columns: 60px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 4px;
  border: 1px solid transparent;
  margin-bottom: 4px;
}

.case:hover {
  background: var(--panel-2);
}

.case .id {
  font-family: ui-monospace, monospace;
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
}

.case .title {
  font-weight: 600;
}

.case .desc {
  grid-column: 2 / span 3;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.case button {
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
}

.case button:hover {
  border-color: var(--accent);
}

.case .badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: ui-monospace, monospace;
  text-transform: uppercase;
}

.case .badge.pending {
  background: var(--panel-2);
  color: var(--muted);
}

.case .badge.running {
  background: var(--running);
  color: #001220;
}

.case .badge.pass {
  background: var(--pass);
  color: #08120a;
}

.case .badge.fail {
  background: var(--fail);
  color: #1c0707;
}

.case .summary {
  grid-column: 2 / span 3;
  color: var(--text);
  font-size: 12px;
  font-family: ui-monospace, monospace;
  margin-top: 4px;
  word-break: break-word;
}

.case[data-mandatory='false'] .id::after {
  content: ' (opt)';
  color: var(--muted);
  font-weight: normal;
}

.event-log,
pre {
  background: var(--code-bg);
  border-radius: 4px;
  padding: 10px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.event-log {
  height: calc(100% - 50px);
  overflow-y: auto;
}

.event-line {
  margin: 0 0 6px;
  padding: 4px 6px;
  border-left: 3px solid var(--muted);
}

.event-line[data-type='display'] {
  border-color: var(--accent);
}

.event-line[data-type='receipt'] {
  border-color: var(--running);
}

.event-line[data-type='key'] {
  border-color: var(--muted);
}

.event-line[data-type='result'] {
  border-color: var(--pass);
}

.event-time {
  color: var(--muted);
  margin-right: 6px;
}

.event-type {
  display: inline-block;
  min-width: 60px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
}

footer {
  padding: 10px 24px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
}

footer code {
  color: var(--accent);
}

.hint {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 8px;
}
