/* ============================================================
   District Mailouts — app.css
   Direction C · "Crisp Mono": Hanken Grotesk, near-monochrome
   neutrals, one decisive indigo accent. Modern, minimal, calm.

   Drop-in replacement for static/app.css — targets the existing
   template class names, so no HTML changes are required.
   ============================================================ */

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

:root {
  --bg:          #fafafa;
  --surface:     #ffffff;
  --surface-2:   #f6f6f7;
  --border:      #e8e8ec;
  --border-soft: #f0f0f2;
  --text:        #3f3f46;
  --ink:         #131316;
  --muted:       #8c8c95;

  --accent:       #4f46e5;
  --accent-dark:  #4338ca;
  --accent-soft:  #ecebfd;
  --accent-ring:  rgba(79, 70, 229, .18);

  --ok:   #15803d;  --ok-soft:   #e7f4ec;
  --err:  #dc2626;  --err-soft:  #fcebeb;
  --warn: #c2710c;  --warn-soft: #fbefdc;
  --slate:#5b6470; --slate-soft:#eef0f2;

  --radius:    12px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(20, 20, 35, .05);
  --shadow:    0 1px 2px rgba(20, 20, 35, .04), 0 4px 16px rgba(20, 20, 35, .05);
  --header-h:  60px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

::selection { background: var(--accent-soft); }

/* ---------------------------------------------------------------
   Top bar
   --------------------------------------------------------------- */
header.topbar {
  background: var(--surface);
  color: var(--ink);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--header-h);
  position: sticky;
  top: 0;
  z-index: 20;
}
header.topbar a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  padding: 7px 12px;
  border-radius: 8px;
  line-height: 1;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
header.topbar a:hover { text-decoration: none; background: var(--surface-2); color: var(--ink); }
/* Optional: add class="active" to the current nav link (one-line template tweak). */
header.topbar a.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
header.topbar a.active:hover { background: var(--accent-soft); }

header.topbar .brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
  margin-right: 18px;
  padding: 0;
}
header.topbar .brand::before {
  content: "";
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiI+PHJlY3Qgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIiByeD0iOCIgZmlsbD0iIzRmNDZlNSIvPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDQgNCkgc2NhbGUoMC44MzMpIiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmZmZmYiIHN0cm9rZS13aWR0aD0iMi4yIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGQ9Ik0yMiAyIDExIDEzIi8+PHBhdGggZD0iTTIyIDIgMTUgMjJsLTQtOS05LTQgMjAtN1oiLz48L2c+PC9zdmc+");
  background-size: contain;
  background-repeat: no-repeat;
  box-shadow: 0 2px 8px rgba(79, 70, 229, .35);
  border-radius: 8px;
}
header.topbar .spacer { flex: 1; }
header.topbar .who { color: var(--muted); font-size: 13px; padding: 0 6px; }

/* ---------------------------------------------------------------
   Layout
   --------------------------------------------------------------- */
.container { max-width: 1080px; margin: 34px auto 56px; padding: 0 24px; }

h1 {
  font-size: 28px; font-weight: 700; letter-spacing: -.025em;
  color: var(--ink); margin: 0 0 22px; line-height: 1.15;
}
h2 {
  font-size: 17px; font-weight: 700; letter-spacing: -.02em;
  color: var(--ink); margin: 0 0 14px; line-height: 1.25;
}

/* ---------------------------------------------------------------
   Cards
   --------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card > h2:first-child { margin-top: 2px; }

/* ---------------------------------------------------------------
   Forms
   --------------------------------------------------------------- */
