html[data-theme="light"] {
    --pico-font-family: "Segoe UI", Arial, sans-serif;
    --pico-background-color: #f3f8f1;
    --pico-color: #193426;
    --pico-muted-color: #5d7466;
    --pico-muted-border-color: #bfd6c4;
    --pico-primary: #246b45;
    --pico-primary-background: #2f7d52;
    --pico-primary-border: #2f7d52;
    --pico-primary-hover: #1d5838;
    --pico-primary-hover-background: #256742;
    --pico-primary-hover-border: #256742;
    --pico-primary-focus: rgba(47, 125, 82, 0.28);
    --pico-primary-inverse: #ffffff;
    --pico-secondary: #385844;
    --pico-secondary-background: #dcebdd;
    --pico-secondary-border: #b9d2bd;
    --pico-secondary-hover-background: #c9e0cc;
    --pico-secondary-hover-border: #9fbea8;
    --pico-secondary-inverse: #173321;
    --pico-card-background-color: #ffffff;
    --pico-card-border-color: #d2e2d4;
    --pico-card-sectioning-background-color: #e9f3e8;
    --pico-form-element-background-color: #ffffff;
    --pico-form-element-border-color: #9fbea8;
    --pico-form-element-color: #193426;
    --pico-form-element-placeholder-color: #607568;
    --pico-form-element-active-background-color: #ffffff;
    --pico-form-element-active-border-color: #2f7d52;
    --pico-form-element-focus-color: #2f7d52;
    --pico-code-background-color: #edf5ee;
}

body {
    min-height: 100vh;
    background: linear-gradient(180deg, #f7fbf5 0%, #eef7ef 100%);
    color: var(--pico-color);
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #a8c9af;
    background: linear-gradient(135deg, #1f5b39 0%, #2f7d52 100%);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(31, 91, 57, 0.16);
}

.app-header a,
.app-header .muted,
.app-header label,
.app-header span {
    color: #ffffff;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: #ffffff;
    font-size: 1.05rem;
    text-decoration: none;
}

.brand-link:hover {
    color: #e6f5e7;
}

.brand-mark {
    width: 2.5rem;
    height: 2.5rem;
    object-fit: contain;
}

.app-header select {
    min-width: 8.5rem;
    background-color: #f7fbf5;
    border-color: rgba(255, 255, 255, 0.55);
    color: #193426;
}

.app-header button {
    background-color: #e6f5e7;
    border-color: #e6f5e7;
    color: #1f5b39;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.guest-auth-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.guest-auth-actions a {
    color: #ffffff;
    font-weight: 600;
    text-decoration: none;
}

.guest-auth-actions a:hover {
    color: #e6f5e7;
    text-decoration: underline;
}

.account-menu {
    position: relative;
    margin: 0;
}

.account-menu summary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.4rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid rgba(230, 245, 231, 0.45);
    border-radius: 6px;
    cursor: pointer;
    color: #ffffff;
    font-weight: 600;
    list-style: none;
}

.account-menu summary::-webkit-details-marker {
    display: none;
}

.account-menu summary:hover {
    background: rgba(255, 255, 255, 0.09);
}

.account-menu-chevron {
    font-size: 0.7rem;
}

.account-menu-dropdown {
    position: absolute;
    z-index: 1010;
    top: calc(100% + 0.45rem);
    right: 0;
    display: grid;
    gap: 0.2rem;
    min-width: 12rem;
    padding: 0.4rem;
    border: 1px solid #bfd6c4;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(19, 46, 29, 0.16);
}

.account-menu-dropdown a,
.account-menu-dropdown button {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.55rem 0.7rem;
    border-radius: 4px;
    color: #193426;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
}

.account-menu-dropdown a:hover,
.account-menu-dropdown button:hover {
    background: #e9f3e8;
    color: #193426;
    text-decoration: none;
}

.account-menu-dropdown button {
    border: 0;
    background: transparent;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.main-nav a,
.header-right > a {
    color: #ffffff;
    font-weight: 600;
    text-decoration: none;
}

.main-nav a:hover,
.header-right > a:hover {
    color: #e6f5e7;
    text-decoration: underline;
}

.profile-page {
    max-width: 760px;
    margin: 0 auto;
    padding: 2rem 0;
}

.profile-section {
    padding: 1.5rem;
    border: 1px solid #d2e2d4;
    border-radius: 8px;
    background: #ffffff;
}

.profile-section + .profile-section {
    margin-top: 1rem;
}

.profile-section h2 {
    margin: 0 0 1.15rem;
    font-size: 1.25rem;
}

.profile-details {
    display: grid;
    grid-template-columns: minmax(8rem, 12rem) 1fr;
    gap: 0.8rem 1.25rem;
    margin: 1.25rem 0 0;
}

.profile-details dt {
    color: #5d7466;
    font-weight: 600;
}

.profile-details dd {
    margin: 0;
    font-weight: 600;
}

.profile-form {
    margin: 0;
}

.profile-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem 1rem;
}

.profile-form-grid label {
    margin: 0;
    color: #345643;
    font-size: 0.92rem;
    font-weight: 600;
}

.profile-form-grid input {
    margin: 0.4rem 0 0;
}

.profile-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.15rem;
}

