/* ============================================
   Auth Modal — JARGAN SPA
   Prototype-exact CSS (prototype-auth-checkout.html)
   Brand: #DD5100 (Traffic Orange)
   ============================================ */

/* ---- Animations ---- */
@keyframes authFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes authScaleIn { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes authLogoEntrance { 0% { opacity: 0; transform: scale(0.75); } 65% { opacity: 1; transform: scale(1.05); } 100% { opacity: 1; transform: scale(1); } }
@keyframes authIndicatorSlideIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: translateX(0); } }
@keyframes authErrorSlideIn { from { opacity: 0; transform: translateY(-8px); max-height: 0; } to { opacity: 1; transform: translateY(0); max-height: 120px; } }
/* Auth 2x2 grid loader keyframes (miniaturized splash animation, 3s cycle) */
@keyframes authC1 {
  0%     { transform: translate(0, 0); }
  8.33%  { transform: translate(-60px, 0); }
  25%    { transform: translate(-60px, 0); }
  33.33% { transform: translate(-60px, 60px); }
  50%    { transform: translate(-60px, 60px); }
  58.33% { transform: translate(0, 60px); }
  75%    { transform: translate(0, 60px); }
  83.33% { transform: translate(0, 0); }
  100%   { transform: translate(0, 0); }
}
@keyframes authC2 {
  0%     { transform: translate(0, 0); }
  8.33%  { transform: translate(0, 0); }
  16.67% { transform: translate(0, -60px); }
  33.33% { transform: translate(0, -60px); }
  41.67% { transform: translate(-60px, -60px); }
  58.33% { transform: translate(-60px, -60px); }
  66.67% { transform: translate(-60px, 0); }
  83.33% { transform: translate(-60px, 0); }
  91.67% { transform: translate(0, 0); }
  100%   { transform: translate(0, 0); }
}
@keyframes authC3 {
  0%     { transform: translate(0, 0); }
  16.67% { transform: translate(0, 0); }
  25%    { transform: translate(60px, 0); }
  41.67% { transform: translate(60px, 0); }
  50%    { transform: translate(60px, -60px); }
  66.67% { transform: translate(60px, -60px); }
  75%    { transform: translate(0, -60px); }
  91.67% { transform: translate(0, -60px); }
  100%   { transform: translate(0, 0); }
}
@keyframes slideLeft { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideRight { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes checkPop { 0% { transform: scale(0); opacity: 0; } 60% { transform: scale(1.2); } 100% { transform: scale(1); opacity: 1; } }

/* ---- Overlay ---- */
.auth-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  animation: authFadeIn 200ms ease both;
  padding: 8px;
  overflow-y: auto;
}

/* ---- Modal ---- */
.auth-modal-content {
  background: #1a1a1a;
  border: 2px solid #DD5100;
  border-radius: 8px;
  padding: 14px 16px;
  max-width: 400px;
  width: 100%;
  max-height: calc(100vh - 16px);
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  animation: authScaleIn 250ms ease both;
  position: relative;
  -webkit-overflow-scrolling: touch;
}
.auth-modal-content::-webkit-scrollbar { width: 0; }
.auth-modal-content { scrollbar-width: none; }

/* ---- Skip / Close ---- */
.auth-skip {
  position: absolute; top: 4px; right: 6px;
  background: none; border: none; color: #666; font-size: 11px;
  cursor: pointer; padding: 2px 6px; border-radius: 4px;
  transition: color 150ms, background 150ms; z-index: 2;
  font-family: inherit;
}
.auth-skip:hover { color: #999; background: rgba(255,255,255,0.05); }

/* ---- Header ---- */
.auth-header { text-align: center; margin-bottom: 8px; clear: both; }
.auth-lockup {
  width: 140px; height: auto; display: block; margin: 0 auto 2px;
  animation: authLogoEntrance 400ms cubic-bezier(0.34,1.56,0.64,1) both;
  animation-delay: 120ms;
}
.auth-header p { color: #999; margin: 2px 0 0; font-size: 11px; min-height: 14px; }

/* ---- Views ---- */
.auth-view { display: none; }
.auth-view.active { display: block; }
.auth-view.slide-in-right { animation: slideLeft 280ms ease both; }
.auth-view.slide-in-left { animation: slideRight 280ms ease both; }

/* ---- Plan Cards (scoped to auth modal) ---- */
#authModal .plan-cards { display: flex; gap: 6px; margin-bottom: 10px; }
#authModal .plan-card {
  flex: 1; background: #222; border: 1.5px solid #333; border-radius: 8px;
  padding: 8px 10px; cursor: pointer; text-align: left;
  transition: border-color 150ms, background 150ms;
  display: flex; gap: 8px; align-items: flex-start;
  -webkit-appearance: none; appearance: none; color: inherit; font: inherit;
  flex-direction: row;
}
#authModal .plan-card:hover { border-color: #555; }
#authModal .plan-card.selected { border-color: #DD5100; background: rgba(221,81,0,0.06); }

#authModal .plan-radio {
  width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid #555;
  flex-shrink: 0; margin-top: 1px; position: relative;
  transition: border-color 150ms;
  box-sizing: content-box;
  background: transparent;
}
#authModal .plan-card.selected .plan-radio { border-color: #DD5100; }
#authModal .plan-card.selected .plan-radio::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 8px; height: 8px; border-radius: 50%; background: #DD5100;
}

#authModal .plan-name { font-size: 12px; font-weight: 600; color: #fff; margin-bottom: 1px; }
#authModal .plan-price { font-size: 11px; color: #DD5100; font-weight: 700; }
#authModal .plan-price .period { color: #888; font-weight: 400; }
#authModal .plan-price .plan-note { display: block; font-size: 10px; color: #888; font-weight: 400; margin-top: 1px; }
#authModal .plan-features { list-style: none; padding: 0; margin: 3px 0 0; }
#authModal .plan-features li {
  font-size: 10px; color: #999; padding: 0.5px 0;
  display: flex; align-items: center; gap: 3px;
}
#authModal .plan-features li svg { flex-shrink: 0; color: #4a4; }

/* ---- Tour Choice Cards (SP-246) — clones .plan-card vocabulary ---- */
#authModal .tour-choice-cards {
  display: flex; gap: 8px; margin-bottom: 12px;
}
#authModal .tour-choice-card {
  flex: 1; background: #242424; border: 1.5px solid #444; border-radius: 8px;
  padding: 14px 14px; cursor: pointer; text-align: left;
  transition: border-color 150ms, background 150ms, transform 100ms;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  -webkit-appearance: none; appearance: none; color: inherit; font: inherit;
  min-height: 112px;
}
#authModal .tour-choice-card:hover {
  border-color: #DD5100; background: rgba(221,81,0,0.04);
}
#authModal .tour-choice-card:active {
  transform: translateY(1px);
}
#authModal .tour-choice-card:focus-visible {
  outline: 2px solid #DD5100; outline-offset: 2px;
}
#authModal .tour-choice-icon {
  width: 32px; height: 32px; color: #DD5100;
  display: inline-flex; align-items: center; justify-content: center;
}
#authModal .tour-choice-icon svg {
  width: 32px; height: 32px; stroke-width: 1.75;
}
#authModal .tour-choice-name {
  font-size: 16px; font-weight: 600; color: #fff; line-height: 1.2;
}
#authModal .tour-choice-desc {
  font-size: 13px; color: #999; line-height: 1.4;
}

/* Auth link button — standalone link-style CTA below the cards */
#authModal .auth-link-btn {
  background: none; border: none; color: #DD5100; font-size: 13px;
  cursor: pointer; font-weight: 600; padding: 6px 4px; margin: 4px auto 0;
  display: block; width: 100%; text-align: center;
  transition: color 150ms;
  -webkit-tap-highlight-color: transparent;
  min-height: 36px;
}
#authModal .auth-link-btn:hover { color: #ff6b00; }
#authModal .auth-link-btn:focus-visible { outline: 2px solid #DD5100; outline-offset: 2px; border-radius: 4px; }

/* Stacked on mobile, side-by-side on desktop */
@media (max-width: 560px) {
  #authModal .tour-choice-cards { flex-direction: column; }
  #authModal .tour-choice-card { min-height: 96px; }
}

/* ---- Form (scoped to auth modal) ---- */
#authModal .form-row { display: flex; gap: 8px; }
#authModal .form-half { flex: 1; min-width: 0; }
#authModal .form-group { margin-bottom: 8px; }
#authModal .form-group label { display: block; margin-bottom: 2px; color: #ccc; font-size: 11px; font-weight: 500; }
#authModal .form-group input {
  width: 100%; padding: 7px 10px; background: #222; border: 1px solid #444;
  border-radius: 6px; color: #fff; font-size: 16px; line-height: 1.3;
  transition: border-color 150ms, box-shadow 150ms;
  -webkit-appearance: none; appearance: none; box-sizing: border-box;
}
#authModal .form-group input::placeholder { color: #666; }
#authModal .form-group input:focus { outline: none; border-color: #DD5100; box-shadow: 0 0 0 3px rgba(221,81,0,0.15); }

