@media screen {
    .legal-print-letterhead {
        display: none !important;
    }
}

@media (max-width: 991px) {
    .legal-pc-only {
        display: none !important;
    }

    .legal-mobile-only {
        display: block !important;
    }

    .legal-page-wrapper {
        background-color: #f1f5f9;
        min-height: 100vh;
        padding: 0 0 calc(90px + env(safe-area-inset-bottom, 20px));
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
        color: #0f172a;
    }

    .legal-app-bar {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-bottom: 1px solid #e2e8f0;
        height: 52px;
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 0 14px;
    }

    .app-back-btn,
    .app-share-btn {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        color: #334155;
        font-size: 0.92rem;
        text-decoration: none;
        cursor: pointer;
        padding: 0;
    }

    .app-share-btn:hover,
    .app-back-btn:hover {
        background: #A74463;
        color: #ffffff;
        border-color: #A74463;
    }

    .app-bar-title {
        font-size: 1rem;
        font-weight: 700;
        color: #0f172a;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 60%;
        text-align: center;
    }

    .legal-mobile-pill-nav {
        background: #ffffff;
        border-bottom: 1px solid #e2e8f0;
        padding: 8px 0;
        position: sticky;
        top: 52px;
        z-index: 999;
    }

    .pill-scroll-container {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding: 0 14px;
        scrollbar-width: none;
        -ms-overflow-style: none;
        white-space: nowrap;
    }

    .pill-scroll-container::-webkit-scrollbar {
        display: none;
    }

    .legal-pill {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 7px 14px;
        border-radius: 20px;
        background: #f1f5f9;
        border: 1px solid #e2e8f0;
        color: #475569;
        font-size: 0.8rem;
        font-weight: 600;
        text-decoration: none;
        flex-shrink: 0;
    }

    .legal-pill i {
        font-size: 0.74rem;
        color: #64748b;
    }

    .legal-pill.active {
        background: #A74463;
        border-color: #A74463;
        color: #ffffff;
    }

    .legal-pill.active i {
        color: #ffffff;
    }

    .legal-page-wrapper .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .legal-article-card {
        background: #ffffff;
        border-radius: 14px;
        border: 1px solid #e2e8f0;
        padding: 20px 16px;
        margin-top: 12px;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
    }

    .mobile-section-tag {
        display: inline-block;
        font-size: 0.7rem;
        font-weight: 600;
        color: #A74463;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 3px;
    }

    .mobile-article-title {
        font-size: 1.35rem;
        font-weight: 700;
        color: #0f172a;
        line-height: 1.25;
        margin: 0 0 10px 0;
    }

    .mobile-article-divider {
        height: 2.5px;
        width: 32px;
        background: #A74463;
        border-radius: 2px;
        margin-bottom: 16px;
    }

    /* ========================================================
       TEXT FIXES: Removes word-stretching & guarantees clean layout
       ======================================================== */
    .legal-html-content,
    .legal-html-content *,
    .legal-html-content p,
    .legal-html-content div,
    .legal-html-content span,
    .legal-html-content li {
        text-align: left !important;
        text-align-last: left !important;
        text-justify: none !important;
        word-spacing: normal !important;
        letter-spacing: normal !important;
    }

    .legal-html-content {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
        font-size: 0.94rem;
        line-height: 1.65;
        color: #334155;
        overflow-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
        -webkit-hyphens: auto;
    }

    /* Paragraphs */
    .legal-html-content p {
        margin-bottom: 0.95rem;
        line-height: 1.65;
        color: #334155;
    }

    /* Unnumbered Section Headings on Mobile */
    .legal-html-content .legal-section-header,
    .legal-html-content h2:not(.auto-clause-heading),
    .legal-html-content h3:not(.auto-clause-heading),
    .legal-html-content h4:not(.auto-clause-heading) {
        font-size: 1.15rem !important;
        font-weight: 700 !important;
        color: #0f172a !important;
        margin: 1.8rem 0 0.8rem 0 !important;
        padding-left: 10px !important;
        border-left: 3.5px solid #A74463 !important;
        line-height: 1.35 !important;
        display: block !important;
    }

    /* Numbered Clause Headings - Mobile (Clean Gap between Badge & Title) */
    .legal-html-content .auto-clause-heading,
    .auto-clause-heading {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        margin-top: 1.6rem !important;
        margin-bottom: 0.8rem !important;
        padding-bottom: 6px !important;
        border-bottom: 1px solid #f1f5f9 !important;
        border-left: none !important;
        padding-left: 0 !important;
    }

    .auto-clause-badge {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 32px !important;
        height: 26px !important;
        padding: 0 7px !important;
        background: #fdf2f4 !important;
        color: #A74463 !important;
        border: 1px solid #f9dbe2 !important;
        border-radius: 6px !important;
        font-weight: 700 !important;
        font-size: 0.8rem !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        margin-right: 12px !important;
        margin-left: 0 !important;
        line-height: 1 !important;
    }

    .auto-clause-title-text {
        font-size: 1.05rem !important;
        font-weight: 700 !important;
        color: #1e293b !important;
        line-height: 1.3 !important;
        margin-left: 0 !important;
    }

    /* Subclauses (e.g. 5.2, 5.3) - Perfectly aligned without word gaps */
    .auto-subclause-item {
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 6px !important;
        padding: 8px 10px !important;
        margin: 8px 0 !important;
        font-size: 0.9rem !important;
        line-height: 1.55 !important;
        border-left: none !important;
        display: block !important;
        text-align: left !important;
    }

    .auto-subclause-badge {
        display: inline-block !important;
        background: #ffffff !important;
        border: 1px solid #cbd5e1 !important;
        color: #475569 !important;
        font-size: 0.72rem !important;
        font-weight: 700 !important;
        padding: 2px 6px !important;
        border-radius: 4px !important;
        margin-right: 8px !important;
        vertical-align: middle !important;
    }

    .auto-subclause-text {
        display: inline !important;
        color: #334155 !important;
        text-align: left !important;
    }

    /* Lists */
    .legal-html-content ul,
    .legal-html-content ol {
        padding-left: 1.25rem !important;
        margin: 0.8rem 0 1rem 0 !important;
    }

    .legal-html-content li {
        margin-bottom: 0.45rem !important;
        line-height: 1.6 !important;
        text-align: left !important;
    }

    .legal-html-content a {
        color: #A74463 !important;
        text-decoration: underline !important;
        font-weight: 600;
        word-break: break-all;
    }

    /* Responsive tables */
    .legal-table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 16px 0;
        border-radius: 8px;
        border: 1px solid #e2e8f0;
    }

    .legal-html-content table {
        width: 100% !important;
        font-size: 0.85rem !important;
        border-collapse: collapse;
    }

    .legal-html-content th,
    .legal-html-content td {
        padding: 9px 12px !important;
        border-bottom: 1px solid #e2e8f0;
        white-space: nowrap;
    }

    .legal-html-content th {
        background: #f8fafc;
        font-weight: 700;
    }

    .footer-sign-box {
        display: flex;
        align-items: center;
        gap: 12px;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        padding: 12px 14px;
        margin-top: 20px;
    }

    .footer-sign-box i {
        font-size: 1.3rem;
        color: #A74463;
    }

    .footer-sign-box strong {
        display: block;
        font-size: 0.88rem;
        color: #0f172a;
    }

    .footer-sign-box span {
        font-size: 0.78rem;
        color: #64748b;
    }

    /* Slide-in Mobile Drawer */
    .mobile-legal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(4px);
        z-index: 19999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .mobile-legal-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .mobile-legal-drawer {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: #ffffff;
        border-radius: 20px 20px 0 0;
        z-index: 20000;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        max-height: 85vh;
        display: flex;
        flex-direction: column;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
    }

    .mobile-legal-drawer.active {
        transform: translateY(0);
    }

    .drawer-header {
        padding: 16px 20px;
        border-bottom: 1px solid #f1f5f9;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .drawer-header h3 {
        margin: 0;
        font-size: 1.05rem;
        font-weight: 700;
        color: #0f172a;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .drawer-header h3 i {
        color: #A74463;
    }

    .drawer-close-btn {
        background: #f1f5f9;
        border: none;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #64748b;
        font-size: 0.95rem;
        cursor: pointer;
    }

    .drawer-body {
        padding: 16px 20px 24px;
        overflow-y: auto;
    }

    .drawer-nav-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .drawer-nav-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        text-decoration: none;
        color: #334155;
        font-weight: 600;
        font-size: 0.92rem;
        transition: all 0.2s ease;
    }

    .drawer-nav-item i:first-child {
        font-size: 1rem;
        color: #64748b;
        width: 20px;
        text-align: center;
    }

    .drawer-nav-item i:last-child {
        margin-left: auto;
        font-size: 0.75rem;
        color: #94a3b8;
    }

    .drawer-nav-item.active {
        background: #fdf2f4;
        border-color: #A74463;
        color: #A74463;
    }

    .drawer-nav-item.active i {
        color: #A74463;
    }

    .drawer-footer-contact {
        margin-top: 20px;
        padding: 14px;
        background: #fdf2f4;
        border-radius: 12px;
        text-align: center;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .drawer-footer-contact strong {
        font-size: 0.86rem;
        color: #0f172a;
    }

    .drawer-footer-contact a {
        color: #A74463;
        font-weight: 700;
        text-decoration: none;
        font-size: 0.9rem;
    }
}