/* ==========================================================================
   ProMailDispatch — dispatch-control aesthetic
   Ink navy chrome · ultramarine signal · coral postmark · dotted routing lines
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --ink:      #0d1526;
  --ink-2:    #16233d;
  --ink-3:    #223354;
  --paper:    #eef1f8;
  --surface:  #ffffff;
  --line:     #dbe2f0;
  --line-2:   #c7d1e6;
  --muted:    #5c6883;
  --muted-2:  #8b97b3;

  --brand:    #2f4bff;
  --brand-2:  #1b2ecc;
  --brand-wash:#eaeeff;
  --stamp:    #ff5a3c;   /* postmark coral */
  --stamp-wash:#ffece7;

  --ok:   #12a150;  --ok-wash:#e4f6ec;
  --warn: #c9820f;  --warn-wash:#fbf1dd;
  --bad:  #e5484d;  --bad-wash:#fce9ea;
  --cool: #4b74a8;  --cool-wash:#e8f0f9;

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(13,21,38,.06), 0 8px 24px -12px rgba(13,21,38,.18);
  --shadow-lg: 0 24px 60px -24px rgba(13,21,38,.35);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; margin: 0 0 .5em; line-height: 1.15; }

code, pre, kbd { font-family: var(--font-mono); }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 780px; }

/* ---- Dotted routing-line signature ---- */
.route-line {
  height: 0; border: 0;
  border-top: 2px dotted var(--line-2);
  margin: 28px 0;
  position: relative;
}
.route-line::before,
.route-line::after {
  content: ''; position: absolute; top: 50%; width: 8px; height: 8px;
  border-radius: 50%; transform: translateY(-50%);
  background: var(--brand); box-shadow: 0 0 0 3px var(--brand-wash);
}
.route-line::before { left: 0; }
.route-line::after  { right: 0; background: var(--stamp); box-shadow: 0 0 0 3px var(--stamp-wash); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: 14px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
  text-decoration: none; line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px -8px var(--brand); }
.btn-primary:hover { background: var(--brand-2); text-decoration: none; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--muted-2); text-decoration: none; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-2); text-decoration: none; }
.btn-danger { background: var(--bad-wash); color: var(--bad); border-color: transparent; }
.btn-danger:hover { background: #f8d7d9; text-decoration: none; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* ==========================================================================
   Chips, badges, postmarks
   ========================================================================== */
.method {
  display: inline-block; font-family: var(--font-mono); font-weight: 600;
  font-size: 12px; letter-spacing: .04em; padding: 4px 9px; border-radius: 6px;
  background: var(--brand-wash); color: var(--brand-2); text-transform: uppercase;
}
.method.get { background: var(--ok-wash); color: var(--ok); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: var(--paper); color: var(--muted);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.delivered { background: var(--ok-wash);  color: var(--ok); }
.badge.accepted  { background: var(--cool-wash);color: var(--cool); }
.badge.queued    { background: var(--warn-wash);color: var(--warn); }
.badge.opened    { background: var(--brand-wash);color: var(--brand-2); }
.badge.clicked   { background: var(--brand-wash);color: var(--brand-2); }
.badge.failed,
.badge.bounced,
.badge.complained{ background: var(--bad-wash);  color: var(--bad); }
.badge.skipped   { background: var(--paper);     color: var(--muted); }

/* ==========================================================================
   Cards / panels
   ========================================================================== */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 22px 24px; }
.card + .card { margin-top: 18px; }

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

.stat { padding: 20px 22px; }
.stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.stat .value { font-family: var(--font-display); font-size: 30px; font-weight: 700; margin-top: 6px; line-height: 1; }
.stat .value.sub { color: var(--muted); font-size: 14px; font-weight: 500; }
.stat .accent { color: var(--brand); }

/* ==========================================================================
   Forms
   ========================================================================== */
label.field { display: block; margin-bottom: 16px; }
label.field .lbl { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
label.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }

.input, .textarea, select.input {
  width: 100%; padding: 11px 13px; font-size: 14px; font-family: var(--font-body);
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, select.input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-wash);
}
.textarea { min-height: 160px; font-family: var(--font-mono); font-size: 13px; line-height: 1.5; resize: vertical; }
.input.mono { font-family: var(--font-mono); }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td, table.data tbody tr:hover td { background: var(--paper); }
table.data .mono { font-family: var(--font-mono); font-size: 13px; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .big { font-family: var(--font-display); font-size: 17px; color: var(--ink-2); margin-bottom: 4px; }

/* ==========================================================================
   Flash / alerts
   ========================================================================== */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; border: 1px solid transparent; }
