/* Shared theme surfaces and readable foregrounds for portal and Studio. */
:root{
 color-scheme:light;
 --page:#f7f7fb;--surface:#fff;--ink:#292537;--muted:#686477;--line:#e6e3ed;
 --accent:#6750a4;--accent-solid:#6750a4;--accent-solid-hover:#58428d;--on-accent:#fff;
 --surface-soft:#f8f6fb;--surface-hover:#f0edf7;--surface-accent:#eee8f7;--line-strong:#a092b5;
 --positive:#29664a;--positive-surface:#e8f4ed;--warning-ink:#735521;--warning-surface:#fff8e8;
 --negative:#9a3045;--negative-surface:#fff0f2;--placeholder:#746c80;--focus:#8770bd;
}
html[data-theme=dark]{
 color-scheme:dark;
 --page:#1c1923;--surface:#24212d;--ink:#ece8f1;--muted:#c3b9cd;--line:#4c4657;
 --accent:#cbb5f5;--accent-solid:#6750a4;--accent-solid-hover:#7960bb;--on-accent:#fff;
 --surface-soft:#2b2634;--surface-hover:#383043;--surface-accent:#3a2d4d;--line-strong:#9588a6;
 --positive:#9adcb9;--positive-surface:#203b31;--warning-ink:#f0d09a;--warning-surface:#3b3021;
 --negative:#ffb6c4;--negative-surface:#432831;--placeholder:#b6aabe;--focus:#d2b8ff;
 /* Studio aliases share the same preference and semantic palette. */
 --paper:var(--page);--white:var(--surface);--purple:var(--accent);--purple-dark:#deccff;
 --lavender:var(--surface-accent);--teal:var(--positive);--teal-light:var(--positive-surface);
}
html{background:var(--page);color:var(--ink)}
input,select,textarea{color-scheme:inherit}
input::placeholder,textarea::placeholder{color:var(--placeholder);opacity:1}
.chapter-writing::placeholder{color:var(--placeholder);opacity:1}
.studio-shell .side-label,.studio-shell .footer-note,.workspace-banner p,.coach-note h3,.coach-note p{color:var(--muted)}
.studio-shell .badge{color:#634c94}
.studio-shell .badge.gray{color:var(--muted)}
.chatgpt-plan-note{color:var(--positive)}
html:not([data-theme=dark]) .notice.warning{color:var(--warning-ink)}
input[type=checkbox],input[type=radio],input[type=range]{accent-color:var(--accent-solid)}
html[data-theme=dark] input[type=checkbox],html[data-theme=dark] input[type=radio],html[data-theme=dark] input[type=range]{accent-color:var(--accent)}
html[data-theme=dark] input,html[data-theme=dark] select,html[data-theme=dark] textarea{border-color:var(--line-strong);color:var(--ink);background-color:var(--surface)}
html[data-theme=dark] option,html[data-theme=dark] optgroup{color:var(--ink);background:var(--surface)}
button:focus-visible,a:focus-visible,summary:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline-color:var(--focus)}
.button{background:var(--accent-solid);color:var(--on-accent)}
.button:hover{background:var(--accent-solid-hover)}
.button.secondary{background:var(--surface);color:var(--ink);border-color:var(--line-strong)}
.button.secondary:hover{background:var(--surface-hover);color:var(--ink);border-color:var(--line-strong)}
.button.danger{background:#ae3446;color:#fff}
.button.danger:hover{background:#963044;color:#fff}
html[data-theme=dark] .button.danger-outline{background:var(--negative-surface);border-color:var(--negative);color:var(--negative)}
html[data-theme=dark] .button.danger-outline:hover{background:#542d3a;color:var(--negative)}
html[data-theme=dark] .skip{background:var(--surface);color:var(--accent)}
html[data-theme=dark] th{background:var(--surface-soft);color:var(--muted)}
html[data-theme=dark] .booklist label{background:var(--surface-soft);color:var(--ink);border-color:var(--line-strong)}
html[data-theme=dark] .booklist label:hover{background:var(--surface-hover)}
html[data-theme=dark] .booklist label:has(input:checked){background:var(--surface-accent);border-color:var(--accent)}
html[data-theme=dark] .booklist input:disabled{opacity:.65}
html[data-theme=dark] .admin-alerts summary{background:var(--surface);color:var(--ink);border-color:var(--line-strong)}
html[data-theme=dark] .admin-alerts summary:hover,html[data-theme=dark] .admin-alerts[open] summary{background:var(--surface-accent);color:var(--accent);border-color:var(--accent)}
html[data-theme=dark] .alert-count{border-color:var(--surface);background:#a92c49;color:#fff}
html[data-theme=dark] .alert-error{background:#8b5b11;color:#fff}
html[data-theme=dark] .admin-notice.unread{background:var(--surface-accent);border-color:var(--line-strong)}
html[data-theme=dark] .admin-notice.compact{background:transparent}
html[data-theme=dark] .compact.unread .notice-dot{box-shadow:0 0 0 4px var(--surface-accent)}
html[data-theme=dark] .notice-filters .selected{background:var(--surface-accent);color:var(--accent);border-color:var(--accent)}
html[data-theme=dark] .notice{background:var(--surface-accent);color:var(--ink);border-color:var(--line-strong)}
html[data-theme=dark] .notice strong{color:inherit}
html[data-theme=dark] .notice.success{background:var(--positive-surface);color:var(--positive);border-color:var(--positive)}
html[data-theme=dark] .notice.warning{background:var(--warning-surface);color:var(--warning-ink);border-color:var(--warning-ink)}
html[data-theme=dark] .notice.error{background:var(--negative-surface);color:var(--negative);border-color:var(--negative)}
html[data-theme=dark] .formerror,html[data-theme=dark] .form-error{color:var(--negative)}
html[data-theme=dark] .badge{background:var(--surface-accent);color:var(--accent)}
html[data-theme=dark] .badge.green,html[data-theme=dark] .badge.teal{background:var(--positive-surface);color:var(--positive)}
html[data-theme=dark] .badge.amber{background:var(--warning-surface);color:var(--warning-ink)}
html[data-theme=dark] .badge.gray{background:var(--surface-hover);color:var(--muted)}
html[data-theme=dark] .badge.red{background:var(--negative-surface);color:var(--negative)}
html[data-theme=dark] .tabnav a.active,html[data-theme=dark] .book-list-tabs .active{background:var(--surface-accent);color:var(--accent)}
html[data-theme=dark] .authaside{background:var(--surface-soft)}
html[data-theme=dark] .authaside .asidefoot{color:var(--muted)}
html[data-theme=dark] .avatar{background:var(--surface-accent);color:var(--accent)}
html[data-theme=dark] .book-detail-info .synopsis-public{color:var(--muted)}
html[data-theme=dark] .detail-chapters-total,html[data-theme=dark] .detail-chapter-number{background:var(--surface-accent);color:var(--accent)}
html[data-theme=dark] .detail-chapters-search input{background:var(--surface-soft)}
html[data-theme=dark] .detail-chapter-copy .free{color:var(--positive)}
html[data-theme=dark] .detail-chapter-copy .premium{color:var(--accent)}
html[data-theme=dark] .detail-chapter-copy .scheduled{color:var(--warning-ink)}
html[data-theme=dark] .detail-chapters-hint>span{color:var(--accent)}
html[data-theme=dark] .coverempty{background:var(--surface-accent);color:var(--muted)}
html[data-theme=dark] .reader-mobile-nav>button[aria-expanded=true],html[data-theme=dark] .reader-mobile-nav>a:hover,html[data-theme=dark] .reader-mobile-nav>button:hover,html[data-theme=dark] .reader-mobile-nav>a[aria-current=page]{background:var(--surface-accent);color:var(--accent)}
html[data-theme=dark] .reader-setting-inputs input[type=range]{background:transparent}
/* Writer guidance uses the same surfaces as the rest of the dashboard. */
.wg-sidebar nav a>span{color:#715d86}
html[data-theme=dark] .writer-guide{--wg-green:var(--positive);--wg-gold:var(--warning-ink)}
html[data-theme=dark] .wg-overview,html[data-theme=dark] .wg-hint,html[data-theme=dark] .wg-hero,html[data-theme=dark] .wg-closing{background:var(--surface-accent);color:var(--ink);border-color:var(--line)}
html[data-theme=dark] .wg-topic,html[data-theme=dark] .wg-status-guide,html[data-theme=dark] .wg-faq,html[data-theme=dark] .wg-sidebar nav a{background:var(--surface);color:var(--ink);border-color:var(--line)}
html[data-theme=dark] .wg-topic-icon,html[data-theme=dark] .wg-section-number,html[data-theme=dark] .wg-steps>li:before{background:var(--surface-accent);color:var(--accent);border-color:var(--line)}
html[data-theme=dark] .wg-topic-icon.penawaran,html[data-theme=dark] .wg-payment-flow li>span{background:var(--positive-surface);color:var(--positive)}
html[data-theme=dark] .wg-topic-icon.pendapatan{background:var(--warning-surface);color:var(--warning-ink)}
html[data-theme=dark] .wg-hero p,html[data-theme=dark] .wg-art-label,html[data-theme=dark] .wg-side-note svg{color:var(--muted)}
html[data-theme=dark] .wg-sidebar nav a>span{color:var(--accent)}
html[data-theme=dark] .wg-sidebar nav a:hover,html[data-theme=dark] .wg-faq summary:hover{background:var(--surface-hover);color:var(--accent)}
html[data-theme=dark] .wg-steps>li:not(:last-child):after{background:var(--line)}
html[data-theme=dark] .wg-steps strong,html[data-theme=dark] .wg-note strong,html[data-theme=dark] .wg-callout p strong{color:var(--ink)}
html[data-theme=dark] .wg-steps code{background:var(--surface-hover);color:var(--accent)}
html[data-theme=dark] .wg-choice-grid>div{background:var(--positive-surface);border-color:var(--line)}
html[data-theme=dark] .wg-choice-grid>div:last-child,html[data-theme=dark] .wg-callout{background:var(--surface-accent);border-color:var(--line)}
html[data-theme=dark] .wg-callout>strong{color:var(--accent)}
html[data-theme=dark] .wg-callout-warm{background:var(--warning-surface)}
html[data-theme=dark] .wg-callout-warm>strong{color:var(--warning-ink)}
html[data-theme=dark] .wg-revenue{background:var(--positive-surface);border-color:var(--line)}
html[data-theme=dark] .wg-revenue-title h3,html[data-theme=dark] .wg-revenue-examples>div>span strong,html[data-theme=dark] .wg-revenue-examples dd strong{color:var(--positive)}
html[data-theme=dark] .wg-revenue-title p,html[data-theme=dark] .wg-revenue-examples>div>span,html[data-theme=dark] .wg-revenue-examples dl{color:var(--muted)}
html[data-theme=dark] .wg-hero-art{background:none}
/* Age confirmation and rating dialogs retain their existing interactions. */
html[data-theme=dark] .fk-age-gate{background:var(--surface);color:var(--ink);border-color:var(--line-strong)}
html[data-theme=dark] .fk-age-symbol{background:var(--surface-accent);color:var(--accent)}
html[data-theme=dark] .fk-age-gate h2{color:var(--ink)}
html[data-theme=dark] .fk-age-gate p{color:var(--muted)}
html[data-theme=dark] .fk-age-gate .fk-age-eyebrow{color:var(--accent)}
html[data-theme=dark] .fk-age-actions .fk-age-accept{background:var(--accent-solid);border-color:var(--accent-solid);color:var(--on-accent)}
html[data-theme=dark] .fk-age-actions .fk-age-leave{background:var(--surface-soft);color:var(--ink);border-color:var(--line-strong)}
html[data-theme=dark] .rating-choice{background:var(--surface-soft);border-color:var(--line-strong)}
html[data-theme=dark] .rating-choice:has(input:checked){background:var(--warning-surface);border-color:var(--warning-ink)}
html[data-theme=dark] .rating-choice svg{stroke:#cfc0a8}
html[data-theme=dark] .rating-choice.selected svg{stroke:#e8b953;fill:#e8b953}
/* Studio dark mode: no writing/project data or AI workflow is changed. */
html[data-theme=dark] .studio-side,html[data-theme=dark] .project-card,html[data-theme=dark] .empty-state,html[data-theme=dark] .panel,html[data-theme=dark] .outline-card,html[data-theme=dark] .chapters-panel,html[data-theme=dark] .writing-panel,html[data-theme=dark] .coach-panel,html[data-theme=dark] .export-card,html[data-theme=dark] .login-card{background:var(--surface);color:var(--ink)}
html[data-theme=dark] .studio-shell .topbar{background:var(--surface)}
html[data-theme=dark] .side-label,html[data-theme=dark] .side-nav button,html[data-theme=dark] .breadcrumbs span,html[data-theme=dark] .footer-note{color:var(--muted)}
html[data-theme=dark] .side-nav button:hover,html[data-theme=dark] .chapter-btn:hover{background:var(--surface-hover);color:var(--accent)}
html[data-theme=dark] .side-nav button.active{color:var(--accent)}
html[data-theme=dark] .side-project,html[data-theme=dark] .project-new,html[data-theme=dark] .memory-block,html[data-theme=dark] .book-preview,html[data-theme=dark] .chatgpt-steps{background:var(--surface-soft);color:var(--ink)}
html[data-theme=dark] .brand-emblem{background:var(--accent-solid);color:var(--on-accent)}
html[data-theme=dark] .user-avatar,html[data-theme=dark] .project-card .project-icon,html[data-theme=dark] .project-new span,html[data-theme=dark] .craft-icon,html[data-theme=dark] .chatgpt-steps b{background:var(--surface-accent);border-color:var(--line);color:var(--accent)}
html[data-theme=dark] .project-card:nth-child(3n+2) .project-icon{background:var(--positive-surface);color:var(--positive)}
html[data-theme=dark] .workspace-banner{background:linear-gradient(115deg,var(--surface-accent),var(--surface-soft),var(--positive-surface));border-color:var(--line)}
html[data-theme=dark] .workspace-banner p,html[data-theme=dark] .filter-search svg,html[data-theme=dark] .project-new strong,html[data-theme=dark] .field label,html[data-theme=dark] .field-label,html[data-theme=dark] .tip-list strong,html[data-theme=dark] .tip-list svg,html[data-theme=dark] .chapter-btn .ch-no,html[data-theme=dark] .chapter-btn small,html[data-theme=dark] .coach-note h3,html[data-theme=dark] .coach-note p,html[data-theme=dark] .review-flags strong,html[data-theme=dark] .chatgpt-steps span{color:var(--muted)}
html[data-theme=dark] .field input,html[data-theme=dark] .field select,html[data-theme=dark] .field textarea,html[data-theme=dark] .filter-search input{background:var(--surface);border-color:var(--line-strong);color:var(--ink)}
html[data-theme=dark] .chapter-writing,html[data-theme=dark] .outline-card input,html[data-theme=dark] .chapter-title-input{color:var(--ink);background:transparent}
html[data-theme=dark] .outline-card textarea{color:var(--muted);background:transparent}
html[data-theme=dark] .coach-action{background:var(--surface);color:var(--accent)}
html[data-theme=dark] .coach-action:hover{background:var(--surface-hover);border-color:var(--accent)}
html[data-theme=dark] .studio-shell .button{border-color:var(--accent-solid)}
html[data-theme=dark] .studio-shell .button.secondary{border-color:var(--line-strong)}
html[data-theme=dark] .button.ghost{background:transparent;color:var(--accent);border-color:transparent}
html[data-theme=dark] .button.ghost:hover{background:var(--surface-accent)}
html[data-theme=dark] .button.teal{background:#29664a;color:#fff;border-color:#29664a}
html[data-theme=dark] .studio-shell .button.danger{background:var(--negative-surface);color:var(--negative);border-color:var(--negative)}
html[data-theme=dark] .save-state.error{color:var(--negative)}
html[data-theme=dark] .chatgpt-notice{background:var(--surface-accent);border-color:var(--line-strong)}
html[data-theme=dark] .field textarea.chatgpt-prompt{background:var(--surface-soft);color:var(--muted)}
html[data-theme=dark] .chatgpt-plan-note{background:var(--positive-surface);color:var(--positive)}
html[data-theme=dark] #studio-dialog{background:var(--surface);border-color:var(--line-strong);color:var(--ink)}
html[data-theme=dark] .login-shell{background:var(--page)}
/* Keep print/export pages readable on paper regardless of screen preference. */
@media print{html,html[data-theme=dark]{color-scheme:light;background:#fff;color:#111}html[data-theme=dark] .print-content,html[data-theme=dark] .print-content *{background:transparent;color:#111}}
