:root {
  --app-bg: #f6f7f9;
  --app-surface: #ffffff;
  --app-border: #d9dee7;
  --app-text: #1f2937;
  --app-muted: #667085;
  --app-primary: #2454a6;
  --app-success-bg: #e8f5ee;
  --app-success: #17663a;
  --app-warning-bg: #fff4d8;
  --app-warning: #7a5300;
  --app-error-bg: #fde8e8;
  --app-error: #9b1c1c;
}

body {
  min-height: 100dvh;
  color: var(--app-text);
  background: var(--app-bg);
  font-size: 16px;
  line-height: 1.5;
}

.app-navbar {
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--app-border);
  backdrop-filter: blur(8px);
}

.navbar-brand {
  color: var(--app-primary);
}

.navbar .nav-link.active {
  color: var(--app-primary);
  font-weight: 600;
}

.app-container {
  max-width: 1280px;
  padding: 24px;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-heading h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
}

.content-section,
.metric-card,
.auth-panel {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 8px;
}

.content-section {
  margin-top: 20px;
  padding: 20px;
}

.narrow-section {
  max-width: 760px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.metric-card {
  min-height: 112px;
  padding: 18px;
}

.metric-card span,
.run-summary span,
.config-line span {
  display: block;
  color: var(--app-muted);
  font-size: 14px;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
  line-height: 1.1;
}

.auth-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(100%, 440px);
  padding: 28px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  background: #eef2f7;
  color: #475467;
}

.status-success,
.status-prepared,
.status-running {
  background: var(--app-success-bg);
  color: var(--app-success);
}

.status-error,
.status-login_error,
.status-preload_error {
  background: var(--app-error-bg);
  color: var(--app-error);
}

.status-sold,
.status-partial,
.status-unavailable,
.status-warning {
  background: var(--app-warning-bg);
  color: var(--app-warning);
}

.status-muted,
.status-empty,
.status-skipped {
  background: #eef2f7;
  color: #667085;
}

.account-form {
  display: grid;
  gap: 12px;
}

.account-check-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.account-check {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--app-border);
  border-radius: 8px;
}

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

.run-summary > div {
  padding: 16px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 8px;
}

.run-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.config-line {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.config-line code,
.message-cell {
  word-break: break-word;
}

.btn {
  min-height: 40px;
}

.btn-sm {
  min-height: 34px;
}

.action-group-wrap {
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.table > :not(caption) > * > * {
  padding: 0.9rem 0.75rem;
}

.modal-content {
  border-radius: 8px;
}

@media (max-width: 767.98px) {
  .app-container {
    padding: 16px;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading h1 {
    font-size: 24px;
  }

  .page-heading .btn {
    width: 100%;
  }

  .content-section {
    padding: 14px;
  }

  .run-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .config-line {
    grid-template-columns: 1fr;
  }

  .btn-group {
    display: flex;
    width: 100%;
  }

  .btn-group .btn {
    flex: 1 1 auto;
  }

  .table {
    min-width: 760px;
  }
}
