.member-body {
  --sidebar-width: 272px;
  --muted: #476385;
  --line: #c8daf8;
  --paper: #f3f7ff;
  --green: #2563eb;
  --green-deep: #123f9f;
  --mint: #e8f1ff;
  --cyan: #22d3ee;
  --coral: #e86a63;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 16% -8%, rgba(34, 211, 238, 0.28), transparent 30%),
    radial-gradient(circle at 86% 4%, rgba(79, 70, 229, 0.16), transparent 28%),
    linear-gradient(135deg, #eef6ff 0%, #f7fbff 42%, #eaf2ff 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

.member-body *,
.member-body *::before,
.member-body *::after {
  box-sizing: border-box;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 27, 63, 0.68);
  backdrop-filter: blur(8px);
}

.auth-gate[hidden] {
  display: none !important;
}

.auth-card {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  background:
    linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.26);
}

.auth-card h1 {
  margin: 6px 0 8px;
  font-size: clamp(28px, 4vw, 40px);
}

.auth-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.auth-mode {
  display: inline-flex;
  gap: 8px;
  margin: 16px 0 14px;
}

.auth-mode button {
  border: 1px solid rgba(18, 63, 159, 0.2);
  border-radius: 999px;
  padding: 10px 12px;
  color: var(--green-deep);
  background: #f8fbff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.auth-mode button.active {
  color: #fff;
  background: var(--green-deep);
}

.auth-form {
  display: grid;
  gap: 10px;
}

.google-auth-btn {
  width: 100%;
  justify-content: center;
  margin: 0 0 14px;
  gap: 10px;
  color: #163153;
  background: #ffffff;
}

.google-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #1558d6;
  background: #f8fbff;
  font-weight: 900;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.auth-form label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.auth-form [hidden] {
  display: none !important;
}

.auth-form input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  font: inherit;
  background: #fbfcfa;
}

.agent-template-block {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.auth-locked .member-header,
.auth-locked .period-panel,
.auth-locked .member-main {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

.account-actions {
  display: grid;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.account-chip {
  display: grid;
  gap: 3px;
  border: 1px solid rgba(200, 218, 248, 0.9);
  border-radius: 8px;
  padding: 9px 10px;
  color: #163153;
  background: #f3f7ff;
  font-size: 12px;
  font-weight: 700;
}

.account-chip strong,
.account-chip span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-chip span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(200, 218, 248, 0.9);
  border-radius: 8px;
  padding: 10px 11px;
  color: #1746c7;
  background: #ffffff;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.logout-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-chat-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 999;
  display: grid;
  justify-items: end;
  gap: 10px;
  touch-action: auto;
  transition: right 0.22s ease, bottom 0.22s ease, transform 0.22s ease;
}

.range-sheet-open .ai-chat-widget {
  right: 14px;
  bottom: clamp(88px, 46vh, 390px);
}

.ai-chat-toggle {
  display: inline-flex;
  align-items: flex-end;
  gap: 8px;
  min-width: 196px;
  min-height: 104px;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: #ffffff;
  background: transparent;
  filter: drop-shadow(0 18px 28px rgba(21, 88, 214, 0.24));
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  user-select: none;
  touch-action: none;
}

.range-sheet-open .ai-chat-toggle {
  min-width: 76px;
  min-height: 76px;
}

.range-sheet-open .ai-chat-bubble {
  display: none;
}

.ai-chat-avatar {
  position: relative;
  display: grid;
  place-items: end center;
  width: 88px;
  height: 96px;
  flex: 0 0 auto;
  perspective: 240px;
}

.ai-avatar-shirt {
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: 4px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 24px 24px 14px 14px;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.2), transparent 38%),
    linear-gradient(135deg, #1d6cff, #0b357d 78%);
  box-shadow:
    inset 0 0 0 1px rgba(34, 199, 255, 0.4),
    0 16px 28px rgba(14, 51, 121, 0.26);
  transform: rotateX(7deg);
  z-index: 1;
}

.ai-avatar-shirt::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 10px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.76);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #ffffff 0 2px, transparent 3px),
    conic-gradient(from 90deg, #22c7ff, #ffffff, #22c7ff);
  box-shadow: 0 0 16px rgba(34, 199, 255, 0.7);
}

.ai-avatar-shirt::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 15px;
  width: 26px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 0 rgba(255, 255, 255, 0.48);
}

.ai-avatar-hair {
  position: absolute;
  left: 16px;
  top: 4px;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 24px;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.96), transparent 0 12px),
    radial-gradient(circle at 68% 34%, rgba(34, 199, 255, 0.92), transparent 0 9px),
    linear-gradient(145deg, #ffffff, #d9e8ff 42%, #87b7ff);
  box-shadow:
    inset -10px -12px 24px rgba(21, 88, 214, 0.24),
    0 18px 30px rgba(21, 88, 214, 0.22);
  transform: rotate(-4deg);
  z-index: 2;
}

.ai-avatar-hair::after {
  content: "";
  position: absolute;
  right: -11px;
  top: 19px;
  width: 24px;
  height: 18px;
  border: 1px solid rgba(34, 199, 255, 0.45);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow:
    -58px 16px 0 -5px rgba(34, 199, 255, 0.25),
    0 0 18px rgba(34, 199, 255, 0.34);
}

