/* StriveX Mailer: light operations UI. Tokens from strivex.shop. */
:root {
  --ink: #16171B;
  --ink-2: #474A54;      /* secondary text, 8.6:1 on white */
  --ink-3: #5F636D;      /* tertiary text, 6.0:1 on white, 5.3:1 on page */
  --line: #DFE2E8;
  --line-strong: #C9CDD6;
  --page: #F2F3F6;
  --panel: #FFFFFF;
  --rail: #FAFAFB;
  --red: #E01B24;        /* primary action / current section */
  --red-hover: #C2141C;
  --red-tint: #FDECEC;
  --ok: #17663F; --ok-tint: #E7F4EC;
  --warn: #7A4E00; --warn-tint: #FFF3D6;
  --err: #A8121A; --err-tint: #FDECEC;
  --info: #1F4E8C; --info-tint: #E8F0FB;
  --radius: 12px;
  --radius-s: 8px;
  --shadow: 0 1px 2px rgba(22, 23, 27, .06), 0 4px 12px rgba(22, 23, 27, .04);
  --font: "Segoe UI Variable Text", "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", Consolas, ui-monospace, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 400 14.5px/1.5 var(--font); font-variant-numeric: tabular-nums;
}
::selection { background: #F7C5C8; color: var(--ink); }
a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
a:hover { text-decoration-color: var(--red); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 1.5rem; font-weight: 650; }
h2 { font-size: 1.0625rem; font-weight: 650; }
h3 { font-size: .9375rem; font-weight: 650; }
p { margin: 0 0 .75em; text-wrap: pretty; }
.muted { color: var(--ink-3); }
.small { font-size: .8125rem; }
code, .mono { font-family: var(--mono); font-size: .8125rem; }
code { background: var(--page); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75;
        stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; background: var(--ink); color: #fff; padding: 8px 12px;
        border-radius: var(--radius-s); z-index: 10; }
.skip:focus { top: 12px; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.rail { background: var(--rail); border-right: 1px solid var(--line); padding: 20px 14px; display: flex;
        flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; flex-direction: column; gap: 2px; padding: 4px 10px 18px; }
.brand img { width: 128px; height: auto; display: block; }
.brand span { font-size: .75rem; color: var(--ink-3); font-weight: 600; letter-spacing: .02em; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-s);
         color: var(--ink-2); text-decoration: none; font-weight: 550; }
.nav a:hover { background: #EEF0F3; color: var(--ink); }
.nav a[aria-current="page"] { background: var(--panel); color: var(--ink); font-weight: 650;
                              box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(22,23,27,.06); }
.nav a[aria-current="page"] .icon { color: var(--red); }
.rail-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); }
.rail-foot form { margin: 0; }
.main { min-width: 0; padding: 28px 36px 64px; max-width: 1280px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px;
             flex-wrap: wrap; }
