/* wa_dashboard — desktop portal styles */
:root {
  --bg:        #f4f6fa;
  --surface:   #ffffff;
  --ink:       #16202e;
  --ink-soft:  #5c6b80;
  --ink-faint: #93a1b5;
  --line:      #e2e7f0;
  --brand:     #1d6f5c;
  --brand-dk:  #14513f;
  --brand-tint:#e7f3ef;
  --danger:    #b4232b;
  --danger-bg: #fdeceb;
  --ok:        #1d8a4f;
  --radius:    10px;
  --shadow:    0 1px 2px rgba(22,32,46,.06), 0 8px 24px rgba(22,32,46,.07);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  min-width: 1120px;
  font: 15px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.brand-mark {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--brand); color: #fff;
  font-size: 13px; font-weight: 700; letter-spacing: .02em;
}
.brand-text { font-weight: 650; font-size: 16px; letter-spacing: -.01em; }
.brand-lg .brand-mark { width: 40px; height: 40px; border-radius: 10px; font-size: 15px; }
.brand-lg .brand-text { font-size: 19px; color: #fff; }

/* ---------- top bar (app pages) ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner {
  max-width: 1440px; margin: 0 auto; padding: 0 28px;
  height: 60px; display: flex; align-items: center; gap: 36px;
}
.mainnav { display: flex; gap: 4px; margin-right: auto; }
.mainnav a {
  padding: 8px 14px; border-radius: 8px;
  color: var(--ink-soft); font-weight: 500;
}
.mainnav a:hover { background: #f1f4f9; color: var(--ink); }
.mainnav a.active { background: var(--brand-tint); color: var(--brand-dk); font-weight: 600; }

.userbox { display: flex; align-items: center; gap: 10px; }
.avatar {
  display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 50%; background: #dfe6f1; color: var(--ink-soft);
  font-size: 13px; font-weight: 650;
}
.username { font-weight: 550; }
.role {
  padding: 2px 8px; border-radius: 999px; background: #eef1f6;
  color: var(--ink-soft); font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
}
.userbox form { margin: 0 0 0 8px; }

/* ---------- buttons ---------- */
.btn, .btn-ghost {
  font: inherit; cursor: pointer; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 8px 14px; transition: background .12s, border-color .12s;
}
.btn-ghost { padding: 6px 12px; color: var(--ink-soft); font-size: 14px; }
.btn-ghost:hover { background: #f1f4f9; color: var(--ink); }
.btn-primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
  font-weight: 600; padding: 11px 18px;
}
.btn-primary:hover { background: var(--brand-dk); border-color: var(--brand-dk); }
.btn-block { width: 100%; margin-top: 6px; }

/* ---------- page shell ---------- */
.page { max-width: 1440px; margin: 0 auto; padding: 32px 28px 64px; }
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 24px; }
.page-head p { margin: 6px 0 0; color: var(--ink-soft); }
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.placeholder { padding: 72px 32px; text-align: center; }
.placeholder-icon { font-size: 30px; opacity: .5; }
.placeholder h2 { margin: 14px 0 6px; font-size: 17px; }
.placeholder p { margin: 0; color: var(--ink-soft); }

/* ---------- login ---------- */
.login-body { display: block; }
.login-shell { display: grid; grid-template-columns: 460px 1fr; min-height: 100vh; }

