/* RTR Control admin portal (marketing, licences). Same palette as rtrcontrol.com. */
:root {
  --bg: #0a0b10; --bg2: #0e1017; --panel: #11131b; --fg: #f3f4f8; --muted: #a6aabf; --faint: #7d8197;
  --line: rgba(255,255,255,.08); --line2: rgba(255,255,255,.14);
  --ind: #8f8cff; --vio: #a99cff; --grad: linear-gradient(135deg, #6d6bff 0%, #a86dff 100%);
  --good: #3ddc84; --warn: #f5b942; --bad: #ff5c7a; --info: #3aa0ff;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--fg); min-height: 100vh;
       font: 15px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", sans-serif;
       -webkit-font-smoothing: antialiased; }
a { color: var(--vio); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: rgba(255,255,255,.06); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 28px; padding-bottom: 64px; }

/* top bar */
.top { border-bottom: 1px solid var(--line); background: var(--bg2); position: sticky; top: 0; z-index: 5; }
.topin { display: flex; align-items: center; gap: 20px; min-height: 58px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--fg); font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand img { width: 26px; height: 26px; border-radius: 6px; }
.tag { font: 600 10px/1 var(--mono); letter-spacing: 1.3px; text-transform: uppercase; color: var(--vio);
       border: 1px solid #3d3b7a; border-radius: 4px; padding: 3px 5px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; }
.nav a:hover { color: var(--fg); background: rgba(255,255,255,.05); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--fg); background: rgba(143,140,255,.14); }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; }

/* a section's own pages (Marketing: Overview, Campaigns, Contacts, Segments), as pill tabs like Reports' */
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin: -8px 0 20px; }
.subtabs a { color: var(--muted); padding: 5px 14px; border-radius: 999px; border: 1px solid var(--line2); font-size: 13.5px; }
.subtabs a:hover { color: var(--fg); text-decoration: none; }
.subtabs a[aria-current="page"] { color: var(--fg); background: rgba(143,140,255,.16); border-color: rgba(143,140,255,.5); }
.loading { color: var(--muted); padding: 14px 0; }

/* headings and text */
h1 { font-family: var(--display); font-size: 28px; letter-spacing: -.6px; line-height: 1.15; }
h2 { font-family: var(--display); font-size: 19px; letter-spacing: -.3px; margin: 34px 0 12px; }
h3 { font-size: 15px; margin: 22px 0 8px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.muted { color: var(--muted); }
.fine { color: var(--faint); font-size: 12.5px; margin-top: 8px; }
.crumbs { font-size: 13px; margin-bottom: 6px; }
p + p { margin-top: 8px; }

/* buttons and forms */
button { font: inherit; cursor: pointer; border: 0; border-radius: 999px; padding: 10px 20px; font-weight: 600;
         color: #fff; background: var(--grad); }
button.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line2); padding: 7px 14px; font-weight: 500; font-size: 13px; }
button.link { background: none; padding: 0; color: var(--vio); font-weight: 500; }
form.inline { display: inline; }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input[type=email], input[type=password], input[type=search], input[type=text], input[type=number], input[type=date],
input[type=time],
textarea, select {
  width: 100%; font: inherit; color: var(--fg); background: var(--panel); border: 1px solid var(--line2);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
textarea { resize: vertical; min-height: 4.5em; line-height: 1.45; }
select { appearance: auto; max-width: 100%; }
input:focus-visible, button:focus-visible, a:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--ind); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.danger { color: var(--bad); border-color: rgba(255,92,122,.4); }
a.button { display: inline-block; border-radius: 999px; padding: 10px 20px; font-weight: 600; color: #fff; background: var(--grad); }
a.button:hover { text-decoration: none; filter: brightness(1.08); }
a.button.ghostlink { background: transparent; color: var(--fg); border: 1px solid var(--line2); font-weight: 500; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--fg); font-size: 14px; margin: 6px 0; }
label.check input { width: auto; margin: 0; accent-color: var(--ind); }
.offscreen { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
.label { font-size: 13px; color: var(--muted); }

/* cards, callouts, stats */
.narrow { max-width: 420px; margin: 40px auto 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 26px; }
.login .brand { margin-bottom: 22px; }
.login h1 { margin-bottom: 6px; }
.login form { margin-top: 16px; }
.callout { border: 1px solid var(--line2); background: rgba(255,255,255,.03); border-radius: 12px; padding: 12px 14px; margin: 14px 0; font-size: 14px; }
.callout.bad { border-color: rgba(255,92,122,.45); background: rgba(255,92,122,.08); }
.callout.warn { border-color: rgba(245,185,66,.45); background: rgba(245,185,66,.08); }
.callout.good { border-color: rgba(61,220,132,.45); background: rgba(61,220,132,.08); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 14px 0; }
/* From a visit to a paying licence: five steps in a row, an arrow in each gap. */
.funnel { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin: 14px 0; }
.funnel .stat { position: relative; }
.funnel .stat + .stat::before { content: '→'; position: absolute; left: -7px; top: 50%; transform: translate(-50%, -50%);
                                color: var(--faint); font-size: 13px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; min-width: 0; }
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font: 600 24px/1.2 var(--display); letter-spacing: -.4px; margin-top: 4px; overflow-wrap: anywhere; }
.stat .note { font-size: 11.5px; color: var(--faint); margin-top: 4px; }

