/* Dashboard-specific styles */

.dash-body {
  min-height: 100vh;
  background: var(--bg);
}

/* ── Shared "tpl-*" form/step primitives ─────────────────────────────────
   Used by the Create Site modal and the auth gate below. This is a
   duplicate of the same class set in cubewp-sites-gallery/assets/inline.css
   (that copy serves the separate cubewp.com/sites embed) — keep both in
   sync by hand if either changes. */

.tpl-back-btn {
  background: none;
  border: none;
  color: #717182;
  padding: 0;
  margin-bottom: 24px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 13px;
  text-align: center;
}

.tpl-back-btn:hover {
  color: var(--text);
}

.tpl-form-group {
  margin-bottom: 16px;
}

.tpl-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.tpl-input-icon {
  position: absolute;
  left: 16px;
  color: var(--muted-2);
  pointer-events: none;
}

.tpl-input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  border: 1px solid var(--border-2);
  border-radius: 30px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  box-sizing: border-box;
  transition: border-color .18s;
  font-family: inherit;
  background: var(--surface);
}

.tpl-input::placeholder {
  color: var(--muted-2);
  font-weight: 400;
}

.tpl-input:focus {
  border-color: var(--accent);
}

.tpl-primary-btn {
  background: var(--accent);
  color: #ffffff;
  padding: 14px;
  border-radius: 30px;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  font-family: inherit;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity .2s;
  width: 100%;
  cursor: pointer;
  text-decoration: none;
}

.tpl-primary-btn:hover {
  opacity: .9;
}

.tpl-primary-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.tpl-error {
  color: var(--danger);
  font-size: 13px;
  padding: 9px 12px;
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
  border-radius: 8px;
  margin-bottom: 10px;
}

.tpl-subdomain-preview {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1.5px solid var(--border-2);
  border-radius: 10px;
  padding: 10px 14px;
  margin-top: 8px;
  font-size: 13.5px;
  gap: 2px;
}

.tpl-sdpre-host {
  font-weight: 700;
  color: var(--accent);
}

.tpl-sdpre-suffix {
  color: var(--muted-2);
}

.tpl-subdomain-status {
  margin-left: auto;
  font-size: 12px;
  min-height: 16px;
  transition: color .2s;
}

.tpl-subdomain-status.checking {
  color: var(--muted);
}

.tpl-subdomain-status.available {
  color: var(--success);
  font-weight: 500;
}

.tpl-subdomain-status.taken {
  color: var(--danger);
  font-weight: 500;
}

.tpl-otp-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  justify-content: center;
}

.tpl-otp-box {
  width: 47px;
  height: 54px;
  border: 1.5px solid var(--border-2);
  border-radius: 9px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  outline: none;
  transition: border-color .18s;
  font-family: inherit;
  box-sizing: border-box;
}

.tpl-otp-box:focus {
  border-color: var(--accent);
}

.tpl-otp-box.tpl-otp-error {
  border-color: var(--danger) !important;
  color: var(--danger);
}

.tpl-otp-box.tpl-otp-success {
  border-color: var(--success) !important;
  color: var(--success);
}

.tpl-prog-wrap {
  margin: 18px 0 20px;
}

.tpl-prog-bar {
  width: 100%;
  height: 10px;
  background: var(--border-2);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 8px;
}

.tpl-prog-fill {
  height: 100%;
  /* Brand spec: flat colour blocking, no gradients, one accent. Was a
     hardcoded #9810FA→#155DFC gradient using two off-palette colours. */
  background: var(--accent);
  border-radius: 100px;
  transition: width .45s ease;
  width: 0%;
}

.tpl-prog-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 500;
}

.tpl-done-site-link {
  display: block;
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 10px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent);
  border: 1.5px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 10px;
  text-align: center;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  box-sizing: border-box;
  word-break: break-all;
  transition: opacity .18s;
}

.tpl-done-site-link:hover {
  opacity: .82;
}

.tpl-done-admin-btn {
  display: block;
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 10px;
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border-2);
  border-radius: 10px;
  text-align: center;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  box-sizing: border-box;
  transition: border-color .18s, color .18s;
}

.tpl-done-admin-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Sidebar shell ────────────────────────────────────────── */

.dash-shell {
  display: flex;
  min-height: 100vh;
}

.dash-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.dash-sidebar .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
  padding: 0 8px;
  margin-bottom: 28px;
}

.dash-sidenav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.dash-sidenav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
}

.dash-sidenav-item:hover {
  background: var(--bg);
  color: var(--text);
}

.dash-sidenav-item.active {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
}

.dash-sidenav-item svg {
  flex-shrink: 0;
}

.dash-sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 8px 0;
  border-top: 1px solid var(--border);
}

.dash-sidebar-footer .nav-email {
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.dash-main-area {
  flex: 1;
  min-width: 0;
}

/* ── Nav (legacy top bar — kept for any narrow-viewport fallback) ───────── */

.dash-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.dash-nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-email {
  font-size: 13px;
  color: var(--muted);
}

.btn-sm {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-2);
  background: none;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  font-family: inherit;
}

.btn-sm:hover {
  color: var(--text);
  border-color: var(--muted);
}

.btn-sm-primary {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 6px;
  background: var(--accent);
  border: none;
  cursor: pointer;
  transition: background .15s;
  font-family: inherit;
  display: inline-block;
}

.btn-sm-primary:hover {
  background: var(--accent-h);
}

.btn-sm-danger {
  font-size: 12px;
  font-weight: 500;
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  background: none;
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  font-family: inherit;
}

/* ── Content ─────────────────────────────────────────────── */

.dash-content {
  padding: 40px 32px 80px;
}

/* Each tab keeps a comfortable 960px reading column — EXCEPT the Sites tab,
   whose template library spans the full width of the content area.

   #dash-loading IS NAMED HERE, not given its own copy of 960px. The boot
   skeleton is a direct child of .dash-content rather than a tab panel, so it
   was never subject to this rule: on a 1920 screen it painted 1601px wide from
   x=272, then the real Overview arrived 960px wide from x=593 and the whole
   page jumped 321px sideways and shrank by two thirds. A skeleton that does
   not stand where its content will is worse than none.

   Stated once, for both, so the column cannot drift apart again — which is
   exactly how it drifted the first time. */
.dash-tab-panel,
#dash-loading {
  max-width: 960px;
  margin: 0 auto;
}

#tab-dashboard {
  max-width: none;
}

/* the template library spans the full width */

.dash-loading {
  text-align: center;
  padding: 80px 0;
  color: var(--muted);
}

.dash-notice {
  text-align: center;
  padding: 80px 0;
}

.dash-notice h2 {
  margin-bottom: 12px;
}

.dash-notice p {
  color: var(--muted);
  margin-bottom: 24px;
}

/* ── Auth gate: Log in / Sign up (injected by dashboard.js) ──────────────── */

.auth-card {
  max-width: 400px;
  margin: 70px auto;
  padding: 36px 32px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.auth-card #auth-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.auth-sub {
  color: var(--muted);
  font-size: 13.5px;
  margin-bottom: 22px;
  line-height: 1.6;
}

/* Google Sign-In — rendered above the email options (priority). */
.auth-google {
  display: flex;
  justify-content: center;
  min-height: 0;
}

.auth-google:empty {
  display: none;
}

.auth-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.auth-or::before,
.auth-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-or.hidden {
  display: none;
}

.auth-tabs {
  display: flex;
  background: var(--bg);
  border-radius: 100px;
  padding: 3px;
  margin-bottom: 22px;
}

.auth-tab {
  flex: 1;
  padding: 9px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.auth-form.hidden {
  display: none;
}

.auth-form .tpl-otp-row {
  justify-content: center;
}

.auth-msg {
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
  margin-top: 14px;
  line-height: 1.6;
}

.auth-msg a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.auth-msg a:hover {
  text-decoration: underline;
}

/* ── Sites tab: panel head + toolbar ─────────────────────── */

.sites-panel-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 18px;
}

.sites-count {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.sites-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.fpill {
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 100px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s, color .15s, border-color .15s;
}

.fpill:hover {
  color: var(--text);
  border-color: var(--muted-2);
}

.fpill.active {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}

.fdot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.fdot.warn {
  background: var(--warn);
}

.fdot.neutral {
  background: var(--muted-2);
}

.fpill-count {
  font-weight: 700;
}

.toolbar-spacer {
  flex: 1;
}

/* ── Sites list: one compact row per site, not a card grid ── */

/* Fixed-width columns (name / plan / status / actions) so nothing shifts
   between rows regardless of domain length — reads like a data table
   instead of a loose flex row. Same card treatment as the Billing tab's
   .billing-sub-row (bordered, rounded, surface background, own margin) so
   the two read as the same design language rather than two different
   list styles. */
.site-row {
  display: grid;
  /* tile · name+domain · plan · status · actions */
  grid-template-columns: 44px minmax(0, 1fr) 92px 160px auto;
  align-items: center;
  column-gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm, var(--radius));
  background: var(--surface);
  margin-bottom: 12px;
  position: relative;
  transition: border-color .12s, box-shadow .12s;
}

.site-row:last-child {
  margin-bottom: 0;
}

.site-row:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow-sm);
}

/* Letter tile — a visual anchor per site (marketing-radius, accent-tinted).
   Removed sites get a muted tile so the dead row reads as dead at a glance. */
.site-tile {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  user-select: none;
}

.site-tile.expired {
  background: var(--bg);
  color: var(--muted-2);
}