/* ---- Password show/hide toggle ---- */
.password-field-wrapper {
  position: relative;
}
.password-field-wrapper input {
  padding-right: 38px !important;
}
.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.password-toggle:hover {
  color: #fff;
}
.password-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- Buttons (scoped to auth modal) ---- */
#authModal .btn-primary {
  width: 100%; padding: 10px 16px; background: #DD5100; color: white;
  border: none; border-radius: 6px; font-size: 14px; font-weight: 600;
  cursor: pointer; min-height: 44px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 4px;
  transition: background 100ms, transform 100ms, box-shadow 100ms;
  -webkit-tap-highlight-color: transparent;
}
#authModal .btn-primary:hover:not(:disabled):not(.loading) { background: #c44600; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(221,81,0,0.35); }
#authModal .btn-primary:active:not(:disabled):not(.loading) { transform: translateY(0); box-shadow: none; background: #b03e00; }
#authModal .btn-primary:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
#authModal .btn-primary:disabled { background: #555; cursor: not-allowed; opacity: 0.7; }
#authModal .btn-primary.loading { pointer-events: none; background: #555; }
#authModal .btn-primary .auth-btn-text { display: inline; }
#authModal .btn-primary .auth-btn-loading { display: none; align-items: center; gap: 8px; }
#authModal .btn-primary.loading .auth-btn-text { display: none; }
#authModal .btn-primary.loading .auth-btn-loading { display: flex; }

/* Keep old class name working too */
.auth-btn-primary {
  width: 100%; padding: 10px 16px; background: #DD5100; color: white;
  border: none; border-radius: 6px; font-size: 14px; font-weight: 600;
  cursor: pointer; min-height: 44px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 4px; transition: background 100ms, transform 100ms, box-shadow 100ms;
  -webkit-tap-highlight-color: transparent; position: relative;
}

.auth-btn-primary:hover:not(:disabled):not(.loading) { background: #c44600; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(221,81,0,0.35); }
.auth-btn-primary:active:not(:disabled):not(.loading) { transform: translateY(0); box-shadow: none; background: #b03e00; }
.auth-btn-primary:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.auth-btn-primary:disabled { background: #555; cursor: not-allowed; opacity: 0.7; }
.auth-btn-primary.loading { pointer-events: none; background: #555; }
.auth-btn-primary .auth-btn-text { display: inline; }
.auth-btn-primary .auth-btn-loading { display: none; align-items: center; gap: 8px; }
.auth-btn-primary.loading .auth-btn-text { display: none; }
.auth-btn-primary.loading .auth-btn-loading { display: flex; }

/* Branded 2x2 grid loader (miniaturized splash screen animation) */
.auth-jargan-loader {
  display: inline-block;
  width: 20px;
  height: 20px;
  vertical-align: middle;
  flex-shrink: 0;
}
.auth-jargan-loader svg {
  width: 100%;
  height: 100%;
}
.auth-kg-c1 { animation: authC1 3s ease-in-out infinite; }
.auth-kg-c2 { animation: authC2 3s ease-in-out infinite; }
.auth-kg-c3 { animation: authC3 3s ease-in-out infinite; }

/* ---- Divider (scoped to auth modal) ---- */
#authModal .auth-divider { display: flex; align-items: center; margin: 10px 0; gap: 10px; }
#authModal .auth-divider::before, #authModal .auth-divider::after { content: ''; flex: 1; height: 1px; background: #333; }
#authModal .auth-divider span { font-size: 11px; color: #666; white-space: nowrap; }

/* ---- Google button (scoped to auth modal) ---- */
#authModal .google-btn {
  width: 100%; padding: 10px 16px; background: #222; border: 1px solid #444;
  border-radius: 6px; color: #fff; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; transition: background 150ms, border-color 150ms;
  -webkit-tap-highlight-color: transparent;
}
#authModal .google-btn:hover { background: #2a2a2a; border-color: #555; }
#authModal .google-btn svg { width: 18px; height: 18px; }

/* ---- Switch row (scoped to auth modal) ---- */
#authModal .switch-row { text-align: center; margin-top: 10px; font-size: 12px; color: #888; }
#authModal .switch-link {
  background: none; border: none; color: #DD5100; font-size: 12px;
  cursor: pointer; font-weight: 600; padding: 0; margin-left: 4px;
  transition: color 150ms; -webkit-tap-highlight-color: transparent;
}
#authModal .switch-link:hover { color: #ff6b00; }

/* ============================================
   NUCLEAR OVERRIDE: Auth modal is ALWAYS dark.
   These [data-theme] #authModal rules beat every
   light-theme selector in this file and in
   styles-instrument-paper.css / styles-mobile.css.
   Specificity: attr + ID + class > attr + class.
   ============================================ */

/* Modal container + overlay — always dark */
[data-theme] #authModal.auth-modal-overlay { background: rgba(0,0,0,0.82); }
[data-theme] #authModal .auth-modal-content {
  background: #1a1a1a; border: 2px solid #DD5100; border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5); color: #fff;
}

/* Header */
[data-theme] #authModal .auth-lockup { fill: #DD5100; }
[data-theme] #authModal .auth-header p { color: #999; }

/* Plan cards — horizontal layout, dark bg */
[data-theme] #authModal .plan-cards { display: flex; gap: 6px; margin-bottom: 10px; }
[data-theme] #authModal .plan-card {
  flex: 1; background: #222; border: 1.5px solid #333; border-radius: 8px;
  padding: 8px 10px; display: flex; flex-direction: row; gap: 8px;
  align-items: flex-start; cursor: pointer;
}
[data-theme] #authModal .plan-card:hover { border-color: #555; }
[data-theme] #authModal .plan-card.selected { border-color: #DD5100; background: rgba(221,81,0,0.06); }

/* Plan radio — CIRCLES, never squares */
[data-theme] #authModal .plan-radio {
  width: 16px; height: 16px; border-radius: 50% !important; border: 1.5px solid #555;
  flex-shrink: 0; margin-top: 1px; position: relative;
  box-sizing: content-box !important;
  background: transparent;
}
[data-theme] #authModal .plan-card.selected .plan-radio { border-color: #DD5100; }
[data-theme] #authModal .plan-card.selected .plan-radio::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 8px; height: 8px; border-radius: 50% !important; background: #DD5100;
}

/* Plan text */
[data-theme] #authModal .plan-name { font-size: 12px; font-weight: 600; color: #fff; }
[data-theme] #authModal .plan-price { font-size: 11px; color: #DD5100; font-weight: 700; }
[data-theme] #authModal .plan-price .period { color: #888; font-weight: 400; }
[data-theme] #authModal .plan-price .plan-note { display: block; font-size: 10px; color: #888; font-weight: 400; }
[data-theme] #authModal .plan-features li { font-size: 10px; color: #999; }
[data-theme] #authModal .plan-features li svg { color: #4a4; }

/* Form groups */
[data-theme] #authModal .form-group { margin-bottom: 8px; }
[data-theme] #authModal .form-group label { display: block; margin-bottom: 2px; color: #ccc; font-size: 11px; font-weight: 500; }
[data-theme] #authModal .form-group input {
  width: 100%; padding: 7px 10px; background: #222; border: 1px solid #444;
  border-radius: 6px; color: #fff; font-size: 16px; line-height: 1.3;
  height: auto; -webkit-appearance: none; appearance: none;
}
[data-theme] #authModal .form-group input::placeholder { color: #666; }
[data-theme] #authModal .form-group input:focus { outline: none; border-color: #DD5100; box-shadow: 0 0 0 3px rgba(221,81,0,0.15); }

/* Buttons */
[data-theme] #authModal .btn-primary {
  width: 100%; padding: 10px 16px; background: #DD5100; color: white;
  border: none; border-radius: 6px; font-size: 14px; font-weight: 600;
  min-height: 44px; cursor: pointer;
}
[data-theme] #authModal .btn-primary:hover:not(:disabled):not(.loading) { background: #c44600; }
[data-theme] #authModal .btn-primary:disabled { background: #555; cursor: not-allowed; opacity: 0.7; }

/* Divider */
[data-theme] #authModal .auth-divider { display: flex; align-items: center; margin: 10px 0; gap: 10px; }
[data-theme] #authModal .auth-divider::before,
[data-theme] #authModal .auth-divider::after { content: ''; flex: 1; height: 1px; background: #333; }
[data-theme] #authModal .auth-divider span { font-size: 11px; color: #666; white-space: nowrap; }

/* Google button */
[data-theme] #authModal .google-btn {
  background: #222; border: 1px solid #444; border-radius: 6px; color: #fff;
}
[data-theme] #authModal .google-btn:hover { background: #2a2a2a; border-color: #555; }

/* Switch row */
[data-theme] #authModal .switch-row { color: #888; }
[data-theme] #authModal .switch-link { color: #DD5100; }
[data-theme] #authModal .switch-link:hover { color: #ff6b00; }

/* Skip button */
[data-theme] #authModal .auth-skip { color: #666; }
[data-theme] #authModal .auth-skip:hover { color: #999; background: rgba(255,255,255,0.05); }

/* Checkout view — compact */
[data-theme] #authModal .checkout-view-header { margin-bottom: 8px; }
[data-theme] #authModal .checkout-view-header h3 { color: #fff; font-size: 14px; margin: 0 0 1px; }
[data-theme] #authModal .checkout-view-header p { color: #999; font-size: 11px; }
[data-theme] #authModal .checkout-success-icon { width: 30px; height: 30px; margin-bottom: 4px; }
[data-theme] #authModal .checkout-success-icon svg { width: 14px; height: 14px; }

