:root {
            --primary: #1a1a1a;
            --accent: #2c6e49;
            --accent-orange: #E67E22;
            --bg-page: #F8F5F2;
            --bg-card: #FFFDF9;
            --border: #EBE5DC;
            --text-muted: #857F78;
            --text-dark: #2D2A26;
            --badge-gmd: #f3f4f6;
            --available: #16a34a;
            --loaned: #dc2626;
        }

        * {
            box-sizing: border-box;
        }

        html, body {
            width: 100%;
            max-width: 100vw;
            overflow-x: hidden;
            margin: 0;
            padding: 0;
        }

        body {
            background-color: var(--bg-page);
            font-family: 'Outfit', sans-serif;
            color: var(--text-dark);
            -webkit-font-smoothing: antialiased;
        }



        /* ── BREADCRUMBS ── */
        .breadcrumbs {
            padding: 16px 7%;
            font-size: 13px;
            color: var(--text-muted);
            display: flex;
            gap: 8px;
            align-items: center;
        }

        .breadcrumbs a {
            color: var(--accent);
            text-decoration: none;
            font-weight: 500;
        }

        .breadcrumbs a:hover {
            text-decoration: underline;
        }

        /* ── MOBILE BACK BUTTON (hidden on desktop) ── */
        .mobile-back-btn {
            display: none;
        }

        /* ── MOBILE DETAIL CARD TOP (hidden on desktop) ── */
        .mobile-detail-card-top {
            display: none;
        }

        /* ── MAIN CONTENT ── */
        .detail-container {
            width: 90%;
            max-width: 1600px;
            margin: 40px auto 80px;
            display: grid;
            grid-template-columns: 280px 1fr;
            gap: 40px;
            box-sizing: border-box;
        }

        .detail-actions {
            display: flex;
            flex-direction: column;
            gap: 10px;
            width: 100%;
            margin-top: 20px;
        }
        .btn-read {
            background: #5C3D2E !important;
            color: white !important;
            border-color: #5C3D2E !important;
            box-shadow: 0 4px 12px rgba(92, 61, 46, 0.15);
        }
        .btn-read:hover {
            background: #472f23 !important;
            border-color: #472f23 !important;
        }
        .btn-download {
            background: white !important;
            border: 1px solid #D0C6B8 !important;
            color: #5C3D2E !important;
        }
        .btn-download:hover {
            background: #FAF8F6 !important;
            border-color: #5C3D2E !important;
        }


        .detail-left {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        .detail-cover {
            width: 100%;
            max-width: 280px;
            aspect-ratio: 5/7;
            object-fit: cover;
            border-radius: 16px;
            box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
            border: 1px solid var(--border);
            background: #fff;
        }

        .avail-badge {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            padding: 12px;
            border-radius: 12px;
            font-size: 14px;
            font-weight: 600;
            width: 100%;
            max-width: 280px;
        }

        .avail-badge.avail {
            background: #ecfdf5;
            color: #047857;
            border: 1px solid #a7f3d0;
        }

        .avail-badge.loaned {
            background: #fef2f2;
            color: #b91c1c;
            border: 1px solid #fecaca;
        }

        .avail-badge .avail-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: currentColor;
        }

        .detail-right {
            background: #fff;
            padding: 36px;
            border-radius: 20px;
            box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
            border: 1px solid var(--border);
        }

        @media (max-width: 640px) {
            .detail-right {
                padding: 20px;
            }
        }

        .badge-gmd {
            display: inline-block;
            font-size: 11px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            padding: 4px 12px;
            border-radius: 20px;
            background: #f3f4f6;
            color: #4b5563;
            margin-bottom: 12px;
        }

        .book-title {
            font-size: 28px;
            font-weight: 700;
            color: var(--text-dark);
            line-height: 1.2;
            margin-bottom: 6px;
        }

        .author-name {
            font-size: 16px;
            font-weight: 500;
            color: var(--text-muted);
            margin-bottom: 30px;
        }

        /* Tabs styling */
        .tabs {
            display: flex;
            border-bottom: 1px solid var(--border);
            margin-bottom: 24px;
            gap: 16px;
        }

        .tab-btn {
            padding: 12px 20px;
            font-family: 'Outfit', sans-serif;
            font-size: 14px;
            font-weight: 600;
            color: var(--text-muted);
            background: none;
            border: none;
            border-bottom: 2px solid transparent;
            cursor: pointer;
            transition: all 0.2s;
        }

        .tab-btn:hover {
            color: var(--text-dark);
        }

        .tab-btn.active {
            color: var(--accent);
            border-bottom-color: var(--accent);
        }

        .tab-content {
            display: none;
        }

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

        /* Detail table styling */
        .detail-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 14px;
            line-height: 1.6;
        }

        .detail-table tr {
            border-bottom: 1px solid #f3f4f6;
        }

        .detail-table tr:last-child {
            border-bottom: none;
        }

        .detail-table th {
            text-align: left;
            font-weight: 600;
            color: #4b5563;
            width: 220px;
            padding: 12px 0;
            vertical-align: top;
        }

        .detail-table td {
            color: var(--text-dark);
            padding: 12px 0;
        }

        .abstract-text {
            font-size: 15px;
            line-height: 1.7;
            color: #374151;
            white-space: pre-wrap;
        }

        /* Availability styling */
        .avail-header {
            display: flex;
            justify-content: space-between;
            background: #f9fafb;
            padding: 14px 20px;
            border-radius: 12px;
            font-size: 14px;
            font-weight: 600;
            color: #374151;
            margin-bottom: 20px;
        }

        .count-badge {
            display: inline-block;
            background: #e5e7eb;
            padding: 2px 10px;
            border-radius: 12px;
            font-size: 12px;
            margin-left: 6px;
        }

        .count-badge.green {
            background: #d1fae5;
            color: #065f46;
        }

        .items-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 13.5px;
        }

        .items-table th, .items-table td {
            padding: 12px 16px;
            text-align: left;
        }

        .items-table th {
            background: #f3f4f6;
            font-weight: 600;
            color: #4b5563;
            border-radius: 4px;
        }

        .items-table td {
            border-bottom: 1px solid #f3f4f6;
        }

        .status-badge {
            display: inline-block;
            padding: 4px 10px;
            border-radius: 8px;
            font-size: 12px;
            font-weight: 600;
        }

        .status-badge.status-avail {
            background: #d1fae5;
            color: #065f46;
        }

        .status-badge.status-loaned {
            background: #fee2e2;
            color: #991b1b;
        }

        /* ── PAGINATION (same style as catalog) ── */
        .pagination-wrap {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            margin-top: 20px;
        }

        .page-btn {
            width: 36px;
            height: 36px;
            border-radius: 8px;
            border: 1.5px solid #e5e7eb;
            background: #fff;
            color: var(--text-dark);
            font-family: 'Outfit', sans-serif;
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            text-decoration: none;
            transition: background 0.2s, color 0.2s, border-color 0.2s;
            user-select: none;
        }

        .page-btn:hover, .page-btn.active {
            background: #1a1a1a;
            color: #fff;
            border-color: #1a1a1a;
        }

        .page-btn.disabled {
            opacity: 0.4;
            pointer-events: none;
            cursor: default;
        }

        .page-info {
            font-size: 12px;
            color: var(--text-muted);
            text-align: center;
            margin-top: 10px;
        }

        @media (max-width: 992px) {
            /* ────────────────────────────────────────────
               CONTAINER — Single column
             ──────────────────────────────────────────── */
            .detail-container {
                grid-template-columns: 1fr !important;
                gap: 0 !important;
            }

            /* Hide desktop-only columns */
            .detail-left {
                display: none !important;
            }
            .desktop-only-meta {
                display: none !important;
            }

            /* ────────────────────────────────────────────
               BACK BUTTON — Mobile only
            ──────────────────────────────────────────── */
            .mobile-back-btn {
                display: inline-flex !important;
                align-items: center !important;
                gap: 6px !important;
                font-size: 13px !important;
                font-weight: 600 !important;
                color: var(--accent-orange) !important;
                text-decoration: none !important;
                margin: 0 0 14px 0 !important;
                transition: transform 0.2s !important;
            }
            .mobile-back-btn:hover {
                transform: translateX(-3px) !important;
            }

            /* ────────────────────────────────────────────
               CARD 1 — Cover + Title + Actions
            ──────────────────────────────────────────── */
            .mobile-detail-card-top {
                display: block !important;
                margin: 12px 0 !important;
                width: 100% !important;
                max-width: 100% !important;
                padding: 20px 16px !important;
                border-radius: 20px !important;
                box-shadow: 0 4px 16px rgba(0,0,0,0.04) !important;
                border: 1px solid var(--border) !important;
                background: var(--bg-card) !important;
                box-sizing: border-box !important;
            }

            /* CARD 2 — Tab details */
            .detail-right {
                display: block !important;
                margin: 12px 0 !important;
                width: 100% !important;
                max-width: 100% !important;
                padding: 20px 16px !important;
                border-radius: 20px !important;
                box-shadow: 0 4px 16px rgba(0,0,0,0.04) !important;
                border: 1px solid var(--border) !important;
                background: var(--bg-card) !important;
                box-sizing: border-box !important;
            }

            /* ────────────────────────────────────────────
               COVER — Centered inside Card 1
            ──────────────────────────────────────────── */
            .mobile-cover-center {
                display: flex !important;
                justify-content: center !important;
                margin-bottom: 16px !important;
            }
            .mobile-cover-center .detail-cover {
                width: 160px !important;
                max-width: 160px !important;
                height: auto !important;
                aspect-ratio: 5/7 !important;
                border-radius: 12px !important;
                box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
            }

            /* ────────────────────────────────────────────
               BADGE ROW — Availability + GMD
            ──────────────────────────────────────────── */
            .mobile-badge-row {
                display: flex !important;
                justify-content: center !important;
                align-items: center !important;
                gap: 8px !important;
                margin-bottom: 14px !important;
                flex-wrap: wrap !important;
            }
            .mobile-badge-row .avail-badge {
                width: auto !important;
                padding: 5px 14px !important;
                border-radius: 20px !important;
                font-size: 12px !important;
                font-weight: 600 !important;
                white-space: nowrap !important;
            }
            .mobile-badge-row .badge-gmd {
                font-size: 10px !important;
                padding: 4px 10px !important;
                margin-bottom: 0 !important;
            }

            /* ────────────────────────────────────────────
               TITLE & AUTHOR — Centered
            ──────────────────────────────────────────── */
            .mobile-title-center {
                text-align: center !important;
                font-size: 18px !important;
                font-weight: 700 !important;
                line-height: 1.3 !important;
                margin-bottom: 6px !important;
                word-break: break-word !important;
            }
            .mobile-author-center {
                text-align: center !important;
                font-size: 12.5px !important;
                color: var(--text-muted) !important;
                margin-bottom: 12px !important;
            }

            /* ────────────────────────────────────────────
               RATING ROW — Centered
            ──────────────────────────────────────────── */
            .mobile-rating-row {
                display: flex !important;
                justify-content: center !important;
                align-items: center !important;
                gap: 6px !important;
                margin-bottom: 16px !important;
            }

            /* ────────────────────────────────────────────
               QUICK META GRID — 2 columns (new, like dashboard)
            ──────────────────────────────────────────── */
            .mobile-meta-row {
                display: grid !important;
                grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
                gap: 8px 12px !important;
                background: #F8F5F2 !important;
                border-radius: 12px !important;
                padding: 12px !important;
                margin-bottom: 16px !important;
            }
            .mobile-meta-item {
                display: flex !important;
                align-items: flex-start !important;
                gap: 6px !important;
                font-size: 12px !important;
                color: #5A5450 !important;
                line-height: 1.4 !important;
                min-width: 0 !important;
            }
            .mobile-meta-item span {
                word-break: break-word !important;
                overflow-wrap: break-word !important;
            }
            .mobile-meta-item i {
                font-size: 12px !important;
                color: #C8973F !important;
                margin-top: 1px !important;
                flex-shrink: 0 !important;
            }

            /* ────────────────────────────────────────────
               ACTION BUTTONS ROW — Flex row
            ──────────────────────────────────────────── */
            .mobile-action-row {
                display: flex !important;
                gap: 8px !important;
                width: 100% !important;
            }
            .mobile-action-row form {
                flex: 1 !important;
                margin: 0 !important;
            }
            .mobile-action-row .btn-fav {
                width: 100% !important;
                font-size: 12px !important;
                padding: 10px 8px !important;
                gap: 5px !important;
                border-radius: 10px !important;
                white-space: nowrap !important;
                justify-content: center !important;
                display: flex !important;
                align-items: center !important;
                margin-top: 0 !important;
            }
            .mobile-action-row .btn-fav i {
                flex-shrink: 0 !important;
                font-size: 13px !important;
            }

            /* ────────────────────────────────────────────
               CARD 2: TABS — Horizontal swipeable
            ──────────────────────────────────────────── */
            .tabs {
                display: flex !important;
                flex-wrap: nowrap !important;
                overflow-x: auto !important;
                white-space: nowrap !important;
                gap: 0 !important;
                padding-bottom: 0 !important;
                margin-bottom: 16px !important;
                border-bottom: 1.5px solid var(--border) !important;
                scrollbar-width: none !important;
                -ms-overflow-style: none !important;
                -webkit-overflow-scrolling: touch !important;
            }
            .tabs::-webkit-scrollbar {
                display: none !important;
                height: 0 !important;
            }
            .tab-btn {
                flex-shrink: 0 !important;
                padding: 8px 14px !important;
                font-size: 12px !important;
                font-weight: 500 !important;
                white-space: nowrap !important;
                background: none !important;
                border: none !important;
                color: var(--text-muted) !important;
                border-bottom: 2px solid transparent !important;
                border-radius: 0 !important;
                cursor: pointer !important;
            }
            .tab-btn.active {
                color: var(--accent-orange) !important;
                border-bottom: 2px solid var(--accent-orange) !important;
                font-weight: 700 !important;
            }

            /* ────────────────────────────────────────────
               DETAIL TABLE — Stacked key/value
            ──────────────────────────────────────────── */
            .detail-table {
                min-width: 0 !important;
                width: 100% !important;
                font-size: 13px !important;
            }
            .detail-table tr {
                display: flex !important;
                flex-direction: column !important;
                padding: 10px 0 !important;
                border-bottom: 1px solid #F3F0EC !important;
            }
            .detail-table tr:last-child {
                border-bottom: none !important;
            }
            .detail-table th {
                width: 100% !important;
                font-size: 10.5px !important;
                color: #A09A92 !important;
                font-weight: 600 !important;
                text-transform: uppercase !important;
                letter-spacing: 0.3px !important;
                padding: 0 0 2px 0 !important;
                border: none !important;
                text-align: left !important;
            }
            .detail-table td {
                width: 100% !important;
                font-size: 13.5px !important;
                font-weight: 500 !important;
                color: #5A5450 !important;
                padding: 0 !important;
                word-break: break-word !important;
                border: none !important;
                text-align: left !important;
            }

            /* ────────────────────────────────────────────
               AVAILABILITY TABLE — Horizontal scroll
            ──────────────────────────────────────────── */
            .table-responsive-wrapper {
                width: 100% !important;
                overflow-x: auto !important;
                -webkit-overflow-scrolling: touch !important;
            }
            .items-table {
                min-width: 380px !important;
                font-size: 12px !important;
            }
            .items-table th,
            .items-table td {
                padding: 8px 10px !important;
            }
            .avail-header {
                font-size: 12px !important;
                padding: 10px 12px !important;
                border-radius: 8px !important;
            }

            /* ────────────────────────────────────────────
               REVIEWS — Compact layout
            ──────────────────────────────────────────── */
            .rating-summary-box {
                flex-direction: row !important;
                align-items: center !important;
                gap: 16px !important;
                padding: 14px !important;
                margin-bottom: 16px !important;
            }
            .rating-big-num {
                font-size: 36px !important;
            }
            .rating-stars-row {
                font-size: 15px !important;
                gap: 2px !important;
                justify-content: flex-start !important;
            }
            .review-list-item {
                gap: 10px !important;
                padding: 12px 0 !important;
            }
            .review-avatar {
                width: 34px !important;
                height: 34px !important;
            }
            .review-user-name {
                font-size: 13px !important;
            }
            .review-body {
                font-size: 13px !important;
                line-height: 1.5 !important;
            }
            .review-date {
                font-size: 11px !important;
            }
            .star-rating-input label {
                font-size: 22px !important;
            }
            .abstract-text {
                font-size: 13px !important;
                line-height: 1.7 !important;
            }

            /* Login notice — stack vertically */
            .detail-right div[style*="background: #FDF8E2"] {
                flex-direction: column !important;
                align-items: stretch !important;
                gap: 14px !important;
                padding: 16px !important;
            }
            .detail-right div[style*="background: #FDF8E2"] a.btn-fav {
                width: 100% !important;
                max-width: none !important;
                margin-top: 0 !important;
                text-align: center !important;
                justify-content: center !important;
            }

            /* Typography adjustment */
            .book-title {
                font-size: 18px !important;
                line-height: 1.3 !important;
            }
            .author-name {
                font-size: 12.5px !important;
                margin-bottom: 20px !important;
            }


        }

        /* ============================================================
           MOBILE OVERFLOW FIX — FINAL OVERRIDE (must be last in file)
           Forces all elements to stay within 100vw on mobile devices
           ============================================================ */
        @media (max-width: 992px) {
            html,
            body {
                width: 100% !important;
                max-width: 100vw !important;
                overflow-x: hidden !important;
            }

            .catalog-hero,
            .detail-container,
            .mobile-detail-card-top,
            .detail-right,
            .detail-left,
            .tabs,
            .tab-content,
            .mobile-meta-row,
            .mobile-action-row,
            .detail-table,
            .table-responsive-wrapper {
                max-width: 100% !important;
                box-sizing: border-box !important;
            }



            .mobile-detail-card-top,
            .detail-right {
                width: 100% !important;
                max-width: 100% !important;
                margin: 10px 0 !important;
                padding: 20px 16px !important;
                box-sizing: border-box !important;
            }

            /* Prevent any child from overflowing the card */
            .mobile-detail-card-top *,
            .detail-right * {
                max-width: 100% !important;
                box-sizing: border-box !important;
            }

            /* Exception: table needs horizontal scroll, not constrained */
            .table-responsive-wrapper {
                overflow-x: auto !important;
            }
            .table-responsive-wrapper * {
                max-width: none !important;
            }
            .items-table {
                min-width: 380px !important;
            }
        }