/* Per-row domain affordance — "Connect domain" (accent) when none is attached,
   "Domain connected" (success) when one is. Sits in the meta line under the name. */
.site-domain-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}

.site-domain-btn:hover { text-decoration: underline; }

.site-domain-btn.linked {
  color: var(--success);
  margin-left: 10px;
}

.site-row[data-state="warn"]::before,
.site-row[data-state="danger"]::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.site-row[data-state="warn"]::before {
  background: var(--warn);
}

.site-row[data-state="danger"]::before {
  background: var(--danger);
}

.site-id {
  min-width: 0;
}

.site-name {
  display: block;
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-name:hover {
  color: var(--accent);
}

.site-plan-col {
  flex-shrink: 0;
}

.plan-chip {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 7px;
  border-radius: 5px;
  display: inline-block;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
}

.plan-chip.free {
  background: var(--border);
  color: var(--muted);
}

.site-meta {
  font-size: 12px;
  color: var(--muted-2);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-cluster {
  min-width: 0;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

.status-item strong {
  color: var(--text);
  font-weight: 600;
}

.status-item.attention {
  color: var(--warn);
}

.status-item.attention strong {
  color: var(--warn);
}

.status-item.critical {
  color: var(--danger);
}

.status-item.critical strong {
  color: var(--danger);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.warn {
  background: var(--warn);
}

.status-dot.danger {
  background: var(--danger);
}

.status-dot.neutral {
  background: var(--muted-2);
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

/* "Admin" — the explicit, labeled primary action (not a bare icon). */
.row-btn-admin {
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s;
}

.row-btn-admin:hover {
  background: var(--accent-h);
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, color .12s, border-color .12s;
}

.icon-btn:hover {
  background: var(--surface);
  border-color: var(--border-2);
  color: var(--text);
}

.row-cta {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
}

.row-cta.warn {
  background: color-mix(in srgb, var(--warn) 15%, transparent);
  color: var(--warn);
}

.row-cta.danger {
  background: var(--danger);
  color: #fff;
}

.kebab-wrap {
  position: relative;
}

.kebab-menu {
  position: absolute;
  top: 36px;
  right: 0;
  z-index: 5;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(20, 20, 43, .14), 0 2px 8px rgba(20, 20, 43, .08);
  padding: 6px;
  width: 200px;
}

.kebab-menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
}

.kebab-menu button:hover {
  background: var(--bg);
}

.kebab-menu button svg {
  color: var(--muted);
  flex-shrink: 0;
}

/* ── Subscription status badge (Billing tab) ─────────────── */

.sub-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 3px 10px;
  border-radius: 100px;
}

.sub-badge.sub-ok {
  background: color-mix(in srgb, #16a34a 18%, transparent);
  color: #16a34a;
  border: 1px solid color-mix(in srgb, #16a34a 35%, transparent);
}

.sub-badge.sub-warn {
  background: color-mix(in srgb, #d97706 18%, transparent);
  color: #d97706;
  border: 1px solid color-mix(in srgb, #d97706 35%, transparent);
}

.sub-badge.sub-bad {
  background: color-mix(in srgb, #dc2626 18%, transparent);
  color: #dc2626;
  border: 1px solid color-mix(in srgb, #dc2626 35%, transparent);
}

/* ── Sites tab: "no sites yet" empty message ─────────────── */

.sites-none {
  max-width: 460px;
  margin: 60px auto;
  padding: 40px 32px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}

.sites-none svg {
  color: var(--muted-2);
  margin-bottom: 14px;
}

.sites-none h2 {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 8px;
}

.sites-none p {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ── Billing tab ─────────────────────────────────────────── */

.billing-section {
  margin-bottom: 32px;
}

.billing-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.billing-loading,
.billing-empty {
  color: var(--muted);
  font-size: 13.5px;
  padding: 16px 0;
}

.billing-sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 10px;
}

.billing-sub-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.billing-sub-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.billing-sub-next {
  font-size: 12.5px;
  color: var(--muted);
}

.billing-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.billing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.billing-table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.billing-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.billing-table tbody tr:last-child td {
  border-bottom: none;
}

.billing-table .billing-desc {
  color: var(--muted);
}

.billing-status {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 100px;
  background: color-mix(in srgb, var(--muted) 15%, transparent);
  color: var(--muted);
}

.billing-status-paid {
  background: color-mix(in srgb, #16a34a 16%, transparent);
  color: #16a34a;
}

.billing-status-open,
.billing-status-draft {
  background: color-mix(in srgb, #d97706 16%, transparent);
  color: #d97706;
}

.billing-status-uncollectible,
.billing-status-void {
  background: color-mix(in srgb, #dc2626 16%, transparent);
  color: #dc2626;
}

.billing-invoice-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.billing-invoice-link:hover {
  text-decoration: underline;
}

.billing-manage-row {
  margin-top: 8px;
}


/* ── Sections ────────────────────────────────────────────── */

.section-desc {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

/* Custom domain form */

.inline-form {
  display: flex;
  gap: 10px;
}

.field-input {
  flex: 1;
  background: var(--surface);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
}

.field-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.domain-pill {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 14px;
  color: var(--text);
}

.domain-status {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.domain-status.ok {
  color: var(--success);
}

.domain-status.pending {
  color: var(--warn);
}

.domain-status.error {
  color: var(--danger);
}

.domain-locked {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.domain-locked p {
  font-size: 14px;
  color: var(--muted);
}

.domain-locked strong {
  color: var(--text);
}

.nameserver-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
}

.ns-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.ns-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.ns-entry {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--accent);
}

.ns-note {
  font-size: 12px;
  color: var(--muted-2);
  line-height: 1.6;
}

/* Small plan grid */

.plan-grid-small {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.plan-card-sm {
  background: var(--surface);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color .15s;
}

.plan-card-sm:hover {
  border-color: var(--muted);
}

.plan-price-sm {
  font-size: 26px;
  font-weight: 700;
  margin: 6px 0;
}

.plan-price-sm span {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
}

.plan-features-sm {
  list-style: none;
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plan-features-sm li {
  padding-left: 16px;
  position: relative;
}

.plan-features-sm li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--success);
}

.btn-plan-sm {
  width: 100%;
  padding: 9px;
  background: var(--border-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}

.btn-plan-sm:hover {
  background: var(--border);
}

.btn-plan-active {
  background: var(--accent);
  color: #fff;
}

.btn-plan-active:hover {
  background: var(--accent-h);
}

.upgrade-note {
  font-size: 12px;
  color: var(--muted-2);
  line-height: 1.6;
}

/* ── Upgrade modal ───────────────────────────────────────── */

.pay-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 3, 8, .7);
  backdrop-filter: blur(3px);
}

.pay-modal-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 28px;
  animation: popIn .25s cubic-bezier(.175, .885, .32, 1.275) both;
}

.pay-modal-card h3 {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 6px;
}

.pay-modal-amount {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
}

.pay-modal-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.pay-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color .15s;
}

.pay-modal-close:hover {
  color: var(--text);
}

/* ── Tab panels ──────────────────────────────────────────── */

.dash-tab-panel.hidden {
  display: none;
}

/* ── Sites tab: empty state (spacious starting-point cards) ──────────────── */

.sites-empty-head {
  text-align: center;
  max-width: 520px;
  margin: 40px auto 36px;
}

.sites-empty-head h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.sites-empty-head p {
  color: var(--muted);
  font-size: 14.5px;
}

.sites-empty-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  max-width: 860px;
  margin: 0 auto;
}

.sites-empty-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}

.sites-empty-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -12px color-mix(in srgb, var(--accent) 30%, transparent);
}

.sites-empty-card-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  border-radius: 10px;
}

.sites-empty-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.sites-empty-card-desc {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
}

.sites-empty-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 860px;
  margin: 36px auto;
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .05em;
}

.sites-empty-divider::before,
.sites-empty-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.sites-empty-divider span {
  padding: 0 14px;
}

.sites-templates-showcase {
  max-width: none;
  /* full width — spans the whole dashboard content area */
  margin: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.sites-templates-showcase h2 {
  font-size: 19px;
  margin-bottom: 6px;
}

.sites-templates-showcase>p {
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 20px;
}

.sites-templates-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

@media (min-width: 640px) {
  .sites-templates-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .sites-templates-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1600px) {
  .sites-templates-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Inline library card — preview image + name + Preview / Use-this-template. */
.tpl-lib-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}

.tpl-lib-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -14px color-mix(in srgb, var(--accent) 30%, transparent);
}

.tpl-lib-thumb-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--border);
  overflow: hidden;
}

.tpl-lib-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.tpl-lib-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 14px 14px;
  flex: 1;
}

.tpl-lib-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.tpl-lib-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.tpl-lib-btn {
  flex: 1;
  padding: 8px 6px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, filter .15s;
}

.tpl-lib-btn-preview {
  flex: 0 0 auto;
  padding: 8px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border-2);
  color: var(--text);
}

.tpl-lib-btn-preview:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tpl-lib-btn-use {
  background: var(--accent);
  border: 1.5px solid var(--accent);
  color: #fff;
}

.tpl-lib-btn-use:hover {
  filter: brightness(.94);
}

/* Browse Templates modal — full library + category filter */

.browse-tpl-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.browse-tpl-cat {
  padding: 7px 16px;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 100px;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.browse-tpl-cat:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.browse-tpl-cat.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Domain/Plan tab site picker — same pill look as .browse-tpl-cat, shown
   only for multi-site accounts so they can pick which site the tab applies to. */
.site-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

/* ── Buttons shared with tpl-* (gallery) styles ──────────── */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: 15px;
  padding: 12px 24px;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s;
}

.btn-primary:hover {
  opacity: .92;
}

.btn-primary:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* ── Create Site modal ───────────────────────────────────── */

.cs-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(26, 26, 46, .45);
  backdrop-filter: blur(3px);
}