/* Billing toggle — single-line, no wrapping */
[data-theme] #authModal .billing-toggle {
  background: #222; border-color: #333; border-radius: 8px;
  padding: 2px; margin-bottom: 8px; gap: 0;
}
[data-theme] #authModal .billing-option {
  color: #888; padding: 6px 4px; white-space: nowrap;
  display: flex; flex-direction: column; align-items: center;
}
[data-theme] #authModal .billing-option.active { background: #DD5100; color: #fff; border-radius: 6px; }
[data-theme] #authModal .billing-label { font-size: 11px; font-weight: 600; }
[data-theme] #authModal .billing-price { font-size: 18px; font-weight: 800; margin-top: 1px; letter-spacing: -0.02em; }
[data-theme] #authModal .billing-note { font-size: 10px; font-weight: 400; opacity: 0.8; }

/* Order summary — single line */
[data-theme] #authModal .order-summary {
  background: #222; border-color: #333; border-radius: 8px;
  padding: 8px 10px; margin-bottom: 8px;
}
[data-theme] #authModal .order-label { color: #ccc; font-size: 12px; }
[data-theme] #authModal .order-value { color: #fff; }
[data-theme] #authModal .order-line.total .order-label { color: #ccc; font-weight: 600; font-size: 12px; }
[data-theme] #authModal .order-line.total .order-value { color: #DD5100; font-size: 16px; font-weight: 800; }
[data-theme] #authModal .order-savings { color: #22a55b; font-size: 10px; }

/* Subscribe button */
[data-theme] #authModal .auth-subscribe-btn { background: #DD5100; color: #fff; border-radius: 6px; }
[data-theme] #authModal .auth-subscribe-btn:hover { background: #c44800; }
[data-theme] #authModal .checkout-trust { color: #666; margin-top: 4px; }
[data-theme] #authModal .skip-checkout { margin-top: 4px; }
[data-theme] #authModal .skip-checkout button { color: #666; min-height: 36px; }

/* Forgot password */
[data-theme] #authModal .auth-forgot-link { color: #DD5100; }
[data-theme] #authModal .auth-form-hint { color: #999; }
[data-theme] #authModal .auth-back-link { color: #DD5100; }

/* ============================================
   BORDER-RADIUS OVERRIDE
   styles-instrument-paper.css sets * { border-radius: 0 !important }
   which kills all rounded corners. Auth modal MUST have its own
   border-radius declarations with !important to restore them.
   ============================================ */
#authModal .auth-modal-content { border-radius: 8px !important; }
#authModal .plan-card { border-radius: 8px !important; }
#authModal .plan-radio { border-radius: 50% !important; }
#authModal .plan-card.selected .plan-radio::after { border-radius: 50% !important; }
#authModal .form-group input { border-radius: 6px !important; }
#authModal .btn-primary { border-radius: 6px !important; }
#authModal .auth-skip { border-radius: 4px !important; }
#authModal .google-btn { border-radius: 6px !important; }
#authModal .auth-error { border-radius: 6px !important; }
#authModal .billing-toggle { border-radius: 8px !important; }
#authModal .billing-option { border-radius: 6px !important; }
#authModal .order-summary { border-radius: 8px !important; }
#authModal #authCheckoutContainer { border-radius: 8px !important; }
#authModal .auth-subscribe-btn { border-radius: 6px !important; }
#authModal .checkout-success-icon { border-radius: 50% !important; }
#authModal .checkout-check { border-radius: 50% !important; }
#authModal .savings-badge { border-radius: 10px !important; }
#authModal .switch-link { border-radius: 0 !important; }
#authModal .auth-divider { border-radius: 0 !important; }
#authModal .tour-choice-card { border-radius: 8px !important; }

/* Box-shadow overrides (instrument-paper kills all shadows) */
#authModal .auth-modal-content { box-shadow: 0 10px 40px rgba(0,0,0,0.5) !important; }
#authModal .billing-option.active { box-shadow: 0 3px 12px rgba(221,81,0,0.4) !important; }
#authModal .savings-badge { box-shadow: 0 2px 6px rgba(34,165,91,0.35) !important; }

/* Transition overrides (instrument-paper kills all transitions) */
#authModal .plan-card { transition: border-color 150ms, background 150ms !important; }
#authModal .plan-radio { transition: border-color 150ms !important; }
#authModal .form-group input { transition: border-color 150ms, box-shadow 150ms !important; }
#authModal .btn-primary { transition: background 100ms, transform 100ms, box-shadow 100ms !important; }
#authModal .auth-skip { transition: color 150ms, background 150ms !important; }
#authModal .google-btn { transition: background 150ms, border-color 150ms !important; }
#authModal .switch-link { transition: color 150ms !important; }
#authModal .billing-option { transition: all 150ms !important; }
#authModal .tour-choice-card { transition: border-color 150ms, background 150ms, transform 100ms !important; }

/* ---- Error ---- */
.auth-error {
  color: #ff6b6b; font-size: 12px; margin-top: 8px; padding: 8px 10px;
  background: rgba(255,107,107,0.1); border-radius: 6px;
  border-left: 3px solid #ff6b6b; overflow: hidden;
}
.auth-error.auth-error-animate { animation: authErrorSlideIn 200ms ease-out both; }

/* ---- Auth Indicator (header) ---- */

.auth-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
}

/* Entrance animation applied via JS when indicator becomes visible */
.auth-indicator.auth-indicator-entering {
  animation: authIndicatorSlideIn 200ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

#userDisplayName {
  color: #DD5100;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.auth-sign-out-btn {
  background: transparent;
  color: #999;
  border: 1px solid #666;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: color 150ms ease-in-out, border-color 150ms ease-in-out;
  white-space: nowrap;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

.auth-sign-out-btn:hover {
  color: #fff;
  border-color: #DD5100;
}

.auth-sign-out-btn:focus-visible {
  outline: 2px solid #DD5100;
  outline-offset: 2px;
}

/* ============================================
   Responsive — height-based (matches prototype)
   ============================================ */

/* Short screens (< 640px height) — compact everything */
@media (max-height: 640px) {
  .auth-modal-content { padding: 10px 12px; }
  .auth-header { margin-bottom: 4px; }
  .auth-lockup { width: 110px; }
  #authModal .plan-card { padding: 6px 8px; }
  #authModal .plan-features { display: none; }
  #authModal .form-group { margin-bottom: 6px; }
  #authModal .form-group input { padding: 6px 8px; }
  #authModal .auth-divider { margin: 6px 0; }
  /* Checkout: aggressive compaction */
  .checkout-view-header { margin-bottom: 6px; }
  .checkout-view-header h3 { font-size: 14px; }
  .checkout-success-icon { width: 28px; height: 28px; margin-bottom: 4px; }
  .checkout-success-icon svg { width: 16px; height: 16px; }
  .checkout-features { display: none; }
  .billing-toggle { margin-bottom: 6px; }
  .billing-option { padding: 6px 4px; }
  .billing-option .billing-price { font-size: 17px; }
  .order-summary { padding: 6px 10px; margin-bottom: 6px; }
  .order-line { margin-bottom: 2px; }
  .order-label, .order-value { font-size: 11px; }
  .order-line.total .order-value { font-size: 13px; }
  .order-savings { font-size: 10px; }
  #authCheckoutContainer { min-height: auto; }
  .auth-subscribe-btn { padding: 10px 12px; font-size: 13px; min-height: 40px; }
  .checkout-trust { margin-top: 4px; }
  .skip-checkout { margin-top: 2px; }
  .skip-checkout button { min-height: 36px; padding: 4px 6px; }
}

/* Very short screens (iPhone SE, 4:5 ratio) */
@media (max-height: 500px) {
  .auth-header p { display: none; }
  .checkout-view-header p { display: none; }
  .billing-option .billing-note { display: none; }
  .order-summary { display: none; }
  #authCheckoutContainer { min-height: auto; }
}

/* Desktop (min-width 500px) — breathe a bit more */
@media (min-width: 500px) {
  .auth-modal-overlay { padding: 16px; }
  .auth-modal-content { padding: 20px 24px; }
  .auth-lockup { width: 160px; }
  #authModal .form-group input { font-size: 14px; } /* No zoom prevention needed on desktop */
}

/* ---- Header responsive (width-based) ---- */

@media (max-width: 768px) {
  #userDisplayName {
    max-width: 120px;
  }

  /* Override instrument-paper absolute positioning — let flex handle spacing */
  .header-center {
    position: static;
    transform: none;
    flex: 1;
    text-align: center;
  }

  .header-right {
    flex-shrink: 0;
    min-width: 0;
  }

  .auth-indicator {
    gap: 4px;
    padding: 0;
  }

  .auth-user-name-btn {
    max-width: none;
    padding: 2px 4px;
    font-size: 12px;
  }

  #userDisplayName {
    max-width: 80px;
    font-size: 12px;
  }
}

