/* Dispatch demo — functional, clean styling. Cobalt accent, cool neutrals. */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400..700;1,400..700&display=swap');
:root {
  --paper: #f7f8fa;
  --surface: #ffffff;
  --ink: #1d2230;
  --ink-soft: #555d6e;
  --ink-faint: #8a91a0;
  --line: #e4e7ec;
  --accent: #2f5cdc;
  --accent-deep: #2347b0;
  --success: #1f9d6b;
  --success-bg: #e7f6ef;
  --warn: #c47d1a;
  --warn-bg: #faf0dd;
  --error: #c0392b;
  --error-bg: #fbe9e7;
  --radius: 10px;
  font-family: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  letter-spacing: -0.002em;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.6; -webkit-font-smoothing: antialiased; }
h1 { font-size: 1.6rem; margin: 0; font-weight: 600; letter-spacing: -0.022em; line-height: 1.14; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; font-weight: 600; letter-spacing: -0.015em; }
a { color: var(--accent); }

.center { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }

/* brand mark */
.brand { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 1.15rem; letter-spacing: -0.022em; }
.mark { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--ink); position: relative; display: inline-block; }
.mark::before { content: ""; position: absolute; inset: 0; margin: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.mark::after { content: ""; position: absolute; right: -5px; top: 50%; transform: translateY(-50%); width: 6px; height: 2px; background: var(--accent); }

/* auth / setup cards */
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 2rem; width: 100%; max-width: 380px; box-shadow: 0 12px 40px -24px rgba(29,34,48,0.4); }
.auth-card.wide { max-width: 480px; }
.tagline { color: var(--ink-soft); margin: 0.4rem 0 1.5rem; font-size: 0.95rem; }
.stack { display: grid; gap: 0.5rem; }
label { font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); }
input, select { width: 100%; padding: 0.6rem 0.7rem; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; background: var(--surface); color: var(--ink); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,92,220,0.15); }
.hint { color: var(--ink-faint); font-size: 0.8rem; margin: 1rem 0 0; text-align: center; }

/* buttons */
.btn { font: inherit; font-weight: 600; padding: 0.6rem 1rem; border-radius: var(--radius); border: 1px solid transparent; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-deep); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-ghost.ok { color: var(--success); border-color: var(--success); }
.btn.block { width: 100%; margin-top: 1rem; }
.btn.sm { padding: 0.4rem 0.7rem; font-size: 0.85rem; }

.error { color: var(--error); font-size: 0.85rem; min-height: 1.2em; margin: 0.5rem 0 0; }

/* setup steps */
.setup-step { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-top: 1rem; opacity: 0.55; transition: opacity 0.2s; }
.setup-step.active { opacity: 1; }
.setup-step.done { opacity: 1; border-color: var(--success); background: var(--success-bg); }
.setup-step[aria-disabled="true"] { opacity: 0.45; }
.step-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; }
.step-head h2 { margin: 0; }
.step-n { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 0.85rem; font-weight: 700; }
.setup-step .btn { margin-top: 0.7rem; }
.alias { display: inline-block; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 0.35rem 0.6rem; font-family: ui-monospace, monospace; font-size: 0.85rem; margin: 0.3rem 0; }

/* one-click email provider buttons */
.providers { display: grid; gap: 0.5rem; margin-top: 0.6rem; }
.provider { display: flex; align-items: center; gap: 0.5rem; text-align: left; width: 100%; padding: 0.7rem 0.9rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font: inherit; font-weight: 500; color: var(--ink); cursor: pointer; transition: border-color 0.15s, background 0.15s, box-shadow 0.15s; }
.provider::before { content: "✉"; opacity: 0.6; }
.provider:hover { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 92, 220, 0.12); }
.provider.connected { border-color: var(--success); background: var(--success-bg); color: var(--success); font-weight: 600; box-shadow: none; }
.provider.connected::before { content: "✓"; opacity: 1; }
.provider.connected::after { content: "Connected"; margin-left: auto; font-size: 0.8rem; font-weight: 600; }
.provider.dim { opacity: 0.5; }
.connected-note { margin-top: 0.7rem; color: var(--success); font-size: 0.88rem; font-weight: 500; }

/* dashboard */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-right { display: flex; align-items: center; gap: 0.9rem; }
.agent { color: var(--ink-soft); font-size: 0.88rem; }
.page { max-width: 920px; margin: 0 auto; padding: 1.75rem 1.5rem 4rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.live { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--ink-faint); font-size: 0.8rem; }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 rgba(31,157,107,0.5); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(31,157,107,0.5); } 70%,100% { box-shadow: 0 0 0 6px transparent; } }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.2rem; }
.stat-n { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; }
.stat:nth-child(1) .stat-n { color: var(--accent-deep); }
.stat:nth-child(2) .stat-n { color: var(--warn); }
.stat-l { color: var(--ink-soft); font-size: 0.85rem; margin-top: 0.15rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem; margin-bottom: 1.25rem; }
.muted { color: var(--ink-soft); font-size: 0.88rem; margin: 0 0 0.9rem; }

.requests { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.requests th { text-align: left; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-faint); padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--line); }
.requests td { padding: 0.6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.requests tr:last-child td { border-bottom: none; }
.mono { font-family: ui-monospace, monospace; font-size: 0.82rem; color: var(--ink-soft); }
.empty { color: var(--ink-faint); text-align: center; padding: 1.5rem; }

.badge { display: inline-block; padding: 0.18rem 0.55rem; border-radius: 999px; font-size: 0.74rem; font-weight: 600; }
.badge-auto_delivered { background: var(--success-bg); color: var(--success); }
.badge-needs_review { background: var(--warn-bg); color: var(--warn); }
.badge-pending { background: var(--paper); color: var(--ink-soft); }
.badge-error { background: var(--error-bg); color: var(--error); }

.test-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 0.8rem; align-items: end; }
.test-form .btn { height: fit-content; }
.test-result { font-size: 0.88rem; margin: 0.8rem 0 0; min-height: 1.2em; }
.test-result.ok { color: var(--success); }
.test-result.err { color: var(--error); }

@media (max-width: 720px) {
  .stats, .test-form { grid-template-columns: 1fr; }
}
