/* Tel5 palette (matches the hosting-contract app and letterhead) */
:root {
  --orange: #F79321; --orange-deep: #D9780A; --orange-tint: #FEF1E2; --orange-ink: #8A4A00;
  --charcoal: #222021; --ink: #2B2A2A; --muted: #6E6B6A; --line: #DCD9D6; --line-soft: #EEEBE8;
  --surface: #F6F5F4; --paper: #FFFFFF;
  --ok: #1E4620; --ok-tint: #EEF6EC; --danger: #B3261E; --danger-tint: #FBEAEA;
  --warn: #7A4B00; --warn-tint: #FFF4B8;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--surface); color: var(--ink);
  font: 15px/1.5 "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--orange-deep); }
code { background: var(--orange-tint); color: var(--orange-ink); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
h1 { font-size: 24px; line-height: 1.2; margin: 0; color: var(--charcoal); letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 0 0 14px; color: var(--charcoal); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 1px; }

/* Top bar with the letterhead's angled cut */
.topbar { position: sticky; top: 0; z-index: 10; overflow: hidden; background: var(--charcoal); color: #fff;
  display: flex; align-items: center; gap: 24px; min-height: 60px;
  padding: 10px clamp(16px, 4vw, 40px) 10px calc(clamp(16px, 4vw, 40px) + 64px); }
.topbar::before { content: ""; position: absolute; left: -30px; top: 0; bottom: 0; width: 92px;
  background: var(--orange); transform: skewX(-32deg); }
.brand { position: relative; color: #fff; text-decoration: none; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar nav a { color: #DAD6D3; text-decoration: none; font-weight: 600; font-size: 14px; padding: 7px 12px; border-radius: 6px; }
.topbar nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.topbar nav a.active { color: var(--charcoal); background: var(--orange); }
.topbar form { margin: 0; }
.me, .linkish { color: #DAD6D3; font: inherit; font-size: 14px; font-weight: 600; background: none; border: 0;
  padding: 6px 8px; border-radius: 6px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.me:hover, .linkish:hover, .me[aria-current] { color: #fff; background: rgba(255,255,255,.08); }

main { max-width: 1200px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 64px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { margin: 6px 0 0; }
.count { color: var(--muted); font-weight: 500; font-size: 18px; margin-left: 6px; }

/* Surfaces */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 22px 24px; margin-bottom: 18px; }
.card.tight { padding: 14px 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card .pad { padding: 18px 20px 4px; }
.narrow { max-width: 640px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 960px) { .two-col { grid-template-columns: 1fr; } }
.split { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Overview figures */
.figures { display: flex; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 18px; flex-wrap: wrap; overflow: hidden; }
.figures a { flex: 1 1 180px; padding: 18px 22px; color: var(--muted); text-decoration: none; border-right: 1px solid var(--line); }
.figures a:last-child { border-right: 0; }
.figures a:hover { background: var(--orange-tint); }
.figures b { display: block; font-size: 30px; color: var(--charcoal); font-variant-numeric: tabular-nums; }

/* Campaign report: click rate leads */
.report { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 18px; overflow: hidden; }
.metric { padding: 20px 22px; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.metric:last-child { border-right: 0; }
.metric b { font-size: 28px; line-height: 1.1; color: var(--charcoal); font-variant-numeric: tabular-nums; }
.metric span { font-weight: 600; margin-top: 4px; }
.metric small { color: var(--muted); margin-top: 2px; }
.metric.lead { position: relative; overflow: hidden; background: var(--charcoal); color: #fff; }
.metric.lead::after { content: ""; position: absolute; right: -40px; top: 0; bottom: 0; width: 60px; background: var(--orange); transform: skewX(-32deg); opacity: .9; }
.metric.lead b { font-size: 52px; color: var(--orange); }
.metric.lead small { color: #DAD6D3; }
@media (max-width: 960px) { .report { grid-template-columns: 1fr 1fr; } .metric.lead { grid-column: 1 / -1; } .metric { border-bottom: 1px solid var(--line); } }

/* Buttons */
.btn { font: inherit; font-size: 14px; font-weight: 700; border-radius: 8px; padding: 9px 16px; cursor: pointer;
  border: 1px solid var(--charcoal); background: var(--paper); color: var(--charcoal); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: var(--charcoal); color: #fff; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: var(--charcoal); }
.btn.primary:hover { background: var(--orange-deep); border-color: var(--orange-deep); color: #fff; }
.btn.danger { color: var(--danger); border-color: #E3B4B0; }
.btn.danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 6px; }
.btn.wide { width: 100%; padding: 12px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-actions form { margin: 0; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em;
  padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--surface); white-space: nowrap; }
td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #FCFBFA; }
th.num, .num { text-align: right; font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.chk { width: 36px; }
.url { max-width: 520px; word-break: break-all; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

/* Forms */
label { display: block; font-size: 13px; font-weight: 600; color: var(--charcoal); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=datetime-local], input[type=file], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 9px 11px; min-height: 40px; }
input:hover, select:hover, textarea:hover { border-color: #BDB8B4; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--orange); outline-offset: 1px; border-color: var(--orange-deep); }
input:disabled { background: var(--surface); color: var(--muted); }
.field { margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.hint { color: var(--muted); font-size: 13.5px; margin: 6px 0 0; }
.hint.warn { color: var(--warn); }
.inline-check { display: flex; gap: 8px; align-items: center; font-weight: 500; font-size: 14px; }
.inline-check input { width: auto; min-height: 0; margin: 0; accent-color: var(--orange-deep); }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.toolbar > div { min-width: 160px; }
.toolbar .grow { flex: 1 1 260px; }
.inline-form { display: flex; gap: 6px; }
.inline-form input { max-width: 220px; min-height: 32px; padding: 5px 9px; }
.inline { display: inline; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); padding: 6px 10px; border-radius: 6px; margin: 0; cursor: pointer; font-weight: 500; }
.checks input { accent-color: var(--orange-deep); }
.checks label:has(input:checked) { border-color: var(--orange); background: var(--orange-tint); }
.match label { margin-bottom: 6px; }
.audience { margin: 10px 0 0; }
.audience b { font-size: 22px; color: var(--charcoal); font-variant-numeric: tabular-nums; }

/* Bits */
.tag { display: inline-block; background: var(--orange-tint); color: var(--orange-ink); border-radius: 4px; padding: 1px 8px; font-size: 12px; font-weight: 600; margin: 0 4px 4px 0; text-decoration: none; }
.badge { display: inline-block; vertical-align: middle; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 4px; background: var(--surface); color: var(--charcoal); border: 1px solid var(--line); }
h1 .badge { font-size: 13px; margin-left: 8px; }
.badge.sent { background: var(--ok-tint); color: var(--ok); border-color: #CFE3CB; }
.badge.queued, .badge.sending, .badge.pending { background: var(--warn-tint); color: var(--warn); border-color: #EBDC8A; }
.badge.failed, .badge.cancelled { background: var(--danger-tint); color: var(--danger); border-color: #EFC9C6; }
.ok { color: var(--ok); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--danger); }
.you { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 1px 7px; border-radius: 4px; background: var(--charcoal); color: #fff; }
.reset-form { display: flex; gap: 6px; }
.reset-form input { width: 170px; min-height: 32px; padding: 5px 9px; }
.flash { border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px; background: var(--ok-tint); color: var(--ok); }
.flash.error { background: var(--danger-tint); color: var(--danger); }
.notice { background: var(--warn-tint); border-radius: 10px; padding: 14px 18px; margin-bottom: 18px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; color: var(--charcoal); }
.bar { flex: 1 1 200px; height: 8px; background: rgba(34,32,33,.12); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--orange); }
.pager { display: flex; gap: 14px; align-items: center; justify-content: center; margin: 8px 0 20px; }
.filters { display: flex; gap: 4px; flex-wrap: wrap; }
.filters a { padding: 4px 10px; border-radius: 6px; text-decoration: none; color: var(--charcoal); font-size: 14px; font-weight: 600; }
.filters a:hover { background: var(--surface); }
.filters a.active { background: var(--charcoal); color: #fff; }
.bulkbar { position: sticky; top: 68px; z-index: 5; display: flex; gap: 10px; align-items: center; background: var(--charcoal); color: #fff; padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.bulkbar select, .bulkbar input { width: auto; min-height: 32px; padding: 5px 9px; }
[hidden] { display: none !important; }
.sample { background: var(--paper); border: 1px dashed var(--line); padding: 14px; border-radius: 8px; max-width: 640px; overflow-x: auto; font-size: 13px; }
details.card summary { cursor: pointer; font-weight: 700; color: var(--charcoal); }
details.card[open] summary { margin-bottom: 14px; }

/* Editor */
.editor-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.editor-head h2 { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--charcoal); border-radius: 6px; overflow: hidden; }
.seg button { background: var(--paper); border: 0; padding: 6px 14px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; color: var(--charcoal); }
.seg button[aria-selected=true] { background: var(--charcoal); color: #fff; }
#editor { min-height: 460px; font-size: 16px; font-family: Helvetica, Arial, sans-serif; }
#editor img { max-width: 100%; }
.ql-toolbar.ql-snow { border-color: var(--line); border-radius: 6px 6px 0 0; background: var(--surface); font-family: inherit; }
.ql-container.ql-snow { border-color: var(--line); border-radius: 0 0 6px 6px; }
.ql-snow .ql-stroke { stroke: var(--charcoal); }
.ql-snow .ql-fill { fill: var(--charcoal); }
.ql-snow.ql-toolbar button:hover .ql-stroke, .ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: var(--orange-deep); }
.ql-snow.ql-toolbar button:hover .ql-fill, .ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--orange-deep); }
textarea.code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; min-height: 480px; line-height: 1.5; }
.snips { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.preview { width: 100%; height: 760px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }

/* Sign-in, setup and public pages: charcoal with the letterhead's orange slashes */
body.brand-screen { background: var(--charcoal); min-height: 100vh; position: relative; overflow-x: hidden; }
body.brand-screen::before { content: ""; position: fixed; left: -140px; top: 0; bottom: 0; width: 360px;
  background: var(--orange); transform: skewX(-32deg); }
body.brand-screen::after { content: ""; position: fixed; left: 250px; top: 0; bottom: 0; width: 22px;
  background: var(--orange); transform: skewX(-32deg); opacity: .55; }
body.brand-screen main { position: relative; z-index: 1; min-height: 100vh; max-width: none; display: grid; place-items: center; padding: 24px; }
body.brand-screen .flash { width: min(420px, 100%); margin: 0 auto 12px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.signin { width: min(420px, 100%); background: var(--paper); border-radius: 12px; padding: 32px 30px 28px;
  box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.signin .mark { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--orange-deep); margin: 0 0 6px; }
.signin h1 { font-size: 24px; margin: 0 0 4px; }
.signin p.sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.signin .btn.wide { margin-top: 6px; }
.signin .foot { margin: 18px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.signin.center { text-align: center; }
.signin.center p.sub { margin-bottom: 0; }
@media (max-width: 640px) { body.brand-screen::before { left: -260px; } body.brand-screen::after { display: none; } }

@media (max-width: 720px) {
  .topbar { overflow-x: auto; gap: 14px; }
  .me { display: none; }
  .bulkbar { top: 64px; }
}
.toolbar input, .toolbar select { height: 40px; }
.signin.center form { margin-top: 20px; }

/* Roles */
.who { display: flex; align-items: center; gap: 6px; }
.topbar .role { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 1px 7px; border-radius: 4px; background: rgba(255,255,255,.12); color: #fff; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.admin { background: var(--charcoal); color: #fff; }
.pill.user { background: var(--surface); color: var(--charcoal); border: 1px solid var(--line); }
.pill.off { background: var(--danger-tint); color: var(--danger); }
.role-form { display: flex; gap: 6px; align-items: center; }
.role-form select { width: auto; min-height: 32px; padding: 4px 8px; }
.roles-help { margin: 0 0 18px; color: var(--muted); }
@media (max-width: 720px) { .who .role { display: none; } }

/* Settings */
.seg-radio { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.seg-radio label { display: inline-flex; gap: 8px; align-items: center; border: 1px solid var(--line); padding: 9px 14px; border-radius: 8px; margin: 0; cursor: pointer; font-size: 14px; }
.seg-radio input { accent-color: var(--orange-deep); margin: 0; }
.seg-radio label:has(input:checked) { border-color: var(--orange); background: var(--orange-tint); }
.src { display: block; margin-top: 5px; font-size: 12.5px; color: var(--muted); }
.src::before { content: "● "; color: var(--orange); }
.src.bad { color: var(--danger); }
.src.bad::before { color: var(--danger); }
.narrow-field { max-width: 220px; }
.card h2 + .hint { margin: -8px 0 16px; }
