:root {
  color-scheme: light;
  --ink: #1c2430;
  --muted: #6c7583;
  --line: #dce2ea;
  --soft: #f6f8fb;
  --panel: #ffffff;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #b7791f;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(23, 31, 43, 0.08);
}

* {
  box-sizing: border-box;
}

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

a {
  color: var(--brand-dark);
  text-decoration: none;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.ghost {
  background: #fff;
  color: var(--brand-dark);
  border-color: var(--line);
}

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

.full {
  width: 100%;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  padding: 24px;
  background: #17212f;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.brand span {
  display: block;
  margin-top: 2px;
  color: #b8c2d1;
  font-size: 13px;
}

nav {
  display: grid;
  gap: 6px;
}

nav a {
  padding: 11px 12px;
  border-radius: 8px;
  color: #d7deea;
  font-weight: 650;
}

nav a.active,
nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.shell {
  margin-left: 260px;
  padding: 32px;
}

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

.login-panel {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 36px;
  align-items: center;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.12;
}

h2 {
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.page-head,
.panel-head,
.actions,
.form-actions,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-head {
  margin-bottom: 24px;
}

.panel,
.form-card,
.stats-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  margin-bottom: 20px;
  padding: 20px;
}

.narrow {
  max-width: 720px;
}

.form-card {
  padding: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-weight: 700;
}

input,
select {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  font: inherit;
  background: #fff;
}

.check {
  grid-template-columns: auto 1fr;
  align-items: center;
  justify-content: start;
}

.check input {
  width: 18px;
  min-height: 18px;
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stats-grid article {
  padding: 18px;
}

.stats-grid span,
.row span,
.meta-line {
  color: var(--muted);
  font-size: 14px;
}

.stats-grid strong {
  display: block;
  margin-top: 10px;
  font-size: 32px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.row:first-of-type {
  border-top: 0;
}

.row strong,
.row span {
  display: block;
}

.row-link {
  color: var(--ink);
}

.toolbar {
  justify-content: flex-start;
  margin-bottom: 16px;
}

.toolbar select {
  max-width: 360px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: #445064;
  background: #f8fafc;
}

tbody tr[onclick] {
  cursor: pointer;
}

tbody tr:hover {
  background: #fbfcfe;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}

.progress-panel[hidden] {
  display: none;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5eaf1;
}

.progress-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pinwheel {
  width: 18px;
  height: 18px;
  border: 3px solid #cbd5e1;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width 220ms ease;
}

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

.progress-stats article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.progress-stats span,
.current-email span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.progress-stats strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.current-email {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.current-email strong {
  display: block;
  margin: 6px 0;
  overflow-wrap: anywhere;
}

.current-email small {
  color: var(--muted);
}

.console-window {
  height: 280px;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: #111827;
  color: #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.console-line {
  display: grid;
  grid-template-columns: 82px 104px minmax(0, 1fr);
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.console-line span {
  color: #9ca3af;
}

.console-line code {
  color: #67e8f9;
}

.console-line p {
  margin: 0;
  overflow-wrap: anywhere;
}

.diagnostics-card {
  width: min(900px, 100%);
}

.diagnostics-list {
  display: grid;
  gap: 10px;
}

.diagnostics-list article {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) 140px minmax(0, 1.5fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.diagnostics-list article.ok {
  border-color: #99d1c9;
}

.diagnostics-list article.bad {
  border-color: #f1b7b2;
}

.diagnostics-list span {
  color: var(--muted);
}

.diagnostics-list code {
  overflow-wrap: anywhere;
  color: #334155;
}

.flash {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.flash.success {
  border-color: #99d1c9;
  color: var(--brand-dark);
}

.flash.error,
.error-text {
  border-color: #f1b7b2;
  color: var(--danger);
}

@media (max-width: 860px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .shell {
    margin-left: 0;
    padding: 20px;
  }

  .login-panel,
  .form-grid,
  .stats-grid,
  .progress-stats {
    grid-template-columns: 1fr;
  }

  .console-line {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .diagnostics-list article {
    grid-template-columns: 1fr;
  }

  .page-head,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
