body.login-page .page-shell,
body.login-page .doc-shell {
    width: min(760px, 100%);
}

.site-footer {
    position: relative;
    z-index: 1;
    width: min(1260px, 100%);
    margin: 18px auto 0;
}

.site-footer-inner {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 16px 18px;
    border-radius: 32px;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(14px);
}

.footer-block {
    display: grid;
    gap: 8px;
}

.footer-title {
    margin: 0;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text);
}

.footer-line {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
    word-break: break-word;
}

.footer-line-muted {
    color: rgba(89, 92, 94, 0.72);
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    max-width: min(320px, calc(100vw - 32px));
    padding: 11px 14px;
    border-radius: 14px;
    color: #fff;
    background: rgba(29, 26, 22, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2);
    z-index: 20;
    line-height: 1.5;
}

.toast[data-state="success"] {
    background: rgba(15, 123, 118, 0.96);
    border-color: rgba(255, 255, 255, 0.12);
}

.toast[data-state="error"] {
    background: rgba(165, 61, 26, 0.96);
    border-color: rgba(255, 255, 255, 0.12);
}

@media (max-width: 1080px) {
    .site-nav-dual,
    .site-nav-shared {
        min-width: 0;
        width: 100%;
    }

    .nav-primary-row,
    .nav-secondary-row,
    .nav-tier {
        width: 100%;
    }

    .nav-tier-links {
        justify-content: flex-start;
    }

    .doc-grid,
    .site-footer-inner {
        grid-template-columns: 1fr;
    }

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

    .toolbar-card {
        align-items: flex-start;
    }

    .toolbar-subnav-card {
        padding: 10px 12px;
    }

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

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

    .custom-card-shell {
        grid-template-columns: 100px minmax(0, 1fr);
    }

    .custom-card-side {
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
        padding-left: 0;
        padding-top: 4px;
        border-left: 0;
        border-top: 1px solid rgba(171, 173, 175, 0.18);
    }

    .project-card-head {
        grid-template-columns: minmax(0, 1fr);
    }

    .project-reward-stack {
        padding-left: 0;
        border-left: 0;
        border-top: 1px solid rgba(171, 173, 175, 0.18);
        padding-top: 10px;
        text-align: left;
    }

    .pagination-card {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    :root {
        --mobile-tabbar-safe-height: 0px;
        --mobile-tabbar-preview-height: 0px;
    }

    body:not(.login-page) {
        padding-bottom: calc(92px + var(--mobile-tabbar-safe-height) + var(--mobile-tabbar-preview-height));
    }

    body.has-front-modal .mobile-tabbar {
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
    }

    .site-nav-dual,
    .site-nav-shared {
        gap: 8px;
    }

    .site-header {
        position: relative;
        top: auto;
        border-radius: 28px;
        margin-bottom: 10px;
        padding: 12px 14px;
        gap: 12px;
    }

    .site-header.is-condensed {
        position: relative;
        top: auto;
        padding: 12px 14px;
        gap: 12px;
        border-radius: 28px;
        box-shadow: var(--shadow-md);
        background: rgba(245, 247, 249, 0.72);
    }

    .site-header.is-condensed .brand-lockup {
        display: grid;
        min-width: 0;
    }

    .site-header.is-condensed .brand-lockup .eyebrow,
    .site-header.is-condensed .brand-lockup .headline-copy {
        opacity: 1;
        transform: none;
        position: static;
        pointer-events: auto;
    }

    .site-header.is-condensed .brand-lockup h1 {
        margin-bottom: 6px;
        font-size: 1.78rem;
        line-height: 0.98;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .brand-lockup .headline-copy {
        font-size: 0.88rem;
        line-height: 1.5;
    }

    .header-identity {
        gap: 6px;
        margin-top: 6px;
    }

    .header-identity-chip {
        min-height: 28px;
        padding: 0 9px;
        font-size: 0.7rem;
    }

    .page-shell,
    .doc-shell {
        gap: 12px;
    }

    .nav-primary-row,
    .nav-secondary-row,
    .nav-tier {
        gap: 6px;
    }

    .nav-tier-label {
        min-width: 0;
        letter-spacing: 0.16em;
    }

    .toolbar-actions,
    .filters {
        width: 100%;
    }

    .hero-panel {
        padding: 10px 12px;
        border-radius: 28px;
    }

    .hero-stats {
        gap: 6px;
    }

    .metric-card {
        min-height: 74px;
        padding: 10px 12px 11px;
        border-radius: 20px;
    }

    .metric-card > span {
        font-size: 0.64rem;
    }

    .metric-card strong {
        font-size: 2.12rem;
    }

    .metric-small {
        font-size: 1rem !important;
        line-height: 1.25 !important;
    }

    .toolbar-card,
    .empty-card {
        padding: 14px;
        border-radius: 28px;
    }

    .toolbar-card {
        gap: 10px;
    }

    .toolbar-top-row {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-card h3 {
        font-size: 0.8rem;
        line-height: 1.4;
    }

    .section-note,
    .muted {
        font-size: 0.76rem;
        line-height: 1.5;
    }

    .toolbar-top-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .toolbar-mobile-toggle {
        display: inline-flex;
    }

    .toolbar-report-links {
        justify-content: flex-start;
        gap: 6px;
    }

    .toolbar-report-button {
        min-height: 36px;
        padding: 0 10px;
        font-size: 0.76rem;
    }

    .subnav-layout {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .site-secondary-nav,
    .site-secondary-nav .nav-secondary-row {
        width: 100%;
    }

    .site-secondary-nav .nav-secondary-row {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: none;
    }

    .site-secondary-nav .nav-secondary-row::-webkit-scrollbar {
        display: none;
    }

    .subnav-search-form {
        width: 100%;
        flex: 1 1 100%;
        margin-left: 0;
        gap: 6px;
    }

    .subnav-search-field,
    .subnav-search-button,
    .input,
    .nav-link,
    .button {
        min-height: 38px;
    }

    .subnav-search-field {
        padding: 0 12px;
    }

    .subnav-search-input {
        min-height: 36px;
    }

    .subnav-search-button {
        padding-inline: 14px;
    }

    .nav-primary-links {
        display: none;
    }

    .nav-primary-aux {
        width: 100%;
        justify-content: flex-end;
    }

    .mobile-tabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 60;
        isolation: isolate;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
        padding: 8px 14px calc(8px + var(--mobile-tabbar-safe-height));
        border-radius: 0;
        background: rgba(245, 247, 249, 0.9);
        box-shadow: 0 20px 40px rgba(57, 57, 199, 0.12);
        backdrop-filter: blur(18px);
    }

    .mobile-tabbar::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        height: var(--mobile-tabbar-preview-height);
        background: rgba(245, 247, 249, 0.9);
        backdrop-filter: blur(18px);
        pointer-events: none;
        z-index: -1;
    }

    .mobile-tabbar-link {
        display: grid;
        justify-items: center;
        gap: 4px;
        min-height: 58px;
        padding: 8px 6px;
        border-radius: 0;
        text-decoration: none;
        color: var(--muted);
        background: transparent;
        box-shadow: none;
        transition: transform 180ms ease, color 180ms ease, opacity 180ms ease;
    }

    .mobile-tabbar-link .site-icon {
        width: 24px;
        height: 24px;
        padding: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .mobile-tabbar-link span {
        font-size: 0.72rem;
        font-weight: 800;
        line-height: 1.2;
        text-align: center;
    }

    .mobile-tabbar-link-current {
        color: var(--primary);
        background: transparent;
        box-shadow: none;
    }

    .mobile-tabbar-link-current .site-icon {
        width: 24px;
        height: 24px;
        color: currentColor;
        background: transparent;
        box-shadow: none;
    }

    .mobile-tabbar-link-current span {
        font-weight: 900;
    }
    .toolbar-actions {
        display: none;
        width: 100%;
    }

    .toolbar-actions.is-open {
        display: flex;
    }

    .toolbar-actions .button,
    .filters .input,
    .filters .button {
        width: 100%;
    }

    .filters {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        overflow: visible;
    }

    .filters .button {
        grid-column: 1 / -1;
    }

    .toolbar-actions {
        gap: 8px;
    }

    .hero-panel.hero-panel-metrics {
        display: none;
    }

    .project-card-actions,
    .project-modal-actions,
    .card-actions {
        gap: 8px;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .pagination-card {
        padding-top: 10px;
    }

    .pagination-link {
        width: 100%;
        justify-content: center;
    }

    .pagination-pages {
        width: 100%;
    }

    .doc-actions,
    .room-strip {
        width: 100%;
    }

    .custom-room-mark {
        display: none;
    }

    .custom-brand-pill-mobile {
        display: inline-flex;
    }

    .custom-card-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .custom-card {
        padding: 16px;
    }

    .custom-card-side {
        grid-column: auto;
        grid-template-columns: 1fr;
        gap: 10px;
        border-top: 0;
    }

    .custom-card-amount,
    .custom-side-note {
        text-align: left;
    }

    .custom-mechanism-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .project-card-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .project-brand-mark {
        display: none;
    }

    .project-card {
        padding: 16px;
    }

    .project-card-actions,
    .project-modal-actions {
        justify-content: stretch;
    }

    .project-card-actions .button,
    .project-modal-actions .button {
        width: 100%;
        min-width: 0;
    }

    .project-rules-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .project-modal-card-head {
        flex-direction: column;
        align-items: stretch;
    }

    .toast {
        right: 16px;
        bottom: 16px;
    }
}

@media (max-width: 780px) {
    .site-header,
    .toolbar-card {
        flex-direction: column;
    }

    .site-header.is-condensed {
        align-items: stretch;
    }

    .site-header.is-condensed .brand-lockup {
        min-width: 0;
    }

    .price-row {
        grid-template-columns: 1fr;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    body.douyin-page .card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    body.douyin-page .product-card {
        border-radius: 22px;
    }

    body.douyin-page .product-media {
        aspect-ratio: 1 / 1.08;
    }

    body.douyin-page .badge {
        top: 10px;
        left: 10px;
        padding: 5px 9px;
        font-size: 0.7rem;
    }

    body.douyin-page .badge-secondary {
        right: 10px;
        left: auto;
    }

    body.douyin-page .product-body {
        padding: 10px 10px 11px;
    }

    body.douyin-page .brand-pill {
        padding: 4px 8px;
        font-size: 0.7rem;
    }

    body.douyin-page .product-headline {
        margin-bottom: 6px;
        gap: 6px;
    }

    body.douyin-page .stock-pill {
        font-size: 0.64rem;
        padding: 3px 7px;
    }

    body.douyin-page .product-body h3 {
        font-size: 0.92rem;
        line-height: 1.28;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
    }

    body.douyin-page .shop-meta {
        font-size: 0.78rem;
        line-height: 1.45;
    }

    body.douyin-page .price-row {
        gap: 6px;
    }

    body.douyin-page .price-block,
    body.douyin-page .commission-block {
        padding: 8px 8px 7px;
        border-radius: 16px;
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        gap: 2px 6px;
    }

    body.douyin-page .field-label {
        font-size: 0.64rem;
        margin-bottom: 2px;
    }

    body.douyin-page .price-block strong {
        font-size: 1rem;
    }

    body.douyin-page .commission-block strong {
        font-size: 0.9rem;
        display: inline;
        line-height: 1;
    }

    body.douyin-page .commission-block small {
        width: 100%;
        margin-top: 2px;
        font-size: 0.72rem;
    }

    body.douyin-page .meta-row {
        gap: 5px;
        margin: 6px 0 7px;
    }

    body.douyin-page .meta-chip {
        padding: 4px 7px;
        font-size: 0.66rem;
    }

    body.douyin-page .card-actions {
        margin-top: 7px;
        gap: 6px;
        flex-wrap: nowrap;
    }

    body.douyin-page .card-actions .button {
        width: auto;
        flex: 1 1 0;
        min-height: 36px;
        font-size: 0.76rem;
        padding-inline: 8px;
        white-space: nowrap;
    }

    .filters {
        width: 100%;
    }

    .subnav-layout {
        flex-direction: column;
        align-items: stretch;
    }

    .subnav-search-form {
        width: 100%;
        flex: 1 1 100%;
        margin-left: 0;
    }

    .filters .input,
    .filters .button {
        width: 100%;
    }

    .card-actions .button {
        width: 100%;
        flex: 1 1 100%;
        min-width: 0;
    }

    .custom-card-shell {
        gap: 12px;
    }

    .custom-table-card {
        padding: 16px;
    }

    .custom-table {
        min-width: 1080px;
    }
}

@media (max-width: 520px) {
    .hero-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .product-metrics {
        grid-template-columns: 1fr;
    }

    body.douyin-page .product-body h3 {
        font-size: 0.88rem;
    }

    body.douyin-page .card-actions .button {
        font-size: 0.72rem;
        padding-inline: 6px;
        gap: 6px;
    }

    body.douyin-page .price-block strong {
        font-size: 0.94rem;
    }

    body.douyin-page .commission-block strong {
        font-size: 0.84rem;
    }

    .metric-card {
        min-height: auto;
    }
}

@media (max-width: 340px) {
    body.douyin-page .card-grid {
        grid-template-columns: 1fr;
    }
}