.cs-modal.hidden {
  display: none;
}

.cs-modal-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  animation: popIn .25s cubic-bezier(.175, .885, .32, 1.275) both;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(.96);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.cs-modal-card h3 {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 18px;
}

.cs-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 6px;
}

.cs-modal-close:hover {
  color: var(--text);
  background: var(--bg);
}

.cs-modal-card .hidden {
  display: none;
}

.cs-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cs-mode-option {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  background: var(--bg);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-family: inherit;
}

.cs-mode-option:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg));
}

.cs-mode-option-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  border-radius: 10px;
}

.cs-mode-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cs-mode-option-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.cs-mode-option-desc {
  font-size: 13px;
  color: var(--muted);
}

.cs-plan-sub {
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 18px;
  line-height: 1.5;
}

.cs-plan-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.cs-plan-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  background: var(--bg);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-family: inherit;
}

.cs-plan-row:hover {
  border-color: var(--accent);
}

.cs-plan-row.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.cs-plan-row.cs-plan-row-disabled,
.cs-plan-row:disabled {
  opacity: .5;
  cursor: not-allowed;
  background: var(--bg);
}

.cs-plan-row.cs-plan-row-disabled:hover,
.cs-plan-row:disabled:hover {
  border-color: var(--border-2);
}

.cs-plan-row-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  grid-column: 1;
  grid-row: 1;
}

.cs-plan-row-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  grid-column: 2;
  grid-row: 1;
}

.cs-plan-row-price span {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.cs-plan-row-note {
  font-size: 12.5px;
  color: var(--muted);
  grid-column: 1 / -1;
  grid-row: 2;
  margin-top: 2px;
}

.cs-pay-methods {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

/* Demo grid (inside modal) */

.cs-demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
}

.cs-demo-card {
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg);
  transition: border-color .15s;
  text-align: left;
  font-family: inherit;
  padding: 0;
  height: 200px;
}

.cs-demo-card:hover {
  border-color: var(--accent);
}

.cs-demo-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}

.cs-demo-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--border);
  display: block;
  object-fit: cover;
  object-position: top center;
}

.cs-demo-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  padding: 8px 10px;
}

.cs-demo-loading,
.cs-demo-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 24px 0;
}

/* Template preview modal — reuses .cs-modal-card, adds the image + text layout */

.tpl-preview-card {
  max-width: 480px;
  padding: 0 0 28px;
  overflow: hidden;
}

.tpl-preview-img {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  background: var(--bg);
  display: block;
  object-position: top center;
}

.tpl-preview-card #tpl-preview-title {
  font-size: 18px;
  margin: 20px 28px 6px;
}

.tpl-preview-desc {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 28px 20px;
}

.tpl-preview-card .btn-primary {
  width: calc(100% - 56px);
  margin: 0 28px;
}

.cs-import-note {
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 18px;
}

.cs-import-note strong {
  color: var(--text);
}

@media (max-width: 780px) {
  .dash-shell {
    flex-direction: column;
  }

  .dash-sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
  }

  .dash-sidebar .logo {
    margin-bottom: 0;
  }

  .dash-sidenav {
    flex-direction: row;
  }

  .dash-sidebar-footer {
    flex-direction: row;
    border-top: none;
    padding: 0;
    margin-left: auto;
  }
}

@media (max-width: 600px) {
  .dash-content {
    padding: 24px 16px 60px;
  }

  .dash-nav {
    padding: 0 16px;
  }

  .inline-form {
    flex-direction: column;
  }

  .plan-grid-small {
    grid-template-columns: 1fr;
  }

  /* Sites tab: status column folds away, row goes two-line (tile + name on
     the first line, plan chip + actions sharing the second) */
  .site-row {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    grid-template-areas: "tile name name""plan plan actions";
    row-gap: 8px;
  }

  .site-tile {
    grid-area: tile;
  }

  .site-id {
    grid-area: name;
  }

  .site-plan-col {
    grid-area: plan;
    align-self: center;
  }

  .status-cluster {
    display: none;
  }

  .row-actions {
    grid-area: actions;
  }
}

.tpl-input-wrapper input#cs-site-name {
  padding-left: 40px;
}
/* ═══════════════════════════════════════════════════════════════════════════
   Support tab — contact form + custom accessible radio group
   ═══════════════════════════════════════════════════════════════════════════ */
.support-form { max-width: 640px; }

.support-field { margin-bottom: 18px; }

.support-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.support-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Custom radio group — selectable pills */
.support-radiogroup {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.support-radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--surface, #fff);
  border: 1.5px solid var(--border-2);
  border-radius: 999px;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.support-radio:hover { border-color: var(--muted); }
.support-radio:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
  border-color: var(--accent);
}
.support-radio.is-checked {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent);
}
.support-radio-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-2);
  flex: 0 0 auto;
  transition: border-color .15s, box-shadow .15s;
}
.support-radio.is-checked .support-radio-dot {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 3px var(--accent);
}

/* Fields */
.support-textarea {
  width: 100%;
  min-height: 130px;
  resize: vertical;
  line-height: 1.5;
}
.support-field .field-input { width: 100%; }
.support-field .field-input.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 15%, transparent);
}
.support-error {
  display: block;
  min-height: 16px;
  margin-top: 5px;
  font-size: 12px;
  color: var(--danger);
}

.support-actions { margin-top: 4px; }

