:root {
  color-scheme: light dark;
  --bg: #0f1115;
  --card: #171a21;
  --border: #2a2f3a;
  --text: #e6e8ee;
  --muted: #9aa3b2;
  --accent: #4f8cff;
  --accent-2: #2f6fdc;
  --ok: #34c759;
  --warn: #ffb020;
  --bad: #ff5d5d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 24px;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

header { max-width: 1100px; margin: 0 auto 20px; }
h1 { margin: 0 0 4px; font-size: 22px; }
h2 { margin: 0 0 12px; font-size: 16px; }
h3 { margin: 16px 0 8px; font-size: 14px; color: var(--muted); }
.muted, .hint { color: var(--muted); }
.hint { margin: 8px 0 0; font-size: 13px; }

main {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.log-card { grid-column: 1 / -1; }

.grid { display: grid; gap: 10px; }

label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
label.row { display: flex; align-items: center; gap: 8px; color: var(--text); }
input[type="text"], input:not([type]), input[type="file"] {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0c0e12;
  color: var(--text);
  font: inherit;
}

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }

button {
  padding: 9px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font: inherit;
  cursor: pointer;
}
button:hover { background: var(--accent-2); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.secondary { background: #2a2f3a; color: var(--text); }
button.small { padding: 5px 10px; font-size: 12px; }

.status {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 6px 12px;
  margin: 0;
}
.status dt { color: var(--muted); }
.status dd { margin: 0; word-break: break-all; }

.candidates ul {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 150px;
  overflow: auto;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--muted);
}
.candidates li { padding: 2px 0; border-bottom: 1px solid #20242c; }

.progress {
  height: 10px;
  border-radius: 6px;
  background: #0c0e12;
  border: 1px solid var(--border);
  overflow: hidden;
  margin-top: 12px;
}
#progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.15s linear; }

#received a { color: var(--accent); }

.log-head { display: flex; align-items: center; justify-content: space-between; }
#log {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: #0c0e12;
  border: 1px solid var(--border);
  font-family: ui-monospace, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.ok { color: var(--ok); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