/* Mobile (768px and below) — must use fixed positioning to escape .right-panel overflow:hidden */
@media (max-width: 768px) {
  .auth-modal-overlay {
    position: fixed;
    padding: 8px;
    padding-top: env(safe-area-inset-top, 8px);
    align-items: center;
    justify-content: center;
    z-index: 10000;
  }

  .auth-modal-content {
    max-width: 100%;
    width: 100%;
    border-radius: 8px;
  }

  .auth-sign-out-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* ============================================
   Light Theme Support
   Auth modal adapts to [data-theme] on <body>
   Default/instrument-paper: white backgrounds
   ============================================ */

[data-theme="default"] .auth-modal-content,
[data-theme="instrument-paper"] .auth-modal-content {
  background: #ffffff;
  border-color: #DD5100;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
}

[data-theme="default"] .auth-header h2,
[data-theme="instrument-paper"] .auth-header h2 {
  color: #DD5100;
}

[data-theme="default"] .auth-header p,
[data-theme="instrument-paper"] .auth-header p {
  color: #666;
}

[data-theme="default"] .form-group label,
[data-theme="instrument-paper"] .form-group label {
  color: #444;
}

[data-theme="default"] .form-group input,
[data-theme="instrument-paper"] .form-group input {
  background: #f5f5f5;
  border-color: #ddd;
  color: #1a1a1a;
}

[data-theme="default"] .form-group input::placeholder,
[data-theme="instrument-paper"] .form-group input::placeholder {
  color: #aaa;
}

[data-theme="default"] .form-group input:focus,
[data-theme="instrument-paper"] .form-group input:focus {
  border-color: #DD5100;
  box-shadow: 0 0 0 3px rgba(221, 81, 0, 0.12);
}

[data-theme="default"] .password-toggle,
[data-theme="instrument-paper"] .password-toggle {
  color: #aaa;
}
[data-theme="default"] .password-toggle:hover,
[data-theme="instrument-paper"] .password-toggle:hover {
  color: #333;
}

[data-theme="default"] .auth-modal-overlay,
[data-theme="instrument-paper"] .auth-modal-overlay {
  background: rgba(0, 0, 0, 0.5);
}

/* Pastel-Mondrian variant */
[data-theme="pastel-mondrian"] .auth-modal-content {
  background: #f9f4f0;
  border-color: #DD5100;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

[data-theme="pastel-mondrian"] .form-group label {
  color: #5a7a8f;
}

[data-theme="pastel-mondrian"] .form-group input {
  background: #fff;
  border-color: #c8bdb7;
  color: #304c61;
}

[data-theme="pastel-mondrian"] .form-group input::placeholder {
  color: #a08c84;
}

[data-theme="pastel-mondrian"] .password-toggle {
  color: #a08c84;
}
[data-theme="pastel-mondrian"] .password-toggle:hover {
  color: #304c61;
}

/* Account Settings + Reset Password always use dark bg — override light-theme toggle colors */
#accountSettingsView .password-toggle,
#resetPasswordView .password-toggle,
#deleteAccountModal .password-toggle {
  color: #999;
}
#accountSettingsView .password-toggle:hover,
#resetPasswordView .password-toggle:hover,
#deleteAccountModal .password-toggle:hover {
  color: #fff;
}

[data-theme="pastel-mondrian"] .auth-header p {
  color: #5a7a8f;
}

[data-theme="pastel-mondrian"] .auth-modal-overlay {
  background: rgba(48, 76, 97, 0.6);
}

/* ============================================
   Forgot Password
   ============================================ */

.auth-forgot-link-group {
  margin-bottom: 12px;
  text-align: right;
}

.auth-forgot-link {
  font-size: 13px;
  color: #DD5100;
  text-decoration: none;
  transition: opacity 200ms ease;
}

.auth-forgot-link:hover {
  opacity: 0.8;
}

.auth-form-hint {
  font-size: 12px;
  color: #999;
  margin-top: 16px;
  text-align: center;
}

.auth-back-link {
  background: none;
  border: none;
  color: #DD5100;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  margin-bottom: 16px;
  text-align: left;
  transition: opacity 200ms ease;
  font-family: inherit;
}

.auth-back-link:hover {
  opacity: 0.8;
}

/* ---- Skip / Continue as Guest ---- */

.auth-skip-btn {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: #666;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 0 0;
  margin-top: 4px;
  text-align: center;
  transition: color 200ms ease;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-skip-btn:hover {
  color: #999;
}

/* ============================================
   Confirmation Overlays
   ============================================ */

.auth-confirmation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  animation: authFadeIn 200ms cubic-bezier(0.4, 0, 0.2, 1) both;
  padding: 16px;
}

.auth-confirmation-content {
  background: #1a1a1a;
  border: 2px solid #DD5100;
  border-radius: 8px;
  padding: 40px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  animation: authScaleIn 250ms cubic-bezier(0.4, 0, 0.2, 1) both;
  position: relative;
}

/* Temporary: instrument-paper.css !important override (remove when SP-133 lands) */
.auth-confirmation-content { border-radius: 8px !important; box-shadow: 0 10px 40px rgba(0,0,0,0.5) !important; }

.confirmation-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  color: #DD5100;
  animation: authScaleIn 300ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: 100ms;
}

.confirmation-icon svg {
  width: 100%;
  height: 100%;
}

