:root {
  --pulse-blue: var(--lfl-blue-text, #4aa3ff);
  --pulse-blue-soft: var(--lfl-blue-wash, rgba(74, 163, 255, .14));
  --pulse-border: var(--lfl-border, #303a47);
  --pulse-panel: var(--lfl-surface, #11161d);
  --pulse-panel-2: var(--lfl-surface, #0b1016);
}

.pulse-page-layout {
  width: 100%;
  max-width: 100%;
  margin: 20px auto;
}

.pulse-page {
  flex: 0 1 960px;
  width: 100%;
  max-width: 960px;
  margin: 0 auto 80px 0;
  color: var(--lfl-text, #f5f7fb);
}

.pulse-page-sidebar .sidebar-item { gap: 8px; }
.pulse-page-sidebar .sidebar-item > span:first-child { min-width: 0; }
.pulse-nav-count { margin-left: auto; font-variant-numeric: tabular-nums; opacity: .85; }

.pulse-hero,
.pulse-history-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 24px;
  border: 1px solid var(--pulse-border);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 0, var(--lfl-blue-wash, rgba(74, 163, 255, .24)), transparent 42%),
    linear-gradient(145deg, var(--lfl-surface-soft, #151c25), var(--lfl-surface, #0b0f15) 72%);
  box-shadow: 0 18px 55px var(--lfl-shadow, rgba(0, 0, 0, .24));
}

.pulse-heart {
  position: relative;
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  border-radius: 24px;
  background: var(--lfl-wash, rgba(255, 255, 255, .05));
}

.pulse-heart > span:first-child {
  font-size: 44px;
}

.pulse-heart-bolt {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-48%, -50%);
  color: #fff;
  -webkit-text-fill-color: #fff;
  font-family: Arial, sans-serif;
  font-size: 23px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 4px #06447f;
}

.pulse-heart-bolt[hidden] { display: none; }

.pulse-hero h1,
.pulse-history-header h1 {
  margin: 2px 0 7px;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1;
}

.pulse-hero p,
.pulse-history-header p {
  margin: 0;
  color: var(--lfl-muted, #b7c0cd);
  line-height: 1.55;
}

.pulse-eyebrow {
  color: var(--lfl-blue-text, #79baff) !important;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.pulse-count-card {
  min-width: 112px;
  padding: 16px;
  border: 1px solid var(--lfl-blue-border, rgba(74, 163, 255, .42));
  border-radius: 14px;
  background: var(--pulse-blue-soft);
  text-align: center;
}

.pulse-count-card strong {
  display: block;
  color: var(--lfl-text, #fff);
  font-size: 34px;
  line-height: 1;
}

.pulse-count-card span {
  display: block;
  margin-top: 6px;
  color: var(--lfl-blue-text, #bcdcff);
  font-size: 12px;
  font-weight: 700;
}

.pulse-status,
.pulse-action-status {
  min-height: 24px;
  margin: 16px 0;
  color: var(--lfl-muted, #b8c1cd);
  text-align: center;
}

.pulse-status.is-error,
.pulse-action-status.is-error { color: var(--lfl-red-text, #ff9696); }
.pulse-status.is-ok,
.pulse-action-status.is-ok { color: var(--lfl-green-text, #7ee2a8); }

.pulse-layout {
  display: block;
}

.pulse-join-card,
.pulse-supporters-card,
.pulse-history-summary,
.pulse-history-list {
  border: 1px solid var(--pulse-border);
  border-radius: 16px;
  background: var(--pulse-panel);
}

.pulse-join-card,
.pulse-supporters-card { padding: 20px; }

.pulse-membership {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 15px 16px;
  border-left: 4px solid var(--pulse-blue);
  border-radius: 10px;
  background: var(--pulse-blue-soft);
  color: inherit;
  text-align: left;
}

.pulse-membership-toggle {
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  font: inherit;
  cursor: default;
}

.pulse-membership strong,
.pulse-supporters-card h2 {
  display: block;
  margin: 0 0 5px;
  font-size: 22px;
}

.pulse-membership small { display: block; color: var(--lfl-text, #c0cad6); font-size: 14px; }
.pulse-membership-chevron { display: none; color: var(--lfl-blue-text, #a9d4ff); font-size: 20px; transition: transform .16s ease; }
.pulse-join-details[hidden] { display: none !important; }

.pulse-form-grid {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
}

.pulse-form-grid label > span,
.pulse-identity legend {
  display: block;
  margin-bottom: 6px;
  color: var(--lfl-text, #c8d0da);
  font-size: 13px;
  font-weight: 700;
}

.pulse-form-grid input {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--lfl-border, #384554);
  border-radius: 9px;
  background: var(--lfl-surface, #080c11);
  color: var(--lfl-text, #fff);
  box-sizing: border-box;
}

.pulse-identity {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  padding: 0;
  border: 0;
}

.pulse-identity label {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--lfl-border, #303b49);
  border-radius: 10px;
  background: var(--pulse-panel-2);
  cursor: pointer;
}

.pulse-identity input { margin-top: 3px; }
.pulse-identity span { display: grid; gap: 3px; }
.pulse-identity small { color: var(--lfl-muted, #9ba7b5); line-height: 1.35; }

.pulse-primary {
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--lfl-blue-border, #74b8ff);
  border-radius: 11px;
  background: linear-gradient(180deg, var(--lfl-blue-solid, #258ff8), var(--lfl-blue-solid, #1165bd));
  color: var(--lfl-text, #fff);
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
}

button.pulse-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.pulse-button-heart {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--lfl-border, rgba(255, 255, 255, .9));
  border-radius: 50%;
  background: var(--lfl-surface, #fff);
  box-shadow: 0 2px 7px rgba(0, 31, 68, .28);
}

.pulse-button-heart-emoji {
  font-size: 23px;
  line-height: 1;
}

.pulse-button-heart-bolt {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-48%, -50%);
  color: #fff;
  -webkit-text-fill-color: #fff;
  font-family: Arial, sans-serif;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 3px #06447f;
}

.pulse-primary:disabled { opacity: .55; cursor: not-allowed; }
.pulse-primary--link { width: auto; min-height: 0; text-decoration: none; }

.pulse-fineprint { margin: 16px 0 0; color: var(--lfl-muted, #929eac); font-size: 12px; line-height: 1.5; }

.pulse-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.pulse-section-heading p { margin: 0 0 4px; }
.pulse-section-description { color: var(--lfl-muted, #9ca9b8); font-size: 13px; line-height: 1.45; }

.pulse-section-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.pulse-top-sort {
  display: grid;
  gap: 4px;
  min-width: 170px;
  color: var(--lfl-muted, #9ca9b8);
  font-size: 12px;
  font-weight: 700;
}

.pulse-top-sort[hidden] { display: none !important; }

.pulse-top-sort select {
  min-height: 36px;
  padding: 7px 30px 7px 10px;
  border: 1px solid var(--lfl-border, #3a4858);
  border-radius: 8px;
  background: var(--lfl-surface, #0b1118);
  color: var(--lfl-text, #dce7f5);
  font: inherit;
}

.pulse-section-heading button,
.pulse-history-card a {
  padding: 8px 11px;
  border: 1px solid var(--lfl-border, #3a4858);
  border-radius: 8px;
  background: var(--lfl-surface, #0b1118);
  color: var(--lfl-text, #dce7f5);
  text-decoration: none;
}

.pulse-supporters { display: grid; gap: 9px; }

.pulse-supporter {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--lfl-border, #293442);
  border-radius: 11px;
  background: var(--pulse-panel-2);
}

.pulse-rank { color: var(--lfl-blue-text, #78baff); font-weight: 900; }
.pulse-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--lfl-surface-soft, #202b38);
}
.pulse-avatar-link { display: block; width: 42px; height: 42px; border-radius: 50%; }
.pulse-avatar-link:focus-visible { outline: 2px solid var(--lfl-blue-border, #78baff); outline-offset: 3px; }
.pulse-avatar--ghost { display: grid; place-items: center; font-size: 25px; }
.pulse-supporter-main { min-width: 0; }
.pulse-supporter-main strong,
.pulse-supporter-main a,
.pulse-supporter-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pulse-supporter-profile { color: var(--lfl-text, #f4f8ff); font-weight: 800; text-decoration: none; }
a.pulse-supporter-profile:hover { color: var(--lfl-blue-text, #8fc7ff); text-decoration: underline; }
.pulse-supporter-main small { margin-top: 3px; color: var(--lfl-muted, #919dac); }
.pulse-supporter-message {
  margin: 7px 0 0;
  color: var(--lfl-text, #d8e2ee);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.pulse-supporter-metrics { display: grid; gap: 5px; justify-items: end; text-align: right; }
.pulse-supporter-sats { color: var(--lfl-amber-text, #ffd969); font-weight: 800; white-space: nowrap; }
.pulse-supporter-lifetime { color: var(--lfl-blue-text, #8fc7ff); font-size: 12px; font-weight: 800; white-space: nowrap; }
.pulse-supporter-state { color: var(--lfl-muted, #9aa6b4); font-size: 12px; white-space: nowrap; }
.pulse-empty { padding: 35px 15px; color: var(--lfl-muted, #9aa6b4); text-align: center; }

.pulse-history-header { grid-template-columns: minmax(0, 1fr) auto; }
.pulse-history-summary { margin-top: 18px; padding: 18px; }
.pulse-history-summary.is-active { border-color: var(--lfl-blue-border, rgba(74, 163, 255, .65)); background: var(--pulse-blue-soft); }
.pulse-history-summary h2 { margin: 0 0 5px; }
.pulse-history-summary p { margin: 0; color: var(--lfl-text, #b9c5d3); }
.pulse-history-list { display: grid; gap: 10px; margin-top: 18px; padding: 18px; }
.pulse-history-list > h2 { margin: 0 0 4px; }
.pulse-history-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--lfl-border, #2d3947);
  border-radius: 11px;
  background: var(--pulse-panel-2);
}
.pulse-history-card h3 { margin: 0 0 5px; font-size: 17px; }
.pulse-history-card p { margin: 0; color: var(--lfl-muted, #96a3b2); font-size: 13px; line-height: 1.5; }
.pulse-history-state { padding: 7px 10px; border-radius: 999px; font-weight: 800; }
.pulse-history-state--paid { background: var(--lfl-green-wash, rgba(50, 190, 113, .16)); color: var(--lfl-green-text, #84e7ac); }
.pulse-history-state--pending { background: var(--lfl-amber-wash, rgba(255, 202, 73, .13)); color: var(--lfl-amber-text, #ffda77); }
.pulse-history-state--expired { background: var(--lfl-blue-wash, rgba(148, 163, 184, .13)); color: var(--lfl-muted, #aeb8c6); }
.pulse-history-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pulse-history-actions a,
.pulse-history-actions button {
  padding: 8px 11px;
  border: 1px solid var(--lfl-border, #3a4858);
  border-radius: 8px;
  background: var(--lfl-surface, #0b1118);
  color: var(--lfl-text, #dce7f5);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

@media (max-width: 780px) {
  .pulse-page { flex-basis: auto; width: min(100% - 20px, 960px); max-width: 960px; margin-top: 14px; }
  .pulse-hero { grid-template-columns: auto minmax(0, 1fr); padding: 18px; }
  .pulse-count-card { grid-column: 1 / -1; }
  .pulse-heart { width: 62px; height: 62px; border-radius: 18px; }
  .pulse-heart > span:first-child { font-size: 34px; }
  .pulse-heart-bolt { font-size: 18px; }
  .pulse-membership-toggle { cursor: pointer; }
  .pulse-membership-chevron { display: inline-block; }
  .pulse-membership-toggle[aria-expanded="true"] .pulse-membership-chevron { transform: rotate(180deg); }
  .pulse-form-grid { grid-template-columns: 1fr; }
  .pulse-history-header { grid-template-columns: 1fr; }
  .pulse-primary--link { text-align: center; }
  .pulse-section-actions { justify-content: flex-start; }
}

@media (max-width: 470px) {
  .pulse-hero { grid-template-columns: 1fr; text-align: center; }
  .pulse-heart { margin: auto; }
  .pulse-supporter { grid-template-columns: auto auto minmax(0, 1fr); }
  .pulse-supporter-sats { grid-column: 3; }
  .pulse-history-card { grid-template-columns: 1fr; }
  .pulse-history-state { justify-self: start; }
}

@media (max-width: 900px) {
  .pulse-page-layout { margin: 10px auto; }
  .pulse-page { margin-bottom: 70px; }
}

@media (max-width: 620px) {
  .pulse-supporter {
    grid-template-columns: auto auto minmax(0, 1fr);
  }
  .pulse-supporter-metrics {
    grid-column: 2 / -1;
    justify-items: start;
    text-align: left;
    grid-template-columns: repeat(2, minmax(0, max-content));
    gap: 4px 12px;
  }
}

/* Private membership uses the same sidebar/column as the public Pulse page. */
.pulse-history-page [hidden] { display:none !important; }
.pulse-history-header-actions { display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.pulse-history-refresh { padding:9px 13px; border:1px solid var(--pulse-border); border-radius:10px; background:var(--pulse-panel); color:inherit; font:inherit; cursor:pointer; }
.pulse-history-refresh:disabled { opacity:.6; cursor:wait; }
.pulse-history-summary .pulse-membership-support { margin-top:12px; }
.pulse-membership-facts { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:14px; margin:20px 0; }
.pulse-membership-facts > div { min-width:0; padding:14px; border:1px solid var(--pulse-border); border-radius:12px; background:var(--pulse-panel); }
.pulse-membership-facts dt { font-size:.85rem; color:var(--lfl-muted,#96a3b2); }
.pulse-membership-facts dd { margin:6px 0 0; font-weight:700; overflow-wrap:anywhere; }
.pulse-history-card .pulse-history-comment-label { margin-top:12px; font-weight:600; }
.pulse-history-comment { margin:6px 0 0; padding:8px 12px; border-left:3px solid var(--pulse-blue); white-space:pre-wrap; overflow-wrap:anywhere; color:var(--lfl-text,#dce7f5); }
@media(max-width:470px) { .pulse-membership-facts { grid-template-columns:1fr; } }
