:root {
  --bg: #0e1117;
  --bg-panel: #161b22;
  --border: #2a2f3a;
  --text: #e6edf3;
  --text-muted: #9aa4b2;
  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --success: #3fb950;
  --warn: #d29922;
  --error: #f85149;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f7fb;
    --bg-panel: #ffffff;
    --border: #e2e2ea;
    --text: #1a1a2e;
    --text-muted: #5c5c70;
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-header {
  padding: 1.5rem 2rem 0.5rem;
  text-align: center;
}

.app-header h1 {
  margin: 0;
  font-size: 2rem;
}

.subtitle {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
}

.app-layout {
  display: flex;
  gap: 1.5rem;
  max-width: 960px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  align-items: flex-start;
}

.sidebar {
  flex: 0 0 240px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.sidebar h2 {
  font-size: 1rem;
  margin-top: 0;
}

.content {
  flex: 1;
  min-width: 0;
}

label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

select,
input[type="text"],
textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

textarea {
  resize: vertical;
}

.field-row {
  margin-top: 1rem;
}

.mode-description {
  color: var(--text-muted);
  margin-top: 0;
}

.primary-btn,
.secondary-btn {
  margin-top: 1rem;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.primary-btn {
  background: var(--accent);
  color: #fff;
}

.primary-btn:hover {
  background: var(--accent-hover);
}

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

.secondary-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.secondary-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.status {
  min-height: 1.4rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.status-success {
  color: var(--success);
}

.status-warn {
  color: var(--warn);
}

.status-error {
  color: var(--error);
}

.status-info {
  color: var(--text-muted);
}

.metric-card {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.metric-label {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.metric-value {
  font-size: 1.8rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

.results-section {
  margin-top: 1.25rem;
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

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

th,
td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  background: var(--bg-panel);
  color: var(--text-muted);
  font-weight: 600;
}

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

.hidden {
  display: none !important;
}

@media (max-width: 720px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    flex: 1 1 auto;
    width: 100%;
  }
}