.ai-avatar-face {
  position: absolute;
  left: 21px;
  top: 22px;
  width: 46px;
  height: 43px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 18px;
  background:
    radial-gradient(circle at 35% 40%, #123463 0 2px, transparent 3px),
    radial-gradient(circle at 65% 40%, #123463 0 2px, transparent 3px),
    linear-gradient(145deg, #eaf4ff, #b8d5ff);
  box-shadow:
    inset -8px -10px 18px rgba(21, 88, 214, 0.18),
    0 10px 18px rgba(21, 88, 214, 0.18);
  overflow: visible;
  z-index: 3;
}

.ai-avatar-face::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 7px;
  width: 30px;
  height: 6px;
  border-radius: 999px;
  background: rgba(21, 88, 214, 0.22);
}

.ai-avatar-glasses {
  position: absolute;
  left: 12px;
  bottom: 9px;
  width: 22px;
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: #1558d6;
  box-shadow:
    8px -13px 0 -1px #1558d6,
    20px -8px 0 -1px #22c7ff;
}

.ai-avatar-glasses::before,
.ai-avatar-glasses::after {
  content: "";
  position: absolute;
  top: -50px;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(34, 199, 255, 0.55);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 18px rgba(21, 88, 214, 0.16);
}

.ai-avatar-glasses::before {
  left: -20px;
}

.ai-avatar-glasses::after {
  right: -26px;
  height: 24px;
}

.ai-avatar-smile {
  position: absolute;
  left: 10px;
  top: -28px;
  width: 70px;
  height: 70px;
  border: 1px solid rgba(34, 199, 255, 0.22);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 47%, rgba(34, 199, 255, 0.28) 48% 52%, transparent 53%),
    linear-gradient(0deg, transparent 47%, rgba(34, 199, 255, 0.22) 48% 52%, transparent 53%);
  opacity: 0.78;
  transform: rotateX(58deg) rotateZ(-8deg);
  pointer-events: none;
  z-index: -1;
}

.ai-chat-bubble {
  position: relative;
  align-self: flex-start;
  margin-top: 4px;
  max-width: 116px;
  border: 1px solid rgba(200, 218, 248, 0.95);
  border-radius: 10px;
  padding: 9px 10px 8px;
  color: #15233d;
  background:
    linear-gradient(145deg, #ffffff, #eff6ff);
  text-align: left;
  line-height: 1.08;
  box-shadow: 0 12px 26px rgba(21, 88, 214, 0.18);
}

.ai-chat-bubble::before {
  content: "";
  position: absolute;
  left: -13px;
  bottom: 14px;
  width: 16px;
  height: 16px;
  border-left: 1px solid rgba(200, 218, 248, 0.95);
  border-bottom: 1px solid rgba(200, 218, 248, 0.95);
  background: #f7fbff;
  transform: rotate(45deg);
}

.ai-chat-bubble small,
.ai-chat-bubble strong {
  position: relative;
  display: block;
}

.ai-chat-bubble small {
  font-size: 9px;
  text-transform: uppercase;
  color: #1558d6;
}

.ai-chat-bubble strong {
  margin-top: 2px;
  font-size: 14px;
  white-space: nowrap;
}

.ai-chat-panel {
  width: min(390px, calc(100vw - 32px));
  max-height: min(620px, calc(100vh - 110px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 26px 70px rgba(17, 24, 39, 0.24);
}

.ai-chat-panel[hidden] {
  display: none !important;
}

.ai-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  color: #ffffff;
  background: #1558d6;
}

.ai-chat-head strong,
.ai-chat-head span {
  display: block;
}

.ai-chat-head span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
}

.ai-chat-head button {
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.ai-chat-messages {
  display: grid;
  gap: 10px;
  max-height: 340px;
  overflow: auto;
  padding: 14px;
  background: #f3f7ff;
}

.ai-message {
  max-width: 88%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 14px;
}

.ai-message.assistant {
  justify-self: start;
  color: #163153;
  background: #ffffff;
}

.ai-message.user {
  justify-self: end;
  color: #ffffff;
  background: #1558d6;
}

.ai-message.typing::after {
  content: "...";
  display: inline-block;
  width: 18px;
  animation: typingDots 1s steps(3, end) infinite;
  overflow: hidden;
  vertical-align: bottom;
}

@keyframes typingDots {
  0% {
    width: 0;
  }

  100% {
    width: 18px;
  }
}

.ai-chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.ai-chat-form textarea {
  min-height: 48px;
  max-height: 120px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font: inherit;
}

.ai-chat-note {
  margin: 0;
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.member-header {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  display: block;
  padding: 20px 14px;
  border-right: 1px solid rgba(200, 218, 248, 0.82);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 250, 255, 0.94));
  box-shadow: 18px 0 48px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(18px);
}

.member-header-top {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 22px;
}

.member-header .brand {
  color: #163153;
}

.member-header .brand-copy small {
  color: #476385;
}

.member-header .brand-mark {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background:
    radial-gradient(circle at 72% 18%, rgba(34, 211, 238, 0.42), transparent 26%),
    linear-gradient(135deg, #0f3f9e, #1d4ed8 58%, #22d3ee);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24), 0 12px 24px rgba(29, 78, 216, 0.18);
}

.member-header .brand-mark svg {
  color: #ffffff;
  stroke: #ffffff;
}

.member-header .logo-runner,
.member-header .logo-speed,
.member-header .logo-finish {
  fill: none;
  stroke: #ffffff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3.2;
}

.member-header .logo-speed {
  opacity: 0.74;
  stroke-width: 2.4;
}

.member-header .logo-finish {
  opacity: 0.92;
  stroke-width: 2.5;
}

.member-header .logo-head {
  fill: #ffffff;
}

.mobile-menu-btn {
  display: none;
  width: 38px;
  height: 38px;
  place-items: center;
  gap: 4px;
  border: 1px solid rgba(21, 88, 214, 0.18);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.08));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.mobile-menu-btn span {
  display: block;
  width: 17px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.mobile-nav-open .mobile-menu-btn span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.mobile-nav-open .mobile-menu-btn span:nth-child(2) {
  opacity: 0;
}

.mobile-nav-open .mobile-menu-btn span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.pov-toggle {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(200, 218, 248, 0.9);
  border-radius: 18px;
  background:
    linear-gradient(180deg, #f8fbff, #eef6ff);
}

.nav-group-label {
  margin: 10px 8px 4px;
  color: #64748b;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-group-label:first-child {
  margin-top: 0;
}

.pov-tab,
.refresh-all-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 11px 12px;
  color: #476385;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.refresh-all-btn {
  margin-top: 4px;
  border-color: rgba(21, 88, 214, 0.18);
  color: #1558d6;
  background: #ffffff;
}

.refresh-all-btn:hover {
  border-color: rgba(21, 88, 214, 0.32);
  background: #eef6ff;
}

.refresh-all-btn.is-loading .pov-icon {
  animation: refreshSpin 0.8s linear infinite;
}

.pov-icon {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  flex: 0 0 auto;
}

.pov-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pov-label {
  white-space: nowrap;
  font-size: 12px;
}

.pov-tab.active {
  color: #ffffff;
  background: #ffffff;
  background: #1558d6;
  box-shadow: 0 12px 26px rgba(21, 88, 214, 0.22);
}

.pov-tab:disabled,
.refresh-all-btn:disabled {
  cursor: wait;
  opacity: 0.68;
}

.admin-only {
  display: block;
}

.mode-owner .admin-only {
  display: none !important;
}

.history-only {
  display: none;
}

.account-only {
  display: none;
}

.customers-only,
.invoice-only,
.billing-only,
.affiliate-only,
.settings-only,
.guide-only,
.support-only {
  display: none;
}

.mode-history .member-panel:not(.history-panel),
.mode-history .member-metrics,
.mode-history .chart-grid,
.mode-history .insight-grid,
.mode-history .member-grid,
.mode-history .owner-action-panel {
  display: none !important;
}

.mode-customers .member-panel:not(.customers-only),
.mode-customers .member-metrics,
.mode-customers .chart-grid,
.mode-customers .insight-grid,
.mode-customers .member-grid,
.mode-customers .owner-action-panel,
.mode-customers .funnel-panel,
.mode-invoice .member-panel:not(.invoice-only),
.mode-invoice .member-metrics,
.mode-invoice .chart-grid,
.mode-invoice .insight-grid,
.mode-invoice .member-grid,
.mode-invoice .owner-action-panel,
.mode-invoice .funnel-panel,
.mode-billing .member-panel:not(.billing-only),
.mode-billing .member-metrics,
.mode-billing .chart-grid,
.mode-billing .insight-grid,
.mode-billing .member-grid,
.mode-billing .owner-action-panel,
.mode-billing .funnel-panel,
.mode-affiliate .member-panel:not(.affiliate-only),
.mode-affiliate .member-metrics,
.mode-affiliate .chart-grid,
.mode-affiliate .insight-grid,
.mode-affiliate .member-grid,
.mode-affiliate .owner-action-panel,
.mode-affiliate .funnel-panel,
.mode-settings .member-panel:not(.settings-only),
.mode-settings .member-metrics,
.mode-settings .chart-grid,
.mode-settings .insight-grid,
.mode-settings .member-grid,
.mode-settings .owner-action-panel,
.mode-settings .funnel-panel,
.mode-guide .member-panel:not(.guide-only),
.mode-guide .member-metrics,
.mode-guide .chart-grid,
.mode-guide .insight-grid,
.mode-guide .member-grid,
.mode-guide .owner-action-panel,
.mode-guide .funnel-panel,
.mode-support .member-panel:not(.support-only),
.mode-support .member-metrics,
.mode-support .chart-grid,
.mode-support .insight-grid,
.mode-support .member-grid,
.mode-support .owner-action-panel,
.mode-support .funnel-panel {
  display: none !important;
}

.mode-account .member-panel:not(.account-panel),
.mode-account .member-metrics,
.mode-account .chart-grid,
.mode-account .insight-grid,
.mode-account .member-grid,
.mode-account .owner-action-panel,
.mode-account .funnel-panel {
  display: none !important;
}

.mode-history .history-only {
  display: block;
}

.mode-account .account-only {
  display: block;
}

.mode-customers .customers-only,
.mode-invoice .invoice-only,
.mode-billing .billing-only,
.mode-affiliate .affiliate-only,
.mode-settings .settings-only,
.mode-guide .guide-only,
.mode-support .support-only {
  display: block;
}

.mode-history .member-hero {
  display: none !important;
}

.mode-customers .member-hero,
.mode-invoice .member-hero,
.mode-guide .member-hero {
  display: none !important;
}

.mode-customers .period-panel,
.mode-invoice .period-panel,
.mode-history .period-panel,
.mode-account .period-panel,
.mode-billing .period-panel,
.mode-affiliate .period-panel,
.mode-settings .period-panel,
.mode-guide .period-panel,
.mode-support .period-panel {
  display: none !important;
}

.utility-panel {
  max-width: 1080px;
}

.empty-state-panel {
  border: 1px dashed rgba(148, 163, 184, 0.45);
  border-radius: 8px;
  padding: 22px;
  background: #f8fbff;
}

.empty-state-panel strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
}

.empty-state-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.utility-table {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.utility-actions,
.invoice-title-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lead-toolbar,
.utility-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px);
  gap: 10px;
  margin: 12px 0 4px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: #f8fbff;
}

.lead-toolbar label,
.utility-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.lead-toolbar input,
.lead-toolbar select,
.utility-toolbar input,
.utility-toolbar select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

.utility-table-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 140px 130px 140px;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.utility-table-row.is-head {
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 900;
}

.utility-sort-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 6px 8px;
  color: #475569;
  background: transparent;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  cursor: pointer;
}

.utility-sort-btn:hover,
.utility-sort-btn.active {
  color: #1558d6;
  border-color: rgba(21, 88, 214, 0.18);
  background: #eef5ff;
}

.utility-sort-btn .sort-indicator {
  display: inline-grid;
  min-width: 38px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  color: #1558d6;
  background: #e8f0ff;
  font-size: 10px;
  padding: 0 6px;
}

.utility-pagination {
  justify-content: center;
}

.utility-table-row strong,
.utility-table-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.invoice-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.76fr) minmax(380px, 1.24fr);
  gap: 16px;
  align-items: start;
}

.invoice-editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.invoice-editor label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-weight: 800;
}

.invoice-picker {
  padding: 12px;
  border: 1px solid rgba(21, 88, 214, 0.18);
  border-radius: 8px;
  background: #ffffff;
}

.invoice-picker small {
  color: var(--muted);
  font-weight: 600;
  line-height: 1.45;
}

.invoice-guide {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  border: 1px solid rgba(18, 63, 159, 0.16);
  border-radius: 18px;
  padding: 14px 16px;
  background:
    linear-gradient(135deg, #f8fbff, #ffffff);
}

.invoice-guide strong {
  color: var(--ink);
  font-size: 15px;
}

.invoice-guide span {
  color: var(--muted);
  line-height: 1.55;
}

.invoice-guide b {
  color: var(--green-deep);
}

.invoice-editor input,
.invoice-editor textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #ffffff;
  font: inherit;
}

.invoice-wide,
.invoice-editor .button {
  grid-column: 1 / -1;
}

.invoice-side {
  display: grid;
  gap: 14px;
}

.invoice-preview {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.86), #ffffff 130px),
    #ffffff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

.invoice-paper-head,
.invoice-meta,
.invoice-item,
.invoice-total {
  display: grid;
  gap: 12px;
}

.invoice-paper-head {
  grid-template-columns: 1fr auto;
  align-items: start;
  padding: 22px;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, #0f3f91, #1d6cff);
}

.invoice-paper-head span,
.invoice-meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.invoice-paper-head strong {
  display: block;
  margin-top: 5px;
  color: #ffffff;
  font-size: 28px;
}

.invoice-paper-head b,
.invoice-paper-head small {
  display: block;
  text-align: right;
}

.invoice-paper-head small {
  margin-top: 4px;
  opacity: 0.88;
}

.invoice-meta {
  grid-template-columns: repeat(3, 1fr);
  margin: 18px 0;
}

.invoice-meta p {
  margin: 0;
  border: 1px solid #dbe7ff;
  border-radius: 8px;
  padding: 12px;
  background: #f8fbff;
}

.invoice-meta small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.invoice-items {
  display: grid;
  gap: 0;
  border: 1px solid #dbe7ff;
  border-radius: 8px;
  overflow: hidden;
}

.invoice-item {
  grid-template-columns: minmax(160px, 1fr) 56px 120px 120px;
  align-items: center;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  padding: 11px 12px;
}

.invoice-item-head {
  background: #eff6ff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.invoice-total {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-top: 18px;
  padding-top: 16px;
  border-radius: 8px;
  color: #ffffff;
  background: #0f172a;
}

.invoice-total span {
  color: rgba(255, 255, 255, 0.72);
  font-weight: 900;
}

.invoice-total strong {
  font-size: 26px;
}