.profile-actions button {
    width: auto;
    margin: 0;
}

.profile-status {
    min-height: 1.4rem;
    margin: 0;
    color: #1f6f43;
}

.profile-status.is-error {
    color: #a02f28;
}

.lang-switch-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.main-shell {
    padding: 1rem;
}

.back-to-top {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 950;
    display: grid;
    place-items: center;
    width: 3.25rem;
    min-width: 3.25rem;
    height: 3.25rem;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    box-shadow: 0 8px 22px rgba(31, 91, 57, 0.28);
    font-size: 1.55rem;
    line-height: 1;
    opacity: 0;
    visibility: hidden;
    transform: translateY(0.8rem);
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.back-to-top span {
    line-height: 1;
}

.landing-hero,
.page-hero,
.landing-cta {
    border: 1px solid #c9dfcc;
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #e9f3e8 100%);
    box-shadow: 0 12px 34px rgba(31, 91, 57, 0.1);
}

.landing-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.7fr);
    gap: 2rem;
    align-items: stretch;
    padding: 2.25rem;
    margin-bottom: 1rem;
}

.hero-copy h1,
.page-hero h1 {
    margin-bottom: 0.4rem;
    font-size: clamp(2.1rem, 5vw, 4.2rem);
}

.hero-lead,
.page-hero p:last-child {
    max-width: 760px;
    color: #385844;
    font-size: 1.15rem;
}

.eyebrow,
.feature-kicker,
.plan-label {
    margin-bottom: 0.45rem;
    color: #2f7d52;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.hero-actions,
.subscribe-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1.25rem;
}

.hero-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.55rem;
    min-height: 260px;
    padding: 1.4rem;
    border-left: 4px solid #2f7d52;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.76);
}

.hero-panel p,
.hero-panel span {
    margin: 0;
    color: #385844;
}

.hero-panel strong {
    color: #173321;
    font-size: 1.35rem;
    line-height: 1.25;
}

.hero-logo {
    display: block;
    width: min(184px, 100%);
    height: auto;
    margin: 0 auto 0.45rem;
    border-radius: 6px;
}

.hero-panel picture {
    display: block;
}

.stats-grid,
.feature-grid,
.team-grid,
.pricing-grid,
.contact-grid {
    display: grid;
    gap: 1rem;
    margin: 1rem 0;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card,
.feature-card,
.team-card,
.pricing-card,
.contact-card,
.subscribe-card {
    border: 1px solid #c9dfcc;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 8px 26px rgba(31, 91, 57, 0.08);
}

.stat-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.9rem;
    align-items: center;
    padding: 1rem;
}

.stat-card p,
.stat-card span {
    margin: 0;
    color: #5d7466;
}

.stat-card strong {
    display: block;
    color: #173321;
    font-size: 1.8rem;
    line-height: 1.15;
}

