/* Each area loads its own palette from its saved appearance settings. */
body { --purple: color-mix(in srgb, var(--brand-accent) 72%, #291a3c); }
.reader-app .appbar, .reader-app .chat-heading, .admin-app .appbar {
    background: var(--brand-header);
    color: var(--brand-header-ink);
}
.reader-app .reader-links a, .reader-app .mobile-menu, .reader-app .chat-heading h2,
.reader-app .chat-heading p, .reader-app .chat-heading .icon-btn, .admin-app .bar-inner h1 { color: var(--brand-header-ink) !important; }
.reader-links a.active, .reader-links a:hover { background: color-mix(in srgb,var(--brand-header-ink) 16%,transparent); }
.admin-side { background: linear-gradient(155deg,var(--brand-sidebar),color-mix(in srgb,var(--brand-sidebar) 90%,var(--brand-sidebar-ink))); color: var(--brand-sidebar-ink); }
.admin-side nav a, .side-bottom button, .side-brand small { color: var(--brand-sidebar-ink); }
.admin-side nav a.active, .admin-side nav a:hover, .primary, .send-btn, .filter-tabs .active, .filters button {
    background: var(--brand-accent);
    color: var(--brand-accent-ink);
}
.primary:hover, .send-btn:hover { background: var(--brand-accent); filter: brightness(.94); }
.mobile-nav a.selected, .avatar, .quick-grid .icon, .section-head a, .filter-tabs button:not(.active) { color: var(--purple); }
.avatar, .quick-grid>a, .quick-grid>button, .filter-tabs button:not(.active) { background: color-mix(in srgb,var(--brand-accent) 11%,white); }
.app-logo .brand-image, .side-brand .brand-image, .sample-brand .brand-image, .compact-brand { max-width:85px; max-height:36px; object-fit:contain; flex-shrink:0; }
.app-logo, .side-brand, .app-logo span, .side-brand span, .side-brand strong { min-width:0; }
.app-logo span, .side-brand strong { text-overflow:ellipsis; overflow:hidden; white-space:nowrap; }
.admin-app .compact-brand { display:none; }
.admin-collapsed .compact-brand { display:block; }
.chapter-access { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:14px; border-top:1px solid var(--line); font-size:13px; }
.appearance { max-width:1080px; margin:10px auto; }
.appearance-title p, .brand-preview p, .brand-form small { color:var(--muted); }
.appearance-title p { margin-top:5px; }
.appearance-tabs { display:inline-flex; gap:4px; padding:4px; background:#ebe7f0; border-radius:9px; margin:20px 0; }
.appearance-tabs a { padding:7px 15px; border-radius:6px; font-weight:600; color:#645d6d; }
.appearance-tabs [aria-current=page] { background:white; box-shadow:0 1px 5px #281d3520; color:var(--purple); }
.appearance-grid { display:grid; grid-template-columns:1fr 1fr; gap:18px; align-items:start; }
.brand-form { display:grid; gap:14px; padding:22px; }
.brand-form h3:not(:first-child) { border-top:1px solid var(--line); padding-top:18px; }
.brand-form label { display:grid; gap:6px; font-size:13px; font-weight:600; }
.brand-form input[type=file] { width:100%; font-size:12px; }
.brand-form input::file-selector-button { border:0; border-radius:4px; padding:5px 8px; margin-right:7px; cursor:pointer; }
.brand-form small { margin-top:-9px; }
.brand-form .check, .brand-form .color-row { display:flex; align-items:center; gap:10px; }
.color-row code { margin-left:auto; font-size:12px; color:var(--muted); }
.brand-form input[type=color] { width:42px; height:32px; padding:2px; cursor:pointer; }
.brand-form .button { justify-self:start; }
.brand-preview { padding:20px; }
.brand-preview header, .sample-header, .sample-brand, .sample-rail>span { display:flex; align-items:center; gap:8px; }
.brand-preview header { justify-content:space-between; margin-bottom:16px; }
.brand-preview p { margin:12px 0 0; font-size:12px; }
.brand-sample { display:flex; border:1px solid var(--line); border-radius:9px; overflow:hidden; }
.sample-main { min-width:0; flex:1; }
.sample-header { justify-content:space-between; background:var(--sample-header); color:var(--sample-header-ink); padding:12px; }
.sample-brand { min-width:0; }
.sample-brand strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sample-rail { display:grid; align-content:start; gap:15px; background:var(--sample-sidebar); color:var(--sample-sidebar-ink); padding:12px; width:39%; font-size:12px; }
.sample-rail .brand-image { max-width:40px; }
.sample-content { background:#f8f7fb; padding:22px 14px; }
.sample-content>.icon { color:var(--sample-accent); }
.sample-content h3 { margin:8px 0 15px; }
.sample-button { border-radius:6px; background:var(--sample-accent); color:var(--sample-accent-ink); padding:7px 10px; font-size:12px; display:inline-block; }
@media(max-width:1020px) { .admin-app .compact-brand { display:block; } }
@media(max-width:760px) { .appearance-grid { grid-template-columns:minmax(0,1fr); } .brand-form,.brand-preview { padding:16px; } .reader-app .bar-inner .app-logo .brand-image { max-width:65px; max-height:29px; } }