.invoice-notes {
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.invoice-footer-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.invoice-history {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.invoice-history .member-panel-title h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
}

.invoice-history-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.invoice-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  padding: 10px;
  background: #f8fbff;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.invoice-history-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.invoice-history-item b {
  color: #1558d6;
  white-space: nowrap;
}

.invoice-history-empty {
  margin: 0;
  color: var(--muted);
}

.affiliate-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid rgba(21, 88, 214, 0.22);
  border-radius: 8px;
  padding: 18px;
  background: linear-gradient(135deg, #f8fbff, #ffffff);
}

.affiliate-card span,
.affiliate-grid b {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.affiliate-card strong {
  display: block;
  margin-top: 6px;
  color: #1558d6;
  font-size: 32px;
  letter-spacing: 0.04em;
}

.affiliate-card p,
.affiliate-grid p,
.guide-list p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.affiliate-earnings,
.affiliate-grid,
.guide-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.affiliate-earnings {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.affiliate-earnings article {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.affiliate-earnings span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.affiliate-earnings strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 28px;
}

.affiliate-earnings small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.4;
}

.affiliate-grid article,
.guide-list article {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.guide-list strong {
  color: var(--ink);
  font-size: 15px;
}

.settings-grid,
.support-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settings-grid article,
.support-card,
.support-hero,
.support-checklist {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
}

.settings-grid span {
  display: block;
  color: #1558d6;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.settings-grid strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 17px;
}

.settings-grid p,
.support-card p,
.support-hero p,
.support-checklist p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.support-hero {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.support-hero h3,
.support-card h3,
.support-checklist h3 {
  margin: 0;
  color: var(--ink);
}

.support-icon {
  display: inline-grid;
  width: 46px;
  height: 46px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 12px;
  color: #1558d6;
  background: #e8f0ff;
  font-weight: 900;
}

.support-icon.small {
  width: 42px;
  height: 42px;
}

.support-card {
  display: grid;
  gap: 12px;
  align-content: start;
}

.support-card strong {
  display: block;
  margin-top: 10px;
  color: var(--ink);
}

.support-card .button {
  width: 100%;
}

.support-checklist {
  margin-top: 14px;
  background: #f8fbff;
}

@media print {
  body.print-invoice {
    background: #ffffff !important;
  }

  body.print-invoice .member-header,
  body.print-invoice .period-panel,
  body.print-invoice .member-hero,
  body.print-invoice .invoice-editor,
  body.print-invoice #invoicePrintBtn,
  body.print-invoice .ai-chat-widget {
    display: none !important;
  }

  body.print-invoice .member-main {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.print-invoice .member-panel,
  body.print-invoice .utility-panel {
    border: 0 !important;
    box-shadow: none !important;
  }

  body.print-invoice .invoice-workspace {
    display: block;
  }

  body.print-invoice .invoice-preview {
    border: 0;
    box-shadow: none;
  }
}

.member-main {
  width: min(1280px, calc(100% - var(--sidebar-width)));
  margin: 0 auto 0 var(--sidebar-width);
  padding: 34px clamp(18px, 4vw, 48px) 76px;
}

.member-hero {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 22px;
  align-items: stretch;
  border: 1px solid rgba(200, 218, 248, 0.78);
  border-radius: 28px;
  padding: 28px;
  background:
    radial-gradient(circle at 88% 4%, rgba(34, 211, 238, 0.2), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(239, 247, 255, 0.86));
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.08);
}

.member-hero h1 {
  max-width: 820px;
  font-size: clamp(38px, 5vw, 70px);
}

.member-hero p {
  max-width: 760px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.quick-add,
.member-panel,
.member-metrics article {
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, #ffffff, #fbfdff);
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.07);
}

.profile-panel {
  margin-top: 22px;
}

.period-panel {
  position: sticky;
  z-index: 8;
  top: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  width: calc(100% - var(--sidebar-width));
  margin: 14px 0 0 var(--sidebar-width);
  padding: 14px clamp(18px, 4vw, 48px);
  border: 1px solid rgba(200, 218, 248, 0.8);
  border-radius: 0 0 24px 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(239, 247, 255, 0.9));
  box-shadow: 0 18px 42px rgba(21, 88, 214, 0.08);
  backdrop-filter: blur(18px);
}

.period-panel h2 {
  font-size: 28px;
}

.period-panel p:not(.section-kicker) {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.period-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.custom-range {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto minmax(140px, 1fr);
  align-items: center;
  gap: 8px;
  width: min(520px, 100%);
}

.custom-range[hidden] {
  display: none !important;
}

.custom-range input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  font-weight: 700;
}

.custom-range span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.period-actions button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--green-deep);
  border-radius: 8px;
  padding: 11px 13px;
  color: var(--green-deep);
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.period-actions button.active {
  color: var(--white);
  background: var(--green-deep);
}

.period-icon {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  flex: 0 0 auto;
}

.period-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.period-label {
  white-space: nowrap;
}

.mobile-range-sheet[hidden] {
  display: none !important;
}

.mobile-range-sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.mobile-range-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 18, 46, 0.42);
}

.mobile-range-card {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  border: 1px solid rgba(200, 218, 248, 0.9);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
  box-shadow: 0 22px 48px rgba(15, 30, 68, 0.24);
}

.mobile-range-head,
.mobile-range-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mobile-range-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}

.mobile-range-fields label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}

.mobile-range-fields input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  font: inherit;
  background: #fbfcff;
}

.mobile-range-close {
  width: 32px;
  height: 32px;
  font-size: 16px;
}

.period-toast-sheet[hidden] {
  display: none !important;
}

.period-toast-sheet {
  position: fixed;
  inset: 0;
  z-index: 45;
}

.period-toast-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 18, 46, 0.28);
  backdrop-filter: blur(4px);
}

.period-toast-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(320px, calc(100vw - 28px));
  transform: translate(-50%, -50%);
  border: 1px solid rgba(200, 218, 248, 0.9);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(15, 30, 68, 0.26);
}

.period-toast-loading,
.period-toast-ready {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 10px;
}

.period-toast-loading {
  min-height: 72px;
}

.period-toast-loading p,
.period-toast-ready p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.period-toast-ready strong {
  display: block;
  font-size: 20px;
  color: var(--ink);
}

.period-toast-done {
  display: inline-grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: #1558d6;
  box-shadow: 0 14px 30px rgba(21, 88, 214, 0.28);
}

.period-toast-done svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  stroke-width: 2.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.period-toast-ready .button {
  min-width: 120px;
  margin-top: 8px;
}


.profile-form,
.template-generator,
.account-form {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.mode-admin #businessProfile {
  display: none;
}

.profile-form label,
.template-generator label,
.account-form label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 700;
}

.profile-form input,
.profile-form select,
.profile-form textarea,
.template-generator input,
.account-form input,
.account-form select,
.account-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  font: inherit;
  color: var(--ink);
  background: #fbfcfa;
}

.profile-form textarea,
.account-form textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}

.profile-wide,
.account-wide {
  grid-column: 1 / -1;
}

.account-panel {
  max-width: 1040px;
}

.account-form {
  grid-template-columns: 1fr;
  gap: 16px;
}

.account-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  background: #ffffff;
}

.account-section-head {
  display: grid;
  gap: 5px;
}

.account-section-head span {
  width: fit-content;
  padding: 0;
  background: transparent;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.account-section-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
}

.account-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.account-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.account-form input[readonly] {
  background: #eef4ff;
  color: #4b6388;
}

.custom-business-type {
  margin-top: 4px;
}

.custom-business-type[hidden] {
  display: none;
}

.account-save-btn {
  grid-column: 1 / -1;
}

.sheets-form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

#sheetsStatusBadge.warning {
  background: #fff9e8;
  color: #7f5e00;
}

#sheetsStatusBadge.success {
  background: #eaf2ff;
  color: #1d4fb8;
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--green-deep);
  border-radius: 8px;
  color: var(--green-deep);
  background: var(--mint);
  font: inherit;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
}

.quick-add {
  display: grid;
  gap: 10px;
  padding: 20px;
}

.quick-add h2 {
  font-size: 22px;
}

.quick-add label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 700;
}

.quick-add input,
.member-panel textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fbfcfa;
}

.member-metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin: 24px 0;
}

.funnel-panel {
  margin-top: 18px;
}

.funnel-steps {
  display: grid;
  grid-template-columns: minmax(320px, 1.15fr) minmax(360px, 0.85fr);
  gap: 12px;
  align-items: stretch;
}

.funnel-chart {
  display: grid;
  gap: 10px;
  align-content: center;
  min-height: 238px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  background: #ffffff;
  overflow: visible;
}

.funnel-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  min-width: 0;
  margin: 0;
  border-radius: 8px;
  box-shadow: none;
}

.funnel-stage-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "icon copy"
    "bar bar";
  align-items: start;
  gap: 8px 10px;
  width: 100%;
  min-height: 76px;
  padding: 11px 14px 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.funnel-stage-bar {
  grid-area: bar;
  display: block;
  justify-self: start;
  width: var(--stage-width, 80%);
  min-width: 28px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1e40af 0%, #2563eb 55%, #60a5fa 100%);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.14);
}

.funnel-stage.is-empty .funnel-stage-bar {
  min-width: 0;
  background: #e2e8f0;
  box-shadow: none;
}