.login-aside {
  background: linear-gradient(160deg, var(--brand-dk) 0%, #0d3a2d 100%);
  color: #cfe4dc; padding: 44px 44px 36px;
  display: flex; flex-direction: column;
}
.login-aside h2 {
  margin: 56px 0 24px; font-size: 26px; line-height: 1.3;
  color: #fff; font-weight: 600; max-width: 20ch;
}
.aside-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.aside-points li { padding-left: 18px; position: relative; font-size: 14px; }
.aside-points li::before {
  content: ""; position: absolute; left: 0; top: .55em;
  width: 6px; height: 6px; border-radius: 50%; background: #4fbf9a;
}
.aside-points strong { color: #fff; font-weight: 600; }
.aside-foot { margin: auto 0 0; font-size: 12px; color: #7fa79a; }

.login-main {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px;
}
.login-card {
  width: 100%; max-width: 400px; padding: 36px 34px 30px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow);
}
.login-card h1 { font-size: 22px; }
.login-card .sub { margin: 6px 0 24px; color: var(--ink-soft); font-size: 14px; }

label { display: block; margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
input[type="email"], input[type="password"], input[type="text"] {
  width: 100%; padding: 11px 12px; margin-bottom: 16px;
  font: inherit; color: var(--ink);
  background: #fbfcfe; border: 1px solid var(--line); border-radius: 8px;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
input:focus {
  outline: none; background: #fff;
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29,111,92,.13);
}
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 62px; }
.pw-toggle {
  position: absolute; top: 10px; right: 8px;
  border: 0; background: none; cursor: pointer;
  color: var(--ink-soft); font: inherit; font-size: 13px; padding: 2px 6px; border-radius: 6px;
}
.pw-toggle:hover { background: #f1f4f9; color: var(--ink); }

.alert {
  margin-bottom: 18px; padding: 11px 13px;
  background: var(--danger-bg); border: 1px solid #f3c9c7; border-left: 3px solid var(--danger);
  border-radius: 8px; color: #8c1c22; font-size: 13.5px;
}
.legal { margin: 18px 0 0; font-size: 12px; color: var(--ink-faint); }

/* ---------- error page ---------- */
.centered { display: grid; place-items: center; }
.errorbox { text-align: center; }
.error-code { font-size: 56px; font-weight: 700; color: var(--ink-faint); }
.errorbox p { color: var(--ink-soft); margin: 4px 0 20px; }

/* ---------- monitor: filters ---------- */
.row-between { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.count-chip {
  padding: 7px 14px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line); color: var(--ink-soft); font-size: 13px; white-space: nowrap;
}
.count-chip strong { color: var(--ink); }

.filterbar {
  display: flex; align-items: flex-end; gap: 14px;
  padding: 16px 18px; margin-bottom: 16px;
}
.filterbar .field { display: flex; flex-direction: column; }
.filterbar .field.grow { flex: 1; }
.filterbar label { margin-bottom: 5px; font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.filterbar input, .filterbar select {
  margin: 0; height: 38px; padding: 0 12px;
  font: inherit; color: var(--ink);
  background: #fbfcfe; border: 1px solid var(--line); border-radius: 8px;
}
.filterbar select { min-width: 168px; cursor: pointer; }
.filterbar input:focus, .filterbar select:focus {
  outline: none; background: #fff; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(29,111,92,.13);
}
.filterbar .actions { flex-direction: row; gap: 8px; }
.filterbar .actions .btn { height: 38px; display: inline-flex; align-items: center; }
/* Download sits with the filter controls because it exports exactly what the
   filter matched — the whole result set, not just the visible page. */
.filterbar .actions .btn-download { gap: 6px; text-decoration: none; }
.btn-download::before { content: "\2193"; font-weight: 700; color: var(--brand); }
.btn-download:hover { background: var(--brand-tint); border-color: #cfe3dc; }
.btn-download.disabled {
  opacity: .45; cursor: not-allowed; color: var(--ink-faint);
}
.btn-download.disabled::before { color: var(--ink-faint); }
.btn-download.disabled:hover { background: var(--surface); border-color: var(--line); }

/* ---------- monitor: table ---------- */
.table-panel { overflow: hidden; }
.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.grid thead th {
  position: sticky; top: 0; z-index: 1;
  padding: 11px 14px; text-align: left; white-space: nowrap;
  background: #f7f9fc; border-bottom: 1px solid var(--line);
  font-size: 11.5px; font-weight: 650; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-soft);
}
.grid tbody td { padding: 11px 14px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover td { background: #fafbfd; }
.grid .num { width: 62px; text-align: right; }
.grid .mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.grid .strong { font-weight: 550; }
.grid .muted { color: var(--ink-faint); }
.grid .nowrap { white-space: nowrap; }
.grid tr.empty:hover td { background: transparent; }

.empty-state { padding: 56px 20px; text-align: center; }
.empty-icon { font-size: 26px; opacity: .45; }
.empty-state p { margin: 12px 0 16px; color: var(--ink-soft); }

/* Status badges — labels come from src/lib/flags.js, never from the database. */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent;
}
.badge-neutral { background: #eef1f6; color: #5c6b80; border-color: #e0e5ee; }
.badge-info    { background: #e8f1fd; color: #1b5fa8; border-color: #d3e4f9; }
.badge-ok      { background: #e6f5ec; color: #1a7a45; border-color: #cfeada; }
.badge-bad     { background: #fdeceb; color: #a52029; border-color: #f6d5d3; }
.badge-warn    { background: #fdf3e3; color: #96631a; border-color: #f6e4c4; }

/* ---------- monitor: pagination ---------- */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; margin-top: 16px;
}
.pager-left { display: flex; align-items: center; gap: 16px; }
.pager-info { margin: 0; color: var(--ink-soft); font-size: 13px; white-space: nowrap; }
.perpage { display: flex; align-items: center; gap: 8px; }
.perpage label { margin: 0; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.perpage select {
  height: 30px; padding: 0 8px; cursor: pointer;
  font: inherit; font-size: 13px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
.perpage select:hover { border-color: #d6dde8; }
.perpage select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29,111,92,.13);
}
.pager-info strong { color: var(--ink); font-weight: 600; }
.pager-nav { display: flex; gap: 4px; }
.pg {
  min-width: 34px; height: 34px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink-soft);
  font-size: 13px; font-weight: 550;
}
a.pg:hover { background: #f1f4f9; color: var(--ink); border-color: #d6dde8; }
.pg.current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pg.disabled { opacity: .4; }
.pg.gap { border-color: transparent; background: transparent; }

/* ---------- blast: stepper ---------- */
.stepper {
  list-style: none; display: flex; gap: 8px; margin: 0 0 20px; padding: 0;
}
.stepper li {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 18px 9px 12px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-faint); font-size: 13.5px; font-weight: 550;
}
.stepper li span {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: #eef1f6; color: var(--ink-faint); font-size: 12px; font-weight: 700;
}
.stepper li.current { border-color: var(--brand); color: var(--brand-dk); background: var(--brand-tint); }
.stepper li.current span { background: var(--brand); color: #fff; }
.stepper li.done { color: var(--ink-soft); }
.stepper li.done span { background: #d6e8e1; color: var(--brand-dk); }

/* ---------- blast step 1 ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.upload-panel, .format-panel { padding: 22px; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 42px 20px; margin-bottom: 16px; cursor: pointer;
  border: 1.5px dashed #cfd7e3; border-radius: 10px; background: #fbfcfe;
  text-align: center; transition: border-color .12s, background .12s;
}
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-tint); }
.dropzone.filled { border-style: solid; border-color: var(--brand); background: var(--brand-tint); }
.dropzone strong { font-size: 15px; }
.dz-icon { font-size: 26px; opacity: .6; }
.dz-sub { font-size: 12.5px; color: var(--ink-soft); }
.dropzone input[type="file"] { display: none; }

.format-panel h2 { font-size: 15px; }
.format-sub { margin: 5px 0 14px; color: var(--ink-soft); font-size: 13px; }
.rules { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.rules td { padding: 8px 10px 8px 0; border-bottom: 1px solid #eef1f6; font-size: 12.5px; vertical-align: top; }
.rules tr:last-child td { border-bottom: 0; }
.rules code {
  background: #eef1f6; padding: 2px 6px; border-radius: 5px;
  font-size: 12px; color: var(--ink);
}
.rule-re { color: var(--brand-dk); white-space: nowrap; }
.rule-hint { color: var(--ink-soft); }

/* ---------- blast step 1: validation errors ---------- */
.errors-panel { margin-bottom: 16px; border-color: #f3c9c7; overflow: hidden; }
.errors-head { padding: 16px 18px; background: var(--danger-bg); border-bottom: 1px solid #f3c9c7; }
.errors-head h2 { font-size: 15px; color: #8c1c22; }
.errors-head p { margin: 4px 0 0; font-size: 13px; color: #a1474b; }
.errors-grid .num { width: 96px; text-align: left; }
.rowno {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  background: #fdeceb; color: #a52029; font-size: 12px; font-weight: 650; white-space: nowrap;
}
.prob { display: flex; align-items: baseline; gap: 8px; padding: 2px 0; flex-wrap: wrap; }
.prob code {
  background: #eef1f6; padding: 1px 6px; border-radius: 5px; font-size: 12px;
}
.prob-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  color: #a52029; background: #fdeceb; padding: 1px 6px; border-radius: 5px;
  max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.prob-why { color: var(--ink-soft); font-size: 12.5px; }

/* ---------- blast step 2 ---------- */
.review-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 18px 20px; margin-bottom: 14px;
}
.review-head h2 { font-size: 16px; }
.review-head p { margin: 5px 0 0; color: var(--ink-soft); font-size: 13px; }
.review-grid tbody tr:nth-child(even) td { background: #fcfdfe; }
.review-grid tbody tr:hover td { background: var(--brand-tint); }

/* Sticky so Confirm / Cancel stay reachable while scrolling a long table. */
.actionbar {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin-top: 14px; padding: 14px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 -4px 16px rgba(22,32,46,.07);
}
.actionbar-note { color: var(--ink-soft); font-size: 13px; }
.actionbar-note strong { color: var(--ink); }
.actionbar-buttons { display: flex; gap: 10px; }
.actionbar-buttons .btn { padding: 10px 24px; }

/* ---------- blast step 3 ---------- */
.done-panel { padding: 56px 32px; text-align: center; }
.done-icon {
  width: 52px; height: 52px; margin: 0 auto 16px;
  display: grid; place-items: center; border-radius: 50%;
  background: #e6f5ec; color: #1a7a45; font-size: 26px; font-weight: 700;
}
.done-panel h2 { font-size: 20px; }
.done-panel p { margin: 8px 0 0; color: var(--ink-soft); }
.done-note { font-size: 13px; }
.done-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }

/* ---------- gateway status (monitor) ---------- */
.head-right { display: flex; align-items: center; gap: 10px; }
.gw-chip {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 12.5px; font-weight: 550; color: var(--ink-soft);
}
.gw-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.gw-chip.gw-ok   { color: #1a7a45; background: #e6f5ec; border-color: #cfeada; }
.gw-chip.gw-warn { color: #96631a; background: #fdf3e3; border-color: #f6e4c4; }
.gw-chip.gw-bad  { color: #a52029; background: #fdeceb; border-color: #f6d5d3; }

.gw-banner {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 18px; margin-bottom: 16px;
  border: 1px solid var(--line); border-left-width: 3px; border-radius: var(--radius);
  background: var(--surface);
}
.gw-banner .gw-text { display: flex; flex-direction: column; gap: 2px; margin-right: auto; }
.gw-banner strong { font-size: 14px; }
.gw-banner span { font-size: 13px; }
.gw-banner .gw-time { color: var(--ink-faint); font-size: 12px; white-space: nowrap; }
.gw-banner.gw-warn {
  background: #fdf9f0; border-color: #f6e4c4; border-left-color: #d99a2b; color: #96631a;
}
.gw-banner.gw-bad {
  background: var(--danger-bg); border-color: #f3c9c7; border-left-color: var(--danger); color: #8c1c22;
}
.gw-banner.gw-warn strong, .gw-banner.gw-bad strong { color: inherit; }

/* ---------- last job run (monitor) ---------- */
.job-chip {
  padding: 6px 13px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 12.5px; font-weight: 550; color: var(--ink-soft);
}
.job-chip.job-info { color: #1b5fa8; background: #e8f1fd; border-color: #d3e4f9; }
.job-chip.job-bad  { color: #a52029; background: #fdeceb; border-color: #f6d5d3; }

/* ---------- clickable merchant name ---------- */
.merch-link {
  padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-weight: 550; color: var(--brand-dk);
  text-align: left; text-decoration: underline;
  text-decoration-color: #bcd6cd; text-underline-offset: 3px;
}
.merch-link:hover { color: var(--brand); text-decoration-color: currentColor; }
.merch-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ---------- history modal ---------- */
body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 40px;
  background: rgba(16, 24, 36, .45);
}
.modal-backdrop[hidden] { display: none; }
.modal {
  width: 100%; max-width: 760px; max-height: 82vh;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 12px;
  box-shadow: 0 18px 48px rgba(16, 24, 36, .28);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  padding: 20px 22px; border-bottom: 1px solid var(--line); background: #fbfcfe;
}
.modal-head h2 { font-size: 17px; }
.modal-sub {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin: 7px 0 0; color: var(--ink-soft); font-size: 12.5px;
}
.modal-sub .dot-sep { color: var(--ink-faint); }
.modal-close {
  border: 0; background: none; cursor: pointer; flex: none;
  width: 30px; height: 30px; border-radius: 8px;
  font-size: 22px; line-height: 1; color: var(--ink-faint);
}
.modal-close:hover { background: #eef1f6; color: var(--ink); }
.modal-body { padding: 8px 22px 22px; overflow-y: auto; }
.modal-empty { padding: 34px 0; text-align: center; color: var(--ink-soft); }

/* Newest first, oldest at the bottom. */
.timeline { list-style: none; margin: 0; padding: 14px 0 0; }
.timeline li {
  position: relative; padding: 0 0 18px 22px;
  border-left: 2px solid var(--line);
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid #c3ccda;
}
.timeline li:first-child::before { border-color: var(--brand); background: var(--brand); }
.timeline time {
  display: block; margin-bottom: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; color: var(--ink-faint);
}
.timeline p { margin: 0; font-size: 13.5px; overflow-wrap: anywhere; }

/* ---------- message templates ---------- */
.save-note {
  margin-bottom: 16px; padding: 11px 15px; border-radius: var(--radius);
  background: #e6f5ec; border: 1px solid #cfeada; border-left: 3px solid var(--ok);
  color: #1a7a45; font-size: 13.5px;
}
.alert ul { margin: 7px 0 0; padding-left: 18px; }
.alert li { margin-top: 3px; }

.tpl { margin-bottom: 18px; overflow: hidden; }
.tpl-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
  padding: 17px 20px; border-bottom: 1px solid var(--line); background: #fbfcfe;
}
.tpl-head h2 { font-size: 15px; }
.tpl-meta { margin: 5px 0 0; font-size: 12px; color: var(--ink-faint); }
.tpl-meta code { font-size: 11.5px; background: #eef1f6; padding: 2px 6px; border-radius: 5px; color: var(--ink-soft); }
.tpl-missing { color: #96631a; }
.tpl-role {
  flex: none; padding: 4px 11px; border-radius: 999px;
  background: #eef1f6; color: var(--ink-soft); font-size: 11.5px; white-space: nowrap;
}

.tpl-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.tpl-editor { padding: 16px 20px 18px; }
.chips { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chips-label { font-size: 12px; color: var(--ink-soft); margin-right: 2px; }
.chip {
  padding: 3px 10px; cursor: pointer;
  border: 1px solid #d9e4e0; border-radius: 999px; background: var(--brand-tint);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; color: var(--brand-dk);
}
.chip:hover { background: #d7ece5; border-color: #b6d4cb; }

.tpl-form textarea {
  width: 100%; padding: 13px; resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; line-height: 1.6; color: var(--ink);
  background: #fbfcfe; border: 1px solid var(--line); border-radius: 8px;
}
.tpl-form textarea:focus {
  outline: none; background: #fff; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(29,111,92,.13);
}
.tpl-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.tpl-issues { margin: 0 auto 0 0; font-size: 12.5px; color: var(--ink-soft); }
.tpl-issues.bad { color: var(--danger); font-weight: 550; }
.counter { font-size: 12px; color: var(--ink-faint); white-space: nowrap; }
.counter.over { color: #96631a; font-weight: 600; }
.btn-primary[disabled] { opacity: .45; cursor: not-allowed; }
.btn-primary[disabled]:hover { background: var(--brand); border-color: var(--brand); }

.tpl-preview {
  padding: 16px 20px 18px; border-left: 1px solid var(--line);
  background: #f7f9fc; display: flex; flex-direction: column;
}
.preview-label {
  margin-bottom: 10px; font-size: 12px; font-weight: 600; color: var(--ink-soft);
}
.preview-label em { font-style: normal; font-weight: 500; color: var(--ink-faint); }
/* Reads like the message a merchant actually receives. */
.wa-bubble {
  position: relative; padding: 12px 14px; border-radius: 10px 10px 10px 2px;
  background: #fff; border: 1px solid #e4ebe6;
  box-shadow: 0 1px 2px rgba(22,32,46,.06);
}
.wa-bubble pre {
  margin: 0; font: inherit; font-size: 13.5px; line-height: 1.62;
  white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink);
}

/* ---------- template tabs ---------- */
.tabs {
  display: flex; gap: 4px; margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.tab {
  position: relative; bottom: -1px;
  padding: 10px 20px; cursor: pointer;
  border: 1px solid transparent; border-bottom: 0;
  border-radius: 9px 9px 0 0; background: none;
  font: inherit; font-size: 14px; font-weight: 550; color: var(--ink-soft);
}
.tab:hover { background: #eef2f7; color: var(--ink); }
.tab.active {
  background: var(--surface); border-color: var(--line);
  color: var(--brand-dk); font-weight: 650;
  box-shadow: 0 -2px 0 var(--brand) inset;
}
.tab:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.tpl[hidden] { display: none; }

/* ---------- admin: user management ---------- */
.users-grid .actions-col { width: 430px; }
.users-grid tbody tr.row-blocked td { background: #fdfbfb; }
.users-grid tbody tr.row-blocked .strong { color: var(--ink-faint); text-decoration: line-through; }
.you {
  margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: var(--brand-tint); color: var(--brand-dk);
  font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em;
}

.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.inline { display: inline; margin: 0; }
.btn-mini {
  padding: 4px 10px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 7px; background: var(--surface);
  font: inherit; font-size: 12px; color: var(--ink-soft); white-space: nowrap;
}
.btn-mini:hover { background: #f1f4f9; color: var(--ink); border-color: #d6dde8; }
.btn-mini.danger { color: var(--danger); border-color: #f0cfcd; }
.btn-mini.danger:hover { background: var(--danger-bg); }
.btn-mini[disabled] { opacity: .4; cursor: not-allowed; }
.btn-mini[disabled]:hover { background: var(--surface); color: var(--ink-soft); border-color: var(--line); }
.btn-mini-tall { padding: 6px 16px; font-size: 12.5px; }

.rowform {
  margin-top: 10px; padding: 12px 14px;
  background: #f7f9fc; border: 1px solid var(--line); border-radius: 9px;
}
.rowform[hidden] { display: none; }
.rowform label { margin-bottom: 6px; font-size: 12px; }
.rowform-line { display: flex; align-items: center; gap: 8px; }
.rowform-line input {
  flex: 1; margin: 0; height: 32px; padding: 0 10px;
  font-size: 13px; background: #fff; border: 1px solid var(--line); border-radius: 7px;
}
.rowform-line input:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29,111,92,.13);
}
.rowform-hint { margin: 8px 0 0; font-size: 11.5px; color: var(--ink-faint); }

.newuser { margin-top: 18px; }
.newuser-form {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: 14px; padding: 18px 20px;
}
.newuser-form .field { display: flex; flex-direction: column; }
.newuser-form .field.grow { flex: 1; min-width: 320px; }
.newuser-form label { margin-bottom: 5px; font-size: 12px; color: var(--ink-soft); }
.newuser-form input, .newuser-form select {
  margin: 0; height: 36px; padding: 0 11px; font: inherit; font-size: 13.5px;
  background: #fbfcfe; border: 1px solid var(--line); border-radius: 8px;
}
.newuser-form input:focus, .newuser-form select:focus {
  outline: none; background: #fff; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(29,111,92,.13);
}
.newuser-form .rowform-line input { height: 36px; }
.locked {
  margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: #eef1f6; color: var(--ink-soft);
  font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em;
}

/* Dropped file: submitted immediately, so the zone shows it is working. */
.dropzone.busy {
  border-style: solid; border-color: var(--brand);
  background: var(--brand-tint); cursor: progress;
}
.dropzone.busy .dz-icon { animation: dz-pulse 1s ease-in-out infinite; }
@keyframes dz-pulse { 0%, 100% { opacity: .35; } 50% { opacity: .8; } }
