/* FramePrime Root Theme V1
   Scope: Root/simple surfaces only. /studio/ is intentionally excluded by not loading this file there. */
:root{color-scheme:light}
html[data-fp-theme="dark"]{
  color-scheme:dark;
  --bg:#0f141d;
  --bg2:#151d29;
  --card:#182130;
  --surface:#182130;
  --surface-2:#121a25;
  --line:#2c384a;
  --line-strong:#3b495d;
  --ink:#edf3fb;
  --text:#edf3fb;
  --muted:#9ba9bd;
  --cta:#6ea8ff;
  --cta2:#39c7f2;
  --mint:#4ad8ae;
  --mint-deep:#2fc294;
  --lav:#242c43;
  --sky:#183149;
  --amber:#f1ba60;
  --danger:#ff8f86;
  --blue:#6ea8ff;
  --blue-soft:#182c49;
  --navy:#f1f5fb;
  --good:#62d6ad;
  --good-soft:#173329;
  --warn:#f0c46f;
  --warn-soft:#3a3019;
  --border:#2c384a;
  --authority:#edf3fb;
  --authority-hover:#ffffff;
  --authority-soft:#202a38;
  --on-authority:#111823;
  --shadow:0 18px 50px rgba(0,0,0,.28);
  --shadow-soft:0 6px 20px rgba(0,0,0,.20);
}