.stage-top .funnel-stage-bar {
  background: linear-gradient(90deg, #1e40af 0%, #2563eb 55%, #60a5fa 100%);
}

.stage-follow .funnel-stage-bar {
  background: linear-gradient(90deg, #1d4ed8 0%, #3b82f6 55%, #7dd3fc 100%);
}

.stage-warm .funnel-stage-bar {
  background: linear-gradient(90deg, #0f766e 0%, #14b8a6 55%, #67e8f9 100%);
}

.stage-booked .funnel-stage-bar {
  background: linear-gradient(90deg, #0f766e 0%, #059669 55%, #5eead4 100%);
}

.funnel-stage-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 900;
}

.funnel-stage-copy {
  grid-area: copy;
  display: grid;
  gap: 5px;
  min-width: 0;
}

.funnel-stage-copy h3 {
  margin: 0;
  font-size: 13px;
  line-height: 1.25;
  color: var(--ink);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: break-word;
}

.funnel-stage-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  align-items: baseline;
}

.funnel-stage-meta strong {
  font-size: 17px;
  line-height: 1;
  color: var(--ink);
}

.funnel-stage-meta small {
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: break-word;
}

.funnel-stage-rate {
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 999px;
  padding: 4px 7px;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.funnel-stage-percent {
  justify-self: end;
  align-self: center;
  min-width: 44px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  padding: 5px 7px;
  background: #ffffff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.funnel-analysis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.funnel-analysis-card,
.funnel-leak-card,
.funnel-summary-note {
  position: relative;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
  overflow: visible;
}

.funnel-analysis-card > span,
.funnel-leak-card > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.funnel-analysis-card strong,
.funnel-leak-card strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.1;
}

.funnel-leak-card .metric-label,
.funnel-analysis-card .metric-label,
.condition-card .metric-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
}

.funnel-analysis-card small,
.funnel-leak-card small,
.funnel-summary-note {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.funnel-legend {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.funnel-summary-note {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 14px 16px;
  width: 100%;
}

.funnel-leak-card {
  border-color: rgba(148, 163, 184, 0.24);
  background: #ffffff;
}

.funnel-leak-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(90deg, #f59e0b, #f97316);
}

.funnel-leak-card strong {
  color: var(--ink);
}

.member-metrics article {
  position: relative;
  min-height: 132px;
  padding: 18px;
  overflow: visible;
}

.member-metrics article::before,
.funnel-analysis-card::before,
.condition-card::before,
.chart-panel::before,
.health-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
}

.member-metrics article.metric-booked::before {
  background: linear-gradient(90deg, #0f766e, #5eead4);
}

.member-metrics article.metric-lost::before {
  background: linear-gradient(90deg, #ef4444, #f97316);
}

.lead-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.lead-pagination button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--green-deep);
  border-radius: 8px;
  color: var(--green-deep);
  background: var(--mint);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.lead-pagination button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.lead-pagination span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.member-metrics > article > span,
.member-metrics small {
  display: block;
  color: var(--muted);
}

.member-metrics strong {
  display: block;
  margin: 14px 0 8px;
  font-size: 34px;
}

.metric-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: var(--ink);
  font-weight: 800;
}

.info-tip {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  border: 1px solid rgba(71, 85, 105, 0.35);
  border-radius: 999px;
  color: #64748b;
  background: #ffffff;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  cursor: help;
}

.info-tip::after {
  content: attr(aria-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 40;
  width: min(260px, 72vw);
  padding: 9px 10px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.info-tip:hover::after,
.info-tip:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.mode-owner .member-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: start;
}

.mode-owner .member-hero,
.mode-owner .period-panel,
.mode-owner .funnel-panel,
.mode-owner .member-metrics,
.mode-owner .chart-grid,
.mode-owner .insight-grid,
.mode-owner .owner-action-panel,
.mode-owner .owner-ai-cta,
.mode-owner #report,
.mode-owner #templates {
  grid-column: 1 / -1;
}

.mode-owner #report {
  order: 2;
}

.mode-owner .member-metrics {
  order: 3;
}

.mode-owner .funnel-panel {
  order: 4;
}

.mode-owner .chart-grid {
  order: 5;
}

.mode-owner .insight-grid {
  order: 6;
}

.mode-owner .owner-ai-cta {
  display: flex;
  order: 7;
}

.mode-owner .member-hero {
  min-height: auto;
}

.mode-owner .member-hero h1 {
  font-size: clamp(30px, 3.6vw, 44px);
  line-height: 1.08;
}

.mode-owner .member-hero p {
  font-size: 15px;
  line-height: 1.55;
}

.mode-owner .period-panel {
  order: 1;
  margin-top: 0;
  position: static;
  top: auto;
  z-index: auto;
  padding: 0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.mode-owner .period-panel .section-kicker {
  margin-bottom: 4px;
  font-size: 11px;
}

.mode-owner .period-panel > div:first-child {
  display: none;
}

.mode-owner .period-panel h2 {
  font-size: 16px;
  line-height: 1.2;
}

.mode-owner .period-panel p:not(.section-kicker) {
  display: none;
}

.mode-owner .period-actions {
  justify-content: flex-start;
  gap: 8px;
}

.mode-owner .period-actions button {
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.1;
}

.mode-owner .custom-range {
  width: min(420px, 100%);
  gap: 6px;
}

.mode-owner .custom-range input {
  padding: 8px 10px;
  font-size: 12px;
}

.period-unpinned.mode-owner .period-panel,
.period-unpinned.mode-admin .period-panel {
  position: sticky;
  top: 0;
}

.mode-owner .member-metrics {
  margin: 0;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.mode-owner .member-metrics article {
  min-height: 106px;
  padding: 14px;
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.mode-owner .member-metrics strong {
  margin: 10px 0 6px;
  font-size: clamp(24px, 2.1vw, 30px);
}

.mode-owner .chart-panel {
  min-height: 0;
}

.mode-owner .chart-track {
  height: 12px;
  background: #eef2ff;
}

.mode-owner .chart-fill {
  box-shadow: 0 0 14px rgba(37, 99, 235, 0.18);
}

.mode-owner #templates .member-panel-title h2 {
  font-size: 21px;
}

.mode-owner .report-box {
  font-size: 14px;
  line-height: 1.6;
}

.mode-owner #report {
  width: 100%;
}

.mode-owner .member-panel {
  padding: 14px;
}

.mode-owner .insight-grid {
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mode-admin .member-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mode-admin .member-hero {
  margin-bottom: 0;
  order: 0;
}

.mode-admin #member-title {
  font-size: clamp(26px, 3.2vw, 36px);
}

.mode-admin #memberSubtitle {
  display: none;
}

.mode-admin .member-hero > div {
  max-width: 100%;
}

.mode-admin #leads {
  margin-top: 0;
  order: 2;
}

.mode-admin .insight-grid {
  display: none;
}

.mode-admin .funnel-panel,
.mode-admin #report {
  display: none;
}

.mode-admin .sheets-panel {
  order: 4;
}

.mode-admin .profile-panel {
  order: 5;
}

.mode-admin #templates {
  order: 6;
}

.mode-admin .period-panel {
  order: 1;
  position: static;
  top: auto;
  z-index: auto;
  margin-top: 0;
  padding: 0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.mode-admin .period-panel .section-kicker {
  margin-bottom: 4px;
  font-size: 11px;
}

.mode-admin .period-panel h2 {
  font-size: 16px;
  line-height: 1.2;
}

.mode-admin .period-panel p:not(.section-kicker) {
  display: none;
}

.mode-admin .period-panel > div:first-child {
  display: none;
}

.mode-admin .period-actions {
  justify-content: flex-start;
  gap: 8px;
}

.mode-admin .period-actions button {
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.1;
}

.mode-admin .custom-range {
  width: min(420px, 100%);
  gap: 6px;
}

.mode-admin .custom-range input {
  padding: 8px 10px;
  font-size: 12px;
}

.mode-admin .member-metrics {
  order: 7;
}

.mode-admin .chart-grid {
  order: 8;
}

.mode-admin .member-panel {
  padding: 16px;
}

.mode-admin .owner-action-panel {
  order: 3;
}

.mode-admin .funnel-step {
  width: 100%;
  clip-path: none;
  padding: 10px 12px;
}

.mode-admin .funnel-step h3 {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.35;
}

.mode-admin .funnel-kpis strong {
  font-size: 24px;
}

.mode-admin .funnel-rate {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.35;
  white-space: normal;
}

.mode-admin .funnel-step:not(:last-child)::after {
  display: none;
}

.mode-admin .lead-row {
  grid-template-columns: minmax(0, 1.25fr) minmax(132px, 0.8fr);
  grid-template-areas:
    "info value"
    "info status"
    "date actions";
  gap: 8px 10px;
  align-items: start;
  padding: 10px;
}

.mode-admin .date-chip,
.mode-admin .status-select {
  font-size: 12px;
  padding: 7px 8px;
}

.mode-admin .date-chip {
  white-space: normal;
  text-align: left;
  line-height: 1.3;
}

.mode-admin .lead-info {
  grid-area: info;
  min-width: 0;
}

.mode-admin .lead-value {
  grid-area: value;
  justify-self: end;
  align-self: start;
  white-space: nowrap;
}

.mode-admin .status-select {
  grid-area: status;
  justify-self: stretch;
}

.mode-admin .date-chip {
  grid-area: date;
}

.mode-admin .lead-row-actions {
  grid-area: actions;
  justify-content: flex-end;
}

.member-grid {
  display: grid;
  grid-template-columns: 1.45fr 0.85fr;
  gap: 18px;
  margin-top: 18px;
}

.admin-workspace {
  grid-template-columns: 340px 1fr;
  align-items: start;
}

.mode-admin .admin-workspace {
  grid-template-columns: minmax(320px, 0.92fr) minmax(360px, 1.08fr);
  grid-template-areas:
    "input priority"
    "table table";
  gap: 14px;
}

.admin-workspace .quick-add {
  position: static;
  gap: 10px;
  padding: 16px;
}

.mode-admin .admin-workspace .quick-add {
  border-color: rgba(37, 99, 235, 0.34);
  background: linear-gradient(180deg, #ffffff, #f5f9ff);
  box-shadow: 0 18px 42px rgba(23, 70, 199, 0.14);
}

.mode-admin .admin-workspace > .quick-add,
.mode-admin .admin-workspace > .lead-board,
.mode-admin .admin-workspace > .ai-panel {
  align-self: start;
}

.mode-admin .admin-workspace > .quick-add {
  grid-area: input;
}

.mode-admin .admin-workspace > .lead-board {
  grid-area: table;
}

.mode-admin .admin-workspace > .ai-panel {
  grid-area: priority;
}

.mode-admin .quick-add,
.mode-admin .lead-board,
.mode-admin .ai-panel {
  font-size: 13px;
}

.mode-admin .quick-add label,
.mode-admin .lead-row p,
.mode-admin .lead-row span,
.mode-admin .ai-panel li span {
  font-size: 13px;
}

.admin-workspace .quick-add h2 {
  margin: 0;
  font-size: 20px;
}

.admin-card-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 4px;
}

.admin-card-heading span {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 8px;
  color: #1558d6;
  background: #eaf2ff;
  font-size: 11px;
  font-weight: 900;
}

.admin-card-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.admin-workspace .lead-board {
  min-height: 0;
}

.admin-workspace .ai-panel {
  grid-column: 1 / -1;
}

.mode-admin .admin-workspace .ai-panel {
  min-height: 100%;
}

.mode-admin #addLeadBtn {
  display: none;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.insight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.owner-action-panel {
  margin-bottom: 18px;
}

.owner-ai-cta {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  border-color: rgba(37, 99, 235, 0.26);
  background:
    linear-gradient(135deg, rgba(239, 246, 255, 0.96), rgba(255, 255, 255, 0.98)),
    radial-gradient(circle at 8% 20%, rgba(59, 130, 246, 0.16), transparent 30%);
  box-shadow: 0 16px 36px rgba(30, 64, 175, 0.10);
}

.mode-admin .owner-ai-cta,
.mode-history .owner-ai-cta,
.mode-account .owner-ai-cta {
  display: none;
}

.owner-ai-cta span {
  display: block;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.owner-ai-cta strong {
  display: block;
  margin-top: 5px;
  max-width: 760px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
}

.owner-ai-cta .button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.next-action-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.next-action-list::before {
  content: attr(data-source);
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.next-action-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 170px;
  padding: 14px;
  background: #f9fcff;
  display: grid;
  align-content: start;
}

.next-action-rank {
  display: inline-flex;
  border-radius: 8px;
  padding: 4px 8px;
  color: #1d4fb8;
  background: #e6efff;
  font-size: 11px;
  font-weight: 800;
}

.next-action-item strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.next-action-item p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}

.next-action-item small {
  display: block;
  margin-top: 8px;
  color: #1d4fb8;
  font-weight: 700;
  line-height: 1.25;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.history-panel {
  max-width: 920px;
  margin: 0 auto;
}

.history-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.history-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.history-toolbar select,
.history-toolbar input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  font-weight: 700;
}

.history-toolbar select {
  min-width: 220px;
  appearance: none;
  padding-right: 34px;
  background:
    linear-gradient(45deg, transparent 50%, var(--green-deep) 50%),
    linear-gradient(135deg, var(--green-deep) 50%, transparent 50%),
    #ffffff;
  background-position:
    calc(100% - 18px) 17px,
    calc(100% - 12px) 17px,
    0 0;
  background-size: 6px 6px, 6px 6px, 100% 100%;
  background-repeat: no-repeat;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #ffffff;
}

.history-dot {
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border-radius: 50%;
  background: #1558d6;
}

.history-item.add .history-dot {
  background: var(--cyan);
}

.history-item.edit .history-dot,
.history-item.status .history-dot {
  background: var(--yellow);
}

.history-item.delete .history-dot {
  background: var(--coral);
}

.history-item strong,
.history-item small,
.history-item p {
  display: block;
}

.history-item strong {
  color: var(--ink);
  font-weight: 900;
}

.history-item small {
  margin-top: 3px;
  color: var(--muted);
}

.history-item p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.history-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: #f8fbff;
  text-align: center;
  font-weight: 800;
}

