/* Rebrand-only Keeper KPI profile. The current /app profile keeps its existing styles. */
html.ke-rebrand-mode [data-ke-open-profile] { cursor: pointer; }
html.ke-rebrand-mode [data-ke-open-profile]:focus-visible { border-radius: 10px; outline: 2px solid #e9ba61; outline-offset: 4px; }

html.ke-rebrand-mode #profile-overlay.ke-profile-overlay {
  background: #f3eadc;
  color: #1a2830;
  font-family: 'DM Sans', sans-serif;
  z-index: 9700;
}

html.ke-rebrand-mode .ke-profile-topbar {
  align-items: center;
  background: #1a2830;
  border-bottom: 1px solid rgba(233,186,97,.34);
  color: #fffaf2;
  display: flex;
  flex: 0 0 auto;
  justify-content: space-between;
  min-height: 68px;
  padding: max(10px, env(safe-area-inset-top)) clamp(15px, 4vw, 34px) 10px;
}

html.ke-rebrand-mode .ke-profile-topbar-copy { align-items: center; display: flex; gap: 13px; }
html.ke-rebrand-mode .ke-profile-topbar-copy img { height: 35px; object-fit: contain; width: 35px; }
html.ke-rebrand-mode .ke-profile-topbar-copy span { color: #d9b671; display: block; font-size: 8px; font-weight: 800; letter-spacing: 1.3px; margin-bottom: 2px; }
html.ke-rebrand-mode .ke-profile-topbar-copy strong { display: block; font-family: 'Playfair Display', serif; font-size: 19px; }

html.ke-rebrand-mode .ke-profile-back,
html.ke-rebrand-mode .ke-profile-close {
  align-items: center;
  background: transparent;
  border: 1px solid rgba(233,186,97,.36);
  border-radius: 50%;
  color: #fffaf2;
  cursor: pointer;
  display: flex;
  font-size: 20px;
  height: 38px;
  justify-content: center;
  padding: 0;
  width: 38px;
}
html.ke-rebrand-mode .ke-profile-back[hidden] { display: none; }

html.ke-rebrand-mode .ke-profile-scroll {
  flex: 1;
  overflow-y: auto;
  padding: clamp(18px, 4vw, 42px) clamp(14px, 4vw, 38px) max(110px, calc(36px + env(safe-area-inset-bottom)));
}
html.ke-rebrand-mode .ke-profile-inner { margin: 0 auto; max-width: 1120px; }

html.ke-rebrand-mode .ke-profile-loading,
html.ke-rebrand-mode .ke-profile-error {
  align-items: center;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  justify-content: center;
  min-height: 320px;
  padding: 30px;
  text-align: center;
}
html.ke-rebrand-mode .ke-profile-loader { animation: keProfileSpin .8s linear infinite; border: 3px solid rgba(109,51,70,.14); border-radius: 50%; border-top-color: #6d3346; height: 34px; width: 34px; }
@keyframes keProfileSpin { to { transform: rotate(360deg); } }

html.ke-rebrand-mode .ke-profile-hero {
  background: linear-gradient(135deg, #1a2830 0%, #223943 58%, #6d3346 145%);
  border: 1px solid rgba(233,186,97,.68);
  border-radius: 26px;
  box-shadow: 0 18px 46px rgba(26,40,48,.16);
  color: #fffaf2;
  display: grid;
  gap: 26px;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr);
  overflow: hidden;
  padding: clamp(24px, 5vw, 46px);
  position: relative;
}
html.ke-rebrand-mode .ke-profile-hero::after,
html.ke-rebrand-mode .ke-profile-kpi::after {
  animation: keProfileShimmer 5.5s ease-in-out infinite;
  background: linear-gradient(112deg, transparent 36%, rgba(255,255,255,.18) 49%, transparent 62%);
  content: '';
  inset: 0;
  pointer-events: none;
  position: absolute;
  transform: translateX(-110%);
}
@keyframes keProfileShimmer { 0%, 25% { transform: translateX(-110%); } 70%, 100% { transform: translateX(110%); } }

html.ke-rebrand-mode .ke-profile-identity { align-items: center; display: flex; gap: 20px; min-width: 0; position: relative; z-index: 1; }
html.ke-rebrand-mode .ke-profile-avatar {
  align-items: center;
  background: #6d3346;
  border: 2px solid #e9ba61;
  border-radius: 50%;
  box-shadow: 0 0 0 8px rgba(233,186,97,.12);
  color: #fffaf2;
  display: flex;
  flex: 0 0 88px;
  font-family: 'Playfair Display', serif;
  font-size: 29px;
  height: 88px;
  justify-content: center;
}
html.ke-rebrand-mode .ke-profile-eyebrow { color: #e9ba61; display: block; font-size: 9px; font-weight: 900; letter-spacing: 1.2px; margin-bottom: 7px; text-transform: uppercase; }
html.ke-rebrand-mode .ke-profile-identity h1 { font-family: 'Playfair Display', serif; font-size: clamp(30px, 5vw, 48px); line-height: 1; margin: 0 0 9px; }
html.ke-rebrand-mode .ke-profile-identity p { color: rgba(255,250,242,.7); font-family: 'Cormorant Garamond', serif; font-size: 18px; font-style: italic; margin: 0; }
html.ke-rebrand-mode .ke-profile-membership { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
html.ke-rebrand-mode .ke-profile-membership span { background: rgba(255,255,255,.08); border: 1px solid rgba(233,186,97,.28); border-radius: 999px; color: #fffaf2; font-size: 9px; font-weight: 800; letter-spacing: .4px; padding: 7px 10px; text-transform: uppercase; }

html.ke-rebrand-mode .ke-profile-flame-card {
  align-items: center;
  align-self: stretch;
  background: rgba(109,51,70,.9);
  border: 1px solid rgba(233,186,97,.58);
  border-radius: 19px;
  display: flex;
  gap: 16px;
  padding: 22px;
  position: relative;
  z-index: 1;
}
html.ke-rebrand-mode .ke-profile-flame-card svg { fill: #e2bb68; flex: 0 0 45px; height: 56px; width: 45px; }
html.ke-rebrand-mode .ke-profile-flame-card span { color: #e9ba61; display: block; font-size: 8px; font-weight: 900; letter-spacing: 1px; margin-bottom: 5px; }
html.ke-rebrand-mode .ke-profile-flame-card strong { display: block; font-family: 'Playfair Display', serif; font-size: 23px; }
html.ke-rebrand-mode .ke-profile-flame-card small { color: rgba(255,250,242,.68); display: block; font-size: 10px; margin-top: 6px; }

html.ke-rebrand-mode .ke-profile-section { margin-top: 34px; }
html.ke-rebrand-mode .ke-profile-section-heading { align-items: end; display: flex; gap: 20px; justify-content: space-between; margin-bottom: 15px; }
html.ke-rebrand-mode .ke-profile-section-heading h2 { font-family: 'Playfair Display', serif; font-size: clamp(25px, 4vw, 34px); line-height: 1.05; margin: 0; }
html.ke-rebrand-mode .ke-profile-section-heading p { color: #6d777b; font-family: 'Cormorant Garamond', serif; font-size: 17px; font-style: italic; margin: 0; text-align: right; }

html.ke-rebrand-mode .ke-profile-kpi-grid { display: grid; gap: 13px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
html.ke-rebrand-mode .ke-profile-kpi {
  background: #fffdfa;
  border: 1px solid rgba(200,165,88,.48);
  border-radius: 17px;
  min-height: 130px;
  overflow: hidden;
  padding: 18px;
  position: relative;
}
html.ke-rebrand-mode .ke-profile-kpi.is-burgundy { background: #6d3346; color: #fffaf2; }
html.ke-rebrand-mode .ke-profile-kpi.is-navy { background: #1a2830; color: #fffaf2; }
html.ke-rebrand-mode .ke-profile-kpi.is-gold { background: #dfbb70; border-color: #cfaa5d; color: #1a2830; }
html.ke-rebrand-mode .ke-profile-kpi span { color: currentColor; display: block; font-size: 8px; font-weight: 900; letter-spacing: 1px; opacity: .7; text-transform: uppercase; }
html.ke-rebrand-mode .ke-profile-kpi strong { display: block; font-family: 'Playfair Display', serif; font-size: clamp(29px, 4vw, 40px); line-height: 1; margin: 13px 0 7px; }
html.ke-rebrand-mode .ke-profile-kpi small { color: currentColor; display: block; font-size: 10px; line-height: 1.35; opacity: .7; }

html.ke-rebrand-mode .ke-profile-today-grid { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0,1fr)); }
html.ke-rebrand-mode .ke-profile-status-card { align-items: center; background: #fffdfa; border: 1px solid rgba(200,165,88,.42); border-radius: 15px; display: flex; gap: 13px; min-height: 82px; padding: 15px; }
html.ke-rebrand-mode .ke-profile-status-icon { align-items: center; background: #f6ead3; border-radius: 50%; color: #6d3346; display: flex; flex: 0 0 38px; font-size: 16px; font-weight: 900; height: 38px; justify-content: center; }
html.ke-rebrand-mode .ke-profile-status-card span { color: #7a6066; display: block; font-size: 8px; font-weight: 900; letter-spacing: .8px; text-transform: uppercase; }
html.ke-rebrand-mode .ke-profile-status-card strong { display: block; font-size: 13px; margin-top: 4px; }
html.ke-rebrand-mode .ke-profile-status-card small { color: #6d777b; display: block; font-size: 9px; margin-top: 3px; }

html.ke-rebrand-mode .ke-profile-options-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0,1fr)); }
html.ke-rebrand-mode .ke-profile-option {
  align-items: center;
  background: #fffdfa;
  border: 1px solid rgba(200,165,88,.44);
  border-radius: 15px;
  color: #1a2830;
  cursor: pointer;
  display: flex;
  gap: 13px;
  min-height: 76px;
  padding: 14px 16px;
  text-align: left;
  width: 100%;
}
html.ke-rebrand-mode .ke-profile-option:hover { border-color: #c8a558; box-shadow: 0 8px 20px rgba(26,40,48,.08); transform: translateY(-1px); }
html.ke-rebrand-mode .ke-profile-option-icon { align-items: center; background: #f6ead3; border-radius: 12px; color: #6d3346; display: flex; flex: 0 0 42px; font-size: 17px; font-weight: 900; height: 42px; justify-content: center; }
html.ke-rebrand-mode .ke-profile-option-copy { flex: 1; min-width: 0; }
html.ke-rebrand-mode .ke-profile-option-copy strong { display: block; font-family: 'Playfair Display', serif; font-size: 16px; }
html.ke-rebrand-mode .ke-profile-option-copy small { color: #687478; display: block; font-size: 9px; line-height: 1.35; margin-top: 4px; }
html.ke-rebrand-mode .ke-profile-option-status { color: #6d3346; font-size: 9px; font-weight: 900; text-align: right; text-transform: uppercase; }
html.ke-rebrand-mode .ke-profile-option-arrow { color: #6d3346; font-size: 18px; }

html.ke-rebrand-mode .ke-profile-view-header { margin: 0 auto 24px; max-width: 760px; text-align: center; }
html.ke-rebrand-mode .ke-profile-view-header h1 { font-family: 'Playfair Display', serif; font-size: clamp(32px, 6vw, 48px); line-height: 1.03; margin: 5px 0 10px; }
html.ke-rebrand-mode .ke-profile-view-header p { color: #765f64; font-family: 'Cormorant Garamond', serif; font-size: 19px; font-style: italic; margin: 0; }
html.ke-rebrand-mode .ke-profile-panel { background: #fffdfa; border: 1px solid rgba(200,165,88,.48); border-radius: 20px; margin: 0 auto 18px; max-width: 820px; padding: clamp(18px, 4vw, 30px); }
html.ke-rebrand-mode .ke-profile-panel h2 { font-family: 'Playfair Display', serif; font-size: 24px; margin: 0 0 5px; }
html.ke-rebrand-mode .ke-profile-panel > p { color: #6c777a; font-size: 11px; line-height: 1.5; margin: 0 0 20px; }

html.ke-rebrand-mode .ke-profile-form-grid { display: grid; gap: 15px; grid-template-columns: repeat(2, minmax(0,1fr)); }
html.ke-rebrand-mode .ke-profile-field { display: grid; gap: 6px; }
html.ke-rebrand-mode .ke-profile-field.is-wide { grid-column: 1 / -1; }
html.ke-rebrand-mode .ke-profile-field span { color: #6d3346; font-size: 9px; font-weight: 900; letter-spacing: .8px; text-transform: uppercase; }
html.ke-rebrand-mode .ke-profile-field input,
html.ke-rebrand-mode .ke-profile-field select { background: #fff; border: 1px solid rgba(200,165,88,.52); border-radius: 12px; color: #1a2830; font: inherit; min-height: 48px; padding: 0 13px; }
html.ke-rebrand-mode .ke-profile-field input[readonly] { background: #f5f0e8; color: #687478; }
html.ke-rebrand-mode .ke-profile-primary { background: #dfb967; border: 1px solid #c89f4e; border-radius: 999px; color: #1a2830; cursor: pointer; font-size: 11px; font-weight: 900; min-height: 46px; padding: 0 22px; }
html.ke-rebrand-mode .ke-profile-primary:disabled { cursor: wait; opacity: .58; }
html.ke-rebrand-mode .ke-profile-form-status { color: #6d3346; font-size: 10px; margin-left: 10px; }

html.ke-rebrand-mode .ke-profile-setting { align-items: center; border-top: 1px solid rgba(200,165,88,.28); display: flex; gap: 18px; justify-content: space-between; padding: 16px 0; }
html.ke-rebrand-mode .ke-profile-setting:first-of-type { border-top: 0; }
html.ke-rebrand-mode .ke-profile-setting-copy { min-width: 0; }
html.ke-rebrand-mode .ke-profile-setting-copy strong { display: block; font-size: 13px; }
html.ke-rebrand-mode .ke-profile-setting-copy small { color: #6c777a; display: block; font-size: 9px; line-height: 1.4; margin-top: 4px; }
html.ke-rebrand-mode .ke-profile-switch { flex: 0 0 auto; position: relative; }
html.ke-rebrand-mode .ke-profile-switch input { height: 1px; opacity: 0; position: absolute; width: 1px; }
html.ke-rebrand-mode .ke-profile-switch span { background: #dfe2e3; border-radius: 999px; display: block; height: 27px; position: relative; transition: .2s; width: 48px; }
html.ke-rebrand-mode .ke-profile-switch span::after { background: #fff; border-radius: 50%; box-shadow: 0 2px 6px rgba(26,40,48,.2); content: ''; height: 21px; left: 3px; position: absolute; top: 3px; transition: .2s; width: 21px; }
html.ke-rebrand-mode .ke-profile-switch input:checked + span { background: #dcb568; }
html.ke-rebrand-mode .ke-profile-switch input:checked + span::after { transform: translateX(21px); }
html.ke-rebrand-mode .ke-profile-select { background: #fff; border: 1px solid rgba(200,165,88,.56); border-radius: 999px; color: #1a2830; font: inherit; font-size: 10px; min-height: 38px; padding: 0 12px; }
html.ke-rebrand-mode .ke-profile-data-actions { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0,1fr)); }
html.ke-rebrand-mode .ke-profile-data-button { background: #fff; border: 1px solid rgba(109,51,70,.3); border-radius: 999px; color: #6d3346; cursor: pointer; font-size: 9px; font-weight: 900; min-height: 42px; padding: 0 14px; text-transform: uppercase; }
html.ke-rebrand-mode .ke-profile-data-button.is-danger { background: #fbf2f0; border-color: rgba(162,57,69,.35); }
html.ke-rebrand-mode .ke-profile-danger-row { border-top: 1px solid rgba(162,57,69,.18); display: grid; gap: 10px; margin-top: 18px; padding-top: 18px; }
html.ke-rebrand-mode .ke-profile-text-button { background: transparent; border: 0; color: #6d3346; cursor: pointer; font-size: 10px; font-weight: 800; padding: 7px; text-decoration: underline; }

@media (max-width: 780px) {
  html.ke-rebrand-mode .ke-profile-hero { grid-template-columns: 1fr; }
  html.ke-rebrand-mode .ke-profile-kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  html.ke-rebrand-mode .ke-profile-today-grid { grid-template-columns: 1fr; }
  html.ke-rebrand-mode .ke-profile-section-heading { align-items: start; flex-direction: column; gap: 5px; }
  html.ke-rebrand-mode .ke-profile-section-heading p { text-align: left; }
}

@media (max-width: 560px) {
  html.ke-rebrand-mode .ke-profile-topbar { min-height: 61px; }
  html.ke-rebrand-mode .ke-profile-topbar-copy img { height: 30px; width: 30px; }
  html.ke-rebrand-mode .ke-profile-topbar-copy strong { font-size: 16px; }
  html.ke-rebrand-mode .ke-profile-scroll { padding: 14px 11px 100px; }
  html.ke-rebrand-mode .ke-profile-hero { border-radius: 20px; padding: 22px 18px; }
  html.ke-rebrand-mode .ke-profile-identity { align-items: flex-start; gap: 15px; }
  html.ke-rebrand-mode .ke-profile-avatar { flex-basis: 68px; font-size: 23px; height: 68px; }
  html.ke-rebrand-mode .ke-profile-flame-card { padding: 17px; }
  html.ke-rebrand-mode .ke-profile-kpi { min-height: 116px; padding: 15px; }
  html.ke-rebrand-mode .ke-profile-options-grid,
  html.ke-rebrand-mode .ke-profile-form-grid,
  html.ke-rebrand-mode .ke-profile-data-actions { grid-template-columns: 1fr; }
  html.ke-rebrand-mode .ke-profile-field.is-wide { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html.ke-rebrand-mode .ke-profile-hero::after,
  html.ke-rebrand-mode .ke-profile-kpi::after,
  html.ke-rebrand-mode .ke-profile-loader { animation: none; }
  html.ke-rebrand-mode .ke-profile-option { transition: none; }
}
