/* Newsbetter house style, matched to newsbetter-timer.netlify.app */
:root {
  --bg: #f5f4f1;
  --surface: #ffffff;
  --ink: #16151a;
  --muted: #6b6970;
  --line: #e4e2dd;
  --brand: #16151a;
  --brand-ink: #ffffff;
  --accent: #3b5bff;
  --ok: #1a7f4b;
  --ok-bg: #e5f4ec;
  --off: #8a8790;
  --off-bg: #efeeeb;
  --err: #b42318;
  --err-bg: #fdecea;
  --warn: #8a5a00;
  --warn-bg: #fff4d6;
  --field: #ffffff;
  --placeholder: #a9a6ad;
  --shadow: rgba(22, 21, 26, .08);
  --radius: 14px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

/* Dark mode: follows the computer's setting, unless someone picks light or dark with the toggle */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141317; --surface: #1d1c21; --ink: #ecebee; --muted: #a09da6; --line: #302e35;
    --brand: #ecebee; --brand-ink: #16151a; --accent: #7b91ff;
    --ok: #5fd197; --ok-bg: #173527; --off: #8a8790; --off-bg: #26252b;
    --err: #ff8a7a; --err-bg: #3a1d1a; --warn: #f2c66b; --warn-bg: #3a2f14;
    --field: #17161a; --placeholder: #6f6c75; --shadow: rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141317; --surface: #1d1c21; --ink: #ecebee; --muted: #a09da6; --line: #302e35;
  --brand: #ecebee; --brand-ink: #16151a; --accent: #7b91ff;
  --ok: #5fd197; --ok-bg: #173527; --off: #8a8790; --off-bg: #26252b;
  --err: #ff8a7a; --err-bg: #3a1d1a; --warn: #f2c66b; --warn-bg: #3a2f14;
  --field: #17161a; --placeholder: #6f6c75; --shadow: rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 28px 80px; min-width: 0; width: 100%; }
.auth-wrap { max-width: 380px; margin: 12vh auto 0; padding: 0 20px; }

/* Header with logo, same as the timer dashboard */
header { display: flex; align-items: center; justify-content: space-between; padding: 22px 0; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -0.3px; text-decoration: none; }
.logo .mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 15px; }
.tool { color: var(--muted); font-weight: 500; }

h1 { font-size: 30px; letter-spacing: -0.8px; margin: 18px 0 6px; }
h2 { font-size: 18px; letter-spacing: -0.2px; margin: 0 0 4px; }
.subtitle, .lede { color: var(--muted); margin: 0 0 26px; max-width: 560px; }

.topbar { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.topbar .who { color: var(--muted); font-size: 13.5px; }

/* Tabs as a segmented control */
.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  background: var(--off-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.tab {
  padding: 8px 16px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  border-radius: 9px;
  transition: background .15s, color .15s;
  user-select: none;
}
.tab:hover { color: var(--ink); }
.tab.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px var(--shadow); }

.pane { display: none; }
.pane.active { display: block; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 14px;
}

/* Form fields */
label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  margin: 18px 0 6px;
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="email"],
input[type="datetime-local"],
select,
textarea {
  font: inherit;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  width: 100%;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
::placeholder { color: var(--placeholder); }

.hint { color: var(--muted); font-size: 12.5px; margin-top: 6px; }

/* Buttons */
button {
  white-space: nowrap;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  transition: opacity .15s, background .15s;
}
button:disabled { opacity: .5; cursor: progress; }

.btn-primary {
  background: var(--brand);
  color: var(--brand-ink);
  padding: 11px 18px;
  margin-top: 22px;
}
.btn-primary:hover { opacity: .88; }

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 10px 16px;
  font-weight: 500;
}
.btn-secondary:hover { background: var(--bg); }

.btn-danger {
  background: transparent;
  color: var(--err);
  border: 1px solid var(--line);
  padding: 7px 12px;
  font-weight: 500;
  font-size: 13.5px;
}
.btn-danger:hover { background: var(--err-bg); }

.btn-small { padding: 7px 12px; font-size: 13.5px; margin: 6px 0 0 6px; width: auto; }

/* Messages */
.error-msg { color: var(--err); font-size: 13.5px; margin-top: 10px; min-height: 1.2em; }
.error-msg:empty { min-height: 0; margin: 0; }

.status-msg {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin-top: 16px;
}
.status-msg.ok { background: var(--ok-bg); color: var(--ok); }
.status-msg.err { background: var(--err-bg); color: var(--err); }

a.link { color: var(--accent); font-weight: 500; text-decoration: none; }
a.link:hover { text-decoration: underline; }

/* Clients table */
table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 10px; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
td:first-child { font-weight: 600; }
#clientsTable select { width: auto; max-width: 260px; padding: 7px 10px; }

/* Sections list */
.section-row {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 1.4fr;
  gap: 12px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.section-row:first-child { padding-top: 8px; }
.section-row:has(> .hint) .name { padding-top: 4px; }
.section-row:has(> .hint) { align-items: start; }
.section-row .name { font-size: 14px; font-weight: 600; padding-top: 37px; }
.section-row .name + .hint { margin-top: 0; padding-top: 4px; }

.row-inline { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }

@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .tabs { display: flex; overflow-x: auto; }
  .section-row { grid-template-columns: 1fr; align-items: stretch; }
  .section-row .name { padding-top: 0; }
  .section-row .hint[style] { grid-column: auto !important; }
}

/* ---------- How it works ---------- */
.howto { padding: 0; overflow: hidden; }
.howto summary { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; cursor: pointer; }
.howto summary::-webkit-details-marker { display: none; }
.howto summary h2 { margin: 0; }
.howto-toggle { color: var(--muted); font-size: 13.5px; font-weight: 500; }
.howto-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 0 24px 24px; }
.howto-step { display: flex; flex-direction: column; gap: 14px; }
.howto-visual { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; height: 178px; position: relative; overflow: hidden; display: grid; place-items: center; }
.howto-text { position: relative; padding-left: 34px; }
.howto-text h3 { font-size: 15px; margin: 0 0 4px; letter-spacing: -0.1px; }
.howto-text p { margin: 0; color: var(--muted); font-size: 13.5px; }
.howto-text b { color: var(--ink); font-weight: 600; }
.step-no { position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-size: 12.5px; font-weight: 700; display: grid; place-items: center; }

