/* Scoped to the authenticated Premium page, its access dialog and Home. */
body.premium-route-active {
  --bg:#f7f6fb;--surface:#fff;--surface-2:#f7f6fe;--text:#17182c;
  --text-secondary:#565873;--text-tertiary:#6c6e87;--border:#e6e3f0;
  --border-light:#eeecf5;--primary:#4338ca;--primary-dark:#3730a3;
  --primary-lighter:#eeedfb;--primary-glow:rgba(67,56,202,.12);
  --premium-action:#4338ca;--premium-action-hover:#3730a3;--premium-on-action:#fff;
  --premium-success-bg:#e9f7ef;--premium-success:#216a46;
  background:var(--bg);color:var(--text);line-height:calc(1.5 * var(--access-line-spacing,1));
}
[data-theme=dark] body.premium-route-active {
  --bg:#0f1020;--surface:#191b30;--surface-2:#20223b;--text:#f2f2fa;
  --text-secondary:#b5b8d2;--text-tertiary:#a3a6c4;--border:#333651;
  --border-light:#2b2e4b;--primary:#b5b3ff;--primary-dark:#c5c2ff;
  --primary-lighter:#292647;--primary-glow:rgba(165,180,252,.1);
  --premium-action:#a5b4fc;--premium-action-hover:#c5ccff;--premium-on-action:#17182c;
  --premium-success-bg:#18382d;--premium-success:#8fe0b3;
}
#premiumShell[hidden],#premiumShell [hidden],#trialGateModal[hidden] {display:none!important}
body.premium-gate-open {overflow:hidden}
#premiumShell,#premiumShell *,#trialGateModal * {box-sizing:border-box}
#premiumShell {min-height:100vh;min-height:100dvh;background:var(--bg);color:var(--text);font-family:var(--font-body);overflow-wrap:anywhere}
#premiumShell :is(button,a,input,summary) {touch-action:manipulation}
#premiumShell button {font-family:inherit;cursor:pointer}
#premiumShell button:disabled {opacity:.55;cursor:default}
#premiumShell :is(button,a,input,summary):focus-visible,#trialGateModal :is(button,a):focus-visible {outline:3px solid var(--primary);outline-offset:4px}
.sa-premium-header {min-height:80px;padding:16px max(24px,calc((100vw - 1328px)/2));display:flex;align-items:center;justify-content:space-between;gap:20px;border-bottom:1px solid var(--border);background:var(--surface)}
.sa-premium-brand {display:flex;align-items:center;flex-shrink:0;min-height:44px}
.sa-premium-brand img {display:block;width:205px;height:auto;max-width:100%}
.sa-premium-header-actions {display:flex;align-items:center;gap:8px}
.sa-premium-header-actions button,.sa-premium-account-actions button {display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:10px 14px;border:0;border-radius:10px;color:var(--text-secondary);background:transparent;font-size:.875rem;font-weight:600;line-height:1.4}
.sa-premium-header-actions button:hover,.sa-premium-account-actions button:hover {background:var(--surface-2);color:var(--primary)}
.sa-premium-header-actions .sa-premium-back {background:var(--primary-lighter);color:var(--primary)}
.sa-premium-header-actions .sa-premium-theme {width:44px;padding:10px;font-size:1rem}
.sa-restore-short {display:none}
.sa-premium-main {max-width:1440px;margin:0 auto;padding:40px 56px 24px;outline:none}
.sa-premium-status {font-size:.8125rem;line-height:1.5;color:var(--text-secondary);display:flex;gap:8px;align-items:flex-start;margin:0 0 24px;background:none;padding:0;border:0;text-align:left}
.sa-premium-status.active {color:var(--premium-success)}
.sa-premium-status i {margin-top:3px}
#premiumShell .sa-premium-status {justify-content:flex-start}
.sa-premium-offer-grid {display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);grid-template-areas:"intro checkout" "benefits checkout" "timeline checkout" "faqs checkout";gap:28px 56px;align-items:start}
.sa-premium-intro {grid-area:intro;min-width:0;padding-top:4px}
.sa-premium-chip,.sa-premium-success-chip,.sa-premium-account-chip {display:inline-flex;align-items:center;padding:6px 12px;border-radius:999px;background:var(--primary-lighter);color:var(--primary);font-size:.75rem;font-weight:700;letter-spacing:.01em;line-height:1.5}
.sa-premium-intro h1 {font-family:var(--font-heading);font-size:3.5rem;font-weight:800;line-height:1.04;letter-spacing:-.035em;margin:22px 0 18px;max-width:650px}
.sa-premium-intro>p {font-size:1.125rem;line-height:1.65;max-width:530px;color:var(--text-secondary);margin:0}
.sa-premium-benefits {grid-area:benefits;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px 20px;min-width:0}
.sa-premium-benefit {display:flex;align-items:flex-start;gap:10px;min-width:0}
.sa-premium-check {width:24px;height:24px;display:grid;place-items:center;background:var(--primary-lighter);color:var(--primary);border-radius:50%;flex-shrink:0;font-size:.6875rem}
.sa-premium-benefit strong {font-size:.875rem;line-height:1.45;display:block;font-weight:700}
.sa-premium-benefit p {font-size:.8125rem;line-height:1.55;color:var(--text-secondary);margin:4px 0 0}
.sa-premium-timeline-card {grid-area:timeline;border:1px solid var(--border);border-radius:20px;background:var(--surface);padding:24px 28px;min-width:0}
#premiumShell h2 {font-family:var(--font-heading);font-size:1.375rem;line-height:1.25;letter-spacing:-.02em;margin:0;font-weight:800}
.sa-premium-timeline {list-style:none;padding:0;margin:24px 0 16px;display:grid;gap:0}
.sa-premium-timeline li {position:relative;display:flex;gap:14px;padding-bottom:23px}
.sa-premium-timeline li:last-child {padding-bottom:0}
.sa-premium-timeline li:not(:last-child):before {content:"";position:absolute;left:5px;top:15px;bottom:0;width:1px;background:var(--border)}
.sa-premium-timeline-dot {width:11px;height:11px;border-radius:50%;background:var(--primary);box-shadow:0 0 0 4px var(--primary-lighter);margin-top:6px;flex-shrink:0;position:relative}
.sa-premium-timeline-dot.is-amber {background:#bd8429;box-shadow:0 0 0 4px rgba(189,132,41,.12)}
.sa-premium-timeline-dot.is-muted {background:var(--text-tertiary);box-shadow:0 0 0 4px var(--surface-2)}
.sa-premium-timeline strong {font-size:.875rem;line-height:1.5}
.sa-premium-timeline p {font-size:.8125rem;line-height:1.6;color:var(--text-secondary);margin:4px 0 0}
.sa-premium-offer-note {border-top:1px solid var(--border);padding-top:14px;margin:18px 0 0;font-size:.75rem;color:var(--text-secondary);line-height:1.6}
.sa-premium-faqs {grid-area:faqs;min-width:0}
.sa-premium-faqs details {border-bottom:1px solid var(--border)}
.sa-premium-faqs summary {list-style:none;min-height:54px;display:flex;align-items:center;justify-content:space-between;gap:16px;font-size:.875rem;font-weight:600;cursor:pointer;padding:14px 0}
.sa-premium-faqs summary::-webkit-details-marker,.home-note-summary summary::-webkit-details-marker {display:none}
.sa-premium-faqs summary i {color:var(--text-tertiary);font-size:.75rem;transition:transform .15s}
.sa-premium-faqs details[open] summary i {transform:rotate(45deg)}
.sa-premium-faqs details>p {margin:0 0 18px;color:var(--text-secondary);font-size:.875rem;line-height:1.7}
#premiumShell .sa-premium-checkout {grid-area:checkout;margin:0;padding:28px;border:1px solid var(--border);border-radius:24px;box-shadow:0 16px 48px -24px rgba(53,37,120,.22);background:var(--surface);min-width:0;scroll-margin-top:20px}
.sa-premium-checkout-heading {display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:22px;flex-wrap:wrap}
.sa-premium-secure-label {display:inline-flex;align-items:center;gap:5px;font-size:.6875rem;color:var(--text-secondary);padding-top:5px}
.sa-premium-secure-label i {color:var(--premium-success)}
.sa-premium-plan-options {display:grid;gap:12px}
#premiumShell .sa-premium-plan {width:100%;display:flex;align-items:center;text-align:left;gap:12px;padding:18px 16px;min-height:92px;border:1.5px solid var(--border);border-radius:14px;background:var(--surface);color:var(--text);margin:0;box-shadow:none;transition:border-color .15s,background .15s}
#premiumShell .sa-premium-plan.active {border:2px solid var(--primary);background:var(--primary-lighter);padding:17.5px 15.5px}
.sa-premium-plan-radio {height:18px;width:18px;border:1.5px solid var(--text-tertiary);border-radius:50%;display:grid;place-items:center;flex-shrink:0}
.sa-premium-plan.active .sa-premium-plan-radio {border-color:var(--primary)}
.sa-premium-plan.active .sa-premium-plan-radio:after {content:"";width:8px;height:8px;border-radius:50%;background:var(--primary)}
.sa-premium-plan-copy {display:flex;flex-direction:column;gap:5px;flex:1;min-width:0}
.sa-premium-plan-copy>strong {display:flex;flex-wrap:wrap;gap:7px;align-items:center;font-size:.9375rem;line-height:1.5}
.sa-premium-plan-copy>small {font-size:.75rem;color:var(--text-secondary);line-height:1.5}
.sa-premium-saving {font-family:var(--font-body);font-size:.625rem;background:var(--premium-success-bg);color:var(--premium-success);border-radius:5px;line-height:1.5;padding:3px 6px;text-transform:uppercase;white-space:nowrap;letter-spacing:.02em}
.sa-premium-plan-price {font-family:var(--font-heading);font-weight:800;font-size:1.5rem;letter-spacing:-.03em;white-space:nowrap;line-height:1.1}
.sa-premium-plan-price small {font-family:var(--font-body);font-size:.75rem;font-weight:400;color:var(--text-secondary);letter-spacing:0;margin-left:2px}
.sa-premium-checkout-summary {display:grid;gap:10px;padding:20px 0;margin-bottom:8px;border-bottom:1px solid var(--border)}
.sa-premium-checkout-summary>div {display:flex;justify-content:space-between;align-items:baseline;gap:14px;font-size:.875rem;line-height:1.5}
.sa-premium-checkout-summary strong {font-family:var(--font-heading);font-size:1.75rem;letter-spacing:-.03em;line-height:1.2}
.sa-premium-summary-renewal {font-size:.75rem!important;color:var(--text-secondary)}
.sa-premium-summary-renewal>span:last-child {text-align:right;font-weight:600}
#premiumShell .premium-payment-heading {display:flex;gap:16px;margin:24px 0 14px;align-items:flex-start}
#premiumShell .premium-payment-heading .section-title {font-family:var(--font-body);font-size:.875rem;font-weight:700;color:var(--text);line-height:1.5}
#premiumShell .premium-payment-help {font-size:.75rem;line-height:1.6;color:var(--text-secondary);margin-top:7px}
#premiumShell .premium-payment-heading>i {font-size:1.125rem;color:var(--primary);margin-top:4px}
#premiumShell .billing-consent {background:var(--surface-2);border:1px solid var(--border);border-radius:10px;padding:12px 14px;font-size:.8125rem;line-height:1.65;color:var(--text-secondary);margin-bottom:16px}
#premiumShell .payment-method-stack {display:grid;gap:12px}
#premiumShell :is(.payment-provider-button,.payment-submit-button,.payment-method-button) {min-height:52px;width:100%;border-radius:12px;font-family:var(--font-body);font-size:.875rem;font-weight:700;line-height:1.4;margin:0;white-space:normal;box-shadow:none;padding:14px 16px}
#premiumShell :is(.payment-provider-button,.payment-submit-button) {background:var(--premium-action);color:var(--premium-on-action);border:1px solid transparent;display:flex;align-items:center;justify-content:center;gap:9px}
#premiumShell :is(.payment-provider-button,.payment-submit-button):hover {background:var(--premium-action-hover)}
#premiumShell #subscribeButton {background:var(--premium-action);color:var(--premium-on-action)}
#premiumShell #subscribeButton:hover {background:var(--premium-action-hover);color:var(--premium-on-action)}
#premiumShell .payment-method-button {background:var(--surface);color:var(--text);border:1px solid var(--border);display:flex;align-items:center;gap:12px;text-align:left}
#premiumShell .payment-method-button:hover {border-color:var(--primary);background:var(--surface-2)}
#premiumShell .payment-method-copy {display:grid;gap:3px;flex:1;min-width:0}
#premiumShell .payment-method-copy strong {font-size:.875rem}
#premiumShell .payment-method-copy small {font-size:.6875rem;font-weight:400;color:var(--text-secondary);line-height:1.5}
#premiumShell .payment-method-icon {width:28px;flex-shrink:0;color:var(--primary);font-size:1.25rem;text-align:center}
#premiumShell .payment-method-chevron {font-size:.6875rem;color:var(--text-tertiary)}
#premiumShell .paypal-card-form {padding:18px 16px;background:var(--surface-2);border:1px solid var(--border);border-radius:12px;margin-top:0;display:grid;gap:14px}
#premiumShell .hosted-field-row {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
#premiumShell .hosted-field-group {min-width:0}
#premiumShell .hosted-field-group label {display:block;font-size:.8125rem;font-weight:600;margin:0 0 6px;color:var(--text)}
#premiumShell .paypal-hosted-field {min-height:48px;background:var(--surface);border:1px solid var(--border);border-radius:8px;overflow:hidden;font-size:16px}
#premiumShell .paypal-hosted-field iframe {width:100%!important;min-height:46px;max-width:100%}
#premiumShell .payment-field-message {font-size:.75rem;color:var(--text-secondary);line-height:1.65;margin:6px 0 0}
#premiumShell .payment-field-message:empty {display:none}
#premiumShell .payment-field-message.error {color:var(--danger)}
#premiumShell .wallet-payment-group {border-top:1px solid var(--border);padding-top:14px;margin-top:0}
#premiumShell .wallet-payment-label {font-size:.75rem;color:var(--text-secondary);margin:0 0 10px}
#premiumShell .apple-pay-button {width:100%;min-height:48px;border-radius:10px}
#premiumShell .google-pay-container {margin-top:10px;min-width:0}
#premiumShell .google-pay-container>button {width:100%;min-height:48px;max-width:100%}
#premiumShell .premium-renewal-note {display:flex;align-items:flex-start;gap:8px;color:var(--text-secondary);font-size:.75rem;line-height:1.65;margin-top:18px}
#premiumShell .premium-renewal-note i {font-size:.75rem;margin-top:4px;color:var(--primary);flex-shrink:0}
.sa-premium-checkout-policy {font-size:.6875rem;line-height:1.7;text-align:center;color:var(--text-secondary);border-top:1px solid var(--border);padding-top:18px;margin:20px 0 0}
#premiumShell a:not(.sa-premium-brand):not([data-premium-checkout]) {color:var(--primary);text-underline-offset:3px}
.sa-premium-unavailable {display:flex;gap:10px;background:var(--surface-2);padding:14px;border-radius:10px;font-size:.8125rem;color:var(--text-secondary);margin:18px 0 0;line-height:1.6}
.sa-premium-unavailable i {margin-top:4px;color:var(--primary)}
.sa-premium-comparison-note {font-size:.8125rem;color:var(--text-secondary);line-height:1.6;background:var(--surface-2);border-radius:10px;padding:12px 14px;margin:20px 0 0}
.sa-premium-sr-only {position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
.sa-premium-footer {margin-top:36px;border-top:1px solid var(--border);padding:20px 0 0;display:flex;justify-content:space-between;gap:12px;align-items:center;font-size:.8125rem}
.sa-premium-account-actions {display:flex;flex-wrap:wrap;gap:0 6px;align-items:center}
.sa-premium-account-actions button {font-size:.8125rem;padding:10px 12px}
.sa-premium-account-actions button:first-child {margin-left:-12px}
#premiumShell #cancelSubscription {color:var(--danger)}
.sa-premium-footer>a {display:inline-flex;align-items:center;min-height:44px;gap:8px;text-decoration:none}
.sa-premium-mobile-action {display:none}
.sa-premium-active-view {max-width:800px;margin:0 auto}
#premiumShell[data-view=active] .sa-premium-status {max-width:800px;margin-left:auto;margin-right:auto}
#premiumShell[data-view=active] .sa-premium-footer {max-width:800px;margin-left:auto;margin-right:auto}
#premiumShell[data-view=active] .sa-premium-offer-grid {margin-top:36px}
.sa-premium-active-heading {display:flex;justify-content:space-between;align-items:center;gap:20px;margin:12px 0 30px}
.sa-premium-eyebrow {font-size:.6875rem;letter-spacing:.12em;text-transform:uppercase;font-weight:700;color:var(--text-tertiary)}
.sa-premium-active-heading h1 {font-family:var(--font-heading);font-size:2.5rem;line-height:1.15;letter-spacing:-.035em;margin:10px 0 12px}
.sa-premium-active-heading p {font-size:.9375rem;color:var(--text-secondary);line-height:1.6;margin:0}
.sa-premium-account-chip {flex-shrink:0}
.sa-premium-current-plan {display:flex;align-items:center;justify-content:space-between;gap:24px;background:var(--surface);border:2px solid var(--primary);border-radius:20px;padding:28px;margin-bottom:20px;min-width:0}
.sa-premium-success-chip {background:var(--premium-success-bg);color:var(--premium-success);font-size:.6875rem;margin-bottom:14px}
.sa-premium-current-plan h2 {font-size:1.625rem!important}
.sa-premium-current-plan p {color:var(--text-secondary);font-size:.875rem;line-height:1.7;margin:12px 0 0}
.sa-premium-current-plan small {display:block;color:var(--text-secondary);font-size:.75rem;line-height:1.6;margin-top:6px}
.sa-premium-current-plan small:empty {display:none}
.sa-premium-secondary {border:1px solid var(--border);border-radius:10px;min-height:44px;background:var(--surface);color:var(--text);padding:10px 14px;display:flex;align-items:center;gap:12px;font-size:.8125rem;font-weight:600;line-height:1.5;flex-shrink:0}
.sa-premium-secondary:hover {border-color:var(--primary)}
.sa-premium-billing-card {background:var(--surface);border:1px solid var(--border);border-radius:18px;padding:24px 28px;margin-top:20px}
#premiumShell .sa-premium-billing-card h2 {font-size:1.125rem}
.sa-premium-billing-detail {display:flex;align-items:center;gap:14px;margin-top:22px;min-width:0}
.sa-premium-billing-icon {background:var(--surface-2);border:1px solid var(--border);border-radius:10px;width:46px;height:46px;display:grid;place-items:center;flex-shrink:0;color:var(--primary);font-size:1.125rem}
.sa-premium-billing-detail strong {font-size:.875rem;font-weight:600;line-height:1.5}
.sa-premium-billing-detail p {color:var(--text-secondary);font-size:.75rem;line-height:1.6;margin:4px 0 0}
.sa-premium-billing-heading {display:flex;justify-content:space-between;gap:12px;align-items:center;flex-wrap:wrap;margin-bottom:10px}
.sa-premium-billing-heading>span {font-size:.75rem;color:var(--text-secondary)}
#premiumShell .billing-history {margin:14px 0 0;display:grid;gap:0}
#premiumShell .billing-history-row {padding:18px 0;border:0;border-top:1px solid var(--border);border-radius:0;display:flex;align-items:center;justify-content:space-between;gap:16px;background:none}
#premiumShell .billing-history-main {min-width:0;display:grid;gap:5px}
#premiumShell .billing-history-main strong {font-size:.875rem}
#premiumShell .billing-history-main span {font-size:.75rem;color:var(--text-secondary);line-height:1.5}
#premiumShell .billing-history-amount {font-size:.875rem;font-weight:700;display:grid;gap:5px;text-align:right;flex-shrink:0}
#premiumShell .billing-history-amount small {font-size:.6875rem;color:var(--text-secondary);font-weight:500}
#premiumShell .billing-history-amount small.completed {color:var(--premium-success)}
#premiumShell .billing-history-empty {color:var(--text-secondary);font-size:.875rem;padding:18px 0;line-height:1.6}
/* The blocking access dialog keeps the existing Continue and Sign out actions. */
#trialGateModal.sa-premium-gate {padding:24px;padding-top:max(24px,env(safe-area-inset-top));padding-bottom:max(24px,env(safe-area-inset-bottom));background:rgba(15,16,32,.58);backdrop-filter:blur(6px)}
#trialGateModal .sa-premium-gate-card {width:100%;max-width:500px;border:1px solid var(--border);border-radius:26px;padding:34px;max-height:calc(100vh - 48px);max-height:calc(100dvh - 48px);overflow:auto;box-shadow:0 24px 80px rgba(15,16,32,.24);background:var(--surface);color:var(--text);text-align:left}
.sa-premium-gate-card .trial-gate-icon {display:grid;place-items:center;background:var(--primary-lighter);color:var(--primary);width:56px;height:56px;border-radius:16px;font-size:1.5rem;margin:0 0 24px;box-shadow:none}
#trialGateModal .trial-gate-kicker {color:var(--primary);font-size:.6875rem;letter-spacing:.12em;line-height:1.6;font-weight:700}
#trialGateModal h2 {font-family:var(--font-heading);font-weight:800;font-size:2rem;letter-spacing:-.03em;line-height:1.15;margin:10px 0 14px}
#trialGateModal #trialGateDescription {font-size:.875rem;color:var(--text-secondary);line-height:1.7;margin:0}
#trialGateModal .trial-gate-benefits {display:grid;grid-template-columns:1fr;gap:12px;padding:20px 0;margin:0;font-size:.8125rem;color:var(--text);text-align:left}
#trialGateModal .trial-gate-benefits>span {display:flex;align-items:center;gap:9px;line-height:1.5}
#trialGateModal .trial-gate-benefits i {width:22px;height:22px;display:grid;place-items:center;border-radius:50%;background:var(--primary-lighter);color:var(--primary);font-size:.625rem;flex-shrink:0}
#trialGateModal #trialGateContinue {width:100%;display:flex;align-items:center;justify-content:center;gap:10px;min-height:52px;border:0;border-radius:12px;background:var(--premium-action,var(--inside-action));color:var(--premium-on-action,var(--inside-on-action));font-family:var(--font-body);font-size:.9375rem;font-weight:700;white-space:normal;line-height:1.5;padding:14px 18px;box-shadow:none}
#trialGateModal #trialGateContinue:hover {background:var(--premium-action-hover,var(--inside-action-hover))}
#trialGateModal #trialGateLogout {display:block;min-height:44px;padding:12px;margin:8px auto 0;background:none;border:0;color:var(--text-secondary);font-size:.8125rem;font-family:var(--font-body);font-weight:600}
.sa-premium-gate-help {display:flex;align-items:center;justify-content:center;gap:7px;font-size:.6875rem;color:var(--text-secondary);margin:18px 0 0;padding-top:18px;border-top:1px solid var(--border);line-height:1.6;text-align:center}
/* Home: compact data, purposeful actions, and readable study material. */
.inside-app-active #page-home .stats-row {gap:14px;margin:28px 0 38px;display:grid;grid-template-columns:repeat(4,minmax(0,1fr))}
.inside-app-active #page-home .stat-item {display:grid;grid-template-columns:44px minmax(0,1fr);grid-template-rows:auto auto;column-gap:14px;row-gap:1px;align-items:center;background:var(--surface);border:1px solid var(--border);border-radius:16px;padding:18px;text-align:left;min-width:0}
.inside-app-active #page-home .stat-icon {grid-row:1/3;width:44px;height:44px;display:grid;place-items:center;border-radius:13px;margin:0;font-size:1.125rem}
.inside-app-active #page-home .stat-value {font-family:var(--font-heading);font-size:1.875rem;line-height:1.15;letter-spacing:-.035em;font-weight:800;min-width:0}
.inside-app-active #page-home .stat-label {font-size:.75rem;color:var(--text-secondary);line-height:1.5;margin:0}
.inside-app-active #page-home .home-section-heading {display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0 0 18px}
.inside-app-active #page-home .section-header .section-title {font-family:var(--font-heading);font-size:1.5rem;line-height:1.3;font-weight:800;letter-spacing:-.02em;margin:0}
.inside-app-active #page-home .section-subtitle {font-size:.875rem;color:var(--text-secondary);line-height:1.6;margin:6px 0 0}
.home-section-kicker {font-size:.6875rem;text-transform:uppercase;letter-spacing:.1em;color:var(--text-tertiary);font-weight:700}
.inside-app-active #page-home .quick-grid {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin:0 0 38px}
.inside-app-active #page-home .quick-item {display:flex;flex-direction:column;align-items:flex-start;text-align:left;padding:20px;gap:18px;position:relative;min-width:0;border:1px solid var(--border);border-radius:16px;background:var(--surface);color:var(--text);min-height:158px;transition:border-color .15s,box-shadow .15s,transform .15s}
.inside-app-active #page-home .quick-item:hover {border-color:var(--primary);box-shadow:0 6px 20px var(--primary-glow);transform:translateY(-2px)}
.inside-app-active #page-home .quick-item.home-quick-primary {border-color:color-mix(in srgb,var(--primary) 24%,var(--border));background:linear-gradient(145deg,var(--surface),var(--primary-lighter))}
.inside-app-active #page-home .quick-icon {width:42px;height:42px;border-radius:12px;font-size:1.125rem;align-self:auto;margin:0;display:grid;place-items:center;flex-shrink:0}
.home-quick-copy {display:grid;gap:5px;min-width:0}
.inside-app-active #page-home .quick-label {font-family:var(--font-body);font-size:.9375rem;font-weight:700;line-height:1.45;letter-spacing:0;white-space:normal}
.home-quick-copy small {font-size:.75rem;font-weight:400;color:var(--text-secondary);line-height:1.6}
.home-quick-arrow {position:absolute;top:22px;right:18px;font-size:.6875rem;color:var(--text-tertiary);opacity:.6}
.inside-app-active #page-home .home-study-sets {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;margin-bottom:38px}
.inside-app-active #page-home .home-set-card-polished {display:flex;flex-direction:column;align-items:stretch;gap:0;padding:22px;border:1px solid var(--border);border-radius:18px;min-width:0;text-align:left;background:var(--surface);color:var(--text);transition:border-color .15s,box-shadow .15s,transform .15s}
.inside-app-active #page-home .home-set-card-polished:hover {border-color:var(--primary);box-shadow:0 10px 24px var(--primary-glow);transform:translateY(-2px)}
.home-set-top {display:flex;align-items:center;gap:10px;margin-bottom:20px;min-width:0}
.home-set-icon {width:40px;height:40px;flex-shrink:0;border-radius:12px;background:color-mix(in srgb,var(--home-set-tone) 11%,var(--surface));color:var(--home-set-tone);display:grid;place-items:center;font-size:1.125rem}
[data-theme=dark] .home-set-icon {background:var(--surface-2);color:var(--primary)}
.home-set-subject {font-size:.6875rem;font-weight:700;color:var(--text-secondary);background:var(--surface-2);border:1px solid var(--border);border-radius:6px;padding:4px 8px;line-height:1.5;max-width:100%;min-width:0;overflow-wrap:anywhere}
.home-set-open {margin-left:auto;color:var(--text-tertiary);font-size:.6875rem;flex-shrink:0}
.inside-app-active #page-home .home-set-title {font-family:var(--font-heading);font-size:1.375rem;font-weight:800;line-height:1.25;letter-spacing:-.02em;white-space:normal;overflow:visible;text-overflow:clip;margin:0 0 14px;display:block;overflow-wrap:anywhere;-webkit-line-clamp:unset}
.home-set-counts {display:flex;flex-wrap:wrap;gap:6px 12px;font-size:.75rem;color:var(--text-secondary);line-height:1.6;margin:0 0 22px}
.home-set-counts>span {display:inline-flex;gap:5px;align-items:center}
.home-set-counts i {font-size:.6875rem;color:var(--text-tertiary)}
.inside-app-active #page-home .home-set-mastery {margin-top:auto;display:grid;gap:8px}
.home-set-mastery-label {display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:.6875rem;color:var(--text-secondary);line-height:1.5}
.home-set-mastery-label strong {color:var(--text);font-size:.75rem;font-weight:700}
.home-set-mastery-track {height:6px;border-radius:20px;overflow:hidden;background:var(--primary-lighter)}
.home-set-mastery-track>span {display:block;height:100%;background:var(--primary);border-radius:20px}
.home-set-footer {display:flex;align-items:center;justify-content:space-between;gap:10px;border-top:1px solid var(--border);padding-top:14px;margin-top:20px;color:var(--primary);font-size:.75rem;font-weight:700;line-height:1.5}
.home-set-footer i {font-size:.6875rem}
.inside-app-active #page-home .section-header>.section-link {min-height:44px;display:inline-flex;align-items:center;justify-content:center;gap:8px;border:1px solid var(--border);border-radius:10px;background:var(--surface);padding:10px 14px;font-size:.8125rem;color:var(--primary);font-weight:600;line-height:1.4;flex-shrink:0}
.inside-app-active #page-home #noteList {display:grid;gap:14px}
.inside-app-active #page-home .home-note-card {display:grid;grid-template-columns:46px minmax(0,1fr) auto;align-items:start;gap:16px;padding:22px;background:var(--surface);border:1px solid var(--border);border-radius:16px;min-width:0}
.inside-app-active #page-home .home-note-card .file-icon {display:grid;place-items:center;width:46px;height:46px;border-radius:12px;font-size:1.25rem;background:var(--primary-lighter);color:var(--primary);margin:0;flex-shrink:0}
.home-note-card .file-copy {min-width:0}
.home-note-heading {display:flex;align-items:baseline;justify-content:space-between;flex-wrap:wrap;gap:8px 16px}
.inside-app-active #page-home .home-note-card .file-name {font-family:var(--font-heading);font-size:1.125rem;font-weight:700;line-height:1.4;white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere;margin:0}
.home-note-status {display:inline-flex;align-items:center;gap:5px;flex-shrink:0;line-height:1.4;font-size:.625rem;font-weight:700;text-transform:capitalize;color:var(--text-secondary);background:var(--surface-2);padding:4px 8px;border-radius:6px}
.home-note-status:empty {display:none}
.home-note-status>span {width:5px;height:5px;background:currentColor;border-radius:50%;flex-shrink:0}
.home-note-status[data-status=ready],.home-note-status[data-status=completed],.home-note-status[data-status=processed] {color:#216a46;background:#e9f7ef}
.home-note-status[data-status=processing],.home-note-status[data-status=pending] {color:#7a5c12;background:#fff4d6}
.home-note-status[data-status=failed],.home-note-status[data-status=error] {color:#a32b36;background:#fdebee}
[data-theme=dark] .home-note-status[data-status=ready],[data-theme=dark] .home-note-status[data-status=completed],[data-theme=dark] .home-note-status[data-status=processed] {color:#8fe0b3;background:#18382d}
[data-theme=dark] .home-note-status[data-status=processing],[data-theme=dark] .home-note-status[data-status=pending] {color:#f7d783;background:#362d18}
[data-theme=dark] .home-note-status[data-status=failed],[data-theme=dark] .home-note-status[data-status=error] {color:#ffadb4;background:#47212d}
.inside-app-active #page-home .note-meta {display:flex;flex-wrap:wrap;gap:4px 14px;color:var(--text-secondary);font-size:.75rem;line-height:1.6;margin-top:6px}
.home-note-summary {margin-top:16px;border-top:1px solid var(--border);padding-top:4px;min-width:0}
.home-note-summary summary {list-style:none;cursor:pointer;display:flex;align-items:center;gap:8px;min-height:44px;font-size:.75rem;font-weight:600;line-height:1.5;color:var(--primary)}
.home-note-summary summary>i:last-child {margin-left:auto;font-size:.625rem;transition:transform .15s}
.home-note-summary[open] summary>i:last-child {transform:rotate(180deg)}
/* Full summaries expand inside their card instead of inheriting the two-line preview clamp. */
.inside-app-active #page-home .home-note-summary .note-summary {display:block;-webkit-line-clamp:unset;font-size:.875rem;line-height:1.7;color:var(--text-secondary);margin:4px 0 0;background:var(--surface-2);border:1px solid var(--border);padding:16px;border-radius:12px;max-height:none;overflow:visible;overflow-wrap:anywhere}
.inside-app-active #page-home .home-note-summary .ai-rich-content {font-size:inherit;color:inherit;line-height:inherit}
.inside-app-active #page-home .home-note-card .file-actions {margin:0;align-self:start}
.inside-app-active #page-home .home-note-card .file-actions button {display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:44px;min-width:44px;border:1px solid var(--border);background:var(--surface);color:var(--text-secondary);border-radius:10px;padding:10px 12px;font-size:.75rem;line-height:1.4;font-weight:500}
.inside-app-active #page-home .home-note-card .file-actions button:hover {color:var(--danger);border-color:var(--danger);background:var(--surface-2)}
.home-notes-empty {display:flex;align-items:center;gap:20px;border:1px dashed var(--border);border-radius:18px;padding:30px;background:var(--surface)}
.home-notes-empty>span {width:52px;height:52px;display:grid;place-items:center;background:var(--primary-lighter);color:var(--primary);font-size:1.375rem;border-radius:14px;flex-shrink:0}
.home-notes-empty>div {flex:1}
.home-notes-empty h3 {font-size:1.125rem;font-weight:700;margin:0 0 6px}
.home-notes-empty p {font-size:.875rem;color:var(--text-secondary);margin:0}
.home-notes-empty button {padding:10px 16px;flex-shrink:0}
@media(min-width:1500px) {.sa-premium-main {padding-top:56px}}
@media(max-width:1150px) {
  .sa-premium-main {padding:32px}
  .sa-premium-offer-grid {gap:26px 32px;grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .sa-premium-intro h1 {font-size:3rem}
  #premiumShell .sa-premium-checkout {padding:24px}
  .sa-premium-benefits {gap:20px 14px}
  .inside-app-active #page-home .quick-grid {gap:12px}
  .inside-app-active #page-home .quick-item {padding:18px}
  .inside-app-active #page-home .home-study-sets {grid-template-columns:repeat(2,minmax(0,1fr))}
  .inside-app-active #page-home .stat-item {padding:16px;column-gap:10px;grid-template-columns:38px minmax(0,1fr)}
  .inside-app-active #page-home .stat-icon {width:38px;height:38px;font-size:1rem}
}
@media(max-width:900px) {
  .sa-premium-header {padding:14px 24px}
  .sa-premium-offer-grid {gap:26px 24px}
  .sa-premium-intro h1 {font-size:2.75rem}
  .sa-premium-benefits {grid-template-columns:1fr;gap:18px}
  .sa-premium-timeline-card {padding:24px}
  .inside-app-active #page-home .quick-grid {grid-template-columns:repeat(2,minmax(0,1fr))}
  .inside-app-active #page-home .quick-item {min-height:118px;flex-direction:row;align-items:center;gap:14px;padding:18px}
  .inside-app-active #page-home .home-quick-copy {padding-right:8px}
  .inside-app-active #page-home .home-quick-arrow {top:15px;right:14px;font-size:.625rem}
  .inside-app-active #page-home .stats-row {gap:10px}
  .inside-app-active #page-home .stat-item {grid-template-columns:1fr;grid-template-rows:auto auto auto;gap:5px;padding:16px;text-align:left}
  .inside-app-active #page-home .stat-icon {grid-row:auto;margin-bottom:7px}
  .home-notes-empty {flex-wrap:wrap}
  .home-notes-empty button {margin-left:72px}
}
@media(max-width:900px) {
  .sa-premium-header {min-height:64px;padding:10px 20px;padding-top:max(10px,env(safe-area-inset-top));gap:12px}
  .sa-premium-brand img {width:158px}
  .sa-premium-header-actions {gap:0}
  .sa-premium-header-actions button {padding:10px;min-width:44px;font-size:.75rem}
  .sa-premium-header-actions .sa-premium-back {width:40px;min-width:40px;min-height:40px;padding:10px;margin-right:4px}
  .sa-premium-back span,.sa-premium-header-logout,.sa-restore-full {display:none!important}
  .sa-restore-short {display:inline}
  .sa-premium-main {max-width:720px;padding:26px 20px 144px;padding-bottom:calc(144px + env(safe-area-inset-bottom))}
  #premiumShell[data-view=active] .sa-premium-main {padding-bottom:32px}
  .sa-premium-status {font-size:.75rem;margin-bottom:20px}
  .sa-premium-offer-grid {display:flex;flex-direction:column;gap:28px}
  .sa-premium-offer-grid>* {width:100%}
  .sa-premium-intro {padding:0}
  .sa-premium-intro h1 {font-size:2.5rem;line-height:1.06;max-width:560px;margin:18px 0 14px}
  .sa-premium-intro>p {font-size:1rem;line-height:1.65}
  .sa-premium-benefits {grid-template-columns:repeat(2,minmax(0,1fr));gap:22px 16px}
  .sa-premium-benefit {gap:9px}
  .sa-premium-benefit strong {font-size:.8125rem}
  .sa-premium-benefit p {font-size:.75rem}
  #premiumShell .sa-premium-checkout {padding:22px;border-radius:20px;scroll-margin-top:16px}
  .sa-premium-checkout-heading {margin-bottom:18px}
  #premiumShell h2 {font-size:1.25rem}
  .sa-premium-timeline-card {padding:22px}
  .sa-premium-footer {display:block;margin-top:28px;padding-top:16px}
  .sa-premium-account-actions {gap:0 2px}
  .sa-premium-footer>a {margin-top:8px}
  .sa-premium-mobile-action {position:fixed;left:0;right:0;bottom:0;z-index:110;background:var(--surface);border-top:1px solid var(--border);padding:12px 20px calc(10px + env(safe-area-inset-bottom));display:grid;gap:7px;box-shadow:0 -8px 32px rgba(15,16,32,.06)}
  #premiumShell .sa-premium-mobile-action>a {background:var(--premium-action);color:var(--premium-on-action);min-height:48px;border-radius:12px;display:flex;justify-content:center;align-items:center;gap:12px;text-decoration:none;font-weight:700;font-size:.875rem;line-height:1.5;padding:12px 16px}
  .sa-premium-mobile-action p {font-size:.625rem;color:var(--text-secondary);text-align:center;margin:0;line-height:1.6}
  .sa-premium-active-heading {margin-top:4px;gap:12px;align-items:flex-start}
  .sa-premium-active-heading h1 {font-size:2rem}
  .sa-premium-active-heading p {font-size:.875rem}
  .sa-premium-active-heading .sa-premium-account-chip {font-size:.625rem;margin-top:26px}
  .sa-premium-current-plan {padding:22px;display:block}
  .sa-premium-current-plan h2 {font-size:1.5rem!important}
  .sa-premium-current-plan .sa-premium-secondary {margin-top:20px;justify-content:space-between;width:100%}
  .sa-premium-billing-card {padding:22px}
  #trialGateModal.sa-premium-gate {padding:18px}
  #trialGateModal .sa-premium-gate-card {padding:28px;max-height:calc(100vh - 36px);max-height:calc(100dvh - 36px);border-radius:22px}
  #trialGateModal h2 {font-size:1.875rem}
  .inside-app-active #page-home .home-section-kicker {display:none}
  .inside-app-active #page-home .stats-row {margin:24px 0 30px}
  .inside-app-active #page-home .stat-item {padding:14px}
  .inside-app-active #page-home .stat-value {font-size:1.625rem}
  .inside-app-active #page-home .quick-item {min-height:142px;flex-direction:column;align-items:flex-start;gap:14px;padding:18px}
  .inside-app-active #page-home .quick-icon {width:38px;height:38px;font-size:1rem;border-radius:11px}
  .inside-app-active #page-home .quick-label {font-size:.875rem}
  .home-quick-copy small {font-size:.75rem}
  .inside-app-active #page-home .quick-grid {gap:12px;margin-bottom:30px}
  .inside-app-active #page-home .section-header .section-title {font-size:1.375rem}
  .inside-app-active #page-home .home-study-sets {gap:14px;margin-bottom:30px}
  .inside-app-active #page-home .home-set-card-polished {padding:20px}
  .inside-app-active #page-home .home-set-title {font-size:1.25rem}
  .inside-app-active #page-home .home-note-card {padding:20px;grid-template-columns:40px minmax(0,1fr) 36px;gap:12px}
  .inside-app-active #page-home .home-note-card .file-icon {width:40px;height:40px;border-radius:11px;font-size:1.125rem}
  .inside-app-active #page-home .home-note-card .file-actions button {padding:10px;position:relative;right:4px}
  .inside-app-active #page-home .home-note-card .file-actions button>span {position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
  .inside-app-active #page-home .home-note-card .home-note-heading {display:grid;gap:8px}
  .home-note-status {justify-self:start}
  .inside-app-active #page-home .home-note-card .file-name {font-size:1rem}
  .home-note-summary {margin-left:-52px;margin-right:-48px;margin-top:18px}
  .home-notes-empty {padding:22px;gap:16px;align-items:flex-start}
  .home-notes-empty>span {width:44px;height:44px;border-radius:12px}
  .home-notes-empty>div {flex-basis:calc(100% - 60px)}
  .home-notes-empty button {width:100%;margin:0}
}
@media(max-width:540px) {
  .inside-app-active #page-home .stats-row {grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .inside-app-active #page-home .stat-item {grid-template-columns:38px minmax(0,1fr);grid-template-rows:auto auto;gap:1px 12px;padding:15px}
  .inside-app-active #page-home .stat-icon {grid-row:1/3;margin:0}
  .inside-app-active #page-home .home-study-sets {grid-template-columns:minmax(0,1fr)}
  .inside-app-active #page-home .section-header {gap:10px;align-items:center}
  .inside-app-active #page-home .section-header>.section-link {padding:10px 12px;font-size:.75rem}
}
@media(max-width:380px) {
  .sa-premium-header {padding-left:16px;padding-right:12px;gap:6px}
  .sa-premium-brand img {width:140px}
  .sa-premium-header-actions button {padding:10px 8px}
  .sa-premium-header-actions .sa-premium-theme {width:40px;min-width:40px}
  .sa-premium-header-actions .sa-premium-back {width:34px;min-width:34px;padding:8px;margin-right:0}
  .sa-premium-main {padding-left:16px;padding-right:16px}
  .sa-premium-intro h1 {font-size:2.25rem}
  #premiumShell .sa-premium-checkout {padding:18px}
  #premiumShell .sa-premium-plan {gap:9px;padding:15px 12px}
  #premiumShell .sa-premium-plan.active {padding:14.5px 11.5px}
  .sa-premium-plan-price {font-size:1.375rem}
  .sa-premium-plan-copy>strong {font-size:.875rem;gap:5px}
  .sa-premium-saving {font-size:.5625rem;padding:3px 5px}
  .sa-premium-plan-copy>small {font-size:.6875rem}
  .sa-premium-benefits {grid-template-columns:1fr;gap:18px}
  .sa-premium-benefit strong {font-size:.875rem}
  .sa-premium-billing-card {padding:18px}
  #trialGateModal .sa-premium-gate-card {padding:24px}
  #trialGateModal h2 {font-size:1.75rem}
  .inside-app-active #page-home .quick-item {padding:16px;min-height:148px}
  .inside-app-active #page-home .quick-label {font-size:.8125rem}
  .inside-app-active #page-home .stat-item {padding:12px;column-gap:9px}
  .inside-app-active #page-home .stat-value {font-size:1.5rem}
  .inside-app-active #page-home .stat-label {font-size:.6875rem}
  .inside-app-active #page-home .section-header .section-title {font-size:1.25rem}
}
@media(prefers-reduced-motion:reduce) {
  #premiumShell *,#trialGateModal *,#page-home * {scroll-behavior:auto!important;transition:none!important;animation:none!important}
  .inside-app-active #page-home :is(.quick-item,.home-set-card-polished):hover {transform:none}
}
body.access-reduce-motion #page-home :is(.quick-item,.home-set-card-polished):hover {transform:none}
@media(forced-colors:active) {
  #premiumShell .sa-premium-plan.active {outline:2px solid Highlight}
  .sa-premium-plan.active .sa-premium-plan-radio:after {background:Highlight}
  .home-set-mastery-track>span {background:Highlight}
}

.sa-premium-gate-brand {margin-bottom:24px;display:flex;align-items:center}
.sa-premium-gate-brand img {display:block;width:184px;height:auto;max-width:100%}
#trialGateModal .sa-premium-gate-card {display:flex;flex-direction:column;overflow:hidden}
.sa-premium-gate-content {overflow:auto;min-height:0;overscroll-behavior:contain;padding:0 3px 2px}
.sa-premium-gate-actions {flex-shrink:0;padding-top:10px;background:var(--surface)}
@media(max-height:700px) {
  #trialGateModal .sa-premium-gate-card {padding:24px}
  #trialGateModal .sa-premium-gate-brand,#trialGateModal .trial-gate-icon {display:none}
  #trialGateModal h2 {font-size:1.625rem;margin:8px 0 12px}
  #trialGateModal #trialGateDescription {font-size:.8125rem;line-height:1.6}
  #trialGateModal .trial-gate-benefits {padding:16px 0;gap:9px}
  #trialGateModal .sa-premium-gate-help {margin:12px 0 0;padding-top:12px}
  #trialGateModal #trialGateLogout {margin-top:4px}
}

@supports not (-webkit-appearance:-apple-pay-button) {
  #premiumShell .apple-pay-button:after {content:"Pay with Apple Pay";color:#fff;font:600 16px var(--font-body)}
}
@supports (-webkit-appearance:-apple-pay-button) {
  #premiumShell .apple-pay-button {-webkit-appearance:-apple-pay-button}
}
body.premium-route-active.access-dyslexia {
  --font-body:'Atkinson Hyperlegible',Arial,sans-serif;--font-heading:'Atkinson Hyperlegible',Arial,sans-serif
}
body.premium-route-active.access-high-contrast {
  --text:#000;--text-secondary:#1f2937;--text-tertiary:#334155;--border:#64748b;
  --border-light:#94a3b8;--surface:#fff;--surface-2:#f8fafc;--bg:#eef2ff;
  --primary:#312e81;--premium-action:#312e81;--premium-on-action:#fff
}
[data-theme=dark] body.premium-route-active.access-high-contrast {
  --text:#fff;--text-secondary:#e2e8f0;--text-tertiary:#cbd5e1;--border:#94a3b8;
  --border-light:#64748b;--surface:#020617;--surface-2:#0f172a;--bg:#000;
  --primary:#c7d2fe;--premium-action:#c7d2fe;--premium-on-action:#000
}