label {
  display: block; font-weight: 600; font-size: 13px;
  color: var(--ink); margin: 14px 0 6px;
}
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=search],
textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
input[type=file] {
  padding: 9px 12px;
  background: var(--surface-2);
  cursor: pointer;
}
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; vertical-align: -3px; }
select {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMiIgaGVpZ2h0PSIxMiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjOGM4Yzk1IiBzdHJva2Utd2lkdGg9IjEuOCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIj48cGF0aCBkPSJNMiA0LjUgNiA4LjUgMTAgNC41Ii8+PC9zdmc+");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
textarea { resize: vertical; line-height: 1.6; }
textarea.code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.65;
  background: var(--surface-2);
}
hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* ---------------------------------------------------------------
   Buttons
   --------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(40, 30, 120, .14);
  transition: background .15s, box-shadow .15s, transform .04s;
}
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn.secondary {
  background: var(--surface); color: var(--ink); border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn.secondary:hover { background: var(--surface-2); border-color: #dcdce1; }
.btn.danger { background: var(--err); }
.btn.danger:hover { background: #b91c1c; }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 7px; }

/* ---------------------------------------------------------------
   Rows / grids
   --------------------------------------------------------------- */
.row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.row > * { flex: 1; min-width: 220px; }

/* ---------------------------------------------------------------
   Tables
   --------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 12px 14px; }
th {
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding-top: 0;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { border-bottom: 1px solid var(--border-soft); color: var(--text); }
tr:last-child td { border-bottom: none; }
tbody tr, table tr { transition: background .12s; }
tr:nth-child(even) td { background: transparent; }
td .muted, td.muted { color: var(--muted); }

/* ---------------------------------------------------------------
   Flash messages
   --------------------------------------------------------------- */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 9px;
}
.flash::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; flex: 0 0 auto;
}
.flash.ok    { background: var(--ok-soft);  color: var(--ok);  border-color: #c5e6cf; }
.flash.error { background: var(--err-soft); color: var(--err); border-color: #f3cccc; }

/* ---------------------------------------------------------------
   Status badges  (soft tint + dot)
   --------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 9px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: capitalize;
  color: #fff;
}
.badge::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.badge.sent, .badge.completed { color: var(--ok);    background: var(--ok-soft); }
.badge.failed                 { color: var(--err);   background: var(--err-soft); }
.badge.queued, .badge.pending { color: var(--slate); background: var(--slate-soft); }
.badge.sending, .badge.running{ color: var(--accent);background: var(--accent-soft); }
.badge.paused                 { color: var(--warn);  background: var(--warn-soft); }
.badge.skipped, .badge.canceled { color: var(--slate); background: var(--slate-soft); }

/* ---------------------------------------------------------------
   Misc text
   --------------------------------------------------------------- */
.muted { color: var(--muted); font-size: 13px; }
ol.muted, ul.muted { line-height: 1.9; padding-left: 20px; }
code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .9em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 6px;
  color: var(--accent-dark);
}

/* ---------------------------------------------------------------
   Token picker
   --------------------------------------------------------------- */
.token-list {
  max-height: 340px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: var(--surface-2);
}
.token {
  display: inline-flex;
  align-items: baseline;
  margin: 3px;
  padding: 5px 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--accent-dark);
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.token:hover { background: var(--accent-soft); border-color: #cfccfa; box-shadow: var(--shadow-sm); }
.token small { color: var(--muted); font-family: inherit; margin-left: 4px; }

/* ---------------------------------------------------------------
   Preview box
   --------------------------------------------------------------- */
.preview-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(0,0,0,.01);
}

/* ---------------------------------------------------------------
   Progress
   --------------------------------------------------------------- */
.progress {
  background: #ededf0;
  border-radius: 100px;
  height: 10px;
  overflow: hidden;
}
.progress > div {
  background: linear-gradient(90deg, #6d63f5, #4f46e5);
  height: 100%;
  width: 0;
  border-radius: 100px;
  transition: width .4s ease;
}

/* ---------------------------------------------------------------
   Stats  (dashboard / monitor / preview)
   --------------------------------------------------------------- */
.stat-grid { display: flex; gap: 14px; flex-wrap: wrap; }
.stat-grid > div {
  min-width: 120px;
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
}
.stat {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat-grid > div .muted { margin-top: 7px; font-weight: 500; font-size: 12.5px; }

/* ---------------------------------------------------------------
   Login — optional branded two-column card.
   Additive: only applies if login.html uses this markup. Fits
   inside the existing .container (no base.html change needed).
   --------------------------------------------------------------- */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 130px); }
.login-card2 {
  display: flex;
  width: 100%;
  max-width: 860px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.login-card2 .lc-brand {
  flex: 1;
  background: #131316;
  color: #f4f4f5;
  padding: 40px 38px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  position: relative;
  overflow: hidden;
}
.login-card2 .lc-brand::after {
  content: "";
  position: absolute;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(79,70,229,.55), transparent);
  top: -90px; right: -90px;
  pointer-events: none;
}
.login-card2 .lc-logo { display: flex; align-items: center; gap: 11px; position: relative; z-index: 1; }
.login-card2 .lc-logo .mk {
  width: 38px; height: 38px; flex: 0 0 auto;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiI+PHJlY3Qgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIiByeD0iOCIgZmlsbD0iIzRmNDZlNSIvPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDQgNCkgc2NhbGUoMC44MzMpIiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmZmZmYiIHN0cm9rZS13aWR0aD0iMi4yIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGQ9Ik0yMiAyIDExIDEzIi8+PHBhdGggZD0iTTIyIDIgMTUgMjJsLTQtOS05LTQgMjAtN1oiLz48L2c+PC9zdmc+");
  background-size: contain; background-repeat: no-repeat; border-radius: 9px;
}
.login-card2 .lc-logo b { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.login-card2 .lc-pitch { position: relative; z-index: 1; }
.login-card2 .lc-eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #a5a3f0; margin-bottom: 14px; }
.login-card2 .lc-head { font-size: 27px; font-weight: 700; letter-spacing: -.03em; line-height: 1.2; margin: 0; max-width: 13ch; color: #f4f4f5; }
.login-card2 .lc-note { position: relative; z-index: 1; font-size: 12.5px; line-height: 1.5; color: #9a9aa3; }
.login-card2 .lc-form { flex: 1; padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; }
.login-card2 .lc-form h1 { font-size: 23px; margin: 0 0 6px; }
.login-card2 .lc-form .sub { color: var(--muted); font-size: 14px; margin: 0 0 24px; }
.login-card2 .lc-form label { margin-top: 0; }
.login-card2 .lc-form .btn { width: 100%; margin-top: 18px; padding: 12px; font-size: 15px; }
.login-card2 .lc-secure { margin-top: 20px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 7px; }

@media (max-width: 720px) {
  .login-card2 { flex-direction: column; max-width: 420px; }
  .login-card2 .lc-brand { gap: 26px; }
}