/* Step 1: Figma canvas with context menu */
.fx-canvas { position: absolute; inset: 0; background: #e9e8e4; background-image: radial-gradient(#d7d5cf 1px, transparent 1px); background-size: 12px 12px; }
.fx-frame { position: absolute; left: 14px; top: 30px; width: 86px; height: 128px; background: #fff; outline: 2px solid #0d99ff; padding: 8px; display: grid; gap: 6px; align-content: start; }
.fx-frame-label { position: absolute; top: -17px; left: -2px; font-size: 9.5px; color: #0d99ff; font-weight: 600; white-space: nowrap; }
.fx-block { height: 18px; background: #eceae5; border-radius: 3px; }
.fx-block-hero { height: 46px; background: #dcd9d2; }
.fx-block-short { width: 60%; }
.fx-menu { position: absolute; left: 64px; top: 50px; width: 112px; background: #1e1e1e; border-radius: 7px; padding: 4px; box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.fx-item { color: #fff; font-size: 9.5px; padding: 5px 7px; border-radius: 4px; display: flex; justify-content: space-between; white-space: nowrap; }
.fx-item-on { background: #0d99ff; }
.fx-sub { position: absolute; left: 108px; top: 24px; width: 120px; background: #1e1e1e; border-radius: 7px; padding: 4px; box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.fx-cursor { position: absolute; left: 278px; top: 124px; width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 16px solid var(--ink); transform: rotate(-28deg); filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff); }

/* Steps 2 and 3: mini dashboard */
.mini-form { width: calc(100% - 32px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 6px; }
.mini-label { font-size: 9.5px; font-weight: 600; margin-bottom: 3px; }
.mini-input { font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
.mini-input-on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent); color: var(--ink); }
.caret { display: inline-block; width: 1px; height: 11px; background: var(--ink); vertical-align: -2px; margin-left: 1px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.mini-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mini-btn { justify-self: start; font-size: 10px; font-weight: 600; background: var(--brand); color: var(--brand-ink); border-radius: 6px; padding: 6px 10px; margin-top: 4px; }
.mini-btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.mini-sec { display: grid; grid-template-columns: 34px 1fr 1fr; gap: 6px; align-items: center; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.mini-sec span { font-size: 10px; font-weight: 600; }

/* ---------- Klaviyo key permissions ---------- */
.scopes { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 12px; }
.scope { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: var(--surface); }
.scope-name { font-weight: 600; font-size: 14px; flex: 1; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.pill.full { background: var(--ink); color: var(--bg); }
.pill.read { background: var(--off-bg); color: var(--muted); }

.info { position: relative; flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 700; font-style: italic; font-family: Georgia, serif; display: grid; place-items: center; cursor: help; outline: none; transition: background .15s, color .15s; }
.info:hover, .info:focus { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.tip { position: absolute; bottom: calc(100% + 10px); right: -10px; width: 230px; background: var(--ink); color: var(--bg); font: 500 12.5px/1.45 var(--font); font-style: normal; padding: 9px 11px; border-radius: 8px; opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity .15s, transform .15s; z-index: 10; box-shadow: 0 6px 18px var(--shadow); }
.tip::after { content: ""; position: absolute; top: 100%; right: 14px; border: 6px solid transparent; border-top-color: var(--ink); }
.info:hover .tip, .info:focus .tip { opacity: 1; transform: translateY(0); }

/* ---------- Universal footer explainer ---------- */
.explainer { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 14px 0 6px; }
.explainer-title { font-weight: 600; font-size: 13.5px; margin-bottom: 2px; }
.explainer p { margin: 0; color: var(--muted); font-size: 13.5px; }

@media (max-width: 860px) {
  .howto-steps { grid-template-columns: 1fr; }
  .howto-visual { max-width: 340px; width: 100%; }
}

/* Info bubble inside a field label */
label .info { display: inline-grid; vertical-align: -3px; margin-left: 4px; width: 16px; height: 16px; font-size: 10px; }
.info-l .tip { right: auto; left: -10px; }
.info-l .tip::after { right: auto; left: 12px; }

/* Flows tab */
.flow-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.flow-card .flow-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.flow-card .flow-head h2 { margin: 0; }
.flow-card .flow-head label { margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 500; }
.flow-card.off > :not(.flow-head) { opacity: .4; pointer-events: none; }
.flow-card .flow-mode { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 10px 0 4px; }
.flow-card .flow-mode label { margin: 0; display: flex; align-items: center; gap: 6px; font-weight: 500; }
.flow-card .flow-mode label:has(input:disabled) { opacity: .45; }
.flow-card .flow-mode .hint { margin: 0; font-size: 13px; }
/* when updating, the trigger and the steps come from Klaviyo, not from here */
.flow-card.updating .f-trigger, .flow-card.updating .flow-facts, .flow-card.updating .flow-outline-wrap,
.flow-card.updating .e-delay, .flow-card.updating .e-unit, .flow-card.updating .f-filter, .flow-card.updating .f-reentry { opacity: .45; }
.flow-checks { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.flow-checks label { margin: 0; display: flex; align-items: center; gap: 9px; font-weight: 500; font-size: 14px; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--ink); margin: 0; }
input[type="number"] { font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; width: 100%; outline: none; }
.flow-emails { margin-top: 18px; border-top: 1px solid var(--line); }
.flow-email { display: grid; grid-template-columns: 1fr 150px 1.3fr 1.3fr; gap: 10px; align-items: end; padding: 12px 0; border-bottom: 1px solid var(--line); }
.flow-email .ename { font-weight: 600; font-size: 14px; padding-bottom: 11px; overflow: hidden; text-overflow: ellipsis; }
.flow-email .ename small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.flow-email label { margin: 0 0 5px; font-size: 12px; }
.flow-email .delay { display: grid; grid-template-columns: 58px 1fr; gap: 6px; }
.flow-email .delay input, .flow-email .delay select { padding: 11px 8px; }
.flow-email .smart { display: flex; flex-direction: column; align-items: center; gap: 13px; }
.flow-email .smart label { margin: 0; }
.flow-emails.chart .flow-email { grid-template-columns: 1fr 1.3fr 1.3fr; }
.flow-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; margin-top: 16px; font-size: 13px; line-height: 1.5; }
.flow-facts b { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.flow-outline-wrap, .flow-warn { margin-top: 16px; }
.flow-outline-wrap summary, .flow-warn summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.flow-outline { margin: 8px 0 0; padding: 12px 14px; background: var(--soft, rgba(127,127,127,.08)); border-radius: 10px; font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; overflow-x: auto; }
.flow-result { margin-top: 10px; }
@media (max-width: 760px) {
  .flow-grid { grid-template-columns: 1fr; }
  .flow-email, .flow-emails.chart .flow-email { grid-template-columns: 1fr; align-items: stretch; }
  .flow-facts { grid-template-columns: 1fr; }
  .flow-email .ename { padding-bottom: 0; }
  .flow-email .smart { flex-direction: row; align-items: center; }
}

/* Flows tab: How it works visuals */
.fx-section { position: absolute; left: 14px; right: 14px; top: 30px; bottom: 16px; border: 1.5px dashed #9b98a0; border-radius: 6px; background: rgba(255,255,255,.35); display: flex; gap: 10px; padding: 14px 12px 10px; }
.fx-section-label { position: absolute; top: -17px; left: 0; font-size: 9.5px; font-weight: 600; color: #57545c; white-space: nowrap; }
.fx-mini { flex: 1; background: #fff; outline: 1.5px solid #0d99ff; border-radius: 2px; padding: 16px 6px 6px; display: flex; flex-direction: column; gap: 5px; position: relative; }
.fx-mini-label { position: absolute; top: 3px; left: 6px; font-size: 8.5px; font-weight: 600; color: #0d99ff; }
.fx-mini .fx-block-hero { height: 40px; }
.mini-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.mini-chips span { font-size: 9px; font-weight: 600; background: var(--ok-bg); color: var(--ok); border-radius: 99px; padding: 2px 7px; white-space: nowrap; }
.mini-badge { position: absolute; top: 8px; right: 8px; font-size: 9.5px; font-weight: 600; background: var(--ink); color: var(--bg); border-radius: 99px; padding: 3px 8px; }
.mini-badge-draft { background: var(--off-bg); color: var(--muted); border: 1px solid var(--line); }
.flowviz { display: flex; flex-direction: column; align-items: center; padding-top: 4px; }
.fv-node { font-size: 9.5px; font-weight: 600; border-radius: 6px; padding: 5px 10px; background: var(--surface); border: 1px solid var(--line); white-space: nowrap; }
.fv-trigger { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.fv-delay { color: var(--muted); font-weight: 500; }
.fv-email { border-color: var(--accent); }
.fv-line { width: 1.5px; height: 10px; background: #b9b6bd; }
.howto-standards { padding: 0 24px 24px; }
.howto-standards .explainer { margin: 0; }
table.standards { font-size: 13px; margin-top: 10px; background: var(--surface); border-radius: 8px; overflow: hidden; }
table.standards th, table.standards td { padding: 8px 10px; }
table.standards td:first-child { font-weight: 600; }
@media (max-width: 760px) {
  .howto-standards { overflow-x: auto; }
  table.standards { min-width: 620px; }
}
.mini-badge-inline { justify-self: start; font-size: 9.5px; font-weight: 600; background: var(--ink); color: var(--bg); border-radius: 99px; padding: 3px 9px; }

/* Master dashboard shell */
.global-client { display: flex; align-items: center; gap: 10px; }
.global-client label { margin: 0; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.global-client select { width: auto; min-width: 200px; padding: 8px 12px; }

.topnav { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 6px; overflow-x: auto; }
.navtab { padding: 12px 0; color: var(--muted); font-weight: 500; font-size: 14.5px; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.navtab:hover { color: var(--ink); }
.navtab.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }

.section { display: none; }
.section.active { display: block; }

.frame-card { padding: 0; overflow: hidden; }
.frame-bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
#timerFrame { display: block; width: 100%; height: 78vh; border: 0; background: var(--bg); }
#masterTable { margin-top: 18px; }

@media (max-width: 640px) {
  header { flex-wrap: wrap; gap: 12px; }
  .global-client { width: 100%; }
  .global-client select { flex: 1; min-width: 0; }
}

/* Master files */
.row-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 8px; }
.row-head .tabs { margin-bottom: 0; }
.back { font-size: 13.5px; display: inline-block; margin-bottom: 6px; }
.hint-cell { color: var(--muted); font-size: 13.5px; font-weight: 400; }
.mf-steps { padding-left: 20px; margin: 4px 0 14px; color: var(--ink); font-size: 14px; }
.mf-steps li { margin-bottom: 6px; }
#mfText { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.55; min-height: 400px; }
.mf-save { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.mf-save button { width: auto; margin: 0; }
.mf-save .link { margin-left: auto; font-size: 13.5px; }

.md { font-size: 14.5px; line-height: 1.6; max-width: 760px; }
.md h1 { font-size: 22px; margin: 6px 0 10px; }
.md h2 { font-size: 17px; margin: 28px 0 8px; padding-top: 18px; border-top: 1px solid var(--line); }
.md h3 { font-size: 14.5px; margin: 18px 0 6px; }
.md hr { display: none; }
.md ul { padding-left: 20px; margin: 6px 0; }
.md li { margin: 3px 0; }
.md p { margin: 8px 0; }
.md table { font-size: 13.5px; }
.md th, .md td { padding: 8px; }
.md td:first-child { font-weight: 500; }
.md a { color: var(--accent); }
.md img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; }
.md img[alt^="Plugin"] { max-width: 340px; }
.md code { background: var(--off-bg); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
.md .check { background: var(--warn-bg); color: var(--warn); padding: 0 5px; border-radius: 4px; }
.md-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 18px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 6px 0 14px; font-size: 13px; }
.md-meta div { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.md-meta span { color: var(--muted); font-size: 11.5px; text-transform: capitalize; }
@media (max-width: 640px) {
  .row-head { flex-direction: column; }
  .mf-save { flex-wrap: wrap; }
}

/* Home */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .15s; min-height: 170px; }
.tile:hover { border-color: var(--ink); box-shadow: 0 6px 18px var(--shadow); transform: translateY(-1px); }
.tile-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--off-bg); display: grid; place-items: center; margin-bottom: 8px; }
.tile-icon svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tile-title { font-weight: 600; font-size: 16px; }
.tile-text { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.tile-stat { margin-top: auto; padding-top: 10px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.tile-stat:empty { display: none; }

/* Pills */
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.off { background: var(--off-bg); color: var(--muted); }

/* Clients */
details.add-client { padding: 0; }
details.add-client summary { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; cursor: pointer; }
details.add-client summary::-webkit-details-marker { display: none; }
details.add-client summary h2 { margin: 0; }
details.add-client[open] { padding-bottom: 24px; }
details.add-client > :not(summary) { margin-left: 24px; margin-right: 24px; }
details.add-client > .scopes { margin-left: 24px; margin-right: 24px; }
details.add-client > button { width: calc(100% - 48px); }
#clientsTable td { vertical-align: middle; }
#clientsTable .btn-small { margin-top: 0; }

/* Timers */
.editbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--off-bg); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 13.5px; }
.editbar .btn-small { margin: 0; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; margin-top: 16px; }
.check-row input { width: auto; margin-top: 3px; }
.tm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 10px; }
.tm-item { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.tm-item.is-editing { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent); }
.tm-thumb { background: var(--bg); display: grid; place-items: center; padding: 12px; min-height: 80px; border-bottom: 1px solid var(--line); }
.tm-thumb img { max-width: 100%; height: auto; display: block; }
.tm-body { padding: 12px 14px 14px; }
.tm-title { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; }
.tm-title span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tm-btns .btn-small { margin: 0; }
.tm-btns .link { font-size: 13.5px; margin: 0 6px; }
.tm-preview { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: grid; place-items: center; margin: 10px 0 16px; overflow: auto; }
.tm-preview img { max-width: 100%; height: auto; }
.linkrow { display: flex; gap: 8px; }
.linkrow button { width: auto; margin: 0; white-space: nowrap; }
#clientsTable th { white-space: nowrap; }

/* Wiki */
.wiki-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.wiki-bar input { flex: 1; min-width: 0; }
.wiki-bar button { margin: 0; flex: none; }
.wiki-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.wiki-cat { font: inherit; font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.wiki-cat:hover { color: var(--ink); }
.wiki-cat.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.wiki-cat .n { opacity: .7; margin-left: 4px; font-variant-numeric: tabular-nums; }
.wiki-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.wiki-item { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-height: 130px; transition: border-color .15s, box-shadow .15s; }
.wiki-item:hover { border-color: var(--ink); box-shadow: 0 6px 18px var(--shadow); }
.wiki-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wiki-item h3 { margin: 0; font-size: 15.5px; letter-spacing: -0.2px; }
.wiki-item p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wiki-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.wiki-chip { font-size: 11.5px; font-weight: 600; background: var(--off-bg); color: var(--ink); border-radius: 99px; padding: 3px 9px; white-space: nowrap; }
.wiki-video-tag { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--accent); }
.wiki-empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.wiki-empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.wiki-video { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: var(--off-bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 14px 0 6px; }
.wiki-video .btn-primary { margin: 0; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; border-radius: 10px; }
.wiki-video .btn-primary svg { width: 16px; height: 16px; fill: currentColor; }
.wiki-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.wiki-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.wiki-actions button { margin: 0; }
.btn-danger { background: transparent; color: var(--err); border: 1px solid var(--line); padding: 8px 14px; }
.btn-danger:hover { border-color: var(--err); }
.wiki-confirm { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--err-bg); color: var(--err); border-radius: 10px; padding: 10px 14px; margin-top: 12px; font-size: 13.5px; font-weight: 500; }
.wiki-confirm button { margin: 0; }
#wikiBody { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.55; min-height: 320px; }
.wiki-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 640px) {
  .wiki-form-row { grid-template-columns: 1fr; }
  .wiki-bar { flex-wrap: wrap; }
  .wiki-bar button { width: 100%; }
}

/* App layout: grouped sidebar on the left, the page on the right */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 20px 14px 16px; background: var(--surface); border-right: 1px solid var(--line); }
.sidebar .logo { padding: 0 8px; margin-bottom: 18px; }
.side-search { display: flex; align-items: center; gap: 8px; width: 100%; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 14px; text-align: left; }
.side-search:hover { border-color: var(--muted); color: var(--ink); }
.side-search svg, .sidenav svg, .menu-btn svg, .theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-search span { flex: 1; }
.side-search kbd { font: 600 11px var(--font); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; background: var(--surface); }
.sidenav { display: flex; flex-direction: column; gap: 2px; }
.side-group { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 16px 10px 6px; }
.sidenav .navtab { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; margin: 0; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: 14px; text-decoration: none; }
.sidenav .navtab:hover { background: var(--off-bg); color: var(--ink); }
.sidenav .navtab.active { background: var(--off-bg); color: var(--ink); font-weight: 600; }
.sidenav .navtab:focus-visible, .side-search:focus-visible, .theme-toggle:focus-visible, .menu-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle { margin-top: auto; display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; font: inherit; font-size: 14px; font-weight: 500; color: var(--muted); background: transparent; border: 0; border-radius: 9px; text-align: left; }
.theme-toggle:hover { background: var(--off-bg); color: var(--ink); }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}
.pagebar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-height: 64px; padding: 14px 0 0; }
.menu-btn, .mobile-logo { display: none; }
.menu-btn { place-items: center; width: 38px; height: 38px; padding: 0; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.side-scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 40; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .2s ease; padding-top: calc(20px + env(safe-area-inset-top, 0px)); }
  .sidebar.open { transform: none; box-shadow: 0 10px 40px var(--shadow); }
  .menu-btn { display: grid; }
  .mobile-logo { display: flex; margin-right: auto; }
  .pagebar { justify-content: flex-start; flex-wrap: wrap; }
  .wrap { padding: 0 18px 60px; }
}
@media (max-width: 640px) {
  .pagebar .global-client { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* Search window (Cmd K) */
.palette { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .35); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.palette[hidden] { display: none; }
.palette-box { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 60px var(--shadow); overflow: hidden; }
.palette-box input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 18px; font-size: 16px; box-shadow: none !important; background: var(--surface); }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette-list li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; cursor: pointer; font-size: 14px; }
.palette-list li .kind { margin-left: auto; font-size: 12px; color: var(--muted); }
.palette-list li.sel { background: var(--off-bg); }
.palette-list li.empty { color: var(--muted); cursor: default; }
.palette-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
@media (max-width: 640px) { .palette-foot { display: none; } }

/* Figma plugin page */
.toolkit-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.toolkit-head .btn-primary { text-decoration: none; display: inline-block; width: auto; margin: 0; }
.toolkit-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 22px; }
.toolkit-cols h3 { margin: 0 0 8px; font-size: 15px; }
.toolkit-cols ol { margin: 0; padding-left: 20px; line-height: 1.6; font-size: 14px; }
@media (max-width: 760px) { .toolkit-cols { grid-template-columns: 1fr; } }

/* Wiki: drawn visuals ([[visual:name]] in an SOP) */
.wv { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 12px 0; padding: 18px; font-size: 11px; color: #1c1c1f; }
.wv-canvas { background: #e9e8e4; background-image: radial-gradient(#d7d5cf 1px, transparent 1px); background-size: 12px 12px; }
.wv-canvas-plain { background: var(--bg); background-image: none; }
.wv-chart { background: #fff; border-radius: 14px; padding: 14px 16px; display: grid; gap: 8px; }
.wv-kicker { font-size: 8.5px; font-weight: 700; color: #d9788c; letter-spacing: .04em; }
.wv-title { font-size: 15px; font-weight: 700; margin-top: -4px; }
.wv-settings { background: #f7f5f2; border-radius: 8px; padding: 8px 10px; display: grid; gap: 3px; }
.wv-settings div { display: grid; grid-template-columns: 70px 1fr; }
.wv-steps { display: flex; align-items: center; flex-wrap: nowrap; overflow-x: auto; padding: 4px 0; }
.wv-start { background: #1c1c1f; color: #fff; font-weight: 700; border-radius: 99px; padding: 4px 9px; }
.wv-arrow { width: 16px; height: 2px; background: #c7c4c2; flex: none; position: relative; }
.wv-arrow::after { content: ''; position: absolute; right: -2px; top: -3px; border-left: 5px solid #c7c4c2; border-top: 4px solid transparent; border-bottom: 4px solid transparent; }
.wv-split { background: #333338; color: #fff; border-radius: 8px; padding: 6px 9px; font-weight: 600; max-width: 120px; flex: none; }
.wv-split small { display: block; font-size: 7.5px; color: #d9788c; font-weight: 700; }
.wv-rails { display: grid; gap: 8px; border-left: 2px solid #c7c4c2; padding-left: 10px; }
.wv-row { display: flex; align-items: center; }
.wv-lab { border: 1.5px solid #333338; border-radius: 9px; padding: 3px 7px; font-weight: 700; background: #fff; white-space: nowrap; }
.wv-lab small { display: block; font-weight: 400; color: #6b6b72; font-size: 8.5px; }
.wv-delay { background: #ebebed; border-radius: 99px; padding: 4px 8px; font-weight: 600; white-space: nowrap; }
.wv-mail { background: #fcedf0; border: 1.5px solid #d9788c; border-radius: 8px; padding: 5px 8px; font-weight: 700; white-space: nowrap; }
.wv-sec { position: relative; border: 1.5px dashed #9b98a0; border-radius: 8px; background: rgba(255,255,255,.4); padding: 22px 12px 12px; }
.wv-sec-name { position: absolute; top: -18px; left: 0; font-size: 10px; font-weight: 600; color: #57545c; }
.wv-sec-chart { background: #fff; border-radius: 8px; height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 10px; margin-bottom: 12px; }
.wv-sec-chart span { height: 12px; flex: 1; border-radius: 4px; background: #fcedf0; border: 1px solid #d9788c; }
.wv-sec-chart span:first-child { flex: .5; background: #333338; border-color: #333338; }
.wv-sec-cols { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 10px; }
.wv-branch { background: var(--c); color: #fff; font-size: 8.5px; font-weight: 700; border-radius: 4px; padding: 3px 6px; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wv-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wv-card { height: 14px; background: #1e1e1e; border-radius: 3px; margin-bottom: 4px; }
.wv-email { background: #fff; outline: 1.5px solid #0d99ff; padding: 5px; display: grid; gap: 4px; min-height: 70px; align-content: start; }
.wv-email i { display: block; height: 10px; background: #eceae5; border-radius: 2px; }
.wv-email i.h { height: 28px; background: #e6c7cc; }
.wv-plugin { width: 260px; margin: 0 auto; background: #2c2c2c; color: #fff; border-radius: 10px; box-shadow: 0 10px 24px rgba(0,0,0,.25); overflow: hidden; }
.wv-plugin-top { display: flex; justify-content: space-between; padding: 8px 10px; font-weight: 600; border-bottom: 1px solid #444; }
.wv-x { color: #aaa; }
.wv-tabs { display: flex; gap: 12px; padding: 8px 10px 0; color: #aaa; font-weight: 600; }
.wv-tabs .on { color: #fff; border-bottom: 2px solid #d9788c; padding-bottom: 5px; }
.wv-btns { display: flex; gap: 6px; padding: 10px; }
.wv-btn { border: 1px solid #555; border-radius: 6px; padding: 4px 9px; font-weight: 600; }
.wv-btn-dark { background: #d9788c; border-color: #d9788c; }
.wv-res { margin: 0 10px 10px; background: #383838; border-radius: 7px; padding: 7px 8px; display: grid; gap: 5px; }
.wv-item { display: flex; gap: 6px; align-items: center; color: #ddd; font-size: 10px; }
.wv-item.ok { color: #7fd18b; font-weight: 600; }
.wv-tag { font-size: 8.5px; font-weight: 700; border-radius: 4px; padding: 1px 5px; flex: none; }
.wv-tag.fix { background: #1e5aa8; } .wv-tag.check { background: #9a6b12; } .wv-tag.problem { background: #a33a3a; }
.wv-flowcard { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 9px; max-width: 420px; margin: 0 auto; }
.wv-fc-head { display: flex; justify-content: space-between; font-size: 12.5px; }
.wv-check { font-size: 10px; color: var(--muted); }
.wv-fc-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
.wv-fc-grid small { display: block; font-weight: 600; font-size: 9.5px; margin-bottom: 3px; }
.wv-fc-grid span { display: block; border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; color: var(--muted); }
.wv-fc-steps { background: var(--off-bg); border-radius: 8px; padding: 7px 9px; font-family: ui-monospace, Menlo, monospace; font-size: 10px; line-height: 1.6; color: var(--ink); }
.wv-fc-foot { display: flex; justify-content: space-between; align-items: center; }
.wv-build { background: var(--brand); color: var(--brand-ink); font-weight: 600; border-radius: 7px; padding: 6px 11px; }
.wv-draft { font-size: 9.5px; font-weight: 600; border: 1px solid var(--line); border-radius: 99px; padding: 3px 8px; color: var(--muted); }
@media (max-width: 760px) { .wv-sec-cols { grid-template-columns: 1fr 1fr; } .wv-col-2 { grid-column: span 2; order: -1; } }

/* Flows How it works: mini flowchart */
.fc-sec { flex-direction: column; gap: 8px; }
.fc-chart { background: #fff; border-radius: 6px; padding: 6px 8px; }
.fc-kicker { font-size: 7px; font-weight: 700; color: #d9788c; margin-bottom: 4px; }
.fc-row { display: flex; align-items: center; font-size: 8px; font-weight: 600; color: #1c1c1f; }
.fc-row > i { width: 8px; height: 1.5px; background: #c7c4c2; flex: none; }
.fc-start { background: #1c1c1f; color: #fff; border-radius: 99px; padding: 2px 5px; }
.fc-split { background: #333338; color: #fff; border-radius: 4px; padding: 3px 5px; }
.fc-rails { display: grid; gap: 3px; border-left: 1.5px solid #c7c4c2; padding-left: 5px; }
.fc-line { display: flex; gap: 4px; align-items: center; }
.fc-lab { border: 1px solid #333338; border-radius: 4px; padding: 0 4px; }
.fc-wait { background: #ebebed; border-radius: 99px; padding: 0 5px; font-weight: 500; }
.fc-mail { background: #fcedf0; border: 1px solid #d9788c; border-radius: 4px; padding: 0 5px; }
.fc-mails { display: flex; gap: 8px; flex: 1; }
.fc-mails .fx-mini { padding-top: 14px; }
.fc-mails .fx-block-hero { height: 22px; }
.fv-fork { display: flex; gap: 8px; margin-top: 6px; }

/* Popups tab */
.pp-row { cursor: pointer; }
.pp-row:hover b { text-decoration: underline; }
.pp-install { padding: 0 24px 20px; }
.pp-install .linkrow { margin-top: 8px; }
.pp-code { font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; margin-top: 8px; white-space: pre; }
.pp-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 18px; }
.pp-bar .back { margin: 0 8px 0 0; }
.pp-bar #ppName { flex: 1; min-width: 180px; font-weight: 600; }
.pp-bar select { width: auto; }
.pp-bar .btn-primary { width: auto; padding: 11px 20px; }
.pp-bar .btn-danger { margin: 0; }
.pp-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 14px; align-items: start; }
.pp-group { padding: 0 22px 22px; }
.pp-group:not([open]) { padding-bottom: 0; }
.pp-group > summary { margin: 0 -22px; padding: 18px 22px; font-weight: 600; font-size: 15px; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.pp-group > summary::after { content: "+"; color: var(--muted); font-weight: 500; }
.pp-group[open] > summary::after { content: "−"; }
.pp-group > summary::-webkit-details-marker { display: none; }
.pp-group > label:first-of-type { margin-top: 0; }
.pp-sub { font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
.pp-group > .pp-sub:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.pp-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.pp-colors label { display: flex; flex-direction: column; gap: 6px; }
.pp-colors input[type="color"] { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); padding: 3px; cursor: pointer; }
input[type="number"] { font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; width: 100%; outline: none; }
.pp-range { display: flex; align-items: center; gap: 12px; }
.pp-range input { flex: 1; accent-color: var(--brand); }
.pp-size-row { display: grid; grid-template-columns: 62px 1fr; align-items: center; gap: 8px; margin: 2px 0; }
.pp-size-row span { font-size: 13px; opacity: .75; }
.pp-size-row b { min-width: 118px; font-size: 13px; font-weight: 600; }
.pp-preview-col { position: sticky; top: 16px; }
.pp-preview-bar { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.pp-preview-bar select { width: auto; }
.pp-seg { display: inline-flex; background: var(--off-bg); border-radius: 10px; padding: 3px; }
.pp-seg button { background: transparent; color: var(--muted); padding: 7px 14px; border-radius: 8px; font-size: 13.5px; }
.pp-seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px var(--shadow); }
.pp-frame-wrap { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; display: flex; justify-content: center; }
.pp-frame-wrap iframe { border: 0; transform-origin: top left; position: absolute; top: 0; left: 0; background: #fff; }
.pp-table-wrap { overflow-x: auto; margin: 6px 0 4px; }
.pp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pp-table th { text-align: right; font-size: 11.5px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.pp-table td { text-align: right; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pp-table th:first-child, .pp-table td:first-child { text-align: left; }
.pp-verdict { font-size: 13.5px; padding-left: 18px; margin: 12px 0; }
.pp-verdict li { margin-bottom: 4px; }
/* Popup editor: tabs, screens and the layout of a screen */
.pp-edit { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
.pp-pane .pp-colors { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pp-tabs { display: flex; gap: 2px; margin-bottom: 10px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.pp-tabs button { position: relative; background: transparent; color: var(--muted); padding: 10px 14px; border-radius: 0; font-size: 14px; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.pp-tabs button:hover { color: var(--ink); }
.pp-tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }
.pp-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--err); margin-left: 6px; vertical-align: 2px; }
.pp-pane { padding: 20px 22px 22px; }
.pp-pane > label:first-child, .pp-pane .pp-design-top + .pp-sub { margin-top: 0; }
.pp-pane .pp-sub { border-top: 0; padding-top: 0; margin-top: 22px; }
.pp-pane .pp-note { display: block; margin: 0 0 8px; }
.pp-design-top { display: flex; align-items: center; gap: 12px; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.pp-design-top .btn-small { margin: 0; flex: none; }
.pp-design-top .hint { margin: 0; }
.pp-screens { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.pp-screens button { display: inline-flex; align-items: center; gap: 7px; background: var(--off-bg); color: var(--ink); padding: 7px 12px 7px 8px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid transparent; }
.pp-screens button i { font-style: normal; display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 11px; }
.pp-screens button.on { background: var(--brand); color: var(--brand-ink, #fff); }
.pp-screens button.on i { background: rgba(255, 255, 255, .2); color: inherit; }
.pp-screens button.off:not(.on) { background: transparent; border-color: var(--line); color: var(--muted); }
.pp-switch { padding: 12px 14px; background: var(--off-bg); border-radius: 10px; margin: 18px 0 6px; }
.pp-layout-box { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.pp-layout-box .pp-sub { margin-top: 0; }
.pp-layout { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; }
.pp-lrow { display: flex; align-items: center; gap: 10px; padding: 9px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 13.5px; }
.pp-lrow.muted .pp-lname { color: var(--muted); }
.pp-lname em { font-style: normal; color: var(--muted); font-size: 12px; margin-left: 4px; }
.pp-lrow.own { background: var(--off-bg); align-items: flex-start; }
.pp-lrow.dragging { opacity: .5; border-style: dashed; }
.pp-grip { flex: none; width: 18px; height: 22px; display: grid; place-items: center; cursor: grab; color: var(--muted); }
.pp-grip svg { width: 8px; height: 13px; fill: currentColor; }
.pp-kind { flex: none; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding-top: 4px; width: 70px; }
.pp-lrow .pp-blk { flex: 1; min-width: 0; margin: 0; padding: 7px 10px; font-size: 13.5px; }
.pp-lrow textarea.pp-blk { resize: vertical; }
.pp-del { flex: none; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; padding: 4px 6px; }
.pp-del:hover { color: var(--err); }
.pp-layout-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pp-layout-add .btn-small { margin: 0; }
.pp-layout-add .link { margin-left: auto; font-size: 13px; background: transparent; padding: 6px 4px; color: var(--muted); text-decoration: underline; font-weight: 500; }
.pp-preview-bar .hint { align-self: center; }

@media (max-width: 900px) {
  .pp-edit { grid-template-columns: 1fr; }
  .pp-preview-col { position: static; order: -1; }
  .pp-colors { grid-template-columns: repeat(2, 1fr); }
}

/* Popup analytics */
#ppAna { --pa-s1: #2a78d6; --pa-s2: #eb6834; --pa-s3: #1baf7a; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) #ppAna { --pa-s1: #3987e5; --pa-s2: #d95926; --pa-s3: #199e70; } }
:root[data-theme="dark"] #ppAna { --pa-s1: #3987e5; --pa-s2: #d95926; --pa-s3: #199e70; }
#ppAna.pp-loading .pp-kpis, #ppAna.pp-loading .pp-chart { opacity: .45; transition: opacity .15s; }
.pp-row-end { display: flex; align-items: center; gap: 10px; }
.pp-row-end .btn-small { margin: 0; }
.pp-seg button:disabled { opacity: .45; cursor: not-allowed; }
.pp-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.pp-custom { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; }
.pp-custom input { width: auto; padding: 7px 10px; font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 10px; }
.pp-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.pp-kpi { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; color: var(--ink); white-space: normal; font-weight: 400; }
.pp-kpi:hover { border-color: var(--muted); }
.pp-kpi.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.pp-kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.pp-kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.pp-kpi-delta { font-size: 12px; color: var(--muted); }
.pp-kpi-delta.up::first-letter { color: var(--ok); }
.pp-kpi-delta.down::first-letter { color: var(--err); }
.pp-kpi-sub { font-size: 12px; color: var(--muted); margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--line); }
.pp-chart-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.pp-smooth { margin: 0; display: flex; align-items: center; gap: 7px; font-weight: 500; font-size: 13.5px; color: var(--muted); }
.pp-metrics { flex-wrap: wrap; margin-bottom: 10px; }
.pp-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); min-height: 4px; margin-bottom: 4px; }
.pp-legend-item { display: inline-flex; align-items: center; gap: 7px; }
.pp-legend-item i, .pa-tip-row i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.pp-chart { position: relative; width: 100%; }
.pp-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.pa-grid { stroke: var(--line); stroke-width: 1; }
.pa-axis { fill: var(--muted); font-size: 11.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.pa-end { fill: var(--ink); font-size: 12px; font-weight: 600; font-family: var(--font); font-variant-numeric: tabular-nums; }
.pa-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pa-cross { stroke: var(--muted); stroke-width: 1; }
.pa-dot { stroke: var(--surface); stroke-width: 2; }
.pa-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; box-shadow: 0 6px 18px var(--shadow); font-size: 12.5px; min-width: 160px; z-index: 2; }
.pa-tip-date { color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.pa-tip-row { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.pa-tip-row b { font-variant-numeric: tabular-nums; }
.pa-tip-row span { color: var(--muted); }
.pa-empty { position: absolute; inset: 0 0 30px 56px; display: grid; place-items: center; color: var(--muted); font-size: 13.5px; pointer-events: none; }
.pp-tableview { margin-top: 12px; }
.pp-tableview summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.pp-tableview .pp-table-wrap { max-height: 320px; overflow: auto; }
@media (max-width: 900px) { .pp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.pp-answers { display: grid; gap: 8px; }
.pp-answers-head, .pp-answer { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; }
.pp-answers-head span { font-size: 12px; font-weight: 600; color: var(--muted); }
@media (max-width: 600px) { .pp-answers-head { display: none; } .pp-answer { grid-template-columns: 1fr; padding-bottom: 8px; border-bottom: 1px solid var(--line); } }

.pp-new { display: flex; gap: 8px; flex-wrap: wrap; }
.pp-new .btn-small { margin: 0; }

/* Popup builder: full screen, Klaviyo style (rail, panel, canvas with desktop and mobile) */
body.pb-open { overflow: hidden; }
.pp-builder { position: fixed; inset: 0; z-index: 55; display: flex; flex-direction: column; background: var(--bg); --pb-blue: #2f6bff; --pb-blue-bg: #eaf0ff; --pb-blue-ink: #1d3fae; }
:root[data-theme="dark"] .pp-builder { --pb-blue-bg: #1c2747; --pb-blue-ink: #b9c9ff; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .pp-builder { --pb-blue-bg: #1c2747; --pb-blue-ink: #b9c9ff; } }
.pb-top { flex: none; display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.pb-back { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--ink); }
.pb-back:hover { background: var(--off-bg); }
.pb-back svg, .pb-rail svg, .pb-el-back svg, .pb-dev svg, .pb-dev-label svg, .pb-tile svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.pb-back svg { width: 20px; height: 20px; }
.pb-top #ppName { width: 260px; font-weight: 600; border-color: transparent; background: transparent; padding: 8px 10px; }
.pb-top #ppName:hover, .pb-top #ppName:focus { border-color: var(--line); background: var(--field); }
.pb-top select { width: auto; padding: 7px 30px 7px 10px; font-size: 13.5px; }
.pb-top .btn-primary { width: auto; padding: 10px 22px; margin: 0; }
.pb-top .btn-danger { margin: 0; }
.pb-grow { flex: 1; }
.pb-top #ppStatusMsg .status-msg { margin: 0; padding: 7px 12px; font-size: 13px; }
.pp-builder .pb-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 72px 330px minmax(0, 1fr); gap: 0; align-items: stretch; overflow: hidden; }
.pb-rail { display: flex; flex-direction: column; gap: 4px; padding: 10px 6px; background: var(--surface); border-right: 1px solid var(--line); }
.pb-rail button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 2px 7px; border-radius: 10px; background: transparent; color: var(--muted); font-size: 10.5px; font-weight: 600; }
.pb-rail button svg { width: 22px; height: 22px; }
.pb-rail button:hover { color: var(--ink); background: var(--off-bg); }
.pb-rail button.on { color: var(--pb-blue-ink); background: var(--pb-blue-bg); }
.pb-rail .pp-dot { position: absolute; top: 7px; right: 14px; margin: 0; }
.pb-panel { overflow-y: auto; padding: 20px 20px 48px; background: var(--surface); border-right: 1px solid var(--line); }
.pb-panel .pp-pane { padding: 0; }
.pb-title { font-weight: 700; font-size: 15px; margin: 0 0 4px; color: var(--ink); }
.pb-title-gap { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.pb-hint { margin: 0 0 12px; }
.pb-panel .flow-grid { grid-template-columns: 1fr; gap: 0; }
.pb-panel .pp-colors { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pb-panel .pp-design-top { flex-direction: column; align-items: stretch; gap: 8px; margin-top: 10px; }
.pb-panel .pp-sub { margin-top: 24px; }
.pb-panel .pp-answers-head, .pb-panel .pp-answer { grid-template-columns: 1.2fr 1fr .8fr; }
.pb-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pb-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 4px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 12.5px; font-weight: 500; cursor: grab; box-shadow: 0 1px 2px var(--shadow); }
.pb-tile:hover { border-color: var(--muted); }
.pb-tile:active { cursor: grabbing; }
.pb-tile svg { width: 22px; height: 22px; }
.pb-tile-grip { position: absolute; top: 5px; left: 50%; transform: translateX(-50%); width: 14px; height: 5px; background: radial-gradient(circle, var(--muted) 1px, transparent 1.4px) 0 0 / 5px 5px; opacity: .6; }
.pb-link { display: inline-block; margin-top: 4px; background: transparent; color: var(--muted); padding: 4px 0; text-decoration: underline; font-size: 13px; font-weight: 500; }
.pp-lrow { cursor: pointer; }
.pp-lrow:hover { border-color: var(--muted); }
.pp-lrow.sel { border-color: var(--pb-blue, #2f6bff); box-shadow: inset 0 0 0 1px var(--pb-blue, #2f6bff); }
.pp-lrow.own { background: var(--surface); }
.pp-lrow.own .pp-lname { font-weight: 600; }
.pp-lname em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-el-head { display: flex; align-items: center; gap: 6px; margin: -4px 0 12px -6px; }
.pb-el-head .pb-title { margin: 0; }
.pb-el-back { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: transparent; color: var(--ink); padding: 0; }
.pb-el-back:hover { background: var(--off-bg); }
.pb-el-back svg { width: 18px; height: 18px; }
#ppElBody .fld:first-child label, #ppElBody > label:first-child { margin-top: 0; }
.pb-el-foot { margin-top: 18px; }
.pb-el-foot .btn-small { margin: 0; }
.pb-canvas { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pb-stepbar { flex: none; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px 8px; }
.pb-steps { display: flex; align-items: center; gap: 6px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 3px var(--shadow); flex-wrap: wrap; }
.pb-steps button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; }
.pb-steps button:hover { border-color: var(--muted); }
.pb-steps button.on { background: var(--pb-blue-bg); border-color: var(--pb-blue); color: var(--pb-blue-ink); }
.pb-steps button.off { border-style: dashed; color: var(--muted); }
.pb-steps button em { font-style: normal; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 2px 5px; border-radius: 4px; background: var(--off-bg); color: var(--muted); }
.pb-arrow { color: var(--muted); font-size: 16px; }
.pb-stepbar .pp-seg { box-shadow: 0 1px 3px var(--shadow); background: var(--surface); border: 1px solid var(--line); }
.pb-stepbar .pp-seg button.on { background: var(--off-bg); box-shadow: none; }
.pb-dev button { padding: 6px 10px; display: grid; place-items: center; }
.pb-dev svg { width: 19px; height: 19px; }
.pb-banner { flex: none; display: flex; align-items: center; justify-content: center; gap: 12px; margin: 2px auto 4px; padding: 7px 8px 7px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pb-banner .btn-small { margin: 0; }
.pb-banner .link { background: transparent; color: var(--muted); text-decoration: underline; padding: 4px 6px; font-size: 13px; }
.pb-stage { flex: 1; min-height: 0; display: flex; align-items: flex-start; justify-content: center; gap: 48px; padding: 14px 24px 0; overflow: hidden; }
.pb-device { display: flex; flex-direction: column; gap: 8px; }
.pb-dev-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pb-dev-label svg { width: 15px; height: 15px; }
.pb-device .pp-frame-wrap { border-radius: 6px; box-shadow: 0 1px 4px var(--shadow); }
.pb-stage.dropping .pp-frame-wrap { outline: 2px dashed var(--pb-blue); outline-offset: 3px; }
.pb-foot { flex: none; text-align: center; margin: 8px 16px 12px; }
.pb-ana { flex: 1; overflow-y: auto; padding: 24px clamp(16px, 4vw, 48px) 48px; }
@media (max-width: 1100px) {
  .pp-builder .pb-main { grid-template-columns: 64px 290px minmax(0, 1fr); }
  .pb-top #ppName { width: 170px; }
}
@media (max-width: 760px) {
  .pp-builder .pb-main { grid-template-columns: 56px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 46vh; }
  .pb-rail { grid-row: 1 / 3; }
  .pb-canvas { grid-column: 2; grid-row: 1; }
  .pb-panel { grid-column: 2; grid-row: 2; border-right: 0; border-top: 1px solid var(--line); }
  .pb-top { gap: 6px; padding: 0 10px; }
  .pb-top #ppName { width: 120px; }
  .pb-top #ppMode, .pb-foot { display: none; }
}

.pb-panel label { margin-top: 14px; font-size: 13px; }
.pb-panel input[type="text"], .pb-panel input[type="url"], .pb-panel input[type="number"], .pb-panel select, .pb-panel textarea { padding: 9px 11px; font-size: 14px; border-radius: 9px; }
.pb-panel .pp-colors input[type="color"] { height: 34px; }
.pb-panel .check-row, .pb-panel .flow-checks label { font-size: 13.5px; }

/* Builder: uploads, font picker, sign up properties */
.pp-upload { display: flex; gap: 8px; align-items: center; }
.pp-upload input[type="url"] { flex: 1; min-width: 0; }
.pp-upload .btn-small { margin: 0; flex: none; }
.pp-font-row { position: relative; display: flex; gap: 8px; align-items: center; }
.pp-font-row input[type="text"] { flex: 1; min-width: 0; }
.pp-font-row .btn-small { margin: 0; flex: none; }
.pp-font-menu { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px var(--shadow); padding: 4px; }
.pp-font-opt { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 13.5px; }
.pp-font-opt em { font-style: normal; color: var(--muted); font-size: 12px; white-space: nowrap; }
.pp-font-opt:hover, .pp-font-opt.on { background: var(--off-bg); }
.pp-font-none { padding: 8px 10px; font-size: 12.5px; color: var(--muted); }
.pp-font-tag { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.pp-font-tag:empty { display: none; }
.pp-props { display: flex; flex-direction: column; gap: 6px; }
.pp-props .pp-answers-head, .pp-prop { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

/* Popup analytics: Klaviyo style tiles, combo chart, reports, A/B results */
.pp-kpi-value { order: 0; }
.pp-bench { align-self: flex-start; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; margin: 4px 0 2px; }
.pp-bench.good { background: #e3edff; color: #1d3fae; }
.pp-bench.great { background: var(--ok-bg); color: var(--ok); }
.pp-bench.low { background: var(--off-bg); color: var(--muted); }
:root[data-theme="dark"] .pp-bench.good { background: #1c2747; color: #b9c9ff; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .pp-bench.good { background: #1c2747; color: #b9c9ff; } }
.pp-legend-item i.line { height: 3px; border-radius: 2px; }
.pa-band { fill: var(--ink); opacity: .05; }
.pp-repby { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); margin: 0; }
.pp-repby select { width: auto; padding: 7px 30px 7px 10px; font-size: 13.5px; }
.pp-report td:first-child { white-space: nowrap; }
#ppGrain { width: auto; padding: 7px 30px 7px 10px; font-size: 13.5px; }
.pp-ab-top { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin: 6px 0 16px; }
.pp-ab-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; font-size: 13.5px; }
.pp-ab-big { font-size: 34px; font-weight: 700; letter-spacing: -.5px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pp-ab-what { font-weight: 600; margin: 4px 0 8px; }
.pp-ab-sig { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--off-bg); color: var(--muted); }
.pp-ab-sig.yes { background: var(--ok-bg); color: var(--ok); }
.pp-ab-k { font-size: 12px; font-weight: 600; color: var(--muted); }
.pp-var { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--off-bg); font-size: 11px; font-weight: 700; margin-right: 4px; }
.pp-trophy { margin-right: 4px; }
@media (max-width: 700px) { .pp-ab-top { grid-template-columns: 1fr; } }
.pp-ab-sub { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); }
.pp-ab-sub b { color: var(--ink); }

/* Builder: match a website */
.pp-brand { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.pp-brand .pp-upload .btn-primary { width: auto; padding: 9px 14px; }
.pp-brand-card { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.pp-brand-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.pp-brand-pal { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.pp-brand-pal .pp-sw { width: 22px; height: 22px; }
.pp-sw { display: inline-block; width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(127,127,127,.35); flex: none; }
.pp-brand-sub { font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); margin: 4px 0 6px; }
.pp-brand-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; }
.pp-brand-row > span:not(.pp-aa):not(.pp-rad) { flex: 1; }
.pp-brand-row code { font-size: 12px; color: var(--muted); text-align: right; }
.pp-brand-row code em { font-style: normal; display: block; font-size: 11px; }
.pp-aa { width: 18px; font-weight: 700; font-size: 12px; text-align: center; }
.pp-rad { width: 18px; height: 14px; border: 1.5px solid var(--ink); flex: none; }
.pp-brand-img img { width: 44px; height: 30px; object-fit: contain; background: var(--off-bg); border-radius: 5px; flex: none; }
.pp-brand-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0 4px; font-size: 13px; }
.pp-brand-checks label { display: flex; align-items: center; gap: 5px; margin: 0; font-weight: 500; }
.pp-brand-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.pp-brand-actions .btn-primary { width: auto; margin: 0; }
.pp-brand-actions .link { background: transparent; padding: 0 2px; text-decoration: underline; color: var(--ink); font-size: 13px; }

/* Popups overview: format cards and popup tiles with a live thumbnail */
.pp-formats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.pp-format { display: flex; flex-direction: column; text-align: left; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); overflow: hidden; cursor: pointer; font-weight: 400; white-space: normal; transition: border-color .15s, box-shadow .15s, transform .15s; }
.pp-format:hover { border-color: var(--muted); box-shadow: 0 8px 24px var(--shadow); transform: translateY(-2px); }
.pp-format:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pp-format-art { display: block; background: var(--off-bg); padding: 18px 22px 0; }
.pp-format-art svg { display: block; width: 100%; height: auto; border-radius: 10px 10px 0 0; box-shadow: 0 -1px 0 var(--line), 0 6px 18px var(--shadow); }
.pp-format-text { display: flex; flex-direction: column; gap: 4px; padding: 16px 20px 18px; font-size: 13.5px; color: var(--muted); }
.pp-format-text b { font-size: 16px; color: var(--ink); }
.pp-format-text em { font-style: normal; font-weight: 600; color: var(--ink); margin-top: 6px; }
.pp-format:hover .pp-format-text em { text-decoration: underline; }
/* the drawings */
.ill-page { fill: #f4f3ef; } .ill-line { fill: #cfcbc2; } .ill-ink { fill: #1d1c21; }
.ill-dim { fill: rgba(20, 20, 25, .38); } .ill-dim2 { fill: rgba(20, 20, 25, .3); }
.ill-win { fill: #fff; } .ill-photo { fill: #e9dfd2; } .ill-sun { fill: #f1c9a0; } .ill-hill { fill: #d9c3a8; }
.ill-foil { fill: #b9bcc2; } .ill-streak { stroke: #d9dbe0; stroke-width: 5; stroke-linecap: round; fill: none; opacity: .8; }
.ill-scratch { stroke: #fff; stroke-width: 15; stroke-linecap: round; fill: none; }
.ill-prize { font: 700 15px system-ui, sans-serif; fill: #2f6bff; }
.ill-coin { fill: #e8b54a; stroke: #c99530; stroke-width: 2; }
.ill-card { fill: #f2f2f2; stroke: #d8d8d8; } .ill-win-card { stroke: #2f6bff; stroke-width: 2; fill: #fff; }
.ill-lift { filter: drop-shadow(0 3px 3px rgba(0,0,0,.18)); }
.ill-cardtx { font: 700 9.5px system-ui, sans-serif; fill: #1d1c21; } .ill-q { font: 700 16px system-ui, sans-serif; fill: #1d1c21; }
.ill-btn { fill: #1d1c21; }
/* tiles */
.pp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pp-tile { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.pp-tile:hover { border-color: var(--muted); box-shadow: 0 6px 18px var(--shadow); }
.pp-tile:hover b { text-decoration: none; }
.pp-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pp-thumb { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #f3f2ef; border-bottom: 1px solid var(--line); }
.pp-thumb iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: top left; pointer-events: none; opacity: 0; transition: opacity .25s; }
.pp-thumb.ready iframe { opacity: 1; }
.pp-thumb-wait { position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.5) 50%, transparent 70%) #ebe9e4; background-size: 200% 100%; animation: pp-shimmer 1.2s infinite; }
.pp-thumb.ready .pp-thumb-wait { display: none; }
@keyframes pp-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .pp-thumb-wait { animation: none; } .pp-format, .pp-format:hover { transform: none; transition: none; } }
.pp-tile-body { padding: 12px 14px 12px; display: flex; flex-direction: column; flex: 1; }
.pp-tile-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pp-tile-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 12px; }
@media (max-width: 700px) { .pp-formats { grid-template-columns: 1fr; } }

/* Builder: remove and put back parts in the layers list */
.pp-lrow .pp-lname { flex: 1; min-width: 0; }
.pp-lrow .pp-del { opacity: .55; }
.pp-lrow:hover .pp-del, .pp-lrow.sel .pp-del { opacity: 1; }
.pp-lrow.removed .pp-lname { text-decoration: line-through; text-decoration-color: var(--muted); }
.pp-lact { flex: none; background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: 7px; padding: 3px 8px; font-size: 12px; font-weight: 600; }
.pp-lact:hover { border-color: var(--muted); }
.ill-scr { font: 700 8.5px system-ui, sans-serif; letter-spacing: .4px; fill: rgba(255,255,255,.92); }

/* Slot machine: format card drawing and the five pictures in the builder */
.pp-formats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1000px) { .pp-formats { grid-template-columns: 1fr; } }
.ill-frame { fill: none; stroke: #c9a227; stroke-width: 2.5; }
.ill-reel { fill: #f2f2f2; stroke: #dedede; }
.ill-pack rect { fill: #b98ad6; } .ill-packtop rect { fill: #8a4fb0; }
.pp-syms { display: flex; flex-direction: column; gap: 8px; }
.pp-sym { display: grid; grid-template-columns: 48px minmax(0, 1fr); grid-template-rows: auto auto; gap: 6px 10px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.pp-sym-thumb { grid-row: 1 / 3; width: 48px; height: 48px; border-radius: 8px; background: var(--off-bg) center / contain no-repeat; border: 1px solid var(--line); }
.pp-sym-thumb.empty { background-image: none; }
.pp-sym-fields { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pp-sym-fields input { margin: 0; }
.pp-sym-win { grid-column: 2; display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12.5px; font-weight: 600; }
.pp-sym:has(input[type="radio"]:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

/* Timers: a folder per client */
.tm-folder { border-top: 1px solid var(--line); }
.tm-folder:first-child { border-top: 0; }
.tm-folder > summary { display: flex; align-items: center; gap: 12px; padding: 14px 0; cursor: pointer; list-style: none; }
.tm-folder > summary::-webkit-details-marker { display: none; }
.tm-folder > summary::before { content: ''; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; opacity: .6; margin-right: 2px; }
.tm-folder[open] > summary::before { transform: rotate(45deg); }
.tm-folder-name { font-weight: 600; }
.tm-folder > .tm-grid { margin: 0 0 18px; }
.tm-move { width: auto; padding: 6px 8px; font-size: 13px; border-radius: 8px; }

/* A file picker that looks like the other buttons */
.file-pick { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-btn { display: inline-flex; align-items: center; margin: 0; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s; }
.file-btn:hover { background: rgba(127, 127, 127, .12); }
.file-input:focus-visible + .file-btn { outline: 2px solid var(--brand); outline-offset: 2px; }
.file-name { font-size: 14px; opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.file-pick.has-file .file-name { opacity: 1; }