.alert.success { background: var(--ok-wash); color: #0c6b36; border-color: #bfe6cd; }
.alert.error   { background: var(--bad-wash); color: #9d2126; border-color: #f2c2c4; }
.alert.info    { background: var(--brand-wash); color: var(--brand-2); border-color: #cdd6ff; }

/* ==========================================================================
   Code blocks
   ========================================================================== */
pre.code {
  background: var(--ink); color: #d7e0f4; padding: 16px 18px; border-radius: var(--radius-sm);
  overflow-x: auto; font-size: 13px; line-height: 1.6; margin: 0;
}
pre.code .k { color: #8fb2ff; }   /* keys */
pre.code .s { color: #7ee0a8; }   /* strings */
pre.code .c { color: #6b7ba0; }   /* comments */
code.inline { background: var(--brand-wash); color: var(--brand-2); padding: 2px 6px; border-radius: 5px; font-size: .9em; }

/* ==========================================================================
   Top navigation (public)
   ========================================================================== */
.topbar {
  background: rgba(255,255,255,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50;
}
.topbar .inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--ink);
  display: grid; place-items: center; color: #fff; font-size: 15px;
  box-shadow: inset 0 0 0 2px var(--ink-3);
}
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a { color: var(--muted); font-weight: 500; font-size: 14px; }
.nav-links a:hover { color: var(--ink); text-decoration: none; }

/* ==========================================================================
   Dashboard shell
   ========================================================================== */
.shell { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--ink); color: #aeb9d4; padding: 22px 16px;
  position: sticky; top: 0; align-self: start; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
}
.sidebar .brand { color: #fff; margin-bottom: 20px; padding: 0 8px; }
.sidebar .brand .mark { background: var(--brand); box-shadow: none; }
.sidebar .nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #566288; padding: 14px 10px 6px; font-weight: 600; }
.sidebar a.item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: #aeb9d4; font-size: 14px; font-weight: 500;
}
.sidebar a.item:hover { background: var(--ink-2); color: #fff; text-decoration: none; }
.sidebar a.item.active { background: var(--brand); color: #fff; }
.sidebar .spacer { flex: 1; }
.sidebar .who { border-top: 1px solid var(--ink-3); padding-top: 14px; margin-top: 8px; font-size: 13px; color: #8b97b3; }
.sidebar .who strong { color: #fff; display: block; font-weight: 600; }

.main { padding: 30px 34px 60px; max-width: 1100px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ==========================================================================
   Auth pages
   ========================================================================== */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 40px 20px;
  background:
    radial-gradient(60% 50% at 80% -10%, rgba(47,75,255,.10), transparent 60%),
    radial-gradient(50% 40% at 0% 110%, rgba(255,90,60,.08), transparent 60%),
    var(--paper);
}
.auth-card { width: 100%; max-width: 420px; }
.auth-card .card-pad { padding: 30px 30px 26px; }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head .brand { justify-content: center; margin-bottom: 12px; }
.auth-head h1 { font-size: 22px; margin-bottom: 4px; }
.auth-head p { color: var(--muted); margin: 0; font-size: 14px; }
.auth-foot { text-align: center; margin-top: 18px; color: var(--muted); font-size: 14px; }

/* ==========================================================================
   Docs page
   ========================================================================== */
.docs-hero {
  background: var(--ink); color: #fff; padding: 56px 0 46px;
  border-bottom: 1px solid var(--ink-3);
  background-image:
    radial-gradient(50% 60% at 88% 10%, rgba(47,75,255,.35), transparent 60%),
    radial-gradient(40% 50% at 6% 100%, rgba(255,90,60,.22), transparent 60%);
}
.docs-hero .eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #7e8fc4; margin-bottom: 12px; }
.docs-hero h1 { font-size: 40px; color: #fff; margin-bottom: 10px; }
.docs-hero p { color: #b9c4e0; max-width: 620px; font-size: 16px; }
.docs-hero .baseurl {
  margin-top: 22px; display: inline-flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.06); border: 1px solid var(--ink-3);
  padding: 9px 14px; border-radius: 8px; font-family: var(--font-mono); font-size: 14px; color: #cdd8f2;
}
.docs-hero .baseurl .k { color: #7e8fc4; }

.docs-layout { display: grid; grid-template-columns: 236px 1fr; gap: 40px; padding: 40px 0 80px; }
.docs-nav { position: sticky; top: 84px; align-self: start; font-size: 14px; }
.docs-nav .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); font-weight: 600; margin: 18px 0 8px; }
.docs-nav a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--muted); font-weight: 500; }
.docs-nav a:hover { background: var(--surface); color: var(--ink); text-decoration: none; }

.endpoint { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); margin-bottom: 26px; overflow: hidden; }
.endpoint > header { padding: 18px 22px; border-bottom: 1px solid var(--line); }
.endpoint > header h3 { margin: 0 0 8px; font-size: 18px; }
.endpoint .path { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.endpoint .path .url { font-family: var(--font-mono); font-size: 14px; color: var(--ink-2); }
.endpoint .body { padding: 20px 22px; }
.endpoint .desc { color: var(--muted); margin: 0 0 16px; }

.params { width: 100%; border-collapse: collapse; margin: 4px 0 18px; font-size: 14px; }
.params th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.params td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.params tr:last-child td { border-bottom: 0; }
.params .name { font-family: var(--font-mono); font-weight: 600; color: var(--brand-2); }
.params .req { color: var(--stamp); font-size: 12px; font-weight: 600; }
.params .opt { color: var(--muted-2); font-size: 12px; }

.subhead { font-family: var(--font-display); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 4px 0 8px; }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer { border-top: 1px solid var(--line); padding: 30px 0; color: var(--muted); font-size: 14px; }
.footer .inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ==========================================================================
   Utilities
   ========================================================================== */
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--font-mono); }
.right { text-align: right; }
.flex { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.wrap-gap { flex-wrap: wrap; }
.nowrap { white-space: nowrap; }
.copy-key { font-family: var(--font-mono); font-size: 13px; background: var(--paper); padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar .nav-group, .sidebar .spacer, .sidebar .who { display: none; }
  .main { padding: 22px 18px 50px; }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-nav { display: none; }
  .docs-hero h1 { font-size: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