.photo-slot {
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #dcebdd;
    color: #1f5b39;
    font-weight: 800;
}

.stat-icon {
    display: grid;
    place-items: center;
    width: 3.5rem;
    min-width: 3.5rem;
    height: 3.5rem;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
    font-size: 2.25rem;
    line-height: 1;
}

.feature-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-card,
.pricing-card,
.contact-card {
    padding: 1.2rem;
}

.feature-card h3,
.pricing-card h2,
.contact-card strong {
    color: #173321;
}

.landing-cta,
.page-hero {
    padding: 1.6rem;
    margin: 1rem 0;
}

.landing-cta p {
    max-width: 720px;
    color: #385844;
}

.content-band {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    gap: 1rem;
    align-items: start;
    margin: 1rem 0;
    padding: 1.2rem;
    border: 1px solid #c9dfcc;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
}

.compact-band {
    display: block;
}

.content-copy p,
.info-list span,
.team-card p,
.pricing-card p,
.contact-card span,
.subscribe-card p {
    color: #385844;
}

.info-list {
    display: grid;
    gap: 0.75rem;
}

.info-list div {
    padding: 0.9rem;
    border-left: 3px solid #2f7d52;
    border-radius: 8px;
    background: #edf6ed;
}

.info-list strong,
.info-list span {
    display: block;
}

.about-hero p:last-child {
    max-width: 820px;
}

.about-overview .content-copy {
    max-width: 960px;
}

.about-section {
    margin: 1rem 0;
    padding: 1.45rem;
    border: 1px solid #c9dfcc;
    border-radius: 8px;
    background: #fff;
}

.section-heading {
    max-width: 940px;
    margin-bottom: 1.2rem;
}

.section-heading h2 {
    margin: 0.35rem 0 0.55rem;
}

.section-heading > p:last-child {
    color: #385844;
}

.about-pillars {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

.about-pillar {
    padding: 1rem;
    border: 1px solid #d5e8d7;
    border-radius: 8px;
    background: #f5faf4;
}

.about-pillar span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    margin-bottom: 0.8rem;
    border-radius: 6px;
    background: #dcecdf;
    color: #226642;
    font-weight: 700;
}

.about-pillar h3 {
    margin: 0 0 0.45rem;
    font-size: 1.04rem;
}

.about-pillar p {
    margin: 0;
    color: #385844;
}

.mission-band {
    display: grid;
    grid-template-columns: minmax(270px, 0.68fr) minmax(0, 1fr);
    gap: 2rem;
    margin: 1rem 0;
    padding: 1.65rem;
    border-radius: 8px;
    background: #1f5b39;
    color: #fff;
}

.mission-band h2,
.mission-band p {
    color: #fff;
}

.mission-band .eyebrow {
    color: #d5ead9;
}

.mission-copy p:last-child {
    margin-bottom: 0;
}

