:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-strong: #eef3f8;
  --text: #172033;
  --muted: #667085;
  --line: #d9e1ea;
  --ok: #16845b;
  --warn: #b7791f;
  --bad: #c2413b;
  --accent: #1f6feb;
  --shadow: 0 18px 45px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card > p:not(.eyebrow) {
  margin-top: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.discord-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.discord-button,
.primary-button {
  background: #5865f2;
  color: #fff;
}

.discord-button {
  width: 100%;
  margin-top: 28px;
}

.secondary-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.error-text {
  color: var(--bad) !important;
}

.user-menu,
.candidate-identity,
.candidate-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-menu span,
.candidate-identity p,
.notice,
.save-state {
  color: var(--muted);
  font-size: 0.88rem;
}

.user-menu div {
  display: grid;
}

.avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--surface-strong);
}

.avatar.small {
  width: 40px;
  height: 40px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 1;
}

h2 {
  font-size: 1rem;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 1.25rem;
}

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

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.status-card {
  display: flex;
  min-height: 112px;
  gap: 14px;
  align-items: flex-start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.status-card p {
  margin-top: 8px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.status-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--warn);
}

.status-dot.ok {
  background: var(--ok);
}

.status-dot.bad {
  background: var(--bad);
}

.panel {
  margin-top: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.panel-header p,
.metrics dt {
  color: var(--muted);
}

.panel-header h2 {
  margin-bottom: 5px;
  font-size: 1.25rem;
}

.whitelist-panel {
  margin-bottom: 20px;
  border-top: 4px solid #5865f2;
}

.candidate-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.candidate-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(300px, 1.4fr);
  gap: 16px 22px;
  align-items: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-strong);
}

.candidate-card h3 {
  margin: 0 0 5px;
}

.candidate-card label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.candidate-card textarea {
  width: 100%;
  margin-top: 7px;
  padding: 10px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-transform: none;
}

.candidate-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.save-state {
  margin-right: auto;
}

.compact-panel {
  margin-top: 20px;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
}

.metrics div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.metrics dt {
  margin-bottom: 8px;
  font-size: 0.82rem;
}

.metrics dd {
  margin: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

pre {
  min-height: 180px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101828;
  color: #d9f99d;
  font-size: 0.9rem;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .status-grid,
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 20px 0;
  }

  .topbar,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .status-grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .candidate-card {
    grid-template-columns: 1fr;
  }

  .candidate-actions {
    grid-column: auto;
    align-items: stretch;
    flex-direction: column;
  }
}