.support-result {
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.45;
}
.support-result-ok {
  background: color-mix(in srgb, #16a34a 10%, transparent);
  color: #15803d;
  border: 1px solid color-mix(in srgb, #16a34a 30%, transparent);
}
.support-result-err {
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
}

/* Honeypot — present in the DOM for bots, invisible + off the tab order for humans */
.support-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  overflow: hidden;
  opacity: 0;
}

@media (max-width: 560px) {
  .support-grid-2 { grid-template-columns: 1fr; }
}

/* ═══ Brand mark — matches sites.cubewp.com exactly ═════════════════════════
   Same /assets/images/logo.png the landing page uses (170×32, rendered at 32px
   height, identical to the marketing .brand .logo rule) so the dashboard and the
   marketing site can never drift apart. Replaces a hand-inlined base64 SVG copy.
   ═══════════════════════════════════════════════════════════════════════════ */
.logo-img {
  height: 32px;
  width: auto;
  display: block;
}

/* Login screen brand — the client's first screen after the marketing site. */
.auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.auth-brand-logo {
  height: 32px;
  width: auto;
  display: block;
}

/* Retry affordance inside an error/empty block — an error the client can act on
   beats a dead end. */
.billing-empty .btn-sm-primary { margin-left: 8px; }

/* ═══ Accessibility — visible keyboard focus ════════════════════════════════
   PROBLEM THIS FIXES: five rules across these stylesheets set `outline: none`
   on inputs/controls with no replacement, so tabbing through the dashboard gave
   NO visible focus indicator — unusable without a mouse (WCAG 2.4.7 failure).

   :focus-visible only matches keyboard/AT focus, so mouse users never see a ring
   on click — which is why those outlines were removed in the first place. We get
   the accessibility back without the thing people disliked.

   Inputs use a box-shadow ring rather than `outline`, because the existing
   `outline: none` rules would otherwise win on specificity and hide it.
   ═══════════════════════════════════════════════════════════════════════════ */
:where(a, button, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.tpl-input:focus-visible,
.field-input:focus-visible,
.tpl-otp-box:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* Controls that are visually custom still need an unmistakable ring. */
.dash-sidenav-item:focus-visible,
.auth-tab:focus-visible,
.support-radio:focus-visible,
.sites-empty-card:focus-visible,
.row-cta:focus-visible,
.tpl-primary-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ═══ Motion budget ═════════════════════════════════════════════════════════
   This is a tool people sit in for long sessions: motion is a cost, not a
   feature. Interactions settle fast (≤150ms) on the marketing site's easing
   curve, and anyone who has asked their OS for less motion gets none.
   ═══════════════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}


/* Site-picker: mark a removed site so identical subdomains are distinguishable. */
.site-picker-pill.is-removed { opacity: .62; }
.site-picker-removed {
  font-size: 0.82em;
  font-weight: 600;
  color: var(--danger);
}
.site-picker-pill.active .site-picker-removed { color: inherit; }

/* Create-success "revenue-ready" nudge (demo clones only) */
.cs-earn {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
  background: color-mix(in srgb, var(--success) 7%, transparent);
  border-radius: var(--radius);
  text-align: left;
}
.cs-earn-head { font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.4; }
.cs-earn-badge {
  display: inline-block;
  margin-right: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--success);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.cs-earn-sub { margin: 5px 0 10px; font-size: 12.5px; color: var(--muted); }

/* Demo-picker subhead — carries the "revenue-ready" positioning */
.cs-demo-sub {
  margin: -4px 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Template library showcase — matched to the cubewp.com/sites gallery.
   Ported verbatim from cubewp-templates.css + gallery-redesign.css and scoped
   under .tpl-browser so it can't touch the rest of the dashboard.
   Markup is emitted by dashboard.js (renderLibraryCategories / createLibraryCard).
   ═══════════════════════════════════════════════════════════════════════════ */

/* Grid */
#sites-templates-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 19px;
}
@media (max-width: 1200px) { #sites-templates-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px)  { #sites-templates-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { #sites-templates-grid { grid-template-columns: 1fr; } }

/* Card shell */
.tpl-browser .cwp-templates-explore-card {
  transition: transform 0.2s ease;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
}
.tpl-browser .cwp-templates-explore-card-media {
  border: 1.07px solid #e5e5e5;
  border-radius: 15px;
  overflow: hidden;
}
.tpl-browser .cwp-templates-explore-card-header {
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 10px;
  background: #f3f4f6;
}
.tpl-browser .cwp-card-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.tpl-browser .cwp-card-dot-red { background: #ff6467; }
.tpl-browser .cwp-card-dot-yellow { background: #fdc700; }
.tpl-browser .cwp-card-dot-green { background: #05df72; }

/* Image + hover */
.tpl-browser .cwp-templates-explore-card-image-wrapper { position: relative; height: 310px; }
.tpl-browser .cwp-template-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: object-position 3s ease-in-out;
}
.tpl-browser .cwp-templates-explore-card-image-wrapper:hover .cwp-template-img { object-position: bottom; }

/* Category tag */
.tpl-browser .cwp-card-tags {
  position: absolute;
  top: 7px;
  right: 4px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  z-index: 5;
}
.tpl-browser .cwp-card-tag-category {
  background: #ffffff;
  color: #1a1a1a;
  padding: 4px 12px;
  border-radius: 20px;
  box-shadow: 0 2px 8px 0 #00000024;
  font-family: 'Inter Tight', sans-serif;
  font-weight: 600;
  font-size: 12px;
  line-height: 18px;
}

/* Hover overlay: Live Preview + Create */
.tpl-browser .cwp-templates-explore-card .cwp-templates-explore-hover-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  opacity: 0;
  background: rgba(26, 18, 66, 0.55);
  transition: opacity 0.2s ease;
}
.tpl-browser .cwp-templates-explore-card:hover .cwp-templates-explore-hover-overlay,
.tpl-browser .cwp-templates-explore-card:focus-within .cwp-templates-explore-hover-overlay { opacity: 1; }
.tpl-browser .cwp-templates-explore-card .cwp-templates-explore-preview-btn,
.tpl-browser .cwp-templates-explore-card .cwp-templates-explore-create-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  margin: 0;
  padding: 0 22px;
  border: none;
  border-radius: 9999px;
  font-family: 'Inter Tight', sans-serif;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.tpl-browser .cwp-templates-explore-card .cwp-templates-explore-preview-btn { background: #5641f3; color: #ffffff; }
.tpl-browser .cwp-templates-explore-card .cwp-templates-explore-preview-btn:hover { background: #4835e0; transform: translateY(-1px); }
.tpl-browser .cwp-templates-explore-card .cwp-templates-explore-create-btn { background: #ffffff; color: #5641f3; }
.tpl-browser .cwp-templates-explore-card .cwp-templates-explore-create-btn:hover { background: #f4f2ff; transform: translateY(-1px); }

/* Card footer */
.tpl-browser .cwp-templates-explore-card-info { padding: 16px 4px 8px 4px; }
.tpl-browser .cwp-card-title {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 500;
  font-size: 17px;
  color: #111827;
  margin: 0 0 4px 0;
}
.tpl-browser .cwp-card-demo {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 400;
  font-size: 14.5px;
  color: #6b7280;
  margin: 0;
}

/* Category dropdown filter (replaces the flat button row) */
.tpl-browser #sites-templates-categories { display: flex; margin: 0 0 22px; }
.tpl-browser .cwp-category-select { position: relative; flex: 0 0 auto; }
.tpl-browser .cwp-category-select-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #e4e4ec;
  border-radius: 9999px;
  background: #ffffff;
  color: #1a1a1a;
  font-family: 'Inter Tight', sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease;
  letter-spacing: -0.3px;
}
.tpl-browser .cwp-category-select-toggle:hover { border-color: #c8c3f5; }
.tpl-browser .cwp-category-select.is-open .cwp-category-select-toggle,
.tpl-browser .cwp-category-select.has-selection .cwp-category-select-toggle { border-color: #5641f3; color: #5641f3; }
.tpl-browser .cwp-category-select-chevron { flex-shrink: 0; transition: transform 0.18s ease; }
.tpl-browser .cwp-category-select.is-open .cwp-category-select-chevron { transform: rotate(180deg); }
.tpl-browser .cwp-category-select-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 60;
  display: none;
  width: 268px;
  padding: 8px 0;
  border: 1px solid #efeff3;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 20px 44px rgba(17, 17, 40, 0.16);
}
.tpl-browser .cwp-category-select.is-open .cwp-category-select-panel { display: block; }
.tpl-browser .cwp-cat-list { max-height: 340px; overflow-y: auto; padding: 0 8px; }
.tpl-browser .cwp-cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: none;
  color: #1a1a1a;
  font-family: 'Inter Tight', sans-serif;
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.tpl-browser .cwp-cat-row:hover { background: #f6f5ff; }
.tpl-browser .cwp-cat-row.is-active { background: #f3f0ff; color: #5641f3; }

/* Search box: full-width on its own row, category dropdown on the row below —
   the same vertical order as the gallery (search, then category controls). */
.tpl-browser .cwp-templates-explore-search-box {
  position: relative;
  width: 100%;
  margin: 14px 0 14px;
}
.tpl-browser .cwp-templates-explore-search-box input {
  width: 100%;
  padding: 13px 46px 13px 20px;
  border-radius: 100px;
  background: #f7f7fa;
  border: 1px solid #e8e8ec;
  color: #111111;
  font-family: 'Inter Tight', sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 1;
}
.tpl-browser .cwp-templates-explore-search-box input::placeholder { color: #9a9aa3; }
.tpl-browser .cwp-templates-explore-search-box input:focus,
.tpl-browser .cwp-templates-explore-search-box input:focus-visible {
  outline: none;
  border-color: #afa9ec;
  box-shadow: none;
}
.tpl-browser .cwp-search-icon {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* Pagination — compact, matches the gallery pager */
.tpl-browser .cwp-templates-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 30px 0 12px;
}
.tpl-browser .cwp-page-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #e5e5ea;
  background: #ffffff;
  color: #b3b3bb;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}
.tpl-browser .cwp-page-arrow:disabled { cursor: not-allowed; opacity: 0.6; }
.tpl-browser .cwp-page-numbers { display: flex; align-items: center; gap: 8px; }
.tpl-browser .cwp-page-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #e5e5ea;
  background: #ffffff;
  color: #44444c;
  font-family: 'Inter Tight', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.tpl-browser .cwp-page-number.active { background: #5641f3; border-color: #5641f3; color: #ffffff; }
.tpl-browser .cwp-page-dots { color: #888888; padding: 0 2px; align-self: flex-end; }
.tpl-browser .cwp-page-next {
  height: 36px;
  padding: 0 18px;
  border-radius: 100px;
  border: none;
  background: #5641f3;
  color: #ffffff;
  font-family: 'Inter Tight', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
}
.tpl-browser .cwp-page-next:disabled { opacity: 0.55; cursor: not-allowed; }

/* ══ Notification Center (P1) ═══════════════════════════════════════════════ */

/* toast(msg,'err') is used at two call sites but only .ok/.error were styled —
   alias 'err' so those toasts stop rendering unstyled. */
.toast.err { background: #dc2626; color: #fff; }

.notif-bell {
  position: fixed; top: 14px; right: 18px; z-index: 900;
  width: 42px; height: 42px; border-radius: 50%;
  background: #fff; border: 1px solid #ececf5; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: #4b4b63; box-shadow: 0 2px 10px rgba(20, 20, 43, .08);
}
.notif-bell:hover { color: #5641f3; border-color: #d8d4fb; }
.notif-badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px;
  border-radius: 999px; background: #dc2626; color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  padding: 0 4px; border: 2px solid #fff; box-sizing: content-box;
}

.notif-panel {
  position: fixed; top: 64px; right: 18px; z-index: 901;
  width: min(380px, calc(100vw - 24px)); max-height: min(72vh, 640px);
  background: #fff; border: 1px solid #ececf5; border-radius: 14px;
  box-shadow: 0 12px 40px rgba(20, 20, 43, .16);
  display: flex; flex-direction: column; overflow: hidden;
}
.notif-panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid #ececf5;
}
.notif-panel-head strong { font-size: 15px; color: #1a1a2e; flex: 1; }
.notif-link {
  background: none; border: 0; color: #5641f3; font-size: 12.5px;
  font-weight: 600; cursor: pointer; padding: 4px 6px;
}
.notif-x {
  background: none; border: 0; font-size: 20px; line-height: 1;
  color: #9c9cb5; cursor: pointer; padding: 2px 6px;
}
.notif-list { overflow-y: auto; padding: 6px 0; }
.notif-empty { padding: 36px 16px; text-align: center; color: #9c9cb5; font-size: 14px; }

.notif-item {
  display: flex; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid #f4f4fa; cursor: default;
}
.notif-item:last-child { border-bottom: 0; }
.notif-item.unread { background: #f8f7ff; }
.notif-dot {
  flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%;
  margin-top: 6px; background: #5641f3;
}
.notif-item[data-sev="warn"]    .notif-dot { background: #f59e0b; }
.notif-item[data-sev="danger"]  .notif-dot { background: #dc2626; }
.notif-item[data-sev="success"] .notif-dot { background: #16a34a; }
.notif-item-main { flex: 1; min-width: 0; }
.notif-item-title { font-size: 13.5px; font-weight: 600; color: #1a1a2e; }
/* pre-line: operation notifications carry ✔/⏳/• checklist lines in the body */
.notif-item-body  { font-size: 12.5px; color: #6b6b85; margin-top: 2px; line-height: 1.5; white-space: pre-line; }
.notif-item-meta  { font-size: 11.5px; color: #9c9cb5; margin-top: 6px; display: flex; gap: 10px; align-items: center; }
.notif-item-meta a { color: #5641f3; font-weight: 600; text-decoration: none; }
.notif-item-dismiss {
  background: none; border: 0; color: #c4c4d4; cursor: pointer;
  font-size: 16px; line-height: 1; padding: 2px 4px; align-self: flex-start;
}
.notif-item-dismiss:hover { color: #6b6b85; }

/* Persistent-notification banner strip (Sites tab) */
.notif-banners { display: flex; flex-direction: column; gap: 10px; margin: 0 0 16px; }
.notif-banner {
  display: flex; align-items: flex-start; gap: 10px;
  border-radius: 10px; padding: 12px 14px; font-size: 13.5px; line-height: 1.5;
  border: 1px solid #ececf5; background: #f7f7fb; color: #1a1a2e;
}
.notif-banner[data-sev="warn"]   { background: #fff8eb; border-color: #fde8bd; }
.notif-banner[data-sev="danger"] { background: #fef2f2; border-color: #fbd5d5; }
.notif-banner[data-sev="info"]   { background: #f5f4ff; border-color: #dfdbfb; }
.notif-banner-main { flex: 1; }
.notif-banner-main strong { display: block; margin-bottom: 2px; }
.notif-banner a { color: #5641f3; font-weight: 600; text-decoration: none; white-space: nowrap; }
.notif-banner .notif-item-dismiss { margin-top: 1px; }

@media (max-width: 640px) {
  .notif-bell { top: 10px; right: 12px; }
  .notif-panel { top: 58px; right: 12px; }
}

/* ══ Backups drawer (P3a) ═══════════════════════════════════════════════════ */

.bk-card { max-width: 560px; width: min(560px, calc(100vw - 32px)); }
.bk-sub { color: #6b6b85; font-size: 13.5px; margin: 4px 0 16px; }
.bk-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.bk-toolbar-note { font-size: 12px; color: #9c9cb5; }
.bk-list { max-height: 46vh; overflow-y: auto; border-top: 1px solid #ececf5; }
.bk-empty { padding: 28px 8px; text-align: center; color: #9c9cb5; font-size: 13.5px; }
.bk-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px; border-bottom: 1px solid #f4f4fa; font-size: 13px;
}
.bk-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bk-row-main strong { color: #1a1a2e; font-size: 13.5px; }
.bk-kind { color: #9c9cb5; font-size: 11.5px; }
.bk-size { color: #6b6b85; white-space: nowrap; }
.bk-badge {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.bk-badge.ok      { background: #e8f7ee; color: #16803c; }
.bk-badge.pending { background: #f5f4ff; color: #5641f3; }
.bk-badge.bad     { background: #fef2f2; color: #b91c1c; }
.bk-badge.muted   { background: #f1f1f6; color: #6b6b85; }
.bk-dl {
  background: #fff; border: 1px solid #d8d4fb; color: #5641f3; border-radius: 7px;
  font-size: 12px; font-weight: 600; padding: 5px 12px; cursor: pointer; white-space: nowrap;
}
.bk-dl:hover { background: #f5f4ff; }
.bk-decrypt {
  background: #f5f4ff; border: 1px solid #dfdbfb; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 12px; font-size: 12.5px; color: #1a1a2e;
}
.bk-decrypt code {
  display: block; background: #fff; border: 1px solid #ececf5; border-radius: 7px;
  padding: 8px 10px; margin: 8px 0; font-size: 11px; word-break: break-all; color: #4b4b63;
}
.bk-decrypt-note { display: block; margin-top: 8px; color: #9c9cb5; font-size: 11.5px; }
.bk-del {
  background: none; border: 0; color: #c4c4d4; cursor: pointer; padding: 5px;
  border-radius: 6px; display: inline-flex; align-items: center;
}
.bk-del:hover { color: #dc2626; background: #fef2f2; }
.bk-restore {
  background: #5641f3; border: 1px solid #5641f3; color: #fff; border-radius: 7px;
  font-size: 12px; font-weight: 600; padding: 5px 12px; cursor: pointer; white-space: nowrap;
}
.bk-restore:hover { background: #4733d6; }

/* ══ Clone Site (P4) ════════════════════════════════════════════════════════ */

.cl-card { max-width: 460px; width: min(460px, calc(100vw - 32px)); }
.cl-label {
  display: block; font-size: 12px; font-weight: 600; color: #4b4b63;
  margin: 14px 0 5px;
}
.cl-input {
  width: 100%; box-sizing: border-box; border: 1px solid #ececf5; border-radius: 8px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; color: #1a1a2e;
}
.cl-input:focus { outline: none; border-color: #5641f3; box-shadow: 0 0 0 3px rgba(86,65,243,.12); }
.cl-subwrap { display: flex; align-items: center; gap: 8px; }
.cl-subwrap .cl-input { flex: 1; min-width: 0; }
.cl-domain { color: #9c9cb5; font-size: 13px; white-space: nowrap; }
/* Step 2 reuses the create-a-site .cs-plan-* styles verbatim — a copy is
   chosen exactly like a new site, so the two flows can never visually drift. */
/* ══ Activity timeline (P7/O4) ══════════════════════════════════════════════ */

.tl-card { max-width: 520px; width: min(520px, calc(100vw - 32px)); }
.tl-list { max-height: 56vh; overflow-y: auto; margin-top: 10px; }
.tl-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 4px; border-bottom: 1px solid #f4f4fa;
}
.tl-row:last-child { border-bottom: 0; }
.tl-dot { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; background: #c4c4d4; }
.tl-dot.ok   { background: #16a34a; }
.tl-dot.bad  { background: #dc2626; }
.tl-dot.run  { background: #5641f3; }
.tl-dot.warn { background: #f59e0b; }
.tl-main { flex: 1; min-width: 0; }
.tl-label { font-size: 13px; font-weight: 600; color: #1a1a2e; }
.tl-meta  { font-size: 11.5px; color: #9c9cb5; margin-top: 2px; }
.tl-time  { font-size: 11.5px; color: #9c9cb5; white-space: nowrap; margin-top: 2px; }

/* ══ Notification email preferences (P7) ════════════════════════════════════ */

.notif-prefs { padding: 14px 16px; }
.notif-prefs-title { font-size: 13px; font-weight: 700; color: #1a1a2e; margin-bottom: 10px; }
.notif-pref-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid #f4f4fa; cursor: pointer;
}
.notif-pref-row input { margin-top: 3px; accent-color: #5641f3; }
.notif-pref-row strong { display: block; font-size: 13px; color: #1a1a2e; }
.notif-pref-row em { display: block; font-style: normal; font-size: 11.5px; color: #9c9cb5; }
.notif-prefs-note {
  font-size: 11.5px; color: #9c9cb5; line-height: 1.5; margin: 12px 0;
  background: #f7f7fb; border-radius: 8px; padding: 10px 12px;
}

/* ══ Site metrics (P5) ══════════════════════════════════════════════════════ */

.mx-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #f5f4ff; border: 1px solid #dfdbfb; color: #5641f3;
  border-radius: 999px; font-size: 11.5px; font-weight: 600;
  padding: 3px 10px; cursor: pointer; font-family: inherit; white-space: nowrap;
}
.mx-chip:hover { background: #ece9fe; }
.mx-card { max-width: 500px; width: min(500px, calc(100vw - 32px)); }
.mx-kpis { display: flex; gap: 10px; margin: 14px 0; }
.mx-kpi {
  flex: 1; background: #f7f7fb; border: 1px solid #ececf5;
  border-radius: 10px; padding: 10px 12px;
}
.mx-kpi-v { font-size: 20px; font-weight: 700; color: #1a1a2e; }
.mx-kpi-l { font-size: 11px; color: #6b6b85; margin-top: 2px; }
.mx-kpi-l span { color: #9c9cb5; }
.mx-chart-wrap { margin: 4px 0 14px; }
.mx-chart-label { font-size: 11.5px; color: #9c9cb5; margin-bottom: 6px; }
.mx-svg { width: 100%; height: 96px; display: block; }
.mx-bar { fill: #5641f3; opacity: .85; }
.mx-bar:hover { opacity: 1; }
.mx-empty { padding: 24px; text-align: center; color: #9c9cb5; font-size: 13px; }
.mx-facts { border-top: 1px solid #ececf5; }
.mx-fact {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 2px; border-bottom: 1px solid #f4f4fa; font-size: 13px;
}
.mx-fact > span { color: #6b6b85; flex: 0 0 130px; }
.mx-fact > strong { color: #1a1a2e; font-weight: 600; }
.hxm-bar { flex: 1 1 100%; height: 5px; border-radius: 3px; background: #eef0f5; overflow: hidden; }
.hxm-bar > i { display: block; height: 100%; background: #16a34a; }
.hxm-bar.amber > i { background: #f59e0b; }
.hxm-bar.red > i { background: #dc2626; }

#cl-next, #cl-go { width: 100%; margin-top: 16px; }
.cl-back {
  display: block; width: 100%; margin-top: 10px; background: none; border: 0;
  color: #6b6b85; font-size: 12.5px; font-family: inherit; cursor: pointer; padding: 6px;
}
.cl-back:hover { color: #5641f3; }
.cl-note { font-size: 11.5px; color: #9c9cb5; margin: 12px 0 0; line-height: 1.5; }

/* ══════════════════════════════════════════════════════════════════════════
   Support (customer) — REDESIGN 2026-08-19: Console-language messenger.
   Conversation list as lifted cards with deterministic avatars, thread as a
   framed chat workspace (day separators, grouped bubbles, floating composer),
   compose as a focused card. Tokens only — dark mode comes along for free,
   EXCEPT the avatar palette, which gets an explicit dark remap below (same
   pattern as tokens.css itself).
   ══════════════════════════════════════════════════════════════════════════ */
.sup-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.sup-head .section-desc { margin-bottom: 0; }
.sup-new-btn { flex: none; white-space: nowrap; }

/* skeletons — the cw-skel shimmer, sized for list rows / bubbles */
#sup-skeleton .sup-skel-row, .sup-msgs .sup-skel-row {
  position: relative; overflow: hidden;
  height: 74px; border-radius: var(--cw-r-lg); margin-bottom: 10px;
  background: var(--cw-surface-2);
}
.sup-msgs .sup-skel-row { height: 48px; width: 55%; border-radius: var(--cw-r-md); }
.sup-msgs .sup-skel-row.r { align-self: flex-end; }
#sup-skeleton .sup-skel-row::after, .sup-msgs .sup-skel-row::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  animation: sup-shimmer 1.4s cubic-bezier(.4, 0, .2, 1) infinite;
}
html[data-theme="dark"] #sup-skeleton .sup-skel-row::after,
html[data-theme="dark"] .sup-msgs .sup-skel-row::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent);
}
@keyframes sup-shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) {
  #sup-skeleton .sup-skel-row::after, .sup-msgs .sup-skel-row::after { display: none; }
}

/* deterministic avatar palette — light pairs + explicit dark remap */
.sup-av {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font: 650 14px/1 var(--cw-font); letter-spacing: .01em;
}
.sup-av-0 { background: #ECE9FE; color: #5641F3; }
.sup-av-1 { background: #E6F2EA; color: #16803C; }
.sup-av-2 { background: #FCF0DD; color: #A16207; }
.sup-av-3 { background: #E8F0FA; color: #2563B0; }
.sup-av-4 { background: #FBE9E9; color: #B42318; }
.sup-av-5 { background: #EFEDE4; color: #57544A; }
html[data-theme="dark"] .sup-av-0 { background: #241E4A; color: #A99DF9; }
html[data-theme="dark"] .sup-av-1 { background: #14291B; color: #6BC98B; }
html[data-theme="dark"] .sup-av-2 { background: #2C2312; color: #D9A94A; }
html[data-theme="dark"] .sup-av-3 { background: #16233A; color: #7AA9E0; }
html[data-theme="dark"] .sup-av-4 { background: #301718; color: #E08A85; }
html[data-theme="dark"] .sup-av-5 { background: #26251F; color: #A5A294; }
.sup-av-support {
  background: linear-gradient(135deg, var(--cw-accent), var(--cw-chart-2));
  color: var(--cw-accent-ink);
}
.sup-av-support svg { width: 15px; height: 15px; }

/* empty state — a welcoming hero, not a dashed placeholder */
.sup-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 56px 24px 48px;
  background: var(--cw-surface); border: 1px solid var(--cw-border);
  border-radius: var(--cw-r-lg);
}
.sup-empty-orb {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--cw-accent), var(--cw-chart-2));
  color: var(--cw-accent-ink);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--cw-e1); margin-bottom: 16px;
}
.sup-empty-orb svg { width: 24px; height: 24px; }
.sup-empty h2 { font: var(--cw-title); color: var(--cw-ink); margin: 0 0 8px; }
.sup-empty p { font: var(--cw-body); color: var(--cw-text-soft); max-width: 46ch; margin: 0 auto 20px; }
.sup-empty-hint {
  margin-top: 14px; font: var(--cw-micro); color: var(--cw-text-soft);
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--cw-surface-2); border: 1px solid var(--cw-border);
  border-radius: var(--cw-r-full); padding: 4px 12px;
}
.sup-empty-hint .sup-hint-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--cw-ok); flex: none;
}

/* conversation list — lifted cards with an accent rail on unread */
.sup-list { display: flex; flex-direction: column; gap: 8px; }
.sup-row {
  position: relative;
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%; text-align: left; cursor: pointer;
  background: var(--cw-surface); border: 1px solid var(--cw-border);
  border-radius: var(--cw-r-lg); padding: 14px 16px;
  font: inherit; color: inherit;
  transition: border-color var(--cw-t-micro), box-shadow var(--cw-t-micro), transform var(--cw-t-micro);
}
.sup-row:hover, .sup-row:focus-visible {
  border-color: var(--cw-border-strong); box-shadow: var(--cw-e1); outline: none;
}
.sup-row.is-unread::before {
  content: ''; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 3px;
  border-radius: 3px; background: var(--cw-accent);
}
.sup-row-main { flex: 1; min-width: 0; }
.sup-row-top { display: flex; align-items: baseline; gap: 8px; }
.sup-row-subject {
  font: 600 14px/20px var(--cw-font); color: var(--cw-text);
  flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sup-row.is-unread .sup-row-subject { color: var(--cw-ink); font-weight: 700; }
.sup-row-time {
  flex: none; font: 500 11px/16px var(--cw-font-mono); color: var(--cw-text-faint);
  display: inline-flex; align-items: center; gap: 6px;
}
.sup-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cw-accent); flex: none; }
.sup-row-preview {
  font: var(--cw-small); color: var(--cw-text-soft); margin: 2px 0 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sup-row.is-unread .sup-row-preview { color: var(--cw-text); font-weight: 500; }
.sup-row-meta { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sup-row-site {
  font: 500 11px/16px var(--cw-font-mono); color: var(--cw-text-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* status badges — dot + label, the Health language */
.sup-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: var(--cw-r-full);
  font: 600 11px/16px var(--cw-font); letter-spacing: .01em; white-space: nowrap;
}
.sup-badge .sup-bdot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }
.sup-badge-info  { background: var(--cw-info-bg);   color: var(--cw-info);   border: 1px solid var(--cw-info-border); }
.sup-badge-warn  { background: var(--cw-warn-bg);   color: var(--cw-warn);   border: 1px solid var(--cw-warn-border); }
.sup-badge-ok    { background: var(--cw-ok-bg);     color: var(--cw-ok);     border: 1px solid var(--cw-ok-border); }
.sup-badge-muted { background: var(--cw-surface-2); color: var(--cw-text-faint); border: 1px solid var(--cw-border); }

/* shared view chrome */
.sup-back {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; padding: 0; margin-bottom: 16px;
  color: var(--cw-text-soft); cursor: pointer; font: 600 13px/18px var(--cw-font);
  transition: color var(--cw-t-micro);
}
.sup-back:hover { color: var(--cw-accent); }
.sup-view-title { font: var(--cw-title); color: var(--cw-ink); margin: 0 0 4px; }
.sup-error { color: var(--cw-danger); background: var(--cw-danger-bg); border: 1px solid var(--cw-danger-border);
  border-radius: var(--cw-r-sm); padding: 8px 12px; font: var(--cw-small); margin: 10px 0; }
.sup-optional { color: var(--cw-text-faint); font-weight: 400; }

/* compose — one focused card */
.sup-compose-card {
  max-width: 640px;
  background: var(--cw-surface); border: 1px solid var(--cw-border);
  border-radius: var(--cw-r-lg); padding: var(--cw-s6);
}
.sup-compose-sub { font: var(--cw-small); color: var(--cw-text-soft); margin: 0 0 20px; }
.sup-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .sup-field-row { grid-template-columns: 1fr; } }

/* thread — a framed chat workspace */
.sup-thread-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--cw-s4); margin-bottom: var(--cw-s4);
}
.sup-thread-titles { min-width: 0; }
.sup-thread-head .sup-view-title { margin: 0 0 3px; }
.sup-thread-head .sup-badge { flex: none; margin-top: 3px; }
/* Secondary metadata line: topic · site. Hidden outright when a conversation
   has neither — an empty strip under the title reads as a broken template. */
.sup-thread-meta {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  min-width: 0; font: var(--cw-micro); color: var(--cw-text-soft);
}
.sup-thread-meta.is-empty { display: none; }
.sup-meta-sep { color: var(--cw-border-strong); }
.sup-meta-site {
  font-family: var(--cw-font-mono); font-size: 11px; color: var(--cw-text-faint);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sup-thread-shell {
  display: flex; flex-direction: column;
  background: var(--cw-surface); border: 1px solid var(--cw-border);
  border-radius: var(--cw-r-lg); overflow: hidden;
}
.sup-msgs {
  display: flex; flex-direction: column; gap: 4px;
  /* Grows with the conversation and scrolls only once it is genuinely long —
     a fixed height parks a 3-message thread in a half-empty well. The header
     and composer sit outside this box, so they stay put while it scrolls. */
  min-height: 200px; max-height: min(56vh, 560px); overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 20px 14px; background: var(--cw-bg);
}
.sup-day {
  display: flex; align-items: center; gap: 12px; margin: 14px 0 8px;
  color: var(--cw-text-faint);
  font: 600 10px/14px var(--cw-font-mono); letter-spacing: .09em; text-transform: uppercase;
}
.sup-day:first-child { margin-top: 0; }
.sup-day::before, .sup-day::after { content: ''; flex: 1; height: 1px; background: var(--cw-border); }
.sup-msg { display: flex; gap: 10px; max-width: 78%; margin-top: 10px; }
.sup-msg.is-grouped { margin-top: 2px; }
.sup-msg-av-slot { flex: none; width: 28px; margin-top: 19px; }
.sup-msg-av-slot .sup-av { width: 28px; height: 28px; }
.sup-msg.is-grouped .sup-msg-av-slot { visibility: hidden; margin-top: 0; }
.sup-msg-c { min-width: 0; }
.sup-msg-head { display: flex; gap: 8px; align-items: baseline; margin: 0 4px 3px; }
.sup-msg.is-grouped .sup-msg-head { display: none; }
.sup-msg-who { font: 650 12px/16px var(--cw-font); color: var(--cw-text); }
.sup-msg-support .sup-msg-who { color: var(--cw-accent); }
.sup-msg-time { color: var(--cw-text-faint); font: 500 10px/14px var(--cw-font-mono); }
/* Flat bubbles: one hairline border, no shadow. Elevation on every message
   turns a calm thread into a pile of floating cards. */
.sup-msg-body {
  border-radius: 14px; padding: 9px 14px;
  font: var(--cw-small); line-height: 1.55; color: var(--cw-ink);
  white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--cw-surface); border: 1px solid var(--cw-border);
}
.sup-msg-support { align-self: flex-start; }
.sup-msg-support .sup-msg-body { border-top-left-radius: 5px; }
.sup-msg-me { align-self: flex-end; flex-direction: row-reverse; }
.sup-msg-me .sup-msg-head { justify-content: flex-end; }
.sup-msg-me .sup-msg-body {
  background: var(--cw-accent-subtle); border-color: var(--cw-accent-border);
  border-top-right-radius: 5px;
}
.sup-msg.is-pending .sup-msg-body { opacity: .55; }

/* ── Support attachments ──────────────────────────────────────────────────
   Screenshots on a message, and the chips shown while composing.            */

.sup-attach-input { display: none; }

.sup-attach {
  display: flex; flex-direction: column; gap: 8px; margin: -4px 0 4px;
}
.sup-attach-btn {
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
  padding: 6px 11px; border: 1px dashed var(--cw-border); background: none;
  border-radius: 8px; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 500; color: var(--cw-text-muted);
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.sup-attach-btn:hover { border-color: var(--cw-accent); color: var(--cw-accent); }
.sup-attach-btn svg { width: 14px; height: 14px; }

/* Icon-only variant inside the reply composer's footer. */
.sup-attach-btn-sm {
  border: 0; padding: 4px; margin-right: 2px; border-radius: 6px;
}
.sup-attach-btn-sm:hover { background: var(--cw-surface-2); }

.sup-attach-list { display: none; flex-wrap: wrap; gap: 6px; }
.sup-attach-list.has-files { display: flex; }
/* Sits between the textarea and the footer. No top padding: the textarea
   already ends with 10px of its own, and doubling it left the chip
   floating in a band of empty space. Left edge matches the textarea and
   footer (14px) so the three line up. */
#sup-reply-files.has-files { padding: 0 14px 10px; }

.sup-file {
  display: inline-flex; align-items: center; gap: 7px;
  max-width: 240px; padding: 4px 6px 4px 10px;
  background: var(--cw-surface-2); border: 1px solid var(--cw-border);
  border-radius: 999px; font-size: 11.5px; color: var(--cw-text);
}
.sup-file-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-file-s { flex: none; color: var(--cw-text-faint); font-size: 10.5px; }
.sup-file-x {
  flex: none; border: 0; background: none; cursor: pointer; line-height: 1;
  padding: 0 2px; font-size: 15px; color: var(--cw-text-faint);
}
.sup-file-x:hover { color: var(--cw-danger, #c0392b); }

/* An upload in flight: the chip pulses so "why is Send refusing?" is visible. */
.sup-file.is-uploading { opacity: .6; }
.sup-file.is-uploading .sup-file-s::after { content: '…'; }
.sup-file.is-error {
  border-color: rgba(192, 57, 43, .4); background: rgba(192, 57, 43, .06);
}
.sup-file.is-error .sup-file-s { color: #c0392b; }

/* Delivered attachments.
   Aligned with the bubble they belong to — a right-aligned message must not
   have left-aligned attachments hanging off it, which is what made them read
   as loose objects rather than part of the message. */
.sup-msg-atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sup-msg-me .sup-msg-atts { justify-content: flex-end; }

.sup-att {
  display: inline-flex; align-items: center; gap: 9px;
  max-width: 260px; padding: 8px 12px 8px 10px; cursor: pointer;
  border: 1px solid var(--cw-border); border-radius: 11px;
  background: var(--cw-surface); font: inherit; color: var(--cw-ink);
  text-align: left; transition: border-color .15s ease, box-shadow .15s ease;
}
.sup-att:hover  { border-color: var(--cw-accent); box-shadow: 0 1px 6px rgba(0,0,0,.06); }
.sup-att:active { transform: translateY(1px); }
.sup-att.is-loading { opacity: .55; pointer-events: none; }

.sup-att-ic {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--cw-surface-2); color: var(--cw-text-muted);
}
.sup-att-ic svg { width: 15px; height: 15px; }
.sup-att-t { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.sup-att-n {
  font-size: 12.5px; font-weight: 500; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sup-att-s { font-size: 10.5px; color: var(--cw-text-faint); line-height: 1.2; }

/* The customer's own bubble is tinted; keep attachments legible on it. */
.sup-msg-me .sup-att { background: rgba(255, 255, 255, .6); }

.sup-msg.is-failed .sup-msg-body { border-color: var(--cw-danger-border); background: var(--cw-danger-bg); }
.sup-retry { background: none; border: none; padding: 0; color: var(--cw-danger);
  font: 500 11px/16px var(--cw-font); cursor: pointer; text-decoration: underline; }
.sup-fail-why { color: var(--cw-danger); font: 500 11px/16px var(--cw-font); }
@media (prefers-reduced-motion: no-preference) {
  .sup-msg.is-new { animation: sup-msg-in .2s ease-out; }
  @keyframes sup-msg-in { from { opacity: 0; transform: translateY(5px); } }
}

/* Lifecycle notice — a system state that belongs to the thread, not a stray
   sentence: status dot, a stated fact, and what to do about it. */
.sup-thread-notice {
  display: flex; align-items: flex-start; gap: 9px;
  margin: 0; padding: 11px 20px;
  background: var(--cw-surface-2); border-top: 1px solid var(--cw-border);
  font: var(--cw-small); color: var(--cw-text-soft); text-align: left;
}
.sup-notice-dot {
  width: 6px; height: 6px; border-radius: 50%; flex: none; margin-top: 7px;
  background: var(--cw-text-faint);
}
.sup-thread-notice.is-resolved .sup-notice-dot { background: var(--cw-ok); }
.sup-notice-t { color: var(--cw-ink); font-weight: 600; }
.sup-notice-d { color: var(--cw-text-soft); }

/* composer — a quiet card that lights up on focus */
.sup-comp {
  margin: 0; padding: var(--cw-s3) var(--cw-s4) var(--cw-s4);
  border-top: 1px solid var(--cw-border); background: var(--cw-surface);
}
.sup-comp-box {
  border: 1px solid var(--cw-border-strong); border-radius: var(--cw-r-md);
  background: var(--cw-surface); overflow: hidden;
  transition: border-color var(--cw-t-micro), box-shadow var(--cw-t-micro);
}
.sup-comp-box:focus-within { border-color: var(--cw-accent); box-shadow: 0 0 0 3px var(--cw-accent-subtle); }
.sup-comp-box textarea {
  display: block; width: 100%; border: 0; background: none; resize: none;
  padding: 12px 14px 10px; box-sizing: border-box;
  font: var(--cw-small); font-family: inherit; line-height: 1.55; color: var(--cw-ink);
  min-height: 46px; max-height: 160px;
}
.sup-comp-box textarea:focus { outline: none; }
.sup-comp-box textarea::placeholder { color: var(--cw-text-faint); }
/* Divider between what you're writing and the controls that act on it. */
.sup-comp-foot {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 8px 14px; border-top: 1px solid var(--cw-border);
}
.sup-comp-hint { font: 500 10px/14px var(--cw-font-mono); color: var(--cw-text-faint); }
.sup-send {
  margin-left: auto; display: inline-flex; align-items: center; gap: 7px;
  background: var(--cw-accent); color: var(--cw-accent-ink);
  border: 0; border-radius: var(--cw-r-md);
  font: 600 13px/1 var(--cw-font); font-family: inherit;
  padding: 8px 14px; cursor: pointer;
  transition: background var(--cw-t-micro), color var(--cw-t-micro), transform var(--cw-t-micro);
}
.sup-send svg { width: 13px; height: 13px; }
.sup-send:hover:not(:disabled) { background: var(--cw-accent-hover); }
.sup-send:active:not(:disabled) { transform: scale(.98); }
.sup-send:focus-visible { outline: 2px solid var(--cw-accent); outline-offset: 2px; }
/* Empty composer: a neutral, obviously-inert button — not a faded purple one. */
.sup-send:disabled { background: var(--cw-surface-2); color: var(--cw-text-faint); cursor: default; }
/* In flight: keep the accent (the action is real), swap the arrow for a ring. */
.sup-send.is-busy:disabled { background: var(--cw-accent); color: var(--cw-accent-ink); }
.sup-send.is-busy svg { display: none; }
.sup-send.is-busy::after {
  content: ''; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: sup-spin .7s linear infinite;
}
@keyframes sup-spin { to { transform: rotate(360deg); } }

/* In-thread states (failed load, and any future in-canvas message) — designed
   blocks rather than a raw sentence dropped on the canvas. */
.sup-state {
  margin: auto; padding: 28px 20px; text-align: center; max-width: 34ch;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.sup-state-icon {
  width: 40px; height: 40px; border-radius: 50%; margin-bottom: 4px;
  background: var(--cw-surface); border: 1px solid var(--cw-border);
  color: var(--cw-text-faint);
  display: flex; align-items: center; justify-content: center;
}
.sup-state-icon svg { width: 18px; height: 18px; }
.sup-state-title { font: 600 14px/20px var(--cw-font); color: var(--cw-ink); }
.sup-state-text  { font: var(--cw-small); color: var(--cw-text-soft); }

/* ── responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sup-compose-card { max-width: none; }
}
@media (max-width: 640px) {
  .sup-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .sup-new-btn { width: 100%; justify-content: center; }
  .sup-row { padding: 12px 14px; gap: 10px; }
  .sup-av { width: 32px; height: 32px; font-size: 13px; }
  /* Back is the only way out of a thread on a phone — give it a real target. */
  .sup-back { padding: 7px 10px; margin: 0 0 12px -10px; border-radius: var(--cw-r-sm); }
  .sup-back:active { background: var(--cw-surface-2); }
  .sup-thread-head { flex-direction: column; gap: 8px; }
  .sup-msg { max-width: 88%; }
  .sup-msgs { padding: 14px 12px 10px; min-height: 180px; max-height: 52vh; }
  .sup-comp { padding: 10px 12px 12px; }
  .sup-comp-hint { display: none; }
  .sup-comp-foot { justify-content: flex-end; padding: 8px 10px; }
  .sup-compose-card { padding: var(--cw-s4); border-radius: var(--cw-r-md); }
  .sup-empty { padding: 40px 18px 36px; }
}

/* ── Evaluation-account notice ────────────────────────────────────────────
 *
 * Rendered once inside #dash-main but outside every tab panel, so it appears
 * on all screens. Amber rather than red: this is orientation for a reviewer,
 * not a fault to fix — a danger colour here would read as "your account is
 * broken" on every single page.
 */
.cw-test-banner {
  margin: 0 0 20px;
  border: 1px solid #f0c36d;
  border-left: 4px solid #d98c1f;
  background: #fffaf0;
  border-radius: 10px;
}
.cw-test-banner.hidden { display: none; }
.cw-test-banner-in { padding: 14px 18px; color: #5c4213; font-size: 13.5px; line-height: 1.55; }
.cw-test-banner-in strong { display: block; color: #7a5410; font-size: 14px; margin-bottom: 6px; }
.cw-test-banner-in p { margin: 0 0 6px; }
.cw-test-banner-in ol { margin: 0 0 8px; padding-left: 20px; }
.cw-test-banner-in li { margin: 3px 0; }
.cw-test-banner-in b { font-weight: 650; }
.cw-test-banner-note { font-size: 12.5px; opacity: .85; margin-top: 8px !important; }

html[data-theme="dark"] .cw-test-banner { background: #2a2008; border-color: #6b5416; border-left-color: #d98c1f; }
html[data-theme="dark"] .cw-test-banner-in { color: #e8d9b0; }
html[data-theme="dark"] .cw-test-banner-in strong { color: #f2c96b; }

/* ── Change Template modal ────────────────────────────────────────────────
 *
 * A large browsing surface, not a dialog with a dropdown in it: the whole point
 * is that choosing a replacement template feels like Launch a Site. The grid,
 * cards, chips and pager inside it are the SAME classes the Sites tab library
 * uses, so they inherit that styling and cannot drift from it.
 */
.ct-modal {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(15, 16, 24, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.ct-modal.hidden { display: none; }
.ct-card {
  background: var(--surface, #fff);
  border-radius: 16px;
  width: min(1080px, 100%);
  max-height: min(88vh, 900px);
  display: flex; flex-direction: column;
  box-shadow: 0 24px 64px -12px rgba(15, 16, 24, .35);
  overflow: hidden;
}
.ct-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 24px 14px; border-bottom: 1px solid var(--line, #e8e8ef);
}
.ct-head h3 { margin: 0 0 4px; font-size: 17px; font-weight: 680; }
.ct-sub { margin: 0; font-size: 13px; color: var(--muted, #6b6b7b); }
.ct-sub strong { color: var(--text, #1a1a24); font-weight: 640; }
.ct-dom { font-family: var(--font-mono, monospace); font-size: 11.5px; opacity: .8; margin-left: 6px; }
.ct-close {
  border: 0; background: none; font-size: 26px; line-height: 1;
  color: var(--muted-2, #9a9aab); cursor: pointer; padding: 0 4px;
}
.ct-close:hover { color: var(--text, #1a1a24); }

/* Each view scrolls on its own so the header and footer stay put. */
.ct-view { overflow-y: auto; padding: 16px 24px; flex: 1; min-height: 0; }
.ct-view.hidden { display: none; }

.ct-current {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface-2, #f6f6f9); border: 1px solid var(--line, #e8e8ef);
  border-radius: 999px; padding: 5px 14px; margin-bottom: 14px;
}
.ct-current-k { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-2, #9a9aab); }
.ct-current-v { font-size: 13px; font-weight: 640; }

.ct-tools { margin-bottom: 12px; }
.ct-tools input {
  width: 100%; padding: 9px 14px; font-size: 13.5px;
  border: 1px solid var(--line, #e8e8ef); border-radius: 10px;
  background: var(--surface, #fff); color: var(--text, #1a1a24);
}
.ct-tools input:focus { outline: 2px solid var(--accent, #5b3bf5); outline-offset: -1px; }

/* Current / unavailable states on the shared card component. */
.cwp-card-tag-state {
  background: #4b5563; color: #fff; border-radius: 999px;
  padding: 2px 9px; font-size: 10.5px; font-weight: 650;
}
.cwp-card-tag-state.is-current { background: var(--accent, #5b3bf5); }
.cwp-templates-explore-card.is-current { outline: 2px solid var(--accent, #5b3bf5); outline-offset: 2px; }
.cwp-templates-explore-card.is-unavailable .cwp-templates-explore-card-image-wrapper { opacity: .55; }
.cwp-templates-explore-create-btn.is-disabled,
.cwp-templates-explore-create-btn:disabled { opacity: .6; cursor: not-allowed; }

/* Confirm view — say plainly what goes and what stays. */
.ct-confirm-h { margin: 4px 0 14px; font-size: 16px; font-weight: 680; }
.ct-facts { margin: 0 0 14px; padding-left: 18px; font-size: 13.5px; line-height: 1.7; }
.ct-facts b { font-weight: 650; }
.ct-warn {
  background: #fffaf0; border: 1px solid #f0c36d; border-radius: 10px;
  padding: 10px 14px; font-size: 13px; color: #5c4213; margin: 0 0 18px;
}
.ct-confirm-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 4px; }
.ct-err { color: var(--danger, #dc2626); font-size: 13px; margin-top: 12px; }
.ct-err.hidden { display: none; }

/* Progress view. */
#ct-progress { text-align: center; padding-top: 48px; padding-bottom: 48px; }
.ct-prog-spin {
  width: 34px; height: 34px; margin: 0 auto 18px;
  border: 3px solid var(--line, #e8e8ef); border-top-color: var(--accent, #5b3bf5);
  border-radius: 50%; animation: ct-spin .9s linear infinite;
}
@keyframes ct-spin { to { transform: rotate(360deg); } }
.ct-prog-h { margin: 0 0 8px; font-size: 16px; font-weight: 680; }
.ct-prog-t { margin: 0 auto 20px; font-size: 13.5px; color: var(--muted, #6b6b7b); max-width: 46ch; line-height: 1.6; }

.ct-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 24px; border-top: 1px solid var(--line, #e8e8ef);
}
.ct-foot.hidden { display: none; }

@media (max-width: 720px) {
  .ct-modal { padding: 0; }
  .ct-card { max-height: 100vh; border-radius: 0; width: 100%; }
}
html[data-theme="dark"] .ct-warn { background: #2a2008; border-color: #6b5416; color: #e8d9b0; }

/* The modal's grid sizes to the MODAL, not the viewport.
 *
 * .sites-templates-grid's column count keys off viewport width — correct for a
 * full-width page section, wrong inside a fixed 1080px dialog, where a 1600px
 * screen would ask for 4 columns and leave each card ~250px wide under a 310px
 * tall preview image. Scoped to #ct-grid so the Sites tab is untouched. */
#ct-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 18px;
}
/* The card imagery is sized for a full-width page; give the modal a shorter
   crop so more than one row is visible without scrolling. */
#ct-grid .cwp-templates-explore-card-image-wrapper { height: 220px; }