.partnership-band {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.partnership-band > div {
    padding: 1.2rem;
    border: 1px solid #c9dfcc;
    border-radius: 8px;
    background: #fff;
}

.partnership-band h3 {
    margin-bottom: 0.55rem;
}

.partnership-band p {
    margin-bottom: 0;
    color: #385844;
}

.team-grid {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.team-card {
    padding: 1rem;
}

.photo-slot {
    width: 100%;
    aspect-ratio: 4 / 3;
    margin-bottom: 0.85rem;
    font-size: 2rem;
}

.team-card h3 {
    margin-bottom: 0.25rem;
}

.team-card strong {
    color: #2f7d52;
}

.pricing-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pricing-card {
    display: flex;
    flex-direction: column;
}

.pricing-card.featured {
    border-color: #2f7d52;
    box-shadow: 0 14px 36px rgba(31, 91, 57, 0.16);
}

.pricing-card [role="button"] {
    margin-top: auto;
}

.token-note {
    padding: 0.75rem;
    border-radius: 8px;
    background: #edf6ed;
}

.contact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.contact-card {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.subscribe-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 0.5fr);
    gap: 1rem;
    align-items: center;
    padding: 1.4rem;
}

.main-shell h1,
.main-shell h2,
.main-shell h3,
.main-shell h4 {
    color: #173321;
}

article,
.sidebar,
.chat-area {
    box-shadow: 0 8px 26px rgba(31, 91, 57, 0.08);
}

article {
    border-color: #c9dfcc;
}

article header,
article footer {
    background-color: #e9f3e8;
    color: #385844;
}

:is(button, [type="button"], [type="submit"], [type="reset"], [role="button"]) {
    --pico-background-color: #2f7d52;
    --pico-border-color: #2f7d52;
    --pico-color: #ffffff;
    font-weight: 600;
    background-color: #2f7d52 !important;
    border-color: #2f7d52 !important;
    color: #ffffff !important;
}

:is(button, [type="button"], [type="submit"], [type="reset"], [role="button"]):is(:hover, :focus) {
    --pico-background-color: #256742;
    --pico-border-color: #256742;
    --pico-color: #ffffff;
    background-color: #256742 !important;
    border-color: #256742 !important;
    color: #ffffff !important;
}

:is(button, [type="button"], [type="submit"], [type="reset"], [role="button"]):focus {
    box-shadow: 0 0 0 0.15rem rgba(47, 125, 82, 0.28);
}

:is(button, [type="button"], [type="submit"], [type="reset"], [role="button"])[aria-busy="true"] {
    --pico-background-color: #2f7d52;
    --pico-border-color: #2f7d52;
    --pico-color: #ffffff;
    background-color: #2f7d52 !important;
    border-color: #2f7d52 !important;
    color: #ffffff !important;
}

:is(button, [type="button"], [type="submit"], [type="reset"], [role="button"]).secondary {
    --pico-background-color: #dcebdd;
    --pico-border-color: #b9d2bd;
    --pico-color: #1f5b39;
    background-color: #dcebdd !important;
    border-color: #b9d2bd !important;
    color: #1f5b39 !important;
}

:is(button, [type="button"], [type="submit"], [type="reset"], [role="button"]).secondary:is(:hover, :focus) {
    --pico-background-color: #c9e0cc;
    --pico-border-color: #9fbea8;
    --pico-color: #173321;
    background-color: #c9e0cc !important;
    border-color: #9fbea8 !important;
    color: #173321 !important;
}

input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
    background-color: #ffffff;
    border-color: #9fbea8;
    color: #193426;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
textarea:focus,
select:focus {
    border-color: #2f7d52;
    box-shadow: 0 0 0 0.15rem rgba(47, 125, 82, 0.18);
}

input:not([type="checkbox"]):not([type="radio"])::placeholder,
textarea::placeholder {
    color: #607568;
    opacity: 1;
}

input[type="checkbox"],
input[type="radio"] {
    appearance: auto !important;
    flex: 0 0 auto;
    width: 1rem !important;
    height: 1rem !important;
    min-width: 1rem;
    margin: 0;
    accent-color: #2f7d52;
    cursor: pointer;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
    accent-color: #2f7d52;
}

.app-shell {
    display: grid;
    grid-template-columns: 520px 1fr;
    gap: 1rem;
    min-height: calc(100vh - 160px);
}

.chat-page {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
}

.chat-page .app-header {
    flex: 0 0 auto;
}

.chat-page .main-shell {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    padding: 0.75rem;
}

.chat-workspace {
    display: grid;
    grid-template-columns: minmax(290px, 330px) minmax(480px, 1fr) minmax(300px, 360px);
    gap: 0.75rem;
    height: 100%;
    min-height: 0;
}

.workspace-panel,
.chat-area {
    height: 100%;
    min-height: 0;
}

.chat-page .sidebar {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.chat-page .sidebar-tabs {
    flex: 0 0 auto;
    margin: 0;
    padding: 0.7rem;
    border-bottom: 1px solid #c9dfcc;
    background: #f5faf4;
}

.sidebar-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem;
}

.sidebar-footer {
    flex: 0 0 auto;
    padding: 0.7rem;
    border-top: 1px solid #c9dfcc;
    background: #fff;
}

.sidebar-footer button {
    width: 100%;
    margin: 0;
}

.chat-page .chat-area {
    padding: 0.75rem;
    overflow: hidden;
}

.chat-page .chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
}