.history-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.history-pagination[hidden] {
  display: none !important;
}

.history-pagination button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--green-deep);
  background: #ffffff;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.history-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.history-pagination span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.member-panel {
  padding: 20px;
}

.chart-panel {
  position: relative;
  min-height: 330px;
  overflow: visible;
}

.health-card {
  position: relative;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
  overflow: visible;
}

.health-card.warning {
  border-color: rgba(148, 163, 184, 0.24);
  background: #ffffff;
}

.health-card.danger {
  border-color: rgba(148, 163, 184, 0.24);
  background: #ffffff;
}

.health-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
}

.health-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.insight-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.insight-item {
  border-left: 4px solid var(--green);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--muted);
  background: #fbfcfa;
  line-height: 1.55;
}

.insight-item.warning {
  border-left-color: var(--yellow);
}

.insight-item.danger {
  border-left-color: var(--coral);
}

.condition-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.condition-card {
  position: relative;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  padding: 12px 12px 14px;
  background: #ffffff;
  overflow: visible;
}

.condition-card > strong,
.condition-card > span,
.condition-card > small {
  display: block;
}

.condition-card .metric-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  font-size: 12px;
  line-height: 1.25;
}

.condition-card .metric-label > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.condition-card .info-tip {
  display: inline-grid;
  width: 15px;
  height: 15px;
  font-size: 10px;
}

.condition-card span {
  font-size: 20px;
  font-weight: 800;
}

.condition-card small {
  margin-top: 5px;
  color: var(--muted);
  display: block;
  overflow: visible;
  font-size: 13px;
  line-height: 1.46;
}

.condition-card.good {
  border-color: rgba(148, 163, 184, 0.24);
  background: #ffffff;
}

.condition-card.watch {
  border-color: rgba(148, 163, 184, 0.24);
  background: #ffffff;
}

.condition-card.bad {
  border-color: rgba(148, 163, 184, 0.24);
  background: #ffffff;
}

.condition-card.good::before,
.health-card::before {
  background: linear-gradient(90deg, #14b8a6, #38bdf8);
}

.condition-card.watch::before,
.health-card.warning::before {
  background: linear-gradient(90deg, #2563eb, #38bdf8);
}

.condition-card.bad::before,
.health-card.danger::before {
  background: linear-gradient(90deg, #f59e0b, #f97316);
}

.member-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.member-panel-title h2 {
  font-size: 24px;
}

.member-panel-title span {
  border-radius: 8px;
  padding: 6px 9px;
  color: var(--green-deep);
  background: var(--mint);
  font-size: 12px;
  font-weight: 800;
}

.panel-helper {
  margin: -6px 0 14px;
  max-width: 720px;
  color: var(--muted);
  line-height: 1.55;
}

.lead-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.export-btn,
.refresh-btn {
  border: 1px solid rgba(13, 77, 53, 0.28);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--green-deep);
  background: rgba(207, 238, 221, 0.45);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.export-btn:hover,
.refresh-btn:hover {
  background: rgba(207, 238, 221, 0.8);
}

.refresh-btn {
  min-width: 76px;
}

.icon-action-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
}

.icon-action-btn svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-action-btn.is-loading svg {
  animation: spin 0.8s linear infinite;
}

.refresh-btn:disabled {
  cursor: wait;
  opacity: 0.72;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.lead-table {
  display: grid;
  gap: 10px;
}

.bar-chart,
.value-chart {
  display: grid;
  gap: 14px;
}

.chart-row {
  display: grid;
  gap: 8px;
}

.chart-row header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.chart-track {
  height: 14px;
  border-radius: 999px;
  background: #eef2ff;
  overflow: hidden;
}

.chart-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  min-width: 8px;
}

.value-chart .chart-fill {
  background: linear-gradient(90deg, #1d4ed8, #14b8a6);
}

.lead-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 120px minmax(220px, 1.2fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfa;
}

.lead-info {
  min-width: 0;
}

.lead-info strong,
.lead-info p {
  overflow-wrap: anywhere;
}

.lead-value {
  color: var(--ink);
  font-size: 15px;
}

.lead-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lead-remove {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(237, 111, 87, 0.45);
  border-radius: 8px;
  color: #a83323;
  background: #fff4f1;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
}

.lead-remove:hover {
  background: #ffe9e4;
}

.danger-button {
  border-color: #dc2626;
  background: #dc2626;
}

.lead-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 18px;
}

.lead-modal[hidden] {
  display: none !important;
}

.lead-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(8px);
}

.lead-modal-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  width: min(560px, 100%);
  border: 1px solid rgba(200, 218, 248, 0.9);
  border-radius: 8px;
  padding: 18px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
}

.lead-modal-card label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 800;
}

.lead-modal-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  font: inherit;
  color: var(--ink);
  background: #fbfcfa;
}

.lead-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.lead-edit {
  border: 1px solid rgba(13, 77, 53, 0.24);
  border-radius: 8px;
  color: var(--green-deep);
  background: #f0f9f2;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  padding: 7px 8px;
  cursor: pointer;
}

.lead-edit:hover {
  background: #e3f2e8;
}

.lead-row strong,
.lead-row span {
  display: block;
}

.lead-row span,
.lead-row p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.date-chip {
  border-radius: 8px;
  padding: 7px 9px;
  color: var(--muted);
  background: #edf2ed;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.status-pill,
.status-select {
  border-radius: 8px;
  padding: 7px 9px;
  color: var(--green-deep);
  background: var(--mint);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.status-select {
  width: 100%;
  border: 1px solid rgba(31, 122, 77, 0.24);
  font-family: inherit;
  cursor: pointer;
}

.ai-panel ul,
.report-box ul {
  margin: 0;
  padding-left: 0;
  color: var(--muted);
  line-height: 1.6;
  list-style: none;
}

.ai-panel ul::before {
  content: attr(data-source);
  display: block;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-panel li {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(200, 218, 248, 0.82);
  border-radius: 8px;
  padding: 9px 10px;
  background: #f8fbff;
  overflow-wrap: anywhere;
}

.ai-panel li strong,
.ai-panel li span {
  display: block;
}

.ai-panel li strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.ai-panel li span {
  color: var(--muted);
  line-height: 1.5;
}

.ai-panel li small {
  color: #1558d6;
  font-weight: 800;
  line-height: 1.35;
}

.ai-panel li + li {
  margin-top: 7px;
}

.template-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}

.saved-template-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 0;
}

.mode-owner .member-hero h1 {
  max-width: 860px;
}

.mode-owner .member-hero p {
  max-width: 820px;
}

.mode-owner .lead-row {
  grid-template-columns: 1fr 120px 120px minmax(220px, 1fr);
}

.mode-owner .date-chip,
.mode-owner .status-select {
  font-size: 11px;
}

.template-generator {
  grid-template-columns: 1fr auto;
  align-items: end;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfa;
}

.template-stack button,
.saved-template-stack button {
  border: 1px solid var(--green-deep);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--green-deep);
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.saved-template-stack .saved-template-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: min(360px, 100%);
  border: 1px solid rgba(21, 88, 214, 0.28);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f3f7ff);
  box-shadow: 0 8px 20px rgba(21, 88, 214, 0.08);
}

