/* Surefire Deadline app styles. Plain CSS, no build step. */
:root {
  --ink: #1a1033;
  --ink-2: #3d3557;
  --muted: #6b6380;
  --line: #e4ddf2;
  --bg: #f6f3ee;
  --card: #ffffff;
  --brand: #6d28d9;
  --brand-ink: #ffffff;
  --brand-soft: #efe8fb;
  --accent: #f5a524;
  --ok: #14653a;
  --ok-soft: #dcf5e6;
  --warn: #8a5300;
  --warn-soft: #fff4de;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(26, 16, 51, .06), 0 8px 24px rgba(26, 16, 51, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f3eeff; --ink-2: #d9cff5; --muted: #a79fbf; --line: #352b52; --bg: #120c24; --card: #1c1436;
    --brand: #9b6bff; --brand-soft: #2a1d4d; --ok: #6ee7a7; --ok-soft: #12321f; --warn: #ffc76b; --warn-soft: #33260b;
    --danger: #ff8a80; --danger-soft: #3a1512; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.5 var(--font); color: var(--ink); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { margin: 0 0 .8em; }
code, pre, textarea.code { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* Top bar */
.topbar { background: var(--ink); color: #fff; }
@media (prefers-color-scheme: dark) { .topbar { background: #0b0718; border-bottom: 1px solid var(--line); } }
.topbar .wrap { display: flex; align-items: center; gap: 24px; min-height: 60px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.logo-mark { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #ff6b3d); display: grid; place-items: center; color: #1a1033; font-size: 14px; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { color: #d9cff5; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: 15px; }
.nav a:hover, .nav a.active { color: #fff; background: rgba(255,255,255,.1); }
.topbar form { margin: 0; }
.linkbtn { background: none; border: 0; color: #d9cff5; font: inherit; font-weight: 600; cursor: pointer; padding: 8px 12px; border-radius: 8px; }
.linkbtn:hover { color: #fff; background: rgba(255,255,255,.1); }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
main { flex: 1; padding: 28px 0 48px; }

/* Cards and layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat .num { font-size: 28px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--muted); font-size: 14px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 10px; padding: 10px 16px; font: 700 15px/1.2 var(--font); cursor: pointer; text-decoration: none; background: var(--brand); color: var(--brand-ink); }
.btn:hover { filter: brightness(1.08); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-secondary { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-small { padding: 7px 11px; font-size: 14px; }
.btn-block { width: 100%; }

/* Forms */
label { display: block; font-weight: 700; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.hint { color: var(--muted); font-size: 14px; margin-top: 4px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font: 16px/1.4 var(--font);
}
input[type=color] { width: 52px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; }
textarea.code { min-height: 92px; resize: vertical; background: var(--bg); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; }
.check input { margin-top: 4px; width: 18px; height: 18px; }
.inline-fields { display: flex; gap: 12px; flex-wrap: wrap; }
.inline-fields > * { flex: 1; min-width: 110px; }
.color-row { display: flex; gap: 16px; flex-wrap: wrap; }
.color-row .field { display: flex; flex-direction: column; }
.error { color: var(--danger); font-size: 14px; margin-top: 4px; font-weight: 600; }
.choice { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (max-width: 560px) { .choice { grid-template-columns: 1fr; } }
.choice label { border: 2px solid var(--line); border-radius: 12px; padding: 14px 16px; cursor: pointer; font-weight: 700; margin: 0; display: flex; gap: 10px; align-items: flex-start; background: var(--card); }
.choice label span { display: block; }
.choice label .hint { font-weight: 400; }
.choice input { margin-top: 4px; }
.choice label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
fieldset { border: 0; padding: 0; margin: 0 0 16px; }
legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.section-title { display: flex; align-items: center; gap: 10px; }
.step { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }

/* Messages */
.flash { border-radius: 12px; padding: 12px 16px; margin-bottom: 20px; font-weight: 600; border: 1px solid transparent; }
.flash-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-warn { background: var(--warn-soft); color: var(--warn); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-muted { background: var(--brand-soft); color: var(--ink-2); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Campaign list */
.campaign-list { display: grid; gap: 14px; }
.campaign-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; text-decoration: none; color: inherit; }
.campaign-row .info { flex: 1; min-width: 220px; }
.campaign-row .name { font-weight: 800; font-size: 18px; }
.campaign-row .meta { color: var(--muted); font-size: 14px; }
.campaign-row .figs { display: flex; gap: 24px; }
.campaign-row .figs div { text-align: right; }
.campaign-row .figs strong { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.campaign-row .figs span { color: var(--muted); font-size: 13px; }
.empty { text-align: center; padding: 48px 24px; }

/* Preview */
.preview { background: repeating-conic-gradient(var(--bg) 0 25%, var(--card) 0 50%) 0 0 / 20px 20px; border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-align: center; }
.preview img { max-width: 100%; height: auto; }
.code-block { position: relative; }
.code-block .btn { position: absolute; top: 8px; right: 8px; }

/* Bars */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 80px; }
.bars span { flex: 1; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; }

/* Auth pages */
.auth { max-width: 440px; margin: 40px auto; }
.auth .logo { color: var(--ink); justify-content: center; margin-bottom: 20px; font-size: 22px; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 20px 0; color: var(--muted); font-size: 14px; }
.footer .wrap { display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.footer a { color: var(--muted); }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.pagination a, .pagination span { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.code-block textarea { padding-right: 84px; }

/* Templates, tabs, details, share tiles */
.choice-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) { .choice-3 { grid-template-columns: 1fr; } }
.template-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; margin: 0; transition: border-color .15s; }
.template-card:hover { border-color: var(--brand); }
.template-icon { font-size: 30px; }
details.more > summary { cursor: pointer; font-weight: 700; color: var(--ink-2); list-style-position: outside; }
details.card.more > summary { color: var(--ink); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid var(--line); margin: 16px 0 20px; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--ink-2); font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -2px; border-radius: 8px 8px 0 0; }
.tabs a:hover { background: var(--brand-soft); }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.extend-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 20px; }
.extend-bar .actions { margin-left: auto; }
.social-tile { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.social-tile img { width: 100%; max-height: 320px; object-fit: contain; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
th[scope=row] { white-space: nowrap; color: var(--ink); font-size: 14px; text-transform: none; letter-spacing: 0; }
.encore { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }

/* Ask AI helper */
.ask-ai-btn { position: fixed; right: 20px; bottom: 20px; z-index: 50; background: var(--ink); color: #fff; border: 0; border-radius: 999px; padding: 12px 18px; font: 700 15px var(--font); cursor: pointer; box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .ask-ai-btn { background: var(--brand); } }
.ask-ai { position: fixed; right: 20px; bottom: 76px; z-index: 60; width: min(400px, calc(100vw - 24px)); height: min(560px, calc(100vh - 110px)); background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 60px rgba(26,16,51,.25); display: flex; flex-direction: column; overflow: hidden; }
.ask-ai[hidden] { display: none; }
.ask-ai header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.linkbtn-dark { background: none; border: 0; font-size: 18px; cursor: pointer; color: var(--ink); padding: 4px 8px; }
.ask-ai-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ask-ai .msg { padding: 10px 12px; border-radius: 12px; font-size: 15px; line-height: 1.45; max-width: 90%; overflow-wrap: anywhere; }
.ask-ai .msg.bot { background: var(--brand-soft); align-self: flex-start; }
.ask-ai .msg.user { background: var(--ink); color: #fff; align-self: flex-end; }
.ask-ai form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); align-items: flex-end; }
.ask-ai textarea { flex: 1; resize: none; }
@media (max-width: 480px) { .ask-ai { right: 12px; left: 12px; width: auto; bottom: 72px; } .ask-ai-btn { right: 12px; bottom: 12px; } }

/* Phone header: logo and log out on one row, menu scrolls on the next */
@media (max-width: 640px) {
  .topbar .wrap { gap: 4px 12px; padding-top: 8px; padding-bottom: 6px; }
  .topbar .logo { flex: 1; }
  .topbar .nav { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .topbar .nav a { white-space: nowrap; padding: 6px 10px; }
}

/* Social clips */
.inline-form { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin: 8px 0; }
.inline-form input[type="datetime-local"] { width: auto; min-width: 210px; }
.social-tile .actions { display: flex; gap: 8px; flex-wrap: wrap; }
table.pack td { vertical-align: top; }
table.pack .code-block textarea { min-width: 220px; }
.pack-links { white-space: nowrap; }
.pack-links a { display: block; padding: 2px 0; }
@media (max-width: 560px) { .pack-links { white-space: normal; } }
.clip-tiles .social-tile img { height: 280px; max-height: none; }
@media (max-width: 560px) { .clip-tiles .social-tile img { height: 240px; } }

/* Admin */
.impersonating { background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--line); padding: 8px 0; font-size: 14px; }
.impersonating .wrap { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.admin-tabs { overflow-x: auto; flex-wrap: nowrap; }
.admin-tabs a { white-space: nowrap; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 8px; }
.chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.chart .bar span { width: 100%; background: var(--brand); border-radius: 6px 6px 0 0; min-height: 2px; }
.chart .bar small { color: var(--muted); font-size: 12px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.toolbar .field { margin: 0; }
.actions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.actions-grid form { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.actions-grid form h3 { margin: 0; font-size: 15px; }
.actions-grid .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions-grid select, .actions-grid input[type=number], .actions-grid input[type=text] { width: auto; flex: 1; min-width: 90px; }
textarea.html-editor { font-family: var(--mono); font-size: 13px; min-height: 520px; line-height: 1.45; }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.plan-card { border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 10px; background: var(--card); }
.plan-card.featured { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.plan-card .price { font-size: 30px; font-weight: 800; }
.plan-card ul { margin: 0; padding-left: 18px; }
.interval-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-bottom: 14px; }
.interval-toggle a { padding: 6px 14px; border-radius: 999px; text-decoration: none; color: var(--ink-2); font-weight: 700; font-size: 14px; }
.interval-toggle a.active { background: var(--brand); color: #fff; }
.chart .bar small { white-space: nowrap; overflow: hidden; max-width: 100%; }
@media (max-width: 560px) { .chart { gap: 3px; } .chart .bar small { font-size: 9px; } .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .admin-stats .num { font-size: 22px; } }
.grid > * { min-width: 0; }
.checks-list { list-style: none; padding: 0; margin: 8px 0; font-size: 14px; } .checks-list li { margin-bottom: 4px; }
/* Email editor */
.editor-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.editor-modes { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.editor-modes button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; font-weight: 700; cursor: pointer; color: var(--ink-2); }
.editor-modes button.active { background: var(--brand); color: #fff; }
.ai-box { background: var(--brand-soft); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.toolbar-ed { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; background: var(--bg); }
.toolbar-ed button { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 5px 9px; font-size: 13px; cursor: pointer; min-width: 34px; }
.toolbar-ed button:hover { border-color: var(--brand); }
.toolbar-ed select { width: auto; padding: 4px 8px; font-size: 13px; }
.email-visual { min-height: 380px; border: 1px solid var(--line); border-radius: 0 0 12px 12px; padding: 22px; background: #fff; color: #2c2540; font-family: Arial, Helvetica, sans-serif; outline: none; }
.email-visual:focus { box-shadow: 0 0 0 3px var(--brand-soft); }
.email-visual h1, .email-visual h2, .email-visual h3 { color: #1a1033; }
.email-visual p, .email-visual li { line-height: 1.6; }
.email-visual a.button { display: inline-block; background: #6d28d9; color: #fff; text-decoration: none; font-weight: 700; padding: 12px 20px; border-radius: 10px; }
.email-visual img { max-width: 100%; }
.qr svg { width: 100%; height: auto; display: block; }
.account-switch select { width: auto; padding: 4px 8px; font-size: 13px; background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }
.account-switch option { color: #1a1033; }