.chat-composer {
    flex: 0 0 auto;
    margin: 0.7rem -0.75rem -0.75rem;
    padding: 0.7rem 0.75rem;
    border-top: 1px solid #c9dfcc;
    background: #fff;
}

.chat-composer label {
    margin: 0;
}

.chat-composer textarea {
    margin-bottom: 0.55rem;
    resize: none;
}

.composer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.composer-actions button {
    width: auto;
    min-width: 9rem;
    margin: 0;
}

.web-search-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #385844;
}

.chat-notice {
    flex: 0 0 auto;
    margin-bottom: 0.55rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid #e8d5a3;
    border-radius: 6px;
    background: #fff7df;
    color: #72581d;
    font-size: 0.9rem;
}

.summary-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: 1px solid #c9dfcc;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    overflow: hidden;
}

.summary-header,
.summary-footer {
    flex: 0 0 auto;
    padding: 0.85rem;
    background: #f5faf4;
}

.summary-header {
    border-bottom: 1px solid #c9dfcc;
}

.summary-header h2 {
    margin: 0 0 0.35rem;
    font-size: 1.2rem;
}

.summary-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0.85rem;
}

.summary-footer {
    border-top: 1px solid #c9dfcc;
}

.summary-footer button,
#extractive-summary-btn {
    width: 100%;
    margin: 0.55rem 0 0;
}

.summary-selection-state {
    margin-bottom: 0.65rem;
    padding: 0.55rem 0.65rem;
    border-radius: 6px;
    background: #edf6ed;
    color: #385844;
    font-size: 0.9rem;
}

.summary-selection-state.warning {
    background: #fff1e5;
    color: #854e16;
}

.summary-books-list {
    margin-bottom: 1rem;
}

.summary-book-item {
    padding: 0.38rem 0;
    border-bottom: 1px solid #e2ece4;
    color: #385844;
    font-size: 0.9rem;
}

.summary-controls {
    margin: 0 0 0.8rem;
    padding: 0;
    border: 0;
}

.summary-controls legend {
    margin-bottom: 0.55rem;
    font-weight: 600;
}

.segmented-control {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
    margin-bottom: 0.7rem;
}

.segmented-control label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    padding: 0.45rem;
    border: 1px solid #c9dfcc;
    border-radius: 6px;
    background: #f8fbf7;
}

.summary-result {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid #c9dfcc;
}

.summary-result h3 {
    margin-bottom: 0.6rem;
    font-size: 1rem;
}

.summary-result-content {
    font-size: 0.9rem;
}

.request-progress {
    margin: 0.65rem 0;
}

.request-progress progress {
    margin-bottom: 0.35rem;
}

.request-progress span {
    display: block;
    color: var(--pico-muted-color);
    font-size: 0.9rem;
}

.request-error {
    padding: 0.7rem;
    border: 1px solid #ef9a9a;
    border-radius: 6px;
    background: #fbe9e7;
    color: #7f1d1d;
}

.request-error p {
    margin: 0 0 0.55rem;
}

.request-error small {
    display: block;
    margin-bottom: 0.55rem;
}

.request-error button {
    width: auto;
    margin: 0;
}

.summary-message-badge {
    display: inline-block;
    margin-bottom: 0.5rem;
    padding: 0.18rem 0.4rem;
    border-radius: 4px;
    background: #dcebdd;
    color: #1f5b39;
    font-size: 0.78rem;
    font-weight: 700;
}

.summary-cap-notice {
    margin: 0.65rem 0;
    padding: 0.65rem 0.75rem;
    border-left: 3px solid var(--primary);
    background: #edf5ee;
    color: #385349;
    font-size: 0.9rem;
}

.mobile-panel-actions,
.chat-panel-overlay {
    display: none;
}

.browse-shell {
    grid-template-columns: 360px 1fr;
    align-items: start;
}

.browse-sidebar {
    max-height: calc(100vh - 150px);
}