.saved-template-stack button {
  border-color: rgba(21, 88, 214, 0.28);
  color: #1558d6;
  background: #f3f7ff;
  font-size: 13px;
}

.saved-template-stack .saved-template-item > button {
  border: 0;
  border-radius: 8px;
}

.saved-template-stack .saved-template-item > [data-saved-template-id] {
  max-width: 100%;
  padding-right: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-template-copy {
  margin-right: 8px;
  border: 1px solid rgba(21, 88, 214, 0.18) !important;
  border-radius: 999px !important;
  padding: 7px 9px !important;
  color: #123f9f !important;
  background: #ffffff !important;
  font-size: 11px !important;
}

.saved-template-copy:hover {
  background: #e8f1ff !important;
}

.saved-template-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 1;
  width: 22px;
  height: 22px;
  min-width: 22px;
  display: grid;
  place-items: center;
  padding: 0 !important;
  border: 1px solid rgba(220, 38, 38, 0.22) !important;
  border-radius: 999px !important;
  color: #dc2626 !important;
  background: #ffffff !important;
  font-size: 11px !important;
  line-height: 1 !important;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.14);
}

.saved-template-remove:hover {
  color: #ffffff !important;
  background: #dc2626 !important;
}

.saved-template-stack button.active {
  color: #ffffff;
  background: #1558d6;
}

.saved-template-stack .saved-template-item:has(button.active) {
  background: #1558d6;
}

.saved-template-stack .saved-template-item:has(button.active) .saved-template-remove {
  border-color: rgba(220, 38, 38, 0.18) !important;
}

.template-save-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbff;
}

.template-copy-wrap {
  display: grid;
  gap: 10px;
}

.template-copy-wrap textarea {
  width: 100%;
}

.template-copy-btn {
  justify-self: end;
}

.template-save-row label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-weight: 800;
}

.template-save-row input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
}

.template-save-actions {
  display: flex;
  gap: 8px;
}

.template-save-actions .button {
  white-space: nowrap;
}

.template-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.report-box {
  color: var(--muted);
  line-height: 1.7;
}

.report-summary {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.55;
}

.owner-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.owner-action-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfa;
}

.owner-action-item strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.owner-action-item span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.owner-metric-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 0;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.owner-breakdown {
  display: grid;
  gap: 8px;
}

.owner-status-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.owner-breakdown-item {
  display: grid;
  grid-template-columns: 126px 1fr auto;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.owner-breakdown-item b {
  color: var(--ink);
  font-size: 12px;
}

.owner-breakdown-track {
  height: 8px;
  border-radius: 999px;
  background: #eef2ff;
  overflow: hidden;
}

.owner-breakdown-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-deep), var(--cyan));
}

@keyframes refreshSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (min-width: 901px) {
  .member-header {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
  }

  .period-panel,
  .mode-owner .period-panel,
  .mode-admin .period-panel {
    position: sticky;
    z-index: 8;
    top: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    width: calc(100% - var(--sidebar-width));
    margin: 0 0 0 var(--sidebar-width);
    padding: 16px clamp(16px, 4vw, 44px);
    border-bottom: 1px solid rgba(200, 218, 248, 0.9);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 14px 34px rgba(21, 88, 214, 0.08);
    backdrop-filter: blur(18px);
  }

  .period-panel > div:first-child,
  .mode-owner .period-panel > div:first-child,
  .mode-admin .period-panel > div:first-child {
    display: block;
  }

  .period-panel .section-kicker,
  .period-panel h2,
  .period-panel p:not(.section-kicker),
  .mode-owner .period-panel .section-kicker,
  .mode-owner .period-panel h2,
  .mode-owner .period-panel p:not(.section-kicker),
  .mode-admin .period-panel .section-kicker,
  .mode-admin .period-panel h2,
  .mode-admin .period-panel p:not(.section-kicker) {
    display: block;
  }

  .mode-owner .period-panel h2,
  .mode-admin .period-panel h2 {
    font-size: 28px;
  }

  .mode-owner .period-actions,
  .mode-admin .period-actions {
    justify-content: flex-end;
    gap: 10px;
  }

  .mode-owner .period-actions button,
  .mode-admin .period-actions button {
    padding: 11px 13px;
    font-size: inherit;
  }

  .member-main,
  .mode-owner .member-main,
  .mode-admin .member-main {
    width: min(1240px, calc(100% - var(--sidebar-width)));
    margin: 0 auto 0 var(--sidebar-width);
  }
}

@media (max-width: 1180px) {
  .mode-admin .admin-workspace {
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  }

  .mode-admin .admin-workspace .ai-panel {
    min-height: auto;
  }
}