.confirmation-icon.success { color: #4CAF50; }
.confirmation-icon.error { color: #d64545; }

.confirmation-title {
  font-size: 20px;
  color: white;
  margin: 0 0 8px 0;
  font-weight: bold;
}

.confirmation-text {
  font-size: 14px;
  color: #ccc;
  margin: 0 0 4px 0;
}

.confirmation-text strong {
  color: #DD5100;
}

.confirmation-hint {
  font-size: 12px;
  color: #666;
  margin: 8px 0 20px 0;
}

.confirmation-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.auth-btn-secondary {
  background: #DD5100;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  transition: background 200ms ease;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-btn-secondary:hover { background: #c44600; }
.auth-btn-secondary:disabled { background: #666; cursor: not-allowed; }
.auth-btn-secondary .auth-btn-loading { display: none; }
.auth-btn-secondary.loading .auth-btn-text { display: none; }
.auth-btn-secondary.loading .auth-btn-loading { display: flex; align-items: center; gap: 8px; }

.auth-btn-link {
  background: none;
  border: none;
  color: #DD5100;
  cursor: pointer;
  font-size: 14px;
  padding: 8px;
  text-decoration: none;
  transition: opacity 200ms ease;
  font-family: inherit;
  font-weight: 500;
}

.auth-btn-link:hover { opacity: 0.8; }

/* ============================================
   Full Screen Views (Reset Password, Verification)
   ============================================ */

.auth-full-screen-view {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: authFadeIn 200ms cubic-bezier(0.4, 0, 0.2, 1) both;
  padding: 16px;
}

.reset-password-container {
  background: #1a1a1a;
  border: 2px solid #DD5100;
  border-radius: 8px;
  padding: 40px;
  max-width: 400px;
  width: 100%;
  animation: authScaleIn 250ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.reset-password-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo-small {
  width: 80px;
  height: 80px;
  margin-bottom: 12px;
  animation: authLogoEntrance 400ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.reset-password-header h2 {
  font-size: 22px;
  color: white;
  margin: 0;
}

.password-strength-indicator {
  font-size: 11px;
  margin-top: 4px;
  display: block;
  color: #999;
}

.password-strength-indicator.weak { color: #d64545; }
.password-strength-indicator.fair { color: #dd9e3b; }
.password-strength-indicator.strong { color: #4CAF50; }

/* ============================================
   Email Verification
   ============================================ */

.verification-container {
  background: #1a1a1a;
  border: 2px solid #DD5100;
  border-radius: 8px;
  padding: 40px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: authScaleIn 250ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.verification-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  color: #DD5100;
  animation: authScaleIn 300ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: 100ms;
}

.verification-icon svg {
  width: 100%;
  height: 100%;
}

.verification-title {
  font-size: 24px;
  color: white;
  margin: 0 0 12px 0;
  font-weight: bold;
}

.verification-text {
  font-size: 14px;
  color: #ccc;
  margin: 0 0 8px 0;
}

.verification-text strong { color: #DD5100; }

.verification-hint {
  font-size: 13px;
  color: #999;
  margin: 0 0 24px 0;
  font-style: italic;
}

.verification-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.verification-footer {
  font-size: 11px;
  color: #666;
  margin-top: 20px;
}

/* ============================================
   User Dropdown Menu
   ============================================ */

.auth-user-name-btn {
  background: none;
  border: none;
  color: #DD5100;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  transition: background 200ms ease;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.auth-user-name-btn:hover {
  background: rgba(221, 81, 0, 0.15);
}

.dropdown-caret {
  width: 10px;
  height: 10px;
  color: #999;
  transition: transform 200ms ease;
  flex-shrink: 0;
}

.auth-indicator.dropdown-open .dropdown-caret {
  transform: rotate(180deg);
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: #2a2a2a;
  border: 1px solid #DD5100;
  border-radius: 6px;
  margin-top: 4px;
  min-width: 180px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  animation: authFadeIn 150ms ease-out;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: #ccc;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  transition: background 150ms ease, color 150ms ease;
}

.user-dropdown-item:hover {
  background: rgba(221, 81, 0, 0.1);
  color: #DD5100;
}

.user-dropdown-item:first-child {
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
}

.user-dropdown-item:last-child {
  border-bottom-left-radius: 5px;
  border-bottom-right-radius: 5px;
}

.user-dropdown-separator {
  height: 1px;
  background: #444;
  margin: 4px 0;
}

.dropdown-version-label {
  font-size: 11px;
  color: #666;
  text-align: center;
  padding: 6px 12px 8px;
  letter-spacing: 0.5px;
  pointer-events: none;
  user-select: none;
}

.user-dropdown-label {
  display: block;
  padding: 6px 14px 2px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #888;
  font-weight: 600;
}

.user-dropdown-item.user-dropdown-signout {
  border-top: 1px solid #444;
  color: #d64545;
}

.user-dropdown-item.user-dropdown-signout:hover {
  background: rgba(214, 69, 69, 0.1);
}

.dropdown-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ============================================
   Account Settings Page
   ============================================ */

.account-settings-full-view {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1a1a1a;
  z-index: 9999;
  overflow-y: auto;
  animation: authFadeIn 200ms ease;
}

.account-settings-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

.account-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
  padding-bottom: 16px;
  border-bottom: 1px solid #333;
}

.account-settings-header h1 {
  font-size: 24px;
  color: white;
  margin: 0;
  flex: 1;
  text-align: center;
}

.back-button {
  background: none;
  border: none;
  color: #DD5100;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  padding: 6px 8px;
  border-radius: 4px;
  transition: background 200ms ease;
  font-family: inherit;
}

.back-button:hover { background: rgba(221, 81, 0, 0.1); }
.back-button svg { width: 18px; height: 18px; }

.account-settings-content { padding-bottom: 40px; }

.settings-section {
  margin-bottom: 24px;
  padding: 20px;
  background: #242424;
  border-radius: 6px;
}

.settings-section-danger-zone { border-left: 3px solid #dd9e3b; }
.settings-danger-zone { border-left: 3px solid #d64545; }

.section-title {
  font-size: 16px;
  color: #DD5100;
  margin: 0 0 16px 0;
  font-weight: 600;
}

.danger-title { color: #d64545; }

.danger-description {
  font-size: 13px;
  color: #999;
  margin: 0 0 12px 0;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #333;
}

.settings-item:last-child { border-bottom: none; }

.settings-item-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-label {
  font-size: 12px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Inline edit inputs — selection highlight for dark backgrounds */
.edit-partner-name::selection {
  background: rgba(221, 81, 0, 0.4);
  color: #fff;
}

.edit-partner-name::-moz-selection {
  background: rgba(221, 81, 0, 0.4);
  color: #fff;
}

.settings-value {
  font-size: 14px;
  color: white;
  font-weight: 500;
}

.settings-badge {
  font-size: 11px;
  background: rgba(76, 175, 80, 0.1);
  color: #4CAF50;
  padding: 4px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 600;
}

.settings-edit-btn {
  background: none;
  border: 1px solid #DD5100;
  color: #DD5100;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 200ms ease;
}

.settings-edit-btn:hover { background: rgba(221, 81, 0, 0.1); }

.settings-action-btn {
  background: transparent;
  border: 1px solid #DD5100;
  color: #DD5100;
  padding: 10px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  width: 100%;
  transition: background 200ms ease;
}

.settings-action-btn:hover { background: rgba(221, 81, 0, 0.1); }

/* SP-144: Membership upgrade button — hardcoded for dark background visibility.
   !important survives instrument-paper.css global resets. */
.membership-upgrade-btn {
  margin-top: 8px;
  background: #DD5100 !important;
  color: #fff !important;
  border: 1px solid #DD5100 !important;
  padding: 10px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  width: 100%;
  transition: background 200ms ease;
}
.membership-upgrade-btn:hover {
  background: #c44800 !important;
}

/* ---- auth-form-group on dark backgrounds (password change, delete account, reset password) ----
   These sections sit on #242424 or #1a1a1a — must use hardcoded light colors, never CSS variables.
   See CLAUDE.md "SPA Contrast & Theme Rules" for rationale (SP-020 incident). */
#accountSettingsView .auth-form-group label,
#deleteAccountModal .auth-form-group label,
#resetPasswordView .auth-form-group label {
  display: block;
  margin-bottom: 4px;
  color: #999;
  font-size: 12px;
  font-weight: 500;
}

#accountSettingsView .auth-form-group input,
#deleteAccountModal .auth-form-group input,
#resetPasswordView .auth-form-group input {
  width: 100%;
  padding: 8px 10px;
  background: #333;
  border: 1px solid #444;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  line-height: 1.3;
  transition: border-color 150ms, box-shadow 150ms;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}

#accountSettingsView .auth-form-group input::placeholder,
#deleteAccountModal .auth-form-group input::placeholder,
#resetPasswordView .auth-form-group input::placeholder {
  color: #666;
}

#accountSettingsView .auth-form-group input:focus,
#deleteAccountModal .auth-form-group input:focus,
#resetPasswordView .auth-form-group input:focus {
  outline: none;
  border-color: #DD5100;
  box-shadow: 0 0 0 3px rgba(221, 81, 0, 0.15);
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.form-actions .auth-btn-primary {
  flex: 1;
  min-width: 140px;
}

.btn-danger {
  background: #d64545;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  width: 100%;
  transition: background 200ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-danger:hover { background: #e0545f; }
.btn-danger:disabled { background: #666; cursor: not-allowed; }
.btn-danger .auth-btn-loading { display: none; }
.btn-danger.loading .auth-btn-text { display: none; }
.btn-danger.loading .auth-btn-loading { display: flex; align-items: center; gap: 8px; }

.delete-account-modal { border-color: #d64545; }

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: #999;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 200ms ease;
}

.modal-close:hover { background: rgba(255, 255, 255, 0.1); color: white; }

/* ============================================
   SP-126: Theme-Responsive Account Settings
   Light themes get light backgrounds and dark text.
   Dark theme keeps the original hardcoded dark styles above.
   ============================================ */

[data-theme="default"] .account-settings-full-view,
[data-theme="instrument-paper"] .account-settings-full-view,
[data-theme="pastel-mondrian"] .account-settings-full-view {
  background: #f5f5f5;
}

[data-theme="default"] .account-settings-header,
[data-theme="instrument-paper"] .account-settings-header,
[data-theme="pastel-mondrian"] .account-settings-header {
  border-bottom-color: #ddd;
}

[data-theme="default"] .account-settings-header h1,
[data-theme="instrument-paper"] .account-settings-header h1,
[data-theme="pastel-mondrian"] .account-settings-header h1 {
  color: #1a1a1a;
}

[data-theme="default"] .settings-section,
[data-theme="instrument-paper"] .settings-section,
[data-theme="pastel-mondrian"] .settings-section {
  background: #fff;
}

[data-theme="default"] .settings-label,
[data-theme="instrument-paper"] .settings-label,
[data-theme="pastel-mondrian"] .settings-label {
  color: #666;
}

[data-theme="default"] .settings-value,
[data-theme="instrument-paper"] .settings-value,
[data-theme="pastel-mondrian"] .settings-value {
  color: #1a1a1a;
}

[data-theme="default"] .settings-item,
[data-theme="instrument-paper"] .settings-item,
[data-theme="pastel-mondrian"] .settings-item {
  border-bottom-color: #e5e5e5;
}

[data-theme="default"] .danger-description,
[data-theme="instrument-paper"] .danger-description,
[data-theme="pastel-mondrian"] .danger-description {
  color: #666;
}

[data-theme="default"] #accountSettingsView .auth-form-group label,
[data-theme="instrument-paper"] #accountSettingsView .auth-form-group label,
[data-theme="pastel-mondrian"] #accountSettingsView .auth-form-group label {
  color: #666;
}

[data-theme="default"] #accountSettingsView .auth-form-group input,
[data-theme="instrument-paper"] #accountSettingsView .auth-form-group input,
[data-theme="pastel-mondrian"] #accountSettingsView .auth-form-group input {
  background: #f0f0f0;
  border-color: #ddd;
  color: #1a1a1a;
}

[data-theme="default"] #accountSettingsView .auth-form-group input::placeholder,
[data-theme="instrument-paper"] #accountSettingsView .auth-form-group input::placeholder,
[data-theme="pastel-mondrian"] #accountSettingsView .auth-form-group input::placeholder {
  color: #999;
}

/* Brief Variant select in light themes */
[data-theme="default"] #prefsBriefVariant,
[data-theme="instrument-paper"] #prefsBriefVariant,
[data-theme="pastel-mondrian"] #prefsBriefVariant {
  background: #f0f0f0;
  border-color: #ddd;
  color: #1a1a1a;
}

/* ============================================
   Google Sign-In
   ============================================ */

.google-signin-container {
  margin-bottom: 4px;
}

.google-signin-container .auth-error {
  margin-top: 8px;
  margin-bottom: 0;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  color: #666;
  font-size: 11px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #333;
}

.auth-divider span {
  white-space: nowrap;
}

/* Light theme divider */
[data-theme="default"] .auth-divider,
[data-theme="instrument-paper"] .auth-divider {
  color: #aaa;
}

[data-theme="default"] .auth-divider::before,
[data-theme="default"] .auth-divider::after,
[data-theme="instrument-paper"] .auth-divider::before,
[data-theme="instrument-paper"] .auth-divider::after {
  background: #ddd;
}

[data-theme="pastel-mondrian"] .auth-divider {
  color: #a08c84;
}

[data-theme="pastel-mondrian"] .auth-divider::before,
[data-theme="pastel-mondrian"] .auth-divider::after {
  background: #d4c8c0;
}

/* ============================================
   Prefers-Reduced-Motion
   WCAG 2.3.3 — honor user's motion preference
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .auth-modal-overlay,
  .auth-modal-content,
  .auth-logo,
  .auth-tab-content.active,
  .auth-error.auth-error-animate,
  .auth-indicator.auth-indicator-entering,
  .auth-confirmation-overlay,
  .auth-confirmation-content,
  .auth-full-screen-view,
  .verification-container,
  .reset-password-container,
  .account-settings-full-view {
    animation: none !important;
  }

  .auth-tab-btn,
  .auth-tab-btn::after,
  .form-group input,
  .auth-form-group input,
  .btn-primary,
  .auth-btn-primary,
  .auth-sign-out-btn,
  .auth-btn-secondary,
  .auth-btn-link,
  .auth-user-name-btn,
  .dropdown-caret,
  .back-button,
  .settings-edit-btn,
  .settings-action-btn,
  .btn-danger {
    transition: none !important;
  }
}

/* ---- Sign In Button (header) — single orange CTA for anonymous users ---- */

.anon-sign-in-btn {
  background: #DD5100;
  border: 1px solid #DD5100;
  color: #fff;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.anon-sign-in-btn:hover {
  background: #c44800;
  border-color: #c44800;
}

/* All themes — button is always orange */
[data-theme="light"] .anon-sign-in-btn,
[data-theme="default"] .anon-sign-in-btn,
[data-theme="instrument-paper"] .anon-sign-in-btn {
  background: #DD5100;
  border-color: #DD5100;
  color: #fff;
}

/* ---- CTA Hero Panel — frosted glass overlay on top of calendar ---- */
.cta-hero-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 4rem;
  background: rgba(255, 255, 255, 0.97);
  overflow-y: auto;
  opacity: 1;
  transition: opacity 0.35s ease;
}

.cta-hero-panel.fading {
  opacity: 0;
  pointer-events: none;
}

/* Dark themes — dark frosted glass */
[data-theme="dark"] .cta-hero-panel {
  background: rgba(18, 18, 18, 0.88);
}

[data-theme="instrument-paper"] .cta-hero-panel {
  background: rgba(245, 240, 230, 0.90);
}

/* Light/default themes */
[data-theme="light"] .cta-hero-panel,
[data-theme="default"] .cta-hero-panel {
  background: rgba(250, 250, 250, 0.90);
}

.cta-hero-inner {
  max-width: 420px;
  width: 100%;
}

.cta-hero-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #DD5100;
  background: rgba(221, 81, 0, 0.1);
  border: 1px solid rgba(221, 81, 0, 0.25);
  border-radius: 20px;
  padding: 3px 12px;
  margin-bottom: 1.25rem;
}

.cta-hero-headline {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary, #fff);
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
}

[data-theme="light"] .cta-hero-headline {
  color: #111;
}

.cta-hero-subhead {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary, #888);
  margin: 0 0 2rem;
}

.cta-hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  border: none;
}

.cta-btn-primary {
  background: #DD5100;
  color: #fff;
}
.cta-btn-primary:hover {
  background: #c44800;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(221, 81, 0, 0.35);
}

.cta-btn-secondary {
  background: transparent;
  color: var(--text-primary, #fff);
  border: 1px solid var(--border-color, #444) !important;
}
.cta-btn-secondary:hover {
  border-color: #DD5100 !important;
  color: #DD5100;
}

[data-theme="light"] .cta-btn-secondary {
  color: #333;
  border-color: #ccc !important;
}

.cta-feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cta-feature-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary, #777);
}

.cta-feature-list li svg {
  flex-shrink: 0;
  stroke: #DD5100;
}

[data-theme="light"] .cta-feature-list li {
  color: #666;
}

/* ---- Auth Nudge Toast ---- */
/* Gentle, non-blocking prompt for anonymous users */

.auth-nudge-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  max-width: 380px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
  pointer-events: none;
}

.auth-nudge-toast.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.auth-nudge-content {
  background: #1a1a1a;
  border: 1px solid #333;
  border-left: 3px solid #DD5100;
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.auth-nudge-content p {
  color: #e0e0e0;
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 12px 0;
}

.auth-nudge-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.auth-nudge-btn {
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.auth-nudge-signup {
  background: #DD5100;
  color: #fff;
}

.auth-nudge-signup:hover {
  background: #c44800;
}

.auth-nudge-dismiss {
  background: transparent;
  color: #888;
  border: 1px solid #444;
}

.auth-nudge-dismiss:hover {
  background: #222;
  color: #bbb;
}

/* Light theme */
[data-theme="light"] .auth-nudge-content {
  background: #fff;
  border-color: #ddd;
  border-left-color: #DD5100;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .auth-nudge-content p {
  color: #333;
}

[data-theme="light"] .auth-nudge-dismiss {
  color: #666;
  border-color: #ccc;
}

[data-theme="light"] .auth-nudge-dismiss:hover {
  background: #f5f5f5;
  color: #333;
}

/* Mobile: full width at bottom */
@media (max-width: 480px) {
  .auth-nudge-toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }
}

/* ============================================
   Welcome Step (Step 0 — on fresh arrival)
   Absorbs CTA Hero Panel content into the modal.
   ============================================ */

.auth-welcome-step {
  animation: authFadeIn 200ms ease-in-out;
}

.auth-welcome-tagline {
  font-size: 15px;
  font-weight: 600;
  color: #ddd;
  text-align: center;
  margin: 0 0 18px;
  line-height: 1.4;
}

.auth-welcome-features {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-welcome-features li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: #bbb;
}

.auth-welcome-features li svg {
  flex-shrink: 0;
  stroke: #DD5100;
}

.auth-welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

/* "Upgrade to Pro" — ghost button */
.auth-welcome-upgrade-btn {
  width: 100%;
  padding: 13px 16px;
  background: transparent;
  color: #DD5100;
  border: 1.5px solid #DD5100;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 100ms ease, box-shadow 100ms ease;
  min-height: 48px;
  font-family: inherit;
}

.auth-welcome-upgrade-btn:hover {
  background: rgba(221, 81, 0, 0.08);
  box-shadow: 0 0 0 3px rgba(221, 81, 0, 0.12);
}

.auth-welcome-upgrade-btn:focus-visible {
  outline: 2px solid #DD5100;
  outline-offset: 2px;
}

.auth-welcome-footer {
  text-align: center;
  padding-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 4px;
}

.auth-welcome-link {
  background: none;
  border: none;
  color: #888;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  padding: 10px 0;
  transition: color 150ms ease;
  display: block;
  width: 100%;
}

.auth-welcome-link:hover { color: #ccc; }

/* Light themes */
[data-theme="default"] .auth-welcome-tagline,
[data-theme="instrument-paper"] .auth-welcome-tagline { color: #333; }

[data-theme="default"] .auth-welcome-features li,
[data-theme="instrument-paper"] .auth-welcome-features li { color: #555; }

[data-theme="default"] .auth-welcome-link,
[data-theme="instrument-paper"] .auth-welcome-link { color: #aaa; }

[data-theme="pastel-mondrian"] .auth-welcome-tagline { color: #304c61; }
[data-theme="pastel-mondrian"] .auth-welcome-features li { color: #5a7a8f; }

@media (prefers-reduced-motion: reduce) {
  .auth-welcome-step { animation: none !important; }
}

/* ============================================
   Plan Selection Step (Post-Signup Onboarding)
   ============================================ */

.plan-selection-step {
  animation: authFadeIn 200ms ease-in-out;
}

.plan-step-header {
  text-align: center;
  margin-bottom: 20px;
}

.plan-step-title {
  font-size: 20px;
  font-weight: 700;
  color: #DD5100;
  margin: 0 0 6px;
}

.plan-step-sub {
  font-size: 14px;
  color: #999;
  margin: 0;
}

/* Plan cards container */
.plan-cards {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

/* Individual plan card */
.plan-card {
  flex: 1;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 16px 14px;
  position: relative;
  transition: border-color 150ms ease;
  display: flex;
  flex-direction: column;
}

.plan-card:hover {
  border-color: #555;
}

.plan-card-pro {
  border-color: #DD5100;
}

.plan-card-pro:hover {
  border-color: #DD5100;
}

/* Recommended badge */
.plan-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(221, 81, 0, 0.15);
  color: #DD5100;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 12px;
  margin-bottom: 8px;
  align-self: flex-start;
}

.plan-card-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.plan-card-price {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
  line-height: 1;
}

.plan-card-period {
  font-size: 13px;
  font-weight: 400;
  color: #888;
}

/* Feature list inside plan card */
.plan-card-features {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.plan-card-features li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #bbb;
}

.plan-card-features li svg {
  flex-shrink: 0;
  stroke: #DD5100;
}

/* Plan card buttons */
.plan-card-btn {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 100ms ease, transform 50ms ease, box-shadow 100ms ease;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  margin-top: auto;
}

.plan-card-btn-primary {
  background: #DD5100;
  color: #fff;
}

.plan-card-btn-primary:hover {
  background: #c44600;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(221, 81, 0, 0.3);
}

.plan-card-btn-secondary {
  background: #333;
  color: #ccc;
  border: 1px solid #444;
}

.plan-card-btn-secondary:hover {
  background: #3a3a3a;
  color: #fff;
  border-color: #555;
}

/* Loading state for Pro button */
.plan-card-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.plan-card-btn .auth-btn-text { display: inline; }
.plan-card-btn .auth-btn-loading { display: none; align-items: center; gap: 6px; }
.plan-card-btn.loading .auth-btn-text { display: none; }
.plan-card-btn.loading .auth-btn-loading { display: flex; }

/* Trust line */
.plan-step-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11px;
  color: #666;
  margin: 0;
}

.plan-step-trust svg {
  flex-shrink: 0;
  color: #666;
}

/* ---- Light Theme Support ---- */

[data-theme="default"] .plan-card,
[data-theme="instrument-paper"] .plan-card {
  border-color: #ddd;
}

[data-theme="default"] .plan-card:hover,
[data-theme="instrument-paper"] .plan-card:hover {
  border-color: #bbb;
}

[data-theme="default"] .plan-card-pro,
[data-theme="instrument-paper"] .plan-card-pro {
  border-color: #DD5100;
}

[data-theme="default"] .plan-card-name,
[data-theme="instrument-paper"] .plan-card-name,
[data-theme="default"] .plan-card-price,
[data-theme="instrument-paper"] .plan-card-price {
  color: #111;
}

[data-theme="default"] .plan-card-features li,
[data-theme="instrument-paper"] .plan-card-features li {
  color: #555;
}

[data-theme="default"] .plan-step-sub,
[data-theme="instrument-paper"] .plan-step-sub {
  color: #666;
}

[data-theme="default"] .plan-card-btn-secondary,
[data-theme="instrument-paper"] .plan-card-btn-secondary {
  background: #f0f0f0;
  color: #333;
  border-color: #ddd;
}

[data-theme="default"] .plan-card-btn-secondary:hover,
[data-theme="instrument-paper"] .plan-card-btn-secondary:hover {
  background: #e5e5e5;
  border-color: #ccc;
}

[data-theme="pastel-mondrian"] .plan-card {
  border-color: #d4c8c0;
}

[data-theme="pastel-mondrian"] .plan-card-name,
[data-theme="pastel-mondrian"] .plan-card-price {
  color: #304c61;
}

[data-theme="pastel-mondrian"] .plan-card-features li {
  color: #5a7a8f;
}

/* ============================================
   Unified Auth Modal — Wide layout for plan cards
   ============================================ */

.auth-modal-content.auth-modal-wide {
  max-width: 480px;
}

/* Auth views — toggle between create / signin */
.auth-view {
  animation: authFadeIn 200ms ease-in-out;
}

/* ============================================
   Checkout View (inside auth modal)
   ============================================ */

@keyframes slideLeft {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideRight {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes checkPop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

.auth-view.slide-in-right { animation: slideLeft 280ms ease both; }
.auth-view.slide-in-left { animation: slideRight 280ms ease both; }

.checkout-view-header {
  text-align: center;
  margin-bottom: 12px;
}

.checkout-success-icon {
  width: 40px;
  height: 40px;
  background: rgba(34, 165, 91, 0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 6px;
  animation: checkPop 400ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: 100ms;
}

.checkout-success-icon svg { color: #22a55b; }

.checkout-view-header h3 {
  font-size: 15px;
  color: #fff;
  font-weight: 700;
  margin: 0 0 2px;
}

.checkout-view-header p {
  font-size: 12px;
  color: #999;
  margin: 0;
}

/* ---- Billing toggle (Monthly / Annual) ---- */
.billing-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  background: #222;
  border-radius: 8px;
  padding: 3px;
  border: 1px solid #333;
}

.billing-option {
  flex: 1;
  padding: 8px 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #888;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 150ms;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.billing-option.active {
  background: #DD5100;
  color: #fff;
  box-shadow: 0 3px 12px rgba(221, 81, 0, 0.4);
}

.billing-option:not(.active):hover { color: #ccc; }

.billing-option .billing-price {
  display: block;
  font-size: 20px;
  font-weight: 800;
  margin-top: 2px;
  letter-spacing: -0.02em;
}

.billing-option .billing-note {
  display: block;
  font-size: 10px;
  font-weight: 400;
  margin-top: 1px;
  opacity: 0.8;
}

.billing-strikethrough {
  text-decoration: line-through;
  opacity: 0.45;
  font-size: 13px;
  font-weight: 500;
  margin-right: 3px;
}

.order-strikethrough {
  text-decoration: line-through;
  opacity: 0.4;
  font-size: 12px;
  font-weight: 500;
  color: #888;
  margin-right: 4px;
}

.billing-option.active .billing-note { color: rgba(255, 255, 255, 0.8); }
.billing-option:not(.active) .billing-note { color: #666; }

/* Savings badge */
.savings-badge {
  display: inline-block;
  background: #22a55b;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 7px;
  border-radius: 10px;
  margin-left: 4px;
  vertical-align: middle;
  box-shadow: 0 2px 6px rgba(34, 165, 91, 0.35);
}

/* Order summary card */
.order-summary {
  background: #222;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.order-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.order-line:last-child { margin-bottom: 0; }

.order-label { font-size: 12px; color: #999; }
.order-value { font-size: 12px; color: #fff; font-weight: 600; }

.order-line.total {
  border-top: 1px solid #333;
  padding-top: 6px;
  margin-top: 3px;
}

.order-line.total .order-label { color: #fff; font-weight: 700; font-size: 13px; }
.order-line.total .order-value { color: #DD5100; font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }

.order-savings {
  font-size: 11px;
  color: #22a55b;
  text-align: right;
  margin-top: 3px;
  font-weight: 700;
}

/* Feature highlights — compact */
.checkout-features {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: grid;
  gap: 4px;
}

.checkout-features li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #ccc;
  font-weight: 500;
}

.checkout-check {
  width: 14px;
  height: 14px;
  background: rgba(34, 165, 91, 0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #22a55b;
}

.checkout-check svg { width: 8px; height: 8px; stroke-width: 3; }

/* Stripe Payment Element container (inside auth modal) */
#authCheckoutContainer {
  background: #222;
  border-radius: 8px;
  min-height: auto;
  padding: 12px;
  margin-bottom: 8px;
  position: relative;
}

#authCheckoutContainer:empty {
  display: none;
}

#authCheckoutContainer .checkout-loading,
#upgradeCheckoutContainer .checkout-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #888;
  font-size: 12px;
  padding: 30px 0;
}
#authCheckoutContainer .checkout-loader-lg,
#upgradeCheckoutContainer .checkout-loader-lg {
  width: 40px;
  height: 40px;
}

#authCheckoutContainer .checkout-error {
  text-align: center;
  color: #ff6b6b;
  font-size: 12px;
  padding: 10px 0;
  margin-top: 8px;
}

/* Subscribe button (Payment Element — no built-in submit) */
.auth-subscribe-btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  margin-top: 12px;
  background: #DD5100;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 150ms, opacity 150ms;
  font-family: inherit;
  letter-spacing: 0.02em;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}
.auth-subscribe-btn:hover { background: #c44800; }
.auth-subscribe-btn:active { background: #b04000; }
.auth-subscribe-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.auth-subscribe-btn .auth-btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.auth-subscribe-btn .auth-jargan-loader {
  width: 16px;
  height: 16px;
}

/* Trust footer */
.checkout-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 10px;
  color: #666;
  margin-top: 6px;
}

.checkout-trust svg { color: #666; flex-shrink: 0; }

/* Skip checkout (go to free) */
.skip-checkout {
  text-align: center;
  margin-top: 6px;
}

.skip-checkout button {
  background: none;
  border: none;
  color: #666;
  font-size: 11px;
  cursor: pointer;
  padding: 6px 8px;
  transition: color 150ms;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}

.skip-checkout button:hover { color: #999; }

/* Plan card note (billing info) */
.plan-card-note {
  display: block;
  font-size: 10px;
  color: #888;
  font-weight: 400;
  margin-top: 1px;
}

/* ---- Mobile: short screens (< 640px height) ---- */
@media (max-height: 640px) {
  .checkout-view-header { margin-bottom: 6px; }
  .checkout-view-header h3 { font-size: 14px; }
  .checkout-success-icon { width: 28px; height: 28px; margin-bottom: 4px; }
  .checkout-success-icon svg { width: 16px; height: 16px; }
  .checkout-features { display: none; }
  .billing-toggle { margin-bottom: 6px; }
  .billing-option { padding: 6px 4px; }
  .billing-option .billing-price { font-size: 17px; }
  .order-summary { padding: 6px 10px; margin-bottom: 6px; }
  .order-line { margin-bottom: 2px; }
  .order-label, .order-value { font-size: 11px; }
  .order-line.total .order-value { font-size: 13px; }
  .order-savings { font-size: 10px; }
  #authCheckoutContainer { min-height: auto; padding: 8px; }
  .auth-subscribe-btn { padding: 10px 12px; font-size: 13px; min-height: 40px; }
  .checkout-trust { margin-top: 4px; }
  .skip-checkout { margin-top: 2px; }
  .skip-checkout button { min-height: 36px; padding: 4px 6px; }
}

/* ---- Very short screens (iPhone SE, 4:5 ratio) ---- */
@media (max-height: 500px) {
  .checkout-view-header p { display: none; }
  .billing-option .billing-note { display: none; }
  .order-summary { display: none; }
  #authCheckoutContainer { min-height: auto; }
}

/* ============================================
   Selectable Plan Cards (radio-toggle behavior)
   ============================================ */

.plan-cards-selectable {
  gap: 8px;
  margin-bottom: 14px;
}

.plan-card-toggle {
  flex: 1;
  border: 1.5px solid #333;
  border-radius: 6px;
  padding: 8px 10px;
  position: relative;
  cursor: pointer;
  background: transparent;
  text-align: left;
  font-family: inherit;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
  color: inherit;
}

.plan-card-toggle:hover {
  border-color: #555;
  background: rgba(255, 255, 255, 0.02);
}

.plan-card-toggle.plan-card-selected {
  border-color: #DD5100;
  background: rgba(221, 81, 0, 0.04);
  box-shadow: 0 0 0 1px rgba(221, 81, 0, 0.2);
}

.plan-card-toggle:focus-visible {
  outline: 2px solid #DD5100;
  outline-offset: 2px;
}

/* Radio indicator — left side */
.plan-card-radio {
  width: 16px;
  height: 16px;
  border: 2px solid #555;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 1px;
  position: relative;
  transition: border-color 150ms ease;
}

.plan-card-toggle.plan-card-selected .plan-card-radio {
  border-color: #DD5100;
}

.plan-card-toggle.plan-card-selected .plan-card-radio::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  background: #DD5100;
  border-radius: 50%;
  animation: authScaleIn 150ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.plan-card-body {
  flex: 1;
  min-width: 0;
}

/* Badge on selectable cards — top right */
.plan-card-toggle .plan-card-badge {
  position: absolute;
  top: -8px;
  right: 10px;
  font-size: 9px;
  padding: 2px 6px;
}

/* Compact inline cards — name + price only, features hidden */
.plan-card-toggle .plan-card-name {
  font-size: 13px;
  margin-bottom: 0;
}

.plan-card-toggle .plan-card-price {
  font-size: 16px;
  margin-bottom: 0;
  line-height: 1.2;
}

.plan-card-toggle .plan-card-features {
  display: none;
}

/* ---- View Switch Row ---- */

.auth-switch-row {
  text-align: center;
  margin-top: 10px;
  font-size: 12px;
  color: #888;
}

.auth-switch-link {
  background: none;
  border: none;
  color: #DD5100;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
  transition: opacity 200ms ease;
}

.auth-switch-link:hover {
  opacity: 0.8;
}

/* ---- Light Theme: Selectable Cards ---- */

[data-theme="default"] .plan-card-toggle,
[data-theme="instrument-paper"] .plan-card-toggle {
  border-color: #ddd;
}

[data-theme="default"] .plan-card-toggle:hover,
[data-theme="instrument-paper"] .plan-card-toggle:hover {
  border-color: #bbb;
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="default"] .plan-card-toggle.plan-card-selected,
[data-theme="instrument-paper"] .plan-card-toggle.plan-card-selected {
  border-color: #DD5100;
  background: rgba(221, 81, 0, 0.03);
}

[data-theme="default"] .plan-card-radio,
[data-theme="instrument-paper"] .plan-card-radio {
  border-color: #bbb;
}

[data-theme="default"] .auth-switch-row,
[data-theme="instrument-paper"] .auth-switch-row {
  border-top-color: rgba(0, 0, 0, 0.06);
  color: #888;
}

[data-theme="pastel-mondrian"] .plan-card-toggle {
  border-color: #d4c8c0;
}

[data-theme="pastel-mondrian"] .plan-card-toggle.plan-card-selected {
  border-color: #DD5100;
  background: rgba(221, 81, 0, 0.04);
}

[data-theme="pastel-mondrian"] .plan-card-radio {
  border-color: #b0a498;
}

/* ---- Responsive ---- */

@media (max-width: 480px) {
  .plan-cards {
    flex-direction: row;
    gap: 6px;
  }

  .plan-cards-selectable {
    margin-bottom: 6px;
  }

  .plan-card-toggle {
    padding: 5px 6px;
    gap: 5px;
  }

  .plan-card-toggle .plan-card-name {
    font-size: 11px;
  }

  .plan-card-toggle .plan-card-price {
    font-size: 13px;
  }

  .plan-card-radio {
    width: 14px;
    height: 14px;
  }

  .auth-modal-content.auth-modal-wide {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-view,
  .plan-card-toggle.plan-card-selected .plan-card-radio::after {
    animation: none !important;
  }
}

/* ---- Auth modal inverse theme ---- */

#authModal.modal-theme-light .auth-modal-content {
  background: #ffffff;
  color: #111111;
}
#authModal.modal-theme-light .auth-modal-content input,
#authModal.modal-theme-light .auth-modal-content select {
  background: #f5f5f5;
  color: #111111;
  border-color: #cccccc;
}
#authModal.modal-theme-light .auth-modal-content .auth-input-label,
#authModal.modal-theme-light .auth-modal-content label {
  color: #333333;
}
#authModal.modal-theme-light .auth-modal-content .auth-subtitle,
#authModal.modal-theme-light .auth-modal-content p {
  color: #555555;
}
/* SP-008: Ensure plan card text is legible inside light modal (iOS dark mode inversion) */
#authModal.modal-theme-light .plan-card-name,
#authModal.modal-theme-light .plan-card-price {
  color: #111111;
}
#authModal.modal-theme-light .plan-card-period {
  color: #666666;
}
#authModal.modal-theme-light .plan-card-features li {
  color: #555555;
}
#authModal.modal-theme-light .plan-card-toggle {
  border-color: #dddddd;
  color: #111111;
}
#authModal.modal-theme-light .plan-card-toggle:hover {
  border-color: #bbbbbb;
  background: rgba(0, 0, 0, 0.02);
}
#authModal.modal-theme-light .plan-card-toggle.plan-card-selected {
  border-color: #DD5100;
  background: rgba(221, 81, 0, 0.03);
}
#authModal.modal-theme-light .plan-card-radio {
  border-color: #bbbbbb;
}

#authModal.modal-theme-dark .auth-modal-content {
  background: #1a1a1a;
  color: #f0f0f0;
}
#authModal.modal-theme-dark .auth-modal-content input,
#authModal.modal-theme-dark .auth-modal-content select {
  background: #2a2a2a;
  color: #f0f0f0;
  border-color: #444444;
}
#authModal.modal-theme-dark .auth-modal-content .auth-input-label,
#authModal.modal-theme-dark .auth-modal-content label {
  color: #cccccc;
}
#authModal.modal-theme-dark .auth-modal-content .auth-subtitle,
#authModal.modal-theme-dark .auth-modal-content p {
  color: #aaaaaa;
}
/* SP-007: Ensure plan card text is legible inside dark modal regardless of page theme */
#authModal.modal-theme-dark .plan-card-name,
#authModal.modal-theme-dark .plan-card-price {
  color: #ffffff;
}
#authModal.modal-theme-dark .plan-card-period {
  color: #888888;
}
#authModal.modal-theme-dark .plan-card-features li {
  color: #bbbbbb;
}
#authModal.modal-theme-dark .plan-card {
  border-color: #333333;
}
#authModal.modal-theme-dark .plan-card:hover {
  border-color: #555555;
}
#authModal.modal-theme-dark .plan-card-toggle {
  border-color: #333333;
  color: #f0f0f0;
}
#authModal.modal-theme-dark .plan-card-toggle:hover {
  border-color: #555555;
  background: rgba(255, 255, 255, 0.02);
}
#authModal.modal-theme-dark .plan-card-radio {
  border-color: #555555;
}
#authModal.modal-theme-dark .plan-card-btn-secondary {
  background: #333333;
  color: #cccccc;
  border-color: #444444;
}
#authModal.modal-theme-dark .plan-card-btn-secondary:hover {
  background: #3a3a3a;
  color: #ffffff;
  border-color: #555555;
}
#authModal.modal-theme-dark .plan-step-trust {
  color: #888888;
}
#authModal.modal-theme-dark .plan-step-sub {
  color: #666666;
}
#authModal.modal-theme-dark .auth-switch-row {
  border-top-color: rgba(255, 255, 255, 0.06);
  color: #888888;
}