.browse-filters h3 {
    margin-top: 0;
}

.browse-checkbox-list {
    max-height: 190px;
    min-height: 96px;
}

.browse-checkbox-list label.hidden {
    display: none;
}

.facet-count {
    color: var(--pico-muted-color);
}

.browse-results {
    min-height: 420px;
    border: 1px solid #c9dfcc;
    border-radius: 8px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 26px rgba(31, 91, 57, 0.08);
}

.browse-results > [aria-busy="true"] {
    margin: 0 0 1rem;
}

.genre-tag {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.08rem 0.35rem;
    border-radius: 4px;
    background: #dcebdd;
    color: #1f5b39;
}

.sidebar {
    border: 1px solid #c9dfcc;
    border-radius: 8px;
    padding: 0.75rem;
    overflow: auto;
    background: rgba(255, 255, 255, 0.88);
}

.sidebar-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.tab-btn {
    margin-bottom: 0;
    font-size: 0.95rem;
    padding: 0.55rem 0.45rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #edf6ed;
    border-color: #c4dbc7;
    color: #385844;
}

.tab-btn:hover,
.tab-btn:focus {
    background: #dcebdd;
    border-color: #9fbea8;
    color: #1f5b39;
}

.tab-btn.active {
    font-weight: 700;
    background: #2f7d52;
    border-color: #2f7d52;
    color: #ffffff;
}

.tab-btn.active:hover,
.tab-btn.active:focus {
    background: #256742;
    border-color: #256742;
    color: #ffffff;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.chat-area {
    border: 1px solid #c9dfcc;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: rgba(255, 255, 255, 0.92);
}

.chat-messages {
    flex: 1;
    min-height: 420px;
    max-height: 66vh;
    overflow: auto;
    padding-right: 0.5rem;
}

.chat-msg {
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
}

.chat-user {
    background: #dcebdd;
    border: 1px solid #b9d2bd;
    color: #193426;
    margin-left: 2rem;
}

.chat-assistant {
    border: 1px solid #c9dfcc;
    background: #ffffff;
    color: #193426;
    margin-right: 2rem;
}

.chat-content {
    line-height: 1.5;
}

.chat-content > :first-child {
    margin-top: 0;
}

.chat-content > :last-child {
    margin-bottom: 0;
}

.chat-content h2,
.chat-content h3,
.chat-content h4 {
    margin: 0.85rem 0 0.4rem;
    line-height: 1.25;
}

.chat-content p,
.chat-content ul,
.chat-content ol {
    margin-bottom: 0.65rem;
}

.chat-content li {
    margin-bottom: 0.25rem;
}

.chat-content pre {
    overflow: auto;
    padding: 0.75rem;
    border-radius: 6px;
    background: var(--pico-code-background-color);
    color: #193426;
}

.chat-content hr {
    margin: 0.9rem 0;
    border: 0;
    border-top: 1px solid var(--pico-muted-border-color);
}

.chat-table-wrap {
    overflow-x: auto;
    margin: 0.75rem 0 1rem;
}

.chat-table-wrap table {
    min-width: 520px;
    margin: 0;
}

.chat-table-wrap th,
.chat-table-wrap td {
    vertical-align: top;
}

.chat-sources {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #c9dfcc;
}

.chat-sources h4 {
    margin: 0 0 0.45rem;
    font-size: 0.95rem;
}

.chat-sources ol {
    margin-bottom: 0;
    padding-left: 1.3rem;
}

.library-source-list {
    margin-bottom: 0;
    padding-left: 1.15rem;
}

.library-source-list li {
    margin-bottom: 0.38rem;
    line-height: 1.5;
}

.web-source-list small {
    display: block;
    margin-top: 0.2rem;
    color: #496455;
    line-height: 1.4;
}

.page-view-link[aria-current="page"] {
    font-weight: 700;
    text-decoration: none;
}

.facet-counter {
    margin-top: 0.75rem;
    font-weight: 600;
}

.facet-warning {
    margin: 0.5rem 0;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    background: #fbe9e7;
    color: #9b1c1c;
    border: 1px solid #ef9a9a;
}