.page-head p { color: var(--ink-3); margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-pad { padding: 20px 22px; }
.panel + .panel, .stack > * + * { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
              padding: 14px 22px; border-bottom: 1px solid var(--line); }
.panel-head p { margin: 2px 0 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.section-gap { margin-top: 28px; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px;
       padding: 7px 14px; border-radius: var(--radius-s); border: 1px solid var(--line-strong); background: var(--panel);
       color: var(--ink); font: 600 .875rem/1.2 var(--font); text-decoration: none; cursor: pointer;
       transition: background-color .15s ease-out, border-color .15s ease-out, color .15s ease-out; }
.btn:hover { background: #F6F7F9; border-color: #B7BCC6; }
.btn:active { background: #EEF0F3; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-hover); border-color: var(--red-hover); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: #EEF0F3; border-color: transparent; }
.btn-danger { color: var(--err); }
.btn-danger:hover { background: var(--err-tint); border-color: #F0B7BA; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: .8125rem; }
.btn.is-busy { position: relative; color: transparent; }
.btn.is-busy::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
                      border: 2px solid currentColor; border-right-color: transparent; color: #fff;
                      animation: spin .7s linear infinite; }
.btn:not(.btn-primary).is-busy::after { color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms */
label, .label { display: block; font-weight: 600; font-size: .8125rem; margin-bottom: 6px; color: var(--ink); }
.hint { display: block; font-size: .8125rem; color: var(--ink-3); margin-top: 5px; font-weight: 400; }
input[type=text], input[type=email], input[type=number], input[type=search], input[type=password],
input[type=datetime-local], select, textarea {
  width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: #fff; color: var(--ink); font: inherit; caret-color: var(--red);
  transition: border-color .15s ease-out, box-shadow .15s ease-out; }
input::placeholder, textarea::placeholder { color: #686C76; }  /* 5.1:1 on white */
input:hover, select:hover, textarea:hover { border-color: #AEB3BD; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22,23,27,.12); }
textarea { resize: vertical; }
textarea.code { font: 12.5px/1.55 var(--mono); tab-size: 2; white-space: pre; min-height: 520px; }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; accent-color: var(--red); margin: 0; flex: none; }
input[type=file] { font: inherit; font-size: .875rem; max-width: 100%; }
input[type=file]::file-selector-button { font: 600 .8125rem var(--font); padding: 7px 12px; margin-right: 10px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: #fff; color: var(--ink); cursor: pointer; }
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 16px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: .875rem; margin-bottom: 8px;
         cursor: pointer; }
.check input { margin-top: 2px; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 16px; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; }
legend { font-weight: 600; font-size: .8125rem; margin-bottom: 8px; padding: 0; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; flex: 1 1 220px; }

/* ---------- status */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
        font-size: .75rem; font-weight: 650; background: #EEF0F3; color: var(--ink-2); white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.chip-sending, .chip-scheduled { background: var(--info-tint); color: var(--info); }
.chip-done, .chip-sent, .chip-active { background: var(--ok-tint); color: var(--ok); }
.chip-paused, .chip-check, .chip-queued { background: var(--warn-tint); color: var(--warn); }
.chip-failed, .chip-cancelled, .chip-blocked, .chip-bounced { background: var(--err-tint); color: var(--err); }
.chip-unsubscribed, .chip-skipped, .chip-draft { background: #EEF0F3; color: var(--ink-2); }

.notice { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius-s); border: 1px solid;
          margin-bottom: 16px; align-items: flex-start; }
.notice .icon { margin-top: 1px; }
.notice p:last-child, .notice ul:last-child { margin-bottom: 0; }
.notice ul { margin: 4px 0 0; padding-left: 18px; }
.notice-ok { background: var(--ok-tint); border-color: #B7DEC6; color: #0F4A2D; }
.notice-error { background: var(--err-tint); border-color: #F0B7BA; color: #7E0E14; }
.notice-warn { background: var(--warn-tint); border-color: #EDD28F; color: #5C3B00; }
.notice-info { background: var(--info-tint); border-color: #B8CDEB; color: #183E70; }
.flashes { margin-bottom: 4px; }

/* ---------- tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.data th { text-align: left; font-weight: 650; font-size: .75rem; color: var(--ink-3); text-transform: uppercase;
                letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
                background: var(--rail); }
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #FAFAFB; }
table.data .num { text-align: right; }
table.data td.wrap { max-width: 420px; overflow-wrap: anywhere; }
.row-link { font-weight: 600; text-decoration: none; }
.row-link:hover { text-decoration: underline; }

/* ---------- key/value + meters */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: .875rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.meter { height: 6px; background: #E8EAEE; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.meter > span { display: block; height: 100%; background: var(--ink); border-radius: 99px; transition: width .25s ease-out; }
.meter.is-full > span { background: var(--warn); }
.tally { display: flex; gap: 22px; flex-wrap: wrap; }
.tally div { min-width: 64px; }
.tally b { display: block; font-size: 1.25rem; font-weight: 650; }
.tally span { font-size: .75rem; color: var(--ink-3); font-weight: 600; }

/* ---------- empty / steps */
.empty { text-align: left; padding: 28px 22px; }
.empty h2 { margin-bottom: 6px; }
.empty p { color: var(--ink-3); max-width: 60ch; }
.setup { list-style: none; margin: 0; padding: 0; }
.setup li { display: flex; gap: 12px; align-items: center; padding: 12px 22px; border-top: 1px solid var(--line); }
.setup li:first-child { border-top: 0; }
.setup .dot { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid;
              place-items: center; flex: none; }
.setup .done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.setup .done .dot .icon { width: 14px; height: 14px; stroke-width: 2.5; }
.setup .txt { flex: 1; }
.setup .done .txt { color: var(--ink-3); }

.gate { list-style: none; margin: 0 0 16px; padding: 0; }
.gate li { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; font-size: .875rem; }
.gate .ok { color: var(--ok); }
.gate .no { color: var(--err); }

/* ---------- template editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.preview-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px;
               border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-s); overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 6px 12px; font: 600 .8125rem var(--font); color: var(--ink-2);
              cursor: pointer; min-height: 30px; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.preview-stage { background: #E9EBEF; padding: 16px; display: flex; justify-content: center; min-height: 560px;
                 border-radius: 0 0 var(--radius) var(--radius); }
.preview-stage iframe { width: 100%; max-width: 100%; height: 700px; border: 1px solid var(--line); background: #fff;
                        border-radius: 6px; transition: max-width .2s ease-out; }
.preview-stage.is-mobile iframe { max-width: 390px; }
.subject-line { padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: .875rem; }
.subject-line b { font-weight: 650; }
.checks { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: .8125rem; }
.checks ul { margin: 0; padding-left: 18px; }
.checks .ok-line { color: var(--ok); display: flex; gap: 6px; align-items: center; font-weight: 600; }
.fields-list { display: flex; flex-wrap: wrap; gap: 6px; }
.fields-list button { font: .75rem var(--mono); border: 1px solid var(--line); background: var(--page); border-radius: 6px;
                      padding: 3px 7px; cursor: pointer; color: var(--ink); }
.fields-list button:hover { border-color: var(--ink-3); }
details.more > summary { cursor: pointer; font-weight: 600; font-size: .875rem; padding: 12px 22px; list-style: none;
                         display: flex; align-items: center; justify-content: space-between; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "Show"; font-weight: 500; color: var(--ink-3); font-size: .8125rem; }
details.more[open] > summary::after { content: "Hide"; }
details.more > div { padding: 0 22px 18px; }

/* ---------- import mapping */
.map-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px;
           padding: 12px 22px; border-top: 1px solid var(--line); align-items: center; }
.map-row .samples { color: var(--ink-3); font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 14px 22px; border-bottom: 1px solid var(--line); }

/* The launch box stays in view beside a long draft form (desktop only; it stacks on narrow screens). */
@media (min-width: 1101px) { .sticky-side { position: sticky; top: 16px; } }

/* ---------- bulk selection bar */
.bulkbar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
           padding: 10px 14px; background: #FBF4F4; border-bottom: 1px solid #F0D6D7; }
.bulkbar-count { font-weight: 650; font-size: .875rem; }
.bulkbar-sep { width: 1px; height: 22px; background: var(--line-strong); margin: 0 4px; }
table.data td:first-child, table.data th:first-child { padding-right: 0; }

/* ---------- pagination */
.pager { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 12px 14px;
         border-top: 1px solid var(--line); font-size: .8125rem; color: var(--ink-3); }

/* ---------- responsive */
@media (max-width: 1100px) {
  .editor, .grid-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 10px 12px;
          border-right: 0; border-bottom: 1px solid var(--line); gap: 2px; }
  .brand { padding: 0 8px 0 2px; }
  .brand img { width: 96px; }
  .brand span { display: none; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .nav a { padding: 8px 9px; }
  .nav a span { font-size: .8125rem; }
  .rail-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .rail-user { display: none; }
  .main { padding: 20px 16px 48px; }
  .grid-2 { grid-template-columns: 1fr; }
  .map-row { grid-template-columns: 1fr; gap: 6px; }
  .panel-pad { padding: 16px; }
  .panel-head { padding: 12px 16px; }
}
@media (max-width: 520px) {
  .nav a span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .nav a { padding: 10px; }
  table.data th, table.data td { padding: 9px 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