/* ============================================
   SP-091: Feedback Modal
   ============================================ */

.feedback-modal {
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  text-align: left;
}

/* SP-092: Overlay alignment for scrollable feedback modal on small viewports */
#feedbackModal.auth-confirmation-overlay {
  align-items: flex-start;
  padding-top: 5vh;
}

/* Form inputs on dark background: hardcoded colors (see CLAUDE.md SP-020 incident) */
#feedbackModal .auth-form-group label {
  display: block;
  margin-bottom: 4px;
  color: #999;
  font-size: 12px;
  font-weight: 500;
}

#feedbackModal .auth-form-group input,
#feedbackModal .auth-form-group select,
#feedbackModal .auth-form-group textarea {
  width: 100%;
  padding: 8px 10px;
  background: #333;
  border: 1px solid #444;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  line-height: 1.3;
  font-family: inherit;
  box-sizing: border-box;
}

#feedbackModal .auth-form-group input::placeholder,
#feedbackModal .auth-form-group textarea::placeholder {
  color: #666;
}

#feedbackModal .auth-form-group input:focus,
#feedbackModal .auth-form-group select:focus,
#feedbackModal .auth-form-group textarea:focus {
  outline: none;
  border-color: #DD5100;
  box-shadow: 0 0 0 2px rgba(221, 81, 0, 0.15);
}