@media (max-width: 900px) {
  .ai-chat-widget {
    right: 12px;
    bottom: 12px;
    max-width: calc(100vw - 24px);
  }

  .range-sheet-open .ai-chat-widget {
    right: 12px;
    bottom: clamp(86px, 42vh, 340px);
  }

  .ai-chat-toggle {
    min-width: 164px;
    min-height: 88px;
  }

  .range-sheet-open .ai-chat-toggle {
    min-width: 70px;
    min-height: 72px;
  }

  .ai-chat-avatar {
    width: 64px;
    height: 76px;
    transform: scale(0.86);
    transform-origin: bottom left;
  }

  .ai-chat-bubble {
    max-width: 100px;
    padding: 7px 8px 6px;
  }

  .ai-chat-bubble small {
    font-size: 9px;
  }

  .ai-chat-bubble strong {
    font-size: 12px;
  }

  .ai-chat-panel {
    width: min(360px, calc(100vw - 24px));
    max-height: min(500px, calc(100dvh - 94px));
  }

  .member-header {
    position: sticky;
    top: 0;
    left: auto;
    bottom: auto;
    width: 100%;
    display: grid;
    gap: 0;
    padding: 8px 7px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    background:
      linear-gradient(135deg, rgba(7, 27, 63, 0.98), rgba(18, 63, 159, 0.96) 58%, rgba(14, 116, 144, 0.94));
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.22);
    backdrop-filter: none;
  }

  .member-header-top {
    display: grid;
    min-height: auto;
    grid-template-columns: minmax(0, 1fr) 42px 38px;
    align-items: center;
    gap: 8px;
    position: relative;
  }

  .member-header .brand {
    color: #ffffff;
  }

  .member-header .brand-copy small {
    color: rgba(255, 255, 255, 0.72);
  }

  .member-header .brand-mark {
    border: 1px solid rgba(255, 255, 255, 0.38);
    background:
      radial-gradient(circle at 72% 18%, rgba(34, 211, 238, 0.42), transparent 26%),
      linear-gradient(135deg, #0f3f9e, #1d4ed8 58%, #22d3ee);
  }

  .member-header .logo-runner,
  .member-header .logo-speed {
    stroke: #ffffff;
  }

  .member-header .logo-head {
    fill: #ffffff;
  }

  .period-panel,
  .mode-owner .period-panel,
  .mode-admin .period-panel,
  .mode-history .period-panel {
    position: sticky;
    top: 62px;
    z-index: 8;
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr;
    width: calc(100% - 16px);
    margin: 0 8px 10px;
    padding: 8px;
    border: 1px solid rgba(200, 218, 248, 0.72);
    border-radius: 0 0 20px 20px;
    background:
      linear-gradient(135deg, rgba(248, 251, 255, 0.96), rgba(238, 246, 255, 0.94));
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(18px);
  }

  .period-panel h2,
  .period-panel p:not(.section-kicker),
  .period-panel .section-kicker,
  .mode-owner .period-panel h2,
  .mode-owner .period-panel p:not(.section-kicker),
  .mode-owner .period-panel .section-kicker,
  .mode-admin .period-panel h2,
  .mode-admin .period-panel p:not(.section-kicker),
  .mode-admin .period-panel .section-kicker {
    display: none;
  }

  .period-panel > div:first-child,
  .mode-owner .period-panel > div:first-child,
  .mode-admin .period-panel > div:first-child {
    display: none;
  }

  .mode-admin .period-panel h2 {
    font-size: 15px;
  }

  .member-header .brand {
    min-width: 0;
    gap: 5px;
  }

  .mobile-menu-btn {
    display: grid;
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.34);
    background: rgba(255, 255, 255, 0.12);
  }

  .member-header .brand-copy strong {
    font-size: 10px;
    line-height: 1;
    white-space: nowrap;
  }

  .member-header .brand-copy small {
    display: none;
  }

  .member-header .brand-mark {
    width: 28px;
    height: 28px;
  }

  .member-header .brand-mark svg {
    width: 22px;
    height: 22px;
  }

  .pov-toggle {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    width: min(360px, calc(100vw - 14px));
    min-width: 0;
    display: none;
    grid-template-columns: 1fr;
    justify-content: stretch;
    gap: 6px;
    margin: 0;
    padding: 10px;
    border-color: rgba(255, 255, 255, 0.26);
    background: #ffffff;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.24);
    overflow: auto;
    max-height: min(74vh, 620px);
    scrollbar-width: thin;
  }

  .mobile-nav-open .pov-toggle {
    display: grid;
  }

  .nav-group-label {
    display: none;
  }

  .pov-tab,
  .refresh-all-btn {
    min-width: 0;
    min-height: 42px;
    justify-content: flex-start;
    gap: 8px;
    padding: 10px 12px;
    font-size: 12px;
  }

  .refresh-all-btn {
    width: 100%;
    padding: 10px 12px;
  }

  .pov-tab,
  .refresh-all-btn {
    color: #476385;
  }

  .refresh-all-btn {
    border-color: rgba(21, 88, 214, 0.18);
    background: #f8fbff;
  }

  .pov-tab.active {
    color: #1558d6;
    background: #ffffff;
  }

  .pov-tab .pov-label {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: nowrap;
    border: 0;
    font-size: 12px;
  }

  .refresh-all-btn .pov-label {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: nowrap;
    border: 0;
  }

  .member-hero,
  .member-grid,
  .chart-grid,
  .insight-grid,
  .member-metrics,
  .period-panel,
  .profile-form,
  .account-form,
  .utility-table-row {
    grid-template-columns: 1fr;
  }

  .invoice-workspace,
  .invoice-side,
  .invoice-editor,
  .invoice-meta,
  .invoice-item,
  .affiliate-card,
  .affiliate-earnings,
  .affiliate-grid,
  .guide-list,
  .settings-grid,
  .support-grid,
  .lead-toolbar,
  .utility-toolbar {
    grid-template-columns: 1fr;
  }

  .affiliate-card {
    display: grid;
  }

  .invoice-paper-head {
    grid-template-columns: 1fr;
  }

  .invoice-paper-head b,
  .invoice-paper-head small {
    text-align: left;
  }

  .account-section-grid {
    grid-template-columns: 1fr;
  }

  .admin-workspace {
    grid-template-columns: 1fr;
  }

  .mode-admin .admin-workspace,
  .sheets-form {
    grid-template-columns: 1fr;
    grid-template-areas:
      "input"
      "priority"
      "table";
  }

  .member-main {
    width: 100%;
    margin-left: 0;
    padding: 16px 10px 40px;
  }

  .member-panel,
  .quick-add,
  .member-metrics article {
    width: 100%;
    max-width: 100%;
  }

  .member-hero h1,
  .mode-owner .member-hero h1,
  .mode-admin #member-title {
    font-size: 30px;
    line-height: 1.12;
    overflow-wrap: anywhere;
  }

  .member-hero p,
  .period-panel p:not(.section-kicker),
  .panel-helper,
  .form-note {
    overflow-wrap: anywhere;
  }

  .admin-workspace .quick-add {
    position: static;
  }

  .account-actions {
    width: auto;
    justify-content: flex-end;
    gap: 4px;
    flex: 0 0 auto;
    margin-top: 0;
  }

  .account-chip {
    display: none;
  }

  .logout-btn {
    width: 38px;
    height: 38px;
    justify-content: center;
    padding: 0;
    border-radius: 999px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.36);
  }

  .logout-btn span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .mode-owner .member-main {
    grid-template-columns: 1fr;
  }

  .mode-owner .member-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mode-owner .insight-grid {
    grid-template-columns: 1fr;
  }

  .owner-ai-cta {
    align-items: stretch;
    flex-direction: column;
  }

  .owner-ai-cta .button {
    width: 100%;
  }

  .health-card {
    padding: 14px;
  }

  .health-card strong {
    font-size: 18px;
    line-height: 1.25;
  }

  .health-card p,
  .insight-item {
    font-size: 14px;
    line-height: 1.55;
  }

  .template-generator {
    grid-template-columns: 1fr;
  }

  .condition-grid {
    grid-template-columns: 1fr;
  }

  .funnel-steps {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .funnel-chart {
    min-height: auto;
    gap: 10px;
    padding: 12px;
  }

  .funnel-stage {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) 48px;
  }

  .funnel-stage-body {
    grid-template-columns: auto minmax(0, 1fr);
    width: 100%;
    height: auto;
    min-width: 128px;
    min-height: 76px;
    margin: 0;
    padding: 10px 12px;
  }

  .funnel-stage-bar {
    height: 12px;
    min-width: 18px;
  }

  .funnel-stage-copy h3 {
    font-size: 12px;
  }

  .funnel-stage-meta strong {
    font-size: 16px;
  }

  .funnel-stage-percent {
    min-width: 42px;
    padding: 5px 6px;
    font-size: 11px;
  }

  .funnel-analysis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .funnel-legend {
    grid-template-columns: 1fr;
    grid-column: 1 / -1;
  }

  .owner-action-grid,
  .next-action-list,
  .owner-metric-strip {
    grid-template-columns: 1fr;
  }

  .period-actions,
  .mode-owner .period-actions,
  .mode-admin .period-actions,
  .mode-history .period-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0;
    scrollbar-width: none;
    margin-right: auto;
  }

  .period-actions::-webkit-scrollbar {
    display: none;
  }

  .period-actions button,
  .mode-owner .period-actions button,
  .mode-admin .period-actions button,
  .mode-history .period-actions button {
    min-width: 36px;
    height: 38px;
    width: auto;
    justify-content: center;
    padding: 6px;
    border-color: rgba(18, 63, 159, 0.18);
    color: #123f9f;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(10px);
    flex: 0 0 auto;
    box-shadow: 0 8px 18px rgba(9, 38, 104, 0.08);
  }

  .period-actions button:hover,
  .mode-owner .period-actions button:hover,
  .mode-admin .period-actions button:hover,
  .mode-history .period-actions button:hover {
    background: #ffffff;
    border-color: rgba(18, 63, 159, 0.32);
  }

  .period-actions button.active,
  .period-actions button:focus-visible,
  .mode-owner .period-actions button.active,
  .mode-owner .period-actions button:focus-visible,
  .mode-admin .period-actions button.active,
  .mode-admin .period-actions button:focus-visible,
  .mode-history .period-actions button.active,
  .mode-history .period-actions button:focus-visible {
    background: linear-gradient(135deg, #123f9f, #1d4ed8);
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(9, 38, 104, 0.18);
    min-width: 108px;
  }

  .period-actions button .period-label,
  .mode-owner .period-actions button .period-label,
  .mode-admin .period-actions button .period-label,
  .mode-history .period-actions button .period-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .period-actions button.active,
  .period-actions button:focus-visible,
  .mode-owner .period-actions button.active,
  .mode-owner .period-actions button:focus-visible,
  .mode-admin .period-actions button.active,
  .mode-admin .period-actions button:focus-visible,
  .mode-history .period-actions button.active,
  .mode-history .period-actions button:focus-visible {
    padding-inline: 10px;
  }

  .period-actions button.active .period-label,
  .period-actions button:focus-visible .period-label,
  .mode-owner .period-actions button.active .period-label,
  .mode-owner .period-actions button:focus-visible .period-label,
  .mode-admin .period-actions button.active .period-label,
  .mode-admin .period-actions button:focus-visible .period-label,
  .mode-history .period-actions button.active .period-label,
  .mode-history .period-actions button:focus-visible .period-label {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: nowrap;
    border: 0;
    font-size: 12px;
  }

  .period-actions button svg,
  .pov-tab svg,
  .refresh-all-btn svg,
  .logout-btn svg {
    width: 16px;
    height: 16px;
  }

  .custom-range {
    display: none !important;
  }

  .member-main {
    padding-top: 18px;
  }

  .member-panel,
  .quick-add {
    padding: 12px;
  }

  .member-panel-title h2,
  .quick-add h2 {
    font-size: 18px;
    line-height: 1.2;
  }

  .member-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 16px 0;
  }

  .member-metrics article {
    min-height: 104px;
    padding: 14px;
  }

  .member-metrics strong {
    margin: 8px 0 4px;
    font-size: 22px;
  }

  .funnel-step {
    padding: 12px;
  }

  .funnel-kpis strong {
    font-size: 24px;
  }

  .funnel-analysis {
    grid-template-columns: 1fr;
  }

  .funnel-legend {
    grid-template-columns: 1fr;
  }

  .funnel-summary-note {
    margin-top: 0;
  }

  .owner-breakdown-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .lead-row {
    grid-template-columns: 1fr;
    grid-template-areas:
      "info"
      "status"
      "value"
      "date"
      "actions";
    min-width: 0;
    gap: 8px;
    padding: 10px 0;
  }

  .mode-admin .lead-row {
    grid-template-columns: 1fr;
    grid-template-areas:
      "info"
      "status"
      "value"
      "date"
      "actions";
  }

  .lead-info {
    grid-area: info;
  }

  .status-pill,
  .status-select {
    grid-area: status;
  }

  .lead-value {
    grid-area: value;
    justify-self: start;
  }

  .date-chip {
    grid-area: date;
  }

  .lead-row-actions {
    grid-area: actions;
    justify-content: flex-start;
    width: 100%;
    gap: 8px;
  }

  .lead-row-actions button {
    flex: 1 1 0;
  }

  .lead-actions,
  .template-stack,
  .saved-template-stack,
  .sheets-form {
    width: 100%;
  }

  .template-stack,
  .saved-template-stack {
    display: grid;
    grid-template-columns: 1fr;
  }

  .template-save-row,
  .template-save-actions,
  .invoice-title-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .lead-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .quick-add input,
  .profile-form input,
  .profile-form select,
  .profile-form textarea,
  .account-form input,
  .account-form select,
  .account-form textarea,
  .template-generator input,
  .member-panel textarea,
  .sheets-form input,
  .sheets-form button {
    min-width: 0;
    width: 100%;
  }

  .chart-row header,
  .lead-row strong,
  .lead-row span,
  .lead-row p,
  .status-pill,
  .status-select,
  .date-chip {
    overflow-wrap: anywhere;
    white-space: normal;
  }
}

@media (max-width: 560px) {
  .member-header-top {
    grid-template-columns: minmax(0, 1fr) 40px 36px;
    gap: 4px;
  }

  .member-header .brand-copy strong {
    font-size: 9px;
    white-space: nowrap;
  }

  .member-header .brand-copy small {
    display: none;
  }

  .pov-tab,
  .refresh-all-btn {
    min-width: 0;
    min-height: 40px;
    gap: 8px;
    padding: 10px;
  }

  .pov-tab .pov-label {
    font-size: 12px;
  }

  .period-actions {
    gap: 4px;
  }

  .mobile-range-card {
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 12px;
  }

  .mobile-range-fields {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .mobile-range-actions {
    gap: 8px;
  }

  .mobile-range-actions .button {
    flex: 1 1 0;
  }

  .member-hero h1,
  .mode-owner .member-hero h1,
  .mode-admin #member-title {
    font-size: 24px;
  }

  .member-hero p {
    font-size: 14px;
    line-height: 1.5;
  }
}

.mode-customers .period-panel,
.mode-invoice .period-panel,
.mode-history .period-panel {
  display: none !important;
}

/* Premium CRM polish for Kejarlagi.id */
.member-body {
  background:
    radial-gradient(circle at 14% -12%, rgba(34, 211, 238, 0.24), transparent 28%),
    radial-gradient(circle at 86% -6%, rgba(37, 99, 235, 0.18), transparent 26%),
    linear-gradient(135deg, #eef6ff 0%, #fbfdff 44%, #e9f2ff 100%);
}

.member-header {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 250, 255, 0.94));
  box-shadow: 22px 0 60px rgba(15, 23, 42, 0.09);
}