.facet-preview {
    font-size: 0.9rem;
}

.facet-select-all-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.facet-book-list {
    border: 1px solid #c9dfcc;
    border-radius: 6px;
    max-height: 270px;
    overflow: auto;
    background: #fbfdf9;
}

.facet-book-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem;
    align-items: start;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px dashed #c9dfcc;
}

.facet-book-row span > div:first-child {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.facet-book-meta {
    font-size: 0.82rem;
    color: var(--pico-muted-color);
}

.facet-checkbox-list {
    border: 1px solid #c9dfcc;
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
    max-height: 140px;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 0.65rem;
    background: #fbfdf9;
}

.facet-checkbox-list label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.25rem 0;
    font-size: 0.9rem;
    min-width: 0;
    cursor: pointer;
}

.facet-checkbox-list label > span:not(.facet-count) {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.facet-checkbox-list .facet-count {
    flex: 0 0 auto;
}

.facet-checkbox-empty {
    color: var(--pico-muted-color);
    font-size: 0.85rem;
    padding: 0.25rem 0;
}

.facet-item {
    padding: 0.35rem 0;
    border-bottom: 1px dashed #c9dfcc;
}

.hidden {
    display: none !important;
}

.muted {
    color: var(--pico-muted-color);
}

.sidebar-head-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chats-list .chat-item {
    border: 1px solid #c9dfcc;
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    background: #fbfdf9;
}

.chats-list .chat-item.active {
    border-color: #2f7d52;
    background: #e7f3e8;
}

.chat-item-actions {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.3rem;
}

.app-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid #c9dfcc;
    color: #385844;
    background: rgba(255, 255, 255, 0.72);
}

@media (max-width: 1024px) {
    .app-header,
    .header-left,
    .header-right,
    .main-nav {
        flex-wrap: wrap;
    }

    .landing-hero,
    .content-band,
    .subscribe-card,
    .mission-band,
    .partnership-band {
        grid-template-columns: 1fr;
    }

    .stats-grid,
    .pricing-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .about-pillars {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .feature-grid,
    .contact-grid {
        grid-template-columns: 1fr;
    }

    .app-shell:not(.chat-workspace) {
        grid-template-columns: minmax(380px, 1fr);
    }

    .chat-workspace {
        display: block;
        position: relative;
    }

    .chat-page .chat-area {
        height: 100%;
    }

    .mobile-panel-actions {
        display: flex;
        flex: 0 0 auto;
        gap: 0.5rem;
        margin-bottom: 0.55rem;
    }

    .mobile-panel-actions button {
        width: auto;
        margin: 0;
    }

    .workspace-panel {
        position: fixed;
        top: 0;
        bottom: 0;
        z-index: 1200;
        width: min(92vw, 380px);
        height: 100dvh;
        transform: translateX(-104%);
        transition: transform 180ms ease;
    }

    #filters-panel {
        left: 0;
    }

    #summary-panel {
        right: 0;
        transform: translateX(104%);
    }

    .workspace-panel.is-open {
        transform: translateX(0);
    }

    .chat-panel-overlay.is-visible {
        position: fixed;
        inset: 0;
        z-index: 1150;
        display: block;
        background: rgba(10, 29, 19, 0.4);
    }
}

@media (max-width: 768px) {
    .main-shell {
        padding: 0.75rem;
    }

    .back-to-top {
        right: 0.85rem;
        bottom: 0.85rem;
        width: 3rem;
        min-width: 3rem;
        height: 3rem;
    }

    .landing-hero,
    .page-hero,
    .landing-cta {
        padding: 1rem;
    }

    .stats-grid,
    .pricing-grid,
    .about-pillars {
        grid-template-columns: 1fr;
    }

    .profile-form-grid {
        grid-template-columns: 1fr;
    }

    .profile-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .hero-actions,
    .subscribe-actions {
        flex-direction: column;
    }

    .chat-user,
    .chat-assistant {
        margin-left: 0;
        margin-right: 0;
    }
}
