/* Panel UpFlowLink: style modelled on sample.png (light dashboard, blue accent, black cards) */
:root {
  --blue: #1f6bff;
  --blue-dark: #0b4fd6;
  --blue-soft: #cfe0ff;
  --ink: #101114;
  --ink-2: #1b1c20;
  --muted: #8a8f98;
  --line: #e7e9ee;
  --bg: #e6e7e9;
  --shell: #ffffff;
  --area: #f1f2f4;
  --card: #ffffff;
  --radius: 24px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.muted-d { color: #9aa0ab; }
.small { font-size: 12px; }
.center { text-align: center; }

/* --- shell --- */
.app { display: grid; grid-template-columns: 250px 1fr; gap: 0; max-width: 1480px; margin: 20px auto; background: var(--shell); border-radius: 32px; overflow: hidden; box-shadow: 0 10px 40px rgba(16,17,20,.08); height: calc(100vh - 40px); min-height: 0; }
.sidebar { padding: 26px 20px; display: flex; flex-direction: column; gap: 6px; background: var(--shell); overflow-y: auto; scrollbar-width: none; }
.sidebar::-webkit-scrollbar { display: none; }
.main { background: var(--area); border-radius: 28px; margin: 12px 12px 12px 0; padding: 18px 22px 26px; min-width: 0; overflow-y: auto; scrollbar-gutter: stable; overscroll-behavior: contain; }
/* Thin, rounded scrollbar; the gutter is always reserved, so every page has exactly the same content width */
.main::-webkit-scrollbar { width: 10px; }
.main::-webkit-scrollbar-track { background: transparent; margin: 14px 0; }
.main::-webkit-scrollbar-thumb { background: #c9ced8; border-radius: 999px; border: 2px solid var(--area); }
.main::-webkit-scrollbar-thumb:hover { background: #a9afbc; }
@supports (-moz-appearance: none) { .main { scrollbar-width: thin; scrollbar-color: #c9ced8 transparent; } }
body { overflow: hidden; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.brand-mark { width: 30px; height: 30px; border-radius: 10px; background: linear-gradient(135deg, #38bdf8, var(--blue)); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; inset: 8px; border-radius: 4px; background: #fff; clip-path: polygon(50% 0, 100% 100%, 0 100%); }

.welcome { margin: 22px 0 14px; }
.welcome h1 { font-size: 30px; line-height: 1.1; font-weight: 500; letter-spacing: -0.03em; word-break: break-word; }
.welcome p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.menu-label { margin: 16px 8px 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #aab0ba; }
.menu { display: flex; flex-direction: column; gap: 2px; }
.menu a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 999px; color: #3b3f47; font-weight: 500; transition: background .15s, color .15s; }
.menu a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.menu a:hover { background: var(--area); }
.menu a.on { background: var(--ink); color: #fff; }

.promo { margin-top: auto; background: linear-gradient(160deg, #3b86ff, var(--blue-dark)); color: #fff; border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.promo b { font-size: 18px; letter-spacing: -0.02em; }
.promo span { font-size: 12.5px; opacity: .9; }

/* --- top bar --- */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.pills { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: #e6e8ec; border-radius: 999px; padding: 4px; }
.pills a { padding: 9px 18px; border-radius: 999px; color: #6b7079; font-weight: 500; text-align: center; white-space: nowrap; }
.pills a.on { background: var(--blue); color: #fff; }
.pills a:not(.on):hover { color: var(--ink); }
.user { display: flex; align-items: center; gap: 10px; }
.user form { margin: 0; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: #e6e8ec; display: grid; place-items: center; cursor: pointer; color: #4b505a; }
.icon-btn:hover { background: var(--blue-soft); color: var(--blue-dark); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 600; }
.uname { font-weight: 600; }

/* --- page header --- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin: 6px 4px 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 30px; font-weight: 500; letter-spacing: -0.03em; }
.crumbs { color: var(--muted); font-size: 12px; margin-top: 4px; }
.head-actions { display: flex; gap: 8px; }
.chip { display: inline-flex; align-items: center; padding: 9px 16px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-weight: 500; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--blue); color: var(--blue); }

/* --- card grid --- */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { background: var(--card); border-radius: var(--radius); padding: 22px; min-width: 0; }
.card.black { background: var(--ink); color: #fff; }
.span-2 { grid-column: span 2; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 14px; }
.card-head h3 { font-size: 16px; font-weight: 500; }
.black .tag { display: inline-block; background: #2a2c31; color: #c7cbd3; border-radius: 999px; padding: 4px 10px; font-size: 11px; margin-bottom: 10px; }
.black h3 { font-size: 22px; font-weight: 500; margin-bottom: 10px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.big { font-size: 40px; font-weight: 500; letter-spacing: -0.04em; line-height: 1.05; }
.big small { font-size: 16px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.big.white { color: #fff; }
.big.blue { color: var(--blue); }
.kpi p { margin: 8px 0 0; }
.promo-wide .big { margin: 6px 0 16px; }
.trend { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 11px 20px; border-radius: 999px; border: 0; font: inherit; font-weight: 600; cursor: pointer; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-dark); }
.btn-light { background: #fff; color: var(--blue-dark); align-self: flex-start; }

/* --- dots --- */
.dots { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.dots-row { display: flex; align-items: center; gap: 10px; }
.dots-label { width: 110px; flex: none; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { flex: 1; max-width: 46px; aspect-ratio: 1; border-radius: 50%; }
.d0 { background: #eceef2; }
.d1 { background: var(--blue-soft); }
.d2 { background: repeating-linear-gradient(45deg, var(--blue), var(--blue) 3px, var(--blue-dark) 3px, var(--blue-dark) 6px); }
.d3 { background: repeating-linear-gradient(45deg, var(--ink), var(--ink) 3px, #3a3c42 3px, #3a3c42 6px); }
.dots-axis .dot-d { flex: 1; max-width: 46px; text-align: center; font-size: 11px; color: #aab0ba; }

/* --- charts --- */
.chart { width: 100%; height: auto; display: block; }
.bar-n { font-size: 11px; font-weight: 600; fill: var(--ink); }
.bar-d { font-size: 11px; fill: #aab0ba; }
.gauge { width: 100%; max-width: 260px; margin: 0 auto; display: block; }
.g-n { font-size: 30px; font-weight: 600; fill: var(--ink); letter-spacing: -1px; }
.gauge-card p { margin: 6px 0 0; }

.meter { height: 8px; background: #eceef2; border-radius: 99px; margin: 8px 0 14px; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #38bdf8, var(--blue)); }
.bar-row:last-child .meter { margin-bottom: 0; }

/* --- table --- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: #aab0ba; padding: 0 10px 10px; }
td { padding: 11px 10px; border-top: 1px solid var(--line); vertical-align: top; }
.status { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eceef2; color: #4b505a; }
.s-pending { background: var(--blue-soft); color: var(--blue-dark); }
.s-processed { background: #fff1c9; color: #8a6200; }
.s-completed { background: #d8f5e3; color: #0d7a3f; }
.s-cancelled { background: #fde0e0; color: #b42318; }

/* --- sign-in --- */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 28px; padding: 34px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 10px 40px rgba(16,17,20,.08); }
.auth-card h1 { font-size: 30px; font-weight: 500; margin-top: 12px; }
.auth-card p { margin: -6px 0 4px; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 13px; }
.auth-card input { padding: 13px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--area); font: inherit; }
.auth-card input:focus { outline: 2px solid var(--blue); outline-offset: 1px; background: #fff; }
.auth-card .btn { margin-top: 6px; padding: 14px; }
.auth-card a.muted { text-align: center; }
.alert { background: #fde0e0; color: #b42318; border-radius: 14px; padding: 11px 14px; font-weight: 500; }

/* --- responsive layout --- */
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-2 { grid-column: span 2; }
}
@media (max-width: 860px) {
  body { overflow: auto; }
  .app { grid-template-columns: 1fr; margin: 0; border-radius: 0; height: auto; min-height: 100vh; overflow: visible; }
  .sidebar { overflow: visible; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 14px 16px; gap: 8px; }
  .welcome, .menu-label, .promo { display: none; }
  .menu { flex-direction: row; flex-wrap: wrap; }
  .menu a { padding: 8px 12px; }
  .main { margin: 0; border-radius: 24px 24px 0 0; padding: 14px; overflow: visible; }
  .uname { display: none; }
}
@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .big { font-size: 34px; }
  .dots-label { width: 80px; }
}

/* --- tiles, company box, pagination, link --- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 6px; }
.tile .big { font-size: 34px; }
.card.black .muted-d { color: #9aa0ab; }
.company-box { margin: 10px 0 0; padding: 12px 14px; background: var(--area); border-radius: 18px; display: flex; flex-direction: column; gap: 6px; }
.company-box select { width: 100%; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font: inherit; font-weight: 600; }
.pager { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.link-in { width: 100%; min-width: 220px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--area); font: 12px/1.2 ui-monospace, Menlo, Consolas, monospace; color: #3b3f47; }
.crumbs a { color: var(--blue); }
td a:hover b { color: var(--blue); }
.s-active { background: #d8f5e3; color: #0d7a3f; }
.s-closed { background: #eceef2; color: #6b7079; }
.s-draft { background: #fff1c9; color: #8a6200; }

/* --- recipient import --- */
.notice { padding: 12px 16px; border-radius: 16px; margin-bottom: 14px; font-weight: 500; }
.notice-ok { background: #d8f5e3; color: #0d7a3f; }
.notice-err { background: #fde0e0; color: #b42318; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label, .tile.card.tile > label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.form input:not([type=file]):not([type=checkbox]), .inp, .form textarea, .map select { padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--area); font: inherit; width: 100%; }
.form textarea { resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.form input:not([type=checkbox]):focus, .form textarea:focus, .inp:focus, .map select:focus { outline: 2px solid var(--blue); outline-offset: 1px; background: #fff; }
.hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.or { text-align: center; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.help h3 { margin-bottom: 10px; }
.help ul { margin: 0 0 16px; padding-left: 18px; display: flex; flex-direction: column; gap: 10px; color: #3b3f47; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; }
.steps li { padding: 7px 14px; border-radius: 999px; background: #e6e8ec; color: #6b7079; font-weight: 500; font-size: 13px; }
.steps li.on { background: var(--blue); color: #fff; }
.steps li.done { background: var(--ink); color: #fff; }
.map th { padding: 0 8px 10px; min-width: 150px; text-transform: none; letter-spacing: 0; }
.map select { padding: 9px 10px; font-weight: 600; background: #fff; }
.map tr.hdr td { color: var(--muted); font-style: italic; }
.actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.pick { display: flex; gap: 8px; flex-wrap: wrap; }
details summary { cursor: pointer; padding: 4px 0; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.lead { margin: 0 4px 16px; color: #5b616c; max-width: 760px; }

/* --- campaign form --- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.form h3 { font-size: 18px; font-weight: 600; margin-bottom: 2px; }
.form label .hint { display: block; margin: 0 0 2px; }
.form select { padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--area); font: inherit; width: 100%; }
.form select:focus { outline: 2px solid var(--blue); outline-offset: 1px; background: #fff; }
.form .link-in { width: 100%; }

/* --- file drop zone --- */
.file { position: relative; display: flex; align-items: center; gap: 16px; padding: 22px 20px; border: 2px dashed #c9cfdb; border-radius: 20px; background: #fafbfd; transition: border-color .15s, background .15s; }
.file:hover, .file:focus-within { border-color: var(--blue); background: #f3f7ff; }
.file.drag { border-color: var(--blue); background: var(--blue-soft); }
.file.has-file { border-style: solid; border-color: var(--blue); background: #f3f7ff; }
.file input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; border: 0; }
.file > svg { width: 44px; height: 44px; padding: 11px; border-radius: 14px; background: var(--blue); fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.file-text { display: flex; flex-direction: column; min-width: 0; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-hint { color: var(--muted); font-size: 12.5px; font-weight: 400; }

/* --- switches (replace native checkboxes) --- */
.chk { position: relative; display: flex !important; flex-direction: row !important; align-items: center; gap: 12px !important; font-weight: 500 !important; cursor: pointer; }
.chk input[type=checkbox] { position: absolute; opacity: 0; width: 44px !important; height: 26px; margin: 0; padding: 0 !important; cursor: pointer; }
.chk .sw { position: relative; flex: none; width: 44px; height: 26px; border-radius: 999px; background: #cfd4de; transition: background .18s; }
.chk .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(16,17,20,.3); transition: transform .18s; }
.chk input:checked + .sw { background: var(--blue); }
.chk input:checked + .sw::after { transform: translateX(18px); }
.chk input:focus-visible + .sw { outline: 2px solid var(--blue); outline-offset: 2px; }
.chk .chk-text { font-size: 14px; }

/* Order status as a select that looks like the status pill */
.status-form { margin: 0; }
select.status { appearance: none; -webkit-appearance: none; border: 0; cursor: pointer; padding-right: 11px; font-family: inherit; }
select.status:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.user-link { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.user-link:hover .uname { color: var(--blue); }

/* Settings tabs */
.tabs { display: flex; gap: 6px; margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 16px; font-weight: 600; font-size: 14px; color: var(--muted, #6b7280); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--blue); }
.tabs a.on { color: var(--blue); border-bottom-color: var(--blue); }

/* Period / campaign filters */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 0 0 16px; }
.filters .f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted, #6b7280); }
.filters select, .filters input[type=date], .filters input[type=search] { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; font-size: 14px; color: inherit; }
.filters .f-range { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.filters .f-range[hidden] { display: none; }

/* Charts: one hue, thin marks, recessive grid */
.grid-l { stroke: #eceef2; stroke-width: 1; }
.axis-t { font-size: 11px; fill: #8a8f98; }
.col .bar { fill: var(--blue); transition: fill .12s; }
.col:hover .bar { fill: var(--blue-dark); }
.chart-empty { margin: 14px 0 4px; }
.as-table { margin-top: 10px; font-size: 12.5px; }
.as-table summary { cursor: pointer; color: var(--muted); }
.as-table table { margin-top: 8px; border-collapse: collapse; }
.as-table th, .as-table td { text-align: left; padding: 3px 18px 3px 0; }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.charts .wide { grid-column: 1 / -1; }
@media (max-width: 900px) { .charts { grid-template-columns: 1fr; } }
.hbars { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.hb { display: grid; grid-template-columns: 120px 1fr 56px 72px; align-items: center; gap: 10px; font-size: 13px; }
.hb-l { color: var(--ink); }
.hb-t { height: 10px; background: #eceef2; border-radius: 6px; overflow: hidden; }
.hb-t i { display: block; height: 100%; background: var(--blue); border-radius: 6px; }
.hb-n { text-align: right; }
.hb-p { color: var(--muted); font-size: 12px; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.2); max-width: 280px; }
.tip[hidden] { display: none; }

/* Overview: four KPI cards */
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
@media (max-width: 1100px) { .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kpi-row { grid-template-columns: 1fr; } }

/* Campaign editor: form + live preview */
.edit-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 20px; align-items: start; }
.edit-form { min-width: 0; }
.pv { position: sticky; top: 12px; background: var(--card); border-radius: var(--radius); padding: 14px; }
.pv-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.pv-tabs, .pv-dev { display: inline-flex; gap: 4px; background: var(--area); border-radius: 999px; padding: 4px; }
.pv-tabs button, .pv-dev button { border: 0; background: transparent; padding: 7px 13px; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.pv-tabs button.on, .pv-dev button.on { background: var(--blue); color: #fff; }
.pv-stage { position: relative; overflow: hidden; border-radius: 14px; border: 1px solid var(--line); background: #fff; }
.pv-stage iframe { border: 0; display: block; background: #fff; }
@media (max-width: 1200px) { .edit-grid { grid-template-columns: minmax(0, 1fr); } .pv { position: static; } }

/* Equal-width tabs everywhere */
.tabs a { min-width: 150px; text-align: center; }
.pv-tabs, .pv-dev { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.pv-tabs button, .pv-dev button { text-align: center; white-space: nowrap; }
@media (max-width: 900px) { .pills { display: grid; grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); } .tabs a { min-width: 0; flex: 1; } }

/* Short windows: the sidebar promo would be cut off */
@media (min-width: 861px) and (max-height: 980px) { .promo { display: none; } }
@media (min-width: 861px) and (max-height: 860px) { .welcome p { display: none; } .welcome { margin: 16px 0 6px; } .welcome h1 { font-size: 22px; } }
@media (min-width: 861px) and (max-height: 760px) { .welcome { display: none; } .company-box { margin-top: 12px; } }


/* Colour pickers as real swatches */
.form label input[type=color], .form input[type=color] { width: 84px !important; height: 48px; padding: 5px; border-radius: 14px; cursor: pointer; }
.form input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.form input[type=color]::-webkit-color-swatch { border: 0; border-radius: 9px; }
.form input[type=color]::-moz-color-swatch { border: 0; border-radius: 9px; }

/* Logo preview: always on a white plate */
.logo-prev { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-prev[hidden] { display: none; }
.logo-plate { display: inline-flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; }
.logo-plate img { max-height: 48px; max-width: 220px; display: block; }

/* Preview button: opens the real page in its own tab */
.pv-bar { align-items: center; }
.pv-open { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 999px; border: 0; background: var(--ink); color: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.pv-open:hover { background: var(--blue); }
.pv-open svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Logo size slider and the browser-tab preview */
.form label.range .range-row { display: flex; align-items: center; gap: 14px; }
.form label.range input[type=range] { flex: 1; width: auto; padding: 0; accent-color: var(--blue); height: 28px; background: transparent; border: 0; }
.form label.range output { min-width: 56px; text-align: right; font-weight: 600; }
.pv-browser { margin-bottom: 8px; }
.pv-tabchip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 7px 14px; background: var(--area); border-radius: 10px 10px 0 0; font-size: 12.5px; color: var(--ink); }
.pv-tabchip img { width: 16px; height: 16px; object-fit: contain; flex: none; }
.pv-tabchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Campaign editor: data source choice and example texts */
.opts-wrap .legend { display: block; font-weight: 600; margin-bottom: 8px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .opts { grid-template-columns: 1fr; } }
.form label.opt { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 14px 44px; border: 1px solid var(--line); border-radius: 16px; background: #fff; cursor: pointer; font-weight: 500; }
.form label.opt input[type=radio] { position: absolute; left: 16px; top: 17px; width: 18px; height: 18px; padding: 0; margin: 0; accent-color: var(--blue); }
.form label.opt b { font-weight: 600; }
.form label.opt span { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.form label.opt:has(input:checked) { border-color: var(--blue); background: #f4f8ff; box-shadow: 0 0 0 3px rgba(31,107,255,.12); }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-weight: 400; }
.examples > span { font-size: 12px; color: var(--muted); margin-right: 2px; }
.ex { border: 1px dashed #c3c9d4; background: #fff; color: var(--ink); border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 12px; cursor: pointer; text-align: left; }
.ex:hover { border-color: var(--blue); color: var(--blue); }
.form textarea { font-family: inherit; }

/* Media library in the campaign editor */
.mlib { border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: #fafbfc; }
.mlib-head { margin-bottom: 10px; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.mcard { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.mcard[hidden] { display: none; }
.mcard.on { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,107,255,.14); }
.mthumb { position: relative; height: 110px; background: #f1f2f4; display: grid; place-items: center; overflow: hidden; }
.mthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mthumb svg { width: 36px; height: 36px; fill: none; stroke: #8a8f98; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.mkind { position: absolute; left: 8px; top: 8px; padding: 2px 9px; border-radius: 999px; background: rgba(16,17,20,.75); color: #fff; font-size: 11px; font-weight: 600; text-transform: capitalize; }
.mmissing { color: #b42318; font-size: 12px; font-weight: 600; }
.mmeta { padding: 10px 12px 6px; display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.mmeta b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mmeta span { font-size: 12px; color: var(--muted); }
.mmeta .mused { color: #5b616c; }
.mact { display: flex; gap: 6px; padding: 8px 12px 12px; }
.mact .chip { padding: 6px 12px; font-size: 12.5px; }
.mcard.on .m-use { background: var(--blue); border-color: var(--blue); color: #fff; }
.m-del:hover { border-color: #d92d20; color: #d92d20; }

/* Video thumbnail in the library: a frame from the video, play badge on top */
.mthumb video.mvideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .2s; background: #f1f2f4; }
.mthumb.has-frame video.mvideo { opacity: 1; }
.mthumb.has-frame > svg { display: none; }
.mplay { position: absolute; right: 8px; bottom: 8px; width: 28px; height: 28px; border-radius: 50%; background: rgba(16,17,20,.7); }
.mplay::after { content: ""; position: absolute; left: 11px; top: 8px; border-left: 9px solid #fff; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }

/* Save bar: always visible at the bottom of the scrolling area */
.savebar { position: sticky; bottom: -14px; z-index: 30; margin-top: 18px; padding: 10px 14px; justify-content: flex-end; align-items: center; gap: 10px;
  background: rgba(255,255,255,.94); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 10px 30px rgba(16,17,20,.14); }

/* Preview controls never scroll sideways: they wrap, and use short labels on narrow screens */
.pv-tabs .sm, .pv-dev .sm { display: none; }
.pv-bar { min-width: 0; }
.pv-tabs, .pv-dev { max-width: 100%; }
@media (max-width: 560px) {
  .pv-tabs .lg { display: none; } .pv-tabs .sm { display: inline; }
  .pv-tabs button, .pv-dev button { padding: 7px 10px; font-size: 12.5px; }
  .pv-bar { gap: 6px; }
  .pv-open { padding: 0 12px; }
}
.form .subhead { margin: 6px 0 0; font-size: 15px; font-weight: 600; padding-top: 14px; border-top: 1px solid var(--line); }

/* Dialog windows (admin tools) */
dialog.dlg { border: 0; border-radius: 26px; padding: 0; width: min(480px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(16,17,20,.35); color: var(--ink); background: #fff; }
dialog.dlg::backdrop { background: rgba(16,17,20,.5); backdrop-filter: blur(4px); }
dialog.dlg form { padding: 26px 26px 22px; display: flex; flex-direction: column; gap: 14px; }
dialog.dlg h3 { margin: 0; font-size: 20px; }
dialog.dlg p { margin: 0; color: #5b616c; }
dialog.dlg label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
dialog.dlg input:not([type=hidden]) { padding: 13px 15px; border: 1px solid #e2e5ea; background: #f4f5f7; border-radius: 14px; font: inherit; font-size: 15px; font-weight: 500; width: 100%; }
dialog.dlg input:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 4px rgba(31,107,255,.14); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.dlg-warn { background: #fdecec; border: 1px solid #f5c2c0; color: #8a2a22; border-radius: 16px; padding: 12px 14px; font-size: 13.5px; }
.dlg-warn ul { margin: 6px 0 0; padding-left: 18px; }
.pwrow { display: flex; gap: 8px; }
.pwrow input { flex: 1; }
.pw-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-danger { background: #d92d20; color: #fff; border: 0; border-radius: 999px; padding: 11px 22px; font: inherit; font-weight: 600; cursor: pointer; }
.btn-danger:hover:not(:disabled) { background: #b42318; }
.btn-danger:disabled { opacity: .45; cursor: not-allowed; }
.chip.danger { color: #b42318; border-color: #f3b8b3; }
.chip.danger:hover { background: #fdecec; color: #b42318; border-color: #d92d20; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.row-actions form { margin: 0; }
.row-actions .chip { padding: 7px 13px; font-size: 12.5px; }
td .sub { display: block; color: var(--muted); font-size: 12.5px; }

/* Cover frame of a video */
.mthumb img.mcover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.mthumb:has(img.mcover) > svg { display: none; }
dialog.dlg-wide { width: min(760px, calc(100vw - 32px)); }
.cover-box { padding: 26px; display: flex; flex-direction: column; gap: 12px; }
.cover-stage { background: #0b1020; border-radius: 16px; overflow: hidden; display: grid; place-items: center; }
.cover-stage video { width: 100%; max-height: 52vh; display: block; background: #0b1020; }
.cover-ctl { display: flex; align-items: center; gap: 12px; }
.cover-ctl input[type=range] { flex: 1; accent-color: var(--blue); }
.cover-ctl span { min-width: 58px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; color: #5b616c; }
.cover-step { display: flex; gap: 8px; flex-wrap: wrap; }
.cover-step .chip { padding: 6px 12px; font-size: 12.5px; }

/* Upload progress inside the save bar */
.upload-progress { flex: 1; min-width: 0; margin-right: 6px; }
.upload-progress[hidden] { display: none; }
.up-text { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-text b { font-weight: 600; }
.up-text span { color: var(--muted); }
.up-bar { height: 6px; border-radius: 999px; background: #e7e9ee; overflow: hidden; margin-top: 5px; }
.up-bar i { display: block; height: 100%; width: 0; background: var(--blue); border-radius: 999px; transition: width .2s ease; }
.upload-progress.err .up-text b { color: #b42318; white-space: normal; }
.upload-progress.err .up-bar { display: none; }

/* A file that is uploading to the library */
.mcard.uploading { border-style: dashed; }
.mcard.uploading .mthumb { background: repeating-linear-gradient(45deg, #f1f2f4, #f1f2f4 10px, #e8eaee 10px, #e8eaee 20px); }
.mcard.uploading .mmeta b { max-width: 100%; }
.mlib-msg { margin: 10px 0 0; padding: 9px 14px; border-radius: 14px; font-size: 13px; background: #fdecec; color: #8a2a22; border: 1px solid #f5c2c0; }
.mlib-msg.ok { background: #e8f7ee; color: #0d7a3f; border-color: #bfe8cf; }
.mlib-msg[hidden] { display: none; }

/* What the response form asks for */
.asks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: #fafbfc; }
.asks .legend { flex: 0 0 100%; font-weight: 600; }
.asks .hint { flex: 0 0 100%; font-size: 12.5px; color: var(--muted); }

/* Sortable tables: click a heading, arrows show the direction */
th.sort-th { cursor: pointer; user-select: none; white-space: nowrap; }
th.sort-th:hover { color: var(--text, #111); }
th.sort-th:focus-visible { outline: 2px solid var(--accent, #0a7cf5); outline-offset: -2px; border-radius: 8px; }
.sort-arrow { display: inline-block; width: 9px; height: 14px; margin-left: 6px; vertical-align: -2px; position: relative; opacity: .35; }
.sort-arrow::before, .sort-arrow::after { content: ""; position: absolute; left: 0; border: 4.5px solid transparent; }
.sort-arrow::before { top: 0; border-bottom: 5px solid currentColor; border-top: 0; }
.sort-arrow::after { bottom: 0; border-top: 5px solid currentColor; border-bottom: 0; }
th[aria-sort=ascending] .sort-arrow, th[aria-sort=descending] .sort-arrow { opacity: 1; }
th[aria-sort=ascending] .sort-arrow::after, th[aria-sort=descending] .sort-arrow::before { opacity: .2; }
th.sort-th > a { color: inherit; text-decoration: none; white-space: nowrap; }
th.sort-th:has(> a) { cursor: default; }
.f-search input { min-width: 240px; }

/* Example of what to type (import help) */
pre.example { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #f6f7f9; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }

/* Export for e-mail tools */
.export-box .filters { margin-bottom: 8px; }
.export-help { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 8px; font-size: 13.5px; color: var(--muted, #6b7280); }
.export-help b { color: var(--text, #111); }

/* Edit / Delete at the end of a table row */
td.row-actions { white-space: nowrap; text-align: right; }
td.row-actions .chip { margin-left: 6px; }

.inline-form { display: inline; margin: 0; }
td.row-actions { display: table-cell; }

/* Big banner on pages that show closed (History) data */
.history-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 18px; padding: 18px 24px; border-radius: 22px; background: #1d1f24; color: #fff; }
.hb-main { display: flex; align-items: center; gap: 18px; min-width: 0; }
.hb-tag { font-size: 30px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #ffb020; line-height: 1; }
.hb-main > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hb-main b { font-size: 16px; }
.hb-main span:not(.hb-tag) { font-size: 14px; color: #c9ccd3; }
.hb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 640px) { .hb-tag { font-size: 24px; } .history-banner { padding: 16px 18px; } }

/* Tabs inside the History panel */
.hist-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: -6px 0 18px; }
.hist-tabs a { padding: 9px 16px; border-radius: 999px; background: #fff; color: #5b616c; font-weight: 600; font-size: 14px; text-decoration: none; border: 1px solid var(--line, #e2e5ea); }
.hist-tabs a:hover { color: #111; }
.hist-tabs a.on { background: #1d1f24; color: #ffb020; border-color: #1d1f24; }

/* Small credit line at the bottom of the panel */
.credit { margin: 14px 0 0; font-size: 11.5px; color: var(--muted, #8b909a); text-align: center; letter-spacing: .01em; }
.credit-main { display: none; }
@media (max-width: 900px) { .credit-main { display: block; margin: 8px 0 18px; } .sidebar .credit { display: none; } }
body.auth { flex-direction: column; }
.credit-login { margin: 6px 0 -6px; }
@media (max-width: 900px) { .credit-login { display: block; } }
.credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.credit a:hover { color: var(--blue, #1f6bff); }

/* Information notice and a field that must be filled to continue */
.notice-info { background: #eaf1ff; color: #17408f; border: 1px solid #c7d9fb; }
.notice-info[hidden] { display: none; }
label.need input { border-color: #1f6bff; box-shadow: 0 0 0 4px rgba(31,107,255,.14); }

/* Buttons and links that look like chips are identical: same font, size and spacing */
button.chip, a.chip { font-family: inherit; font-size: 12.5px; font-weight: 500; line-height: 1.2; color: inherit; text-decoration: none; }
button.chip.danger, a.chip.danger { color: #b42318; }
td.row-actions { display: table-cell; }
td.row-actions > * { vertical-align: middle; }
td.row-actions .chip { margin-left: 6px; }
td.row-actions .inline-form { display: inline-block; margin: 0 0 0 6px; }
td.row-actions .inline-form .chip { margin-left: 0; }

/* The buttons at the top of a page (links, forms and buttons) have the same height and size */
.head-actions { align-items: center; flex-wrap: wrap; }
.head-actions .inline-form { display: flex; margin: 0; }
.head-actions .chip, .head-actions .btn { height: 42px; padding: 0 18px; font-size: 13px; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }

/* How to use */
.help-sec { margin-top: 16px; }
.help-sec h3 { margin-bottom: 8px; }
.help-sec h4 { margin: 18px 0 6px; font-size: 16px; }
.help-sec ol, .help-sec ul { margin: 0; padding-left: 22px; display: grid; gap: 7px; line-height: 1.55; }
.help-sec code { background: #f1f2f4; border-radius: 6px; padding: 1px 6px; font-size: 12.5px; }
.help-toc { margin: 0 0 4px; }
.help-flow { list-style: none; padding: 0 !important; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px !important; counter-reset: s; }
.help-flow li { counter-increment: s; background: #f6f7f9; border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.help-flow li::before { content: counter(s); width: 26px; height: 26px; border-radius: 50%; background: var(--blue, #1f6bff); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.help-flow span { color: #5b616c; font-size: 14px; }
.help-words { margin: 0; display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 8px 18px; }
.help-words dt { font-weight: 700; }
.help-words dd { margin: 0; color: #5b616c; }
@media (max-width: 640px) { .help-words { grid-template-columns: 1fr; gap: 2px; } .help-words dd { margin-bottom: 8px; } }
html { scroll-behavior: smooth; }

/* Demo account: until when it works */
.demo-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 16px; padding: 10px 18px; border-radius: 16px; background: #1d1f24; color: #c9ccd3; font-size: 13.5px; }
.demo-bar > b { color: #ffb020; letter-spacing: .06em; text-transform: uppercase; font-size: 12px; }
.demo-bar span b { color: #fff; }
.demo-bar a { color: #fff; text-decoration: underline; }
.demo-bar.soon { background: #7a1f16; }
.demo-bar.soon > b { color: #ffd2cc; }

/* Guided tour (prototype) */
.tour { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
.tour-ring { position: fixed; border-radius: 16px; box-shadow: 0 0 0 9999px rgba(16, 17, 20, .62), 0 0 0 3px #ffb020; transition: left .25s, top .25s, width .25s, height .25s; pointer-events: none; }
.tour-pop { position: fixed; width: min(340px, calc(100vw - 24px)); background: #fff; color: #111; border-radius: 22px; padding: 18px 20px 16px; box-shadow: 0 24px 60px rgba(16,17,20,.4); pointer-events: auto; display: flex; flex-direction: column; gap: 6px; transition: left .25s, top .25s; }
.tour-n { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8b909a; }
.tour-t { margin: 0; font-size: 19px; }
.tour-x { margin: 0; color: #4a505b; line-height: 1.5; font-size: 14.5px; }
.tour-b { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.tour-sp { flex: 1; }
.tour-b .btn { padding: 0 18px; height: 38px; }
.tour-b .chip { height: 38px; padding: 0 16px; }
.demo-pw { background: #f1f2f4; border-radius: 6px; padding: 1px 6px; font-size: 12.5px; user-select: all; }

/* Welcome window and the tour card (picture + Start) */
dialog.dlg-welcome { width: min(600px, calc(100vw - 24px)); }
.dlg-welcome .wd { padding: 22px 22px 20px; display: flex; flex-direction: column; gap: 12px; }
.dlg-welcome img, .tour-card img { width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--line, #e2e5ea); display: block; }
.dlg-welcome h3 { margin: 4px 0 0; font-size: 22px; }
.dlg-welcome p { margin: 0; color: #5b616c; line-height: 1.5; }
.tour-card { display: grid; grid-template-columns: minmax(240px, 380px) 1fr; gap: 22px; align-items: center; margin: 0 0 16px; }
.tour-card h3 { margin: 0 0 6px; font-size: 20px; }
.tour-card p { margin: 0 0 14px; color: #5b616c; line-height: 1.5; }
@media (max-width: 760px) { .tour-card { grid-template-columns: 1fr; } }
.tour-prog { height: 4px; border-radius: 4px; background: #eceef2; overflow: hidden; margin: 2px 0 6px; }
.tour-prog i { display: block; height: 100%; background: var(--blue, #1f6bff); border-radius: 4px; transition: width .25s; }
.tour-b { flex-wrap: wrap; }
.tour-b [data-a=section] { color: #5b616c; }
.tour-pop { max-height: calc(100vh - 24px); overflow: auto; }
.tour-pop { width: min(410px, calc(100vw - 24px)); }
.tour-b { flex-wrap: nowrap; gap: 6px; }
.tour-b .chip { height: 34px; padding: 0 12px; font-size: 12.5px; white-space: nowrap; }
.tour-b .btn { height: 36px; padding: 0 18px; white-space: nowrap; }
@media (max-width: 460px) { .tour-b { flex-wrap: wrap; } }

/* Tour: exit cross and section links */
.tour-pop { position: fixed; }
.tour-x-btn { position: absolute; top: 10px; right: 12px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: #f1f2f4; color: #5b616c; font-size: 20px; line-height: 1; cursor: pointer; }
.tour-x-btn:hover { background: #e2e5ea; color: #111; }
.tour-s { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; padding-top: 8px; border-top: 1px solid #eceef2; }
.tour-s button { border: 0; background: none; padding: 2px 0; font: inherit; font-size: 12.5px; color: #5b616c; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.tour-s button:hover { color: var(--blue, #1f6bff); }
.tour-n { padding-right: 34px; }

/* Select fields in the windows look like the other fields */
dialog.dlg select { padding: 13px 15px; border: 1px solid #e2e5ea; background: #f4f5f7; border-radius: 14px; font: inherit; font-size: 15px; color: inherit; width: 100%; }
dialog.dlg select:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 4px rgba(31,107,255,.14); }

/* Selects in the windows: the same look as the text fields (own arrow, regular weight) */
dialog.dlg select { -webkit-appearance: none; appearance: none; font-weight: 400; line-height: 1.3; padding: 13px 40px 13px 15px; cursor: pointer;
  background: #f4f5f7 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235b616c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>") no-repeat right 15px center / 14px; }
dialog.dlg select:focus { background-color: #fff; }
dialog.dlg select option { font-weight: 400; }
dialog.dlg [hidden] { display: none !important; }