/* badges */
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
         border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.badge.good { color: var(--good); border-color: rgba(61,220,132,.4); }
.badge.warn { color: var(--warn); border-color: rgba(245,185,66,.4); }
.badge.bad  { color: var(--bad);  border-color: rgba(255,92,122,.4); }
.badge.info { color: var(--info); border-color: rgba(58,160,255,.4); }

/* tables: scroll inside their own box, never the page */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--bg2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td { white-space: nowrap; }
td.wrapcell { white-space: normal; overflow-wrap: anywhere; min-width: 180px; }
tr[hidden] { display: none; }

/* facts list */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 16px 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { overflow-wrap: anywhere; }

/* contact filters */
.filters { margin: 16px 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: transparent; color: var(--muted); border: 1px solid var(--line2); padding: 5px 12px; font-weight: 500; font-size: 13px; }
.chip[aria-pressed="true"] { color: var(--fg); background: rgba(143,140,255,.16); border-color: rgba(143,140,255,.5); }

/* email previews */
.previews { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.previews figure { min-width: 0; }
.previews figcaption { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.previews iframe { border: 1px solid var(--line2); border-radius: 12px; background: #fff; height: 760px; }
.previews iframe.desktop { width: 640px; max-width: calc(100vw - 32px); }
.previews iframe.phone { width: 375px; max-width: calc(100vw - 32px); }

/* the builder */
.settings h2 { margin-top: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid2 > div { min-width: 0; }
.grid2 .span2 { grid-column: 1 / -1; }
fieldset.block { position: relative; border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px 4px;
                 margin: 0 0 18px; background: rgba(255,255,255,.015); min-width: 0; scroll-margin-top: 80px; }
fieldset.block legend { font-weight: 600; font-size: 14px; padding: 0 6px; }
/* The block's buttons sit on its top edge, opposite the title, so they cost no row of their own. */
.blockops { position: absolute; top: -23px; right: 12px; display: flex; gap: 6px; padding: 0 4px; background: var(--bg); }
.blockops button { padding: 4px 12px; background: var(--bg); }
fieldset.block .field:first-of-type label { margin-top: 6px; }
.item { border-left: 2px solid var(--line2); padding: 4px 0 0 12px; margin: 4px 0 12px; }
.itemhead { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.itemhead button { padding: 3px 10px; font-size: 12px; }
fieldset.block > button.ghost { margin-bottom: 12px; }
.addrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 16px 0; }
.addrow label { margin: 0; }
.addrow select { width: auto; margin: 0; }
.savebar { position: sticky; bottom: 0; z-index: 4; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
           background: var(--bg2); border-top: 1px solid var(--line); padding: 12px 16px; margin: 18px -16px 0; }
.savebar .fine { margin: 0; }
.testform, .cancelform { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 10px 0; }
.testform button, .cancelform button { margin-top: 8px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; margin: 10px 0 6px; }
.actions .cancelform { flex-basis: 100%; }
.newform { margin: 16px 0 6px; padding: 18px 20px; }
.newform label { margin-top: 0; }
.newform .row { display: flex; gap: 10px; flex-wrap: wrap; }
.newform select { flex: 1 1 260px; width: auto; min-width: 0; margin: 0; }
.newform .row input[type=text] { flex: 1 1 260px; width: auto; min-width: 0; margin: 0; }
.manualform { margin-top: 14px; }
.attachform { margin-top: 16px; max-width: 640px; }
.attachform .row { display: flex; gap: 10px; flex-wrap: wrap; }
.attachform select { flex: 1 1 260px; width: auto; min-width: 0; margin: 0; }
ul.checks { list-style: none; margin: 10px 0 18px; }
ul.checks li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
ul.checks li.ok span { color: var(--good); }
ul.checks li.no { color: var(--bad); }
.sendform { max-width: 560px; }
.sendform .when { display: flex; gap: 10px; margin: 4px 0 4px 26px; }
.sendform .when input { width: auto; margin-bottom: 6px; }
.sendform input#confirm, .sendform input#now-confirm { display: block; max-width: 200px; }
.nowform { flex-basis: 100%; margin-top: 6px; }
details.addcontact { margin: 16px 0; padding: 14px 20px; }
details.addcontact summary { cursor: pointer; font-weight: 600; }
details.addcontact[open] summary { margin-bottom: 8px; }
details.addcontact fieldset { margin: 6px 0 4px; }
.cancelform input#del-confirm { max-width: 360px; }
h1.wrapcell { overflow-wrap: anywhere; min-width: 0; }
.nowform h3 { margin-top: 0; }
p.state { margin-bottom: 14px; }
.callout ul { margin: 6px 0 0 18px; }

@media (max-width: 760px) {
  .funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .funnel .stat + .stat::before { content: none; }
  /* Brand and Sign out on the first line; every section below, wrapped, so none hides off-screen.
     The bar stops sticking: three rows pinned to the top would eat a phone's screen. */
  .top { position: static; }
  .topin { gap: 8px 12px; }
  .who { margin-left: auto; }
  .nav { order: 3; flex: 0 0 100%; gap: 6px; }
  .nav a { white-space: nowrap; display: inline-flex; align-items: center; min-height: 40px; padding: 8px 12px;
           background: rgba(255,255,255,.03); border: 1px solid var(--line); }
}
@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .who span { display: none; }
  .subtabs a { display: inline-flex; align-items: center; min-height: 40px; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 8px; }
  .grid2 { grid-template-columns: 1fr; }
  fieldset.block { padding: 12px 12px 4px; }
  .sendform .when { margin-left: 0; flex-wrap: wrap; }
  .savebar .fine { display: none; }
  .card { padding: 18px; }
  /* At this width the desktop preview is the phone preview again: show the phone one only. */
  .previews figure:has(iframe.desktop) { display: none; }

  /* 16px text in every box: iPhones zoom the whole page in when a smaller box is tapped. */
  input[type=email], input[type=password], input[type=search], input[type=text], input[type=number], input[type=date],
  input[type=time], textarea, select { font-size: 16px; }
  /* Fingers, not pointers: every control at least 40px tall. */
  button.ghost, .chip, a.button { min-height: 40px; }
  button.link { min-height: 40px; }
  .itemhead button { min-height: 36px; padding: 6px 12px; }
  /* The block's buttons get their own row under its title: on its top edge they would cover it. */
  .blockops { position: static; justify-content: flex-end; padding: 0; margin: 2px 0 4px; background: none; }
  .blockops button { min-height: 36px; }
  label.check { min-height: 36px; }
  details.addcontact summary { padding: 9px 0; }
  label.check input { width: 20px; height: 20px; flex: none; }

  /* List tables become one card per row; admin-1024.js labels each value with its column.
     Logs and stack traces (no .stack) keep scrolling sideways inside their box. */
  .tablewrap.stacked { overflow: visible; border: 0; border-radius: 0; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; }
  table.stack thead { display: none; }
  table.stack tr { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 2px 14px; margin-bottom: 10px; }
  table.stack tr[hidden] { display: none; }
  /* The heading on the left, the value (one or several pieces) together on the right. */
  table.stack td, table.stack tr:last-child td { display: flex; justify-content: flex-end; flex-wrap: wrap; align-items: baseline; gap: 6px 14px;
           padding: 9px 0; border-bottom: 1px solid var(--line); white-space: normal; overflow-wrap: anywhere;
           text-align: right; min-width: 0; }
  table.stack td::before { content: attr(data-label); flex: none; max-width: 42%; margin-right: auto; text-align: left; color: var(--muted); font-size: 12.5px; }
  /* The row's name leads, left; tr:last-child td above outranks a plain td:first-child, so both are named. */
  table.stack td:first-child, table.stack tr:last-child td:first-child { justify-content: flex-start; text-align: left; font-weight: 600; }
  table.stack td:first-child::before, table.stack td[data-label=""]::before { content: none; }
  table.stack td[data-label=""] { justify-content: flex-start; }
  table.stack tr td:last-child { border-bottom: 0; }
  table.stack td:empty, table.stack tr:last-child td:empty { display: none; }
  /* Reports' own boxes are smaller; at 16px iPhones don't zoom the page when one is tapped. */
  main .rp-filters input, main .rp-filters select, main input.rp-confirm { font-size: 16px; }
}
