:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --text: #12203a;
  --muted: #62708a;
  --card: #ffffff;
  --border: #d8deea;
  --primary: #1853d6;
  --primary-strong: #0f3ca4;
  --danger: #b42318;
  --success-bg: #e6f7ea;
  --success-text: #116329;
  --error-bg: #fce8e7;
  --error-text: #9b1c1c;
  --info-bg: #e8f0ff;
  --info-text: #1f4acc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: #0e1730;
  color: white;
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
}

.brand-subtitle {
  display: block;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
}

.topbar-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.page {
  width: min(1200px, calc(100vw - 2rem));
  margin: 2rem auto;
  display: grid;
  gap: 1.25rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.card,
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: 0 10px 32px rgba(16, 24, 40, 0.05);
}

.auth-card {
  width: min(460px, 100%);
  margin: 3rem auto;
}

.stack {
  display: grid;
  gap: 1rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

.two-columns {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

label {
  display: grid;
  gap: 0.4rem;
}

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

input,
select,
textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  font-weight: 600;
}

.button:hover {
  background: var(--primary-strong);
}

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

.button-danger {
  background: var(--danger);
}

.button-small {
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  font-size: 0.9rem;
}

.actions-row,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.compact-table th,
.compact-table td {
  padding: 0.55rem 0.65rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: lowercase;
}

.pill-active,
.pill-success {
  background: #e7f8ee;
  color: #156738;
}

.pill-paused,
.pill-partial {
  background: #fff3db;
  color: #8d5b02;
}

.pill-failed {
  background: #fde7e7;
  color: #991b1b;
}

.flash {
  padding: 0.9rem 1rem;
  border-radius: 14px;
  font-weight: 600;
}

.flash-success {
  background: var(--success-bg);
  color: var(--success-text);
}

.flash-error {
  background: var(--error-bg);
  color: var(--error-text);
}

.flash-info {
  background: var(--info-bg);
  color: var(--info-text);
}

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

.definition-list {
  display: grid;
  gap: 0.85rem;
}

.definition-list div {
  display: grid;
  gap: 0.15rem;
}

.definition-list dt {
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

summary {
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

small {
  font-size: 0.8rem;
}

@media (max-width: 800px) {
  .section-header,
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .page {
    width: min(100vw - 1rem, 1200px);
    margin: 1rem auto;
  }

  .table {
    display: block;
    overflow-x: auto;
  }
}