#feedbackModal .auth-form-group select {
  appearance: auto;
  cursor: pointer;
}

#feedbackModal .auth-form-group textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.4;
}

#feedbackModal .auth-form-group {
  margin-bottom: 14px;
}

/* Character count under textarea */
.feedback-char-count {
  text-align: right;
  font-size: 11px;
  color: #666;
  margin-top: 4px;
}

.feedback-char-count.near-limit {
  color: #dd9e3b;
}

.feedback-char-count.at-limit {
  color: #d64545;
}

/* SP-208: Proper toggle switch with knob — used for Preferences toggles */
.jargan-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.jargan-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.jargan-toggle-track {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #444;
  border-radius: 24px;
  transition: background-color 0.3s;
}
.jargan-toggle-track::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
}
.jargan-toggle input:checked + .jargan-toggle-track {
  background-color: #DD5100;
}
.jargan-toggle input:checked + .jargan-toggle-track::before {
  transform: translateX(20px);
}

/* ---- SP-228: Referral Welcome Banner ---- */
.referral-welcome-banner {
  margin: 8px 0 4px;
  animation: authScaleIn 300ms ease both;
  animation-delay: 200ms;
}
.referral-banner-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(221, 81, 0, 0.12);
  border: 1px solid rgba(221, 81, 0, 0.35);
  border-radius: 8px;
  padding: 10px 14px;
}
.referral-banner-icon {
  font-size: 22px;
  flex-shrink: 0;
  line-height: 1;
}
.referral-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.referral-banner-discount {
  font-size: 14px;
  font-weight: 700;
  color: #DD5100;
}
.referral-banner-code-label {
  font-size: 11px;
  color: #999;
}
.referral-banner-code {
  font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
  color: #fff;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  letter-spacing: 0.5px;
}