.member-header .brand-mark,
.brand-mark {
  border-radius: 8px;
}

.pov-toggle,
.account-chip,
.logout-btn,
.member-panel,
.quick-add,
.member-metrics article,
.period-panel,
.invoice-preview,
.invoice-history-item,
.utility-table-row,
.support-card,
.affiliate-card,
.settings-grid article,
.guide-list article {
  border-radius: 8px;
}

.pov-toggle {
  border-color: rgba(200, 218, 248, 0.72);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(238, 246, 255, 0.72));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.pov-tab,
.refresh-all-btn {
  border-radius: 8px;
}

.pov-tab.active {
  background:
    linear-gradient(135deg, #123f9f, #1d4ed8 62%, #22d3ee);
  box-shadow: 0 14px 28px rgba(21, 88, 214, 0.24);
}

.member-main {
  position: relative;
}

.member-main::before {
  content: "";
  position: fixed;
  z-index: -1;
  right: 4vw;
  top: 88px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.16), transparent 68%);
  pointer-events: none;
}

.member-panel,
.quick-add,
.member-metrics article {
  border-color: rgba(200, 218, 248, 0.74);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.94));
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.07);
}

.member-panel {
  position: relative;
  overflow: hidden;
}

.member-panel-title {
  align-items: center;
}

.member-metrics article {
  position: relative;
  overflow: hidden;
}

.member-metrics article::after,
.member-panel::after {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #123f9f, #22d3ee);
  opacity: 0.85;
  pointer-events: none;
}

.member-metrics article.metric-booked::after {
  background: linear-gradient(90deg, #0f766e, #10b981);
}

.member-metrics article.metric-lost::after {
  background: linear-gradient(90deg, #ef4444, #fb7185);
}

.period-panel {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(239, 247, 255, 0.88));
  box-shadow: 0 18px 42px rgba(21, 88, 214, 0.08);
}

.period-actions button {
  border-color: rgba(18, 63, 159, 0.16);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.period-actions button.active {
  border-color: transparent;
  background:
    linear-gradient(135deg, #123f9f, #1d4ed8 64%, #22d3ee);
  box-shadow: 0 12px 24px rgba(21, 88, 214, 0.22);
}

@media (max-width: 900px) {
  .member-header {
    border-bottom: 1px solid rgba(200, 218, 248, 0.72);
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(239, 247, 255, 0.94));
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(18px);
  }

  .member-header .brand,
  .member-header .brand-copy small,
  .mobile-menu-btn {
    color: #123153;
  }

  .member-header .brand-copy strong {
    color: #123153;
    font-size: 12px;
  }

  .mobile-menu-btn {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(18, 63, 159, 0.18);
    border-radius: 999px;
    background:
      radial-gradient(circle at 72% 22%, rgba(34, 211, 238, 0.24), transparent 26%),
      linear-gradient(180deg, #ffffff, #eef6ff);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
  }

  .mobile-menu-btn span {
    height: 2px;
    background: #123f9f;
  }

  .mobile-menu-btn span:nth-child(1) {
    width: 18px;
  }

  .mobile-menu-btn span:nth-child(2) {
    width: 13px;
    justify-self: end;
  }

  .mobile-menu-btn span:nth-child(3) {
    width: 18px;
  }

  .period-panel,
  .mode-owner .period-panel,
  .mode-admin .period-panel,
  .mode-history .period-panel {
    top: 58px;
    width: calc(100% - 20px);
    margin: 8px 10px 12px;
    padding: 7px;
    border: 1px solid rgba(200, 218, 248, 0.86);
    border-radius: 999px;
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(238, 246, 255, 0.92));
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.1);
  }

  .period-actions,
  .mode-owner .period-actions,
  .mode-admin .period-actions,
  .mode-history .period-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .period-actions::-webkit-scrollbar {
    display: none;
  }

  .period-actions button,
  .mode-owner .period-actions button,
  .mode-admin .period-actions button,
  .mode-history .period-actions button {
    min-width: 44px;
    height: 38px;
    flex: 0 0 auto;
    justify-content: center;
    border: 1px solid rgba(18, 63, 159, 0.16);
    border-radius: 999px;
    padding: 0 12px;
    color: #123f9f;
    background: #ffffff;
    box-shadow: none;
  }

  .period-actions button.active,
  .mode-owner .period-actions button.active,
  .mode-admin .period-actions button.active,
  .mode-history .period-actions button.active {
    min-width: 112px;
    color: #ffffff;
    background: linear-gradient(135deg, #123f9f, #1d4ed8 62%, #22d3ee);
  }

  .period-actions button:not(.active) .period-label,
  .mode-owner .period-actions button:not(.active) .period-label,
  .mode-admin .period-actions button:not(.active) .period-label,
  .mode-history .period-actions button:not(.active) .period-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .period-actions button.active .period-label,
  .mode-owner .period-actions button.active .period-label,
  .mode-admin .period-actions button.active .period-label,
  .mode-history .period-actions button.active .period-label {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
    overflow: visible;
  }

  .pov-toggle {
    border-radius: 8px;
    border-color: rgba(200, 218, 248, 0.9);
    background: rgba(255, 255, 255, 0.98);
  }

  .member-panel,
  .quick-add,
  .member-metrics article {
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.07);
  }
}

/* Fresh mobile visual pass for ad-ready dashboard screenshots */
@media (max-width: 900px) {
  .member-body {
    background:
      radial-gradient(circle at 14% -4%, rgba(56, 189, 248, 0.28), transparent 32%),
      radial-gradient(circle at 94% 10%, rgba(59, 130, 246, 0.18), transparent 34%),
      linear-gradient(180deg, #f7fbff 0%, #eef7ff 44%, #f8fbff 100%);
  }

  .member-header {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(191, 219, 254, 0.86);
    background:
      radial-gradient(circle at 12% 0%, rgba(34, 211, 238, 0.28), transparent 34%),
      linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(232, 244, 255, 0.96));
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.12);
  }

  .member-header-top {
    grid-template-columns: minmax(0, 1fr) 44px 42px;
    gap: 10px;
  }

  .member-header .brand {
    gap: 8px;
  }

  .member-header .brand-mark {
    width: 34px;
    height: 34px;
    background:
      radial-gradient(circle at 72% 20%, rgba(255, 255, 255, 0.42), transparent 24%),
      linear-gradient(135deg, #2f7cf6, #23b6e8 62%, #8beafe);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
  }

  .member-header .brand-mark svg {
    width: 26px;
    height: 26px;
  }

  .member-header .brand-copy strong {
    color: #163153;
    font-size: 13px;
    letter-spacing: 0;
  }

  .mobile-menu-btn {
    width: 42px;
    height: 42px;
    color: #1858c9;
    border-color: rgba(37, 99, 235, 0.18);
    background:
      radial-gradient(circle at 72% 18%, rgba(125, 211, 252, 0.34), transparent 30%),
      linear-gradient(180deg, #ffffff, #edf7ff);
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.14);
  }

  .mobile-menu-btn span {
    background: #1d67db;
  }

  .period-panel,
  .mode-owner .period-panel,
  .mode-admin .period-panel,
  .mode-history .period-panel {
    top: 64px;
    width: calc(100% - 24px);
    margin: 10px 12px 14px;
    padding: 8px;
    border-color: rgba(147, 197, 253, 0.52);
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(225, 242, 255, 0.94));
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.12);
  }

  .period-actions button,
  .mode-owner .period-actions button,
  .mode-admin .period-actions button,
  .mode-history .period-actions button {
    height: 40px;
    color: #2463d6;
    border-color: rgba(147, 197, 253, 0.58);
    background: rgba(255, 255, 255, 0.88);
  }

  .period-actions button.active,
  .mode-owner .period-actions button.active,
  .mode-admin .period-actions button.active,
  .mode-history .period-actions button.active {
    background: linear-gradient(135deg, #2f7cf6, #23b6e8 70%, #8beafe);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.2);
  }

  .member-main {
    padding: 18px 12px 104px;
  }

  .member-hero,
  .quick-add,
  .member-panel,
  .member-metrics article {
    border-color: rgba(147, 197, 253, 0.48);
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 250, 255, 0.96));
    box-shadow: 0 16px 34px rgba(37, 99, 235, 0.1);
  }

  .member-panel,
  .quick-add {
    padding: 16px;
  }

  .member-metrics {
    gap: 10px;
  }

  .member-metrics article {
    min-height: 118px;
    padding: 16px;
  }

  .member-metrics article::after,
  .member-panel::after {
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #38bdf8, #67e8f9);
  }

  .member-metrics article.metric-booked::after {
    background: linear-gradient(90deg, #10b981, #34d399);
  }

  .member-metrics article.metric-lost::after {
    background: linear-gradient(90deg, #f97316, #fb7185);
  }

  .member-metrics strong {
    color: #10213f;
  }

  .member-panel-title h2,
  .quick-add h2 {
    color: #10213f;
  }

  .pov-toggle {
    top: calc(100% + 12px);
    left: 4px;
    right: 4px;
    width: min(370px, calc(100vw - 24px));
    border-color: rgba(147, 197, 253, 0.54);
    background:
      linear-gradient(180deg, #ffffff, #f3f9ff);
    box-shadow: 0 18px 42px rgba(37, 99, 235, 0.16);
  }

  .pov-tab.active {
    color: #ffffff;
    background: linear-gradient(135deg, #2f7cf6, #23b6e8);
  }

  .ai-chat-panel {
    border-color: rgba(147, 197, 253, 0.58);
    box-shadow: 0 22px 52px rgba(37, 99, 235, 0.2);
  }

  .ai-chat-head {
    background: linear-gradient(135deg, #2f7cf6, #23b6e8);
  }
}

@media (max-width: 520px) {
  .member-main {
    padding-left: 10px;
    padding-right: 10px;
  }

  .member-panel,
  .quick-add {
    padding: 14px;
  }

  .member-hero h1,
  .mode-owner .member-hero h1,
  .mode-admin #member-title {
    font-size: 28px;
  }
}