html[data-fp-theme="dark"],
html[data-fp-theme="dark"] body{
  background:#0f141d;
  color:var(--ink,#edf3fb);
}
html[data-fp-theme="dark"] body{
  background:linear-gradient(180deg,var(--bg,#0f141d) 0%,var(--bg2,#151d29) 100%);
}
html[data-fp-theme="dark"] ::selection{background:#2a4f7d;color:#fff}

/* Dark-safe logo presentation without changing the official logo asset. */
html[data-fp-theme="dark"] :is(
  .brand-header-logo,.brand-kicker-logo img,.brand img,.library-logo img,.mobile-edit-app>header img,
  .mobile-settings-header img,.logo
){
  background:rgba(255,255,255,.96);
  border-radius:10px;
  padding:4px 8px;
}

/* Shared root controls / surfaces */
html[data-fp-theme="dark"] .topbar,
html[data-fp-theme="dark"] .growth-header{
  background:rgba(15,20,29,.90);
  border-color:var(--line);
}
html[data-fp-theme="dark"] :is(
  .top-account,.top-credit,.menu-btn,.menu-panel,
  button:not(.primary),input[type=text],input[type=email],input[type=url],
  input[type=datetime-local],input[type=number],select,textarea
){
  background:var(--card);
  color:var(--ink);
  border-color:var(--line);
}
html[data-fp-theme="dark"] :is(.top-account:hover,.menu-panel button:hover,button:not(.primary):hover){
  background:#202a38;
}
html[data-fp-theme="dark"] .top-account-icon{background:#202a38}
html[data-fp-theme="dark"] .top-credit .minibar,
html[data-fp-theme="dark"] .gauge-bar,
html[data-fp-theme="dark"] .mp-bar{background:#293548}
html[data-fp-theme="dark"] :is(.card,.feat){
  background:var(--card);
  border-color:var(--line);
  color:var(--ink);
}
html[data-fp-theme="dark"] :is(.face,.chip-float){
  background:#1a2433;
  border-color:#324155;
  color:var(--ink);
}
html[data-fp-theme="dark"] .face.f5,
html[data-fp-theme="dark"] .face.f6{
  background:linear-gradient(135deg,#182b40,#1d3330);
}
html[data-fp-theme="dark"] .chip-float.c1{color:#9fc4ff}
html[data-fp-theme="dark"] .chip-float.c2{color:#73ddbb;border-color:#2d5a4d}
html[data-fp-theme="dark"] .chip-float.c3{color:#c6adff;border-color:#4b4265}
html[data-fp-theme="dark"] .beta-line,
html[data-fp-theme="dark"] .beta-tag{
  color:#f3cd83;background:#342b18;border-color:#5b4824;
}
html[data-fp-theme="dark"] .boundary{
  color:#9ce0c8;background:#142b24;border-color:#2e6654;
}
html[data-fp-theme="dark"] .boundary b{color:#c1f2df}
html[data-fp-theme="dark"] .contact{
  color:#a8c9ff;background:#162a46;border-color:#315b8d;
}
html[data-fp-theme="dark"] .ghost-cta,
html[data-fp-theme="dark"] .mp-link,
html[data-fp-theme="dark"] .topnav a{
  color:#a9caff;background:#172943;border-color:#315884;
}
html[data-fp-theme="dark"] :is(.ghost-cta:hover,.mp-link:hover,.topnav a:hover){background:#1d3555}

/* Pricing + public tabs */
html[data-fp-theme="dark"] .public-feature-tabs{
  background:rgba(24,33,48,.88)!important;
  border-color:var(--line)!important;
}
html[data-fp-theme="dark"] .public-feature-tabs a{color:#a4b2c6!important}
html[data-fp-theme="dark"] .public-feature-tabs a:hover{background:#202a38!important;color:#d7e6fb!important}
html[data-fp-theme="dark"] .public-feature-tabs a.active{
  background:#17283a!important;color:#f2f6fb!important;border-color:#4ca5d6;
}
html[data-fp-theme="dark"] .pricing-tabs{background:#111925}
html[data-fp-theme="dark"] .pricing-tabs button.active{
  background:#202a38;color:var(--ink);border-color:#3b506c;box-shadow:none;
}
html[data-fp-theme="dark"] .plan{
  background:#182130;border-color:var(--line);box-shadow:var(--shadow-soft);
}
html[data-fp-theme="dark"] .plan.upcoming{background:linear-gradient(180deg,#182130 0%,#141c28 100%)}
html[data-fp-theme="dark"] .plan-status,
html[data-fp-theme="dark"] .plan-credit{background:#202a38;color:#aab8ca;border-color:#314056}
html[data-fp-theme="dark"] .plan-credit b{color:var(--ink)}
html[data-fp-theme="dark"] .plan-feature-list{color:#b3c0d1!important}
html[data-fp-theme="dark"] .plan-feature-list li{border-color:#263244}
html[data-fp-theme="dark"] .plan-compare-scroll{background:#182130;border-color:var(--line)}
html[data-fp-theme="dark"] .plan-compare thead th{background:#202a38;color:#b9c6d7}
html[data-fp-theme="dark"] .plan-compare tbody th{background:#151e2b;color:#c6d1df}
html[data-fp-theme="dark"] .plan-compare th,
html[data-fp-theme="dark"] .plan-compare td{border-color:#263244}

/* Home image cards + disabled state */
html[data-fp-theme="dark"] .fp-home-image-card{
  box-shadow:0 1px 3px rgba(0,0,0,.45);
  outline:1px solid #28364a;
}
html[data-fp-theme="dark"] .fp-home-image-card.fp-coming-soon::after{
  background:rgba(20,28,40,.94);
  color:#dce5f1;
  border-color:#526079;
}

/* Dashboard / settings summaries */
html[data-fp-theme="dark"] :is(
  .dash-settings-card,#dashEmail,.fp-settings-summary,.fp-settings-readback,
  .fp-settings-overlay-panel,.fp-settings-overlay iframe
){
  background:#182130!important;
  color:var(--ink);
  border-color:var(--line);
}
html[data-fp-theme="dark"] .fp-settings-readback-error{color:#ff9f96!important}
html[data-fp-theme="dark"] .plan-chip{
  color:#8ee2c5;background:#173128;border-color:#2d6b57;
}

/* My Page */
html[data-fp-theme="dark"] #scr-mypage{
  --mp-surface:#182130;
  --mp-surface-soft:#121a25;
  --mp-surface-tint:#172334;
  --mp-text:#edf3fb;
  --mp-muted:#9ba9bd;
  --mp-line:#2c384a;
  --mp-accent:#6ea8ff;
  --mp-safe-bg:#142b24;
  --mp-safe-text:#a9e2cf;
  --mp-safe-line:#2e6654;
  --mp-shadow:0 8px 26px rgba(0,0,0,.22);
}
html[data-fp-theme="dark"] .mp-hero{
  background:linear-gradient(145deg,#172536 0%,#172b27 100%);
  border-color:#30445a;
}
html[data-fp-theme="dark"] .mp-overview-plan{
  color:#a8c9ff;background:#172943;border-color:#315884;
}
html[data-fp-theme="dark"] .mp-overview-notification button,
html[data-fp-theme="dark"] .mp-settings-nav,
html[data-fp-theme="dark"] .mp-support-email{
  background:var(--mp-surface);
  border-color:var(--mp-line);
}
html[data-fp-theme="dark"] .mp-safety-card h3{color:#c1f2df}
html[data-fp-theme="dark"] .mp-settings-nav button:hover{background:#202b3a}
html[data-fp-theme="dark"] .mp-settings-nav button.is-active{
  background:#172b45;border-color:#315b8d;color:#a9caff;
}
html[data-fp-theme="dark"] .mp-row{border-color:#273345}
html[data-fp-theme="dark"] .mp-actions .signout{border-color:#613a3a}
html[data-fp-theme="dark"] #mpZeroCredit{
  color:#f2ca7f!important;background:#332b18!important;border-color:#5c4924!important;
}
@media(max-width:780px){
  html[data-fp-theme="dark"] .mp-settings-nav{background:#182130}
  html[data-fp-theme="dark"] .mp-settings-nav button{border-bottom-color:#263244}
}

/* Theme selector */
.fp-theme-setting{
  margin-top:18px;
  padding-top:16px;
  border-top:1px solid var(--mp-line,var(--line,#e3eaf3));
}
.fp-theme-setting-head{
  display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin-bottom:10px
}
.fp-theme-setting-head b{font-size:13px}
.fp-theme-setting-head span{font-size:11px;color:var(--muted)}
.fp-theme-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.fp-theme-options button{
  min-height:42px;padding:9px 10px;border-radius:11px;font-size:12.5px;font-weight:700;
  background:var(--card,#fff);color:var(--ink,#1c2740);border:1px solid var(--line,#e3eaf3)
}
.fp-theme-options button.is-active{
  border-color:var(--cta,#2f7cff);
  background:color-mix(in srgb,var(--cta,#2f7cff) 12%,var(--card,#fff));
  color:var(--ink,#1c2740);
  box-shadow:0 0 0 2px color-mix(in srgb,var(--cta,#2f7cff) 18%,transparent)
}
html[data-fp-theme="dark"] .fp-theme-options button{background:#182130}
html[data-fp-theme="dark"] .fp-theme-options button.is-active{background:#172b45;color:#edf3fb}

/* Growth standalone */
html[data-fp-theme="dark"] .growth-header{border-bottom-color:#2d394b}
html[data-fp-theme="dark"] .link-button{
  background:#182130;color:#d7e2f1;border-color:var(--line);
}
html[data-fp-theme="dark"] .link-button:hover{background:#202a38;border-color:#44536a}
html[data-fp-theme="dark"] .hero-copy{color:#aab7c8}
html[data-fp-theme="dark"] .authority-note{
  background:#15263a;border-color:#2d4b6b;color:#abc1dc;
}
html[data-fp-theme="dark"] :is(
  .status-panel,.video-choice,.media-card,.growth-card,.limitations,
  .fatal-actions button,.fatal-actions a
){
  background:var(--surface);border-color:var(--line);color:var(--ink);
}
html[data-fp-theme="dark"] .video-choice:hover{border-color:#51627a}
html[data-fp-theme="dark"] :is(.identity-grid div,.metric,.fact-row,.signal-row,.next-row,.learning-summary){
  background:var(--surface-2);border-color:var(--line);
}
html[data-fp-theme="dark"] .status-pill{background:#263244;color:#bac6d6}
html[data-fp-theme="dark"] .card-number{color:#314056}
html[data-fp-theme="dark"] .window-switch button{background:#182130;color:#aab7c8;border-color:var(--line)}
html[data-fp-theme="dark"] .window-switch button.active{background:#edf3fb;border-color:#edf3fb;color:#121923}
html[data-fp-theme="dark"] :is(.card-empty,.evidence-empty){
  background:#121a25;border-color:#3b495d;color:#a7b5c7;
}
html[data-fp-theme="dark"] .next-row.good{background:#173329;border-color:#2d6b57}
html[data-fp-theme="dark"] .next-row.wait{background:#3a3019;border-color:#695423}
html[data-fp-theme="dark"] .fatal{background:#321d1c;border-color:#673b38}

/* Library */
html[data-fp-theme="dark"] .library-shell,
html[data-fp-theme="dark"] .library-main{background:#0f141d;color:#edf3fb}
html[data-fp-theme="dark"] .library-sidebar{
  background:#151d29;border-color:#2c384a;
}
html[data-fp-theme="dark"] .library-sidebar nav b,
html[data-fp-theme="dark"] .library-header p,
html[data-fp-theme="dark"] .library-meta,
html[data-fp-theme="dark"] .library-detail section>b{color:#9ba9bd}
html[data-fp-theme="dark"] .library-sidebar button{color:#c5d0df}
html[data-fp-theme="dark"] .library-sidebar button:hover,
html[data-fp-theme="dark"] .library-sidebar button.active{
  background:#1a2c46;color:#9fc4ff;
}
html[data-fp-theme="dark"] .library-primary-links .studio-link,
html[data-fp-theme="dark"] .library-header-actions select,
html[data-fp-theme="dark"] .library-header-actions button,
html[data-fp-theme="dark"] .library-card,
html[data-fp-theme="dark"] .library-card-actions button,
html[data-fp-theme="dark"] .copy-row button,
html[data-fp-theme="dark"] .library-detail-actions button,
html[data-fp-theme="dark"] .post-record-box input,
html[data-fp-theme="dark"] .library-state{
  background:#182130;color:#dce5f1;border-color:#2c384a;
}
html[data-fp-theme="dark"] .library-loop-hint,
html[data-fp-theme="dark"] .library-notice,
html[data-fp-theme="dark"] .post-record-help{
  background:#17263a;color:#a9bfd9;
}
html[data-fp-theme="dark"] .library-caption-preview{color:#b7c3d3}
html[data-fp-theme="dark"] .library-tags{color:#8eb8ff}
html[data-fp-theme="dark"] .library-detail{border-color:#2c384a}
html[data-fp-theme="dark"] .copy-icon,
html[data-fp-theme="dark"] .copy-icon:before{border-color:#9ba9bd}
html[data-fp-theme="dark"] .copy-icon:before{background:#182130}
html[data-fp-theme="dark"] .post-record-box{
  background:#121a25;border-color:#2c384a;
}
html[data-fp-theme="dark"] .post-record-box label{color:#9ba9bd}
html[data-fp-theme="dark"] .library-posted{background:#173329;color:#8ddfc2}
html[data-fp-theme="dark"] .library-revision-badge{background:#172334f0;color:#bdd0ec}
@media(max-width:760px){
  html[data-fp-theme="dark"] .library-sidebar{border-bottom-color:#2c384a}
  html[data-fp-theme="dark"] .library-sidebar button{background:#182130}
}

/* Mobile edit/settings inherit Studio variables only on these Root pages. */
html[data-fp-theme="dark"] .mobile-edit-app>header,
html[data-fp-theme="dark"] .mobile-settings-header,
html[data-fp-theme="dark"] .mobile-settings-tabs{background:#0f141d}
html[data-fp-theme="dark"] .mobile-edit-error,
html[data-fp-theme="dark"] .mobile-settings-error{background:#182130;border-color:#2c384a}

/* Privacy / legal / public feature pages */
html[data-fp-theme="dark"] .legal-nav{background:#182130;border-color:#2c384a}
html[data-fp-theme="dark"] .legal-nav a{color:#9fc4ff}
html[data-fp-theme="dark"] .legal-nav a[aria-current="page"]{color:#9ba9bd}
html[data-fp-theme="dark"] main.card,
html[data-fp-theme="dark"] main{color:var(--ink,#edf3fb)}
html[data-fp-theme="dark"] th{background:#121a25}
html[data-fp-theme="dark"] th,
html[data-fp-theme="dark"] td{border-color:#2c384a}
html[data-fp-theme="dark"] .foot,
html[data-fp-theme="dark"] .legal-foot{color:#8796aa}
html[data-fp-theme="dark"] .legal-foot a{color:#9ba9bd}
html[data-fp-theme="dark"] .lead{color:#a9b6c8}
html[data-fp-theme="dark"] .nav a{color:#9fc4ff}
html[data-fp-theme="dark"] small{color:#9ba9bd}


/* Root light-surface closure overrides discovered by browser QA. */
html[data-fp-theme="dark"] :is(.pricing-coming,.credit-pack,.pkg-item,.radio-row label,.empty,.ai-explain){
  background:#182130;
  color:var(--ink);
  border-color:var(--line);
}
html[data-fp-theme="dark"] :is(.pricing-coming span,.credit-pack span){
  background:#202a38;
  color:#aab8ca;
}
html[data-fp-theme="dark"] .plan-cta{
  color:#a9caff;
  background:#172943;
  border-color:#315884;
}
html[data-fp-theme="dark"] .billing-success-toast{
  background:rgba(7,10,16,.48);
}
html[data-fp-theme="dark"] .billing-success-toast__card{
  background:rgba(24,33,48,.97);
  color:var(--ink);
  border-color:#315884;
  box-shadow:0 18px 48px rgba(0,0,0,.34);
}
html[data-fp-theme="dark"] .billing-success-toast__card img{
  background:rgba(255,255,255,.96);
  border-radius:9px;
  padding:4px 7px;
}
html[data-fp-theme="dark"] .mp-plan-badge{
  background:linear-gradient(135deg,#172a3d,#24253e);
  border-color:#3b506c;
  color:#dce6f4;
}
html[data-fp-theme="dark"] .ha-chip{
  background:rgba(24,33,48,.94);
  color:#a9caff;
  border-color:#315884;
}
html[data-fp-theme="dark"] .ha-form{
  background:rgba(24,33,48,.82);
  border-color:#304056;
}
html[data-fp-theme="dark"] .upgrade-hint,
html[data-fp-theme="dark"] #ctxSaveWarn{
  background:#332b18!important;
  color:#f1ca80!important;
  border-color:#5c4924!important;
}
html[data-fp-theme="dark"] #ctxSaveWarn p{color:#f1ca80!important}
html[data-fp-theme="dark"] #fpStudioMobileNotice .card{
  background:#172943!important;
  border-color:#315884!important;
  color:var(--ink)!important;
}
html[data-fp-theme="dark"] .pkg-badge.posted,
html[data-fp-theme="dark"] .rec-saved{
  background:#173329;
  color:#8ddfc2;
  border-color:#2d6b57;
}
html[data-fp-theme="dark"] .lr-post-link{
  background:#172943;
  color:#a9caff;
  border-color:#315884;
}
html[data-fp-theme="dark"] .ai-note{
  background:#121a25;
  border-color:#2c384a;
  color:#aab8ca;
}

/* Dark-mode final contrast closure — browser audit 2026-10-04 */
html[data-fp-theme="dark"] .plan-eyebrow{color:var(--muted)!important}
html[data-fp-theme="dark"] .profile-avatar{background:#202a38!important;color:#dfe8f5!important}
html[data-fp-theme="dark"] #scr-newpkg label[style*="background:#fff"]{
  background:#182130!important;color:var(--ink)!important;border-color:var(--line)!important
}
html[data-fp-theme="dark"] #pr-at{
  background:#182130!important;color:var(--ink)!important;border-color:var(--line)!important
}
html[data-fp-theme="dark"] #pr-at::-webkit-calendar-picker-indicator{filter:invert(1) brightness(1.35)}

/* Standalone Root contrast closure — browser audit 2026-10-04 */
html[data-fp-theme="dark"] .library-loop-hint{color:#a9bfd9!important}
html[data-fp-theme="dark"] .library-primary-links .dashboard-link{
  background:#245bb6!important;color:#fff!important;box-shadow:none!important
}
html[data-fp-theme="dark"] main .cta{background:#155bb8!important;color:#fff!important}

/* Final standalone contrast closure */
html[data-fp-theme="dark"] .library-state a{color:#9fc4ff!important}
html[data-fp-theme="dark"] .brand .mark{
  background:linear-gradient(135deg,#245bb6,#176f5a)!important;color:#fff!important
}
html[data-fp-theme="dark"] a[href^="mailto:support@frameprime.app"]{
  background:linear-gradient(135deg,#245bb6,#176f8f)!important;color:#fff!important
}

/* Production readback contrast repair candidate — NOT DEPLOYED */
html[data-fp-theme="dark"] button.primary,
html[data-fp-theme="dark"] .tag,
html[data-fp-theme="dark"] .plan-cta.founder-checkout{
  background:linear-gradient(135deg,#245bb6,#176f8f)!important;
  color:#fff!important;
}
html[data-fp-theme="dark"] .ck,
html[data-fp-theme="dark"] .success-mark{
  background:linear-gradient(135deg,#176f5a,#135846)!important;
  color:#fff!important;
}
html[data-fp-theme="dark"] .library-open-cta{
  color:#9fc4ff!important;
}

html[data-fp-theme="dark"] .library-open-cta{
  background:linear-gradient(135deg,#245bb6,#176f8f)!important;
  color:#fff!important;
}
