/* ============ RESET & BASE ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary: #1e40af;
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    --accent: #f59e0b;
    --success: #16a34a;
    --danger: #dc2626;

    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --bg-shell: #ffffff;

    --text: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --text-invert: #ffffff;

    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);

    --radius: 14px;
    --radius-lg: 20px;

    --filter-bg: rgba(255, 255, 255, 0.85);
    --titlebar-bg: linear-gradient(180deg, #f8fafc, #eef2f7);
    --titlebar-border: #e2e8f0;
    --titlebar-text: #64748b;

    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    --input-text: #0f172a;
    --input-placeholder: #94a3b8;

    --count-bg: #f1f5f9;
    --count-text: #64748b;

    --cat-tag-bg: #f1f5f9;
    --cat-tag-text: #475569;

    --provider-bg: linear-gradient(135deg, #dbeafe, #bfdbfe);
    --provider-text: #1e40af;

    --thumb-bg: linear-gradient(135deg, #dbeafe, #ede9fe);
    --hero-bg: linear-gradient(135deg, #dbeafe, #ede9fe);

    --list-border: #f1f5f9;
    --list-check-bg: linear-gradient(135deg, #d1fae5, #a7f3d0);
    --list-check-text: #059669;

    --back-hover-bg: #eff6ff;

    --tabbar-bg: rgba(255, 255, 255, 0.95);
    --tabbar-border: #e2e8f0;
    --tab-inactive: #64748b;
    --tab-active: #1e40af;

    --spinner-border: #e2e8f0;
    --spinner-top: #1e40af;

    --cta-bg: #ffffff;
    --cta-text: #1e40af;
}

html,
body {
    height: 100%;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background: linear-gradient(135deg, #dbeafe 0%, #ede9fe 50%, #fce7f3 100%);
    background-attachment: fixed;
    overflow-x: hidden;
}

body { padding: 0; }

/* ============ APP SHELL ============ */
.app-shell {
    max-width: 1280px;
    margin: 24px auto;
    background: var(--bg-shell);
    border-radius: 16px;
    box-shadow:
        0 30px 80px rgba(30, 64, 175, 0.25),
        0 10px 30px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 48px);
}

/* ============ TITLE BAR ============ */
.titlebar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: var(--titlebar-bg);
    border-bottom: 1px solid var(--titlebar-border);
    user-select: none;
}

.traffic-lights { display: flex; gap: 8px; }

.traffic-lights .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    cursor: pointer;
    transition: transform 0.15s;
}
.traffic-lights .dot:hover { transform: scale(1.15); }

.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }

.titlebar-text {
    font-size: 0.82rem;
    color: var(--titlebar-text);
    font-weight: 600;
    letter-spacing: 0.3px;
}

.titlebar-spacer { flex: 1; }

/* ============ NAVBAR ============ */
.navbar {
    background: linear-gradient(135deg, #1e40af 0%, #4f46e5 55%, #7c3aed 100%);
    color: #fff;
    padding: 14px 0;
    position: relative;
    overflow: hidden;
}

.navbar::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15), transparent 70%);
    pointer-events: none;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.brand {
    color: #fff !important;
    text-decoration: none;
    font-family: 'Poppins', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.3px;
}

.brand-icon,
.brand-text { color: #fff !important; }

.nav-links { display: flex; gap: 8px; }

.nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff !important;
}

.nav-ico { font-size: 1rem; }

/* ============ APP CONTENT ============ */
.app-content {
    padding: 26px 24px 40px;
    flex: 1;
}

/* ============ CAROUSEL ============ */
.carousel-section { margin-bottom: 26px; }

.carousel {
    position: relative;
    min-height: 320px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow:
        0 20px 50px rgba(30, 64, 175, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    color: #fff !important;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 40px;
    animation: slideIn 0.6s ease;
    isolation: isolate;
}

.carousel[data-theme="0"] { background: linear-gradient(135deg, #1e40af 0%, #7c3aed 55%, #db2777 100%); }
.carousel[data-theme="1"] { background: linear-gradient(135deg, #059669 0%, #0ea5e9 60%, #6366f1 100%); }
.carousel[data-theme="2"] { background: linear-gradient(135deg, #dc2626 0%, #ea580c 55%, #f59e0b 100%); }
.carousel[data-theme="3"] { background: linear-gradient(135deg, #7c3aed 0%, #c026d3 60%, #f43f5e 100%); }

.carousel::before,
.carousel::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 70%);
    pointer-events: none;
    z-index: -1;
}
.carousel::before { width: 400px; height: 400px; top: -150px; right: -80px; }
.carousel::after  { width: 300px; height: 300px; bottom: -120px; left: -60px; }

.carousel .banner-img {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 45%;
    object-fit: cover;
    opacity: 0.28;
    mask-image: linear-gradient(to left, black 40%, transparent 100%);
    -webkit-mask-image: linear-gradient(to left, black 40%, transparent 100%);
    z-index: -1;
    pointer-events: none;
}

.carousel .badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #422006 !important;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
    align-self: flex-start;
    animation: pulseBadge 2s ease-in-out infinite;
}

@keyframes pulseBadge {
    0%, 100% { box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5); }
    50%      { box-shadow: 0 6px 30px rgba(245, 158, 11, 0.9); }
}

.carousel h2 {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    margin-top: 16px;
    line-height: 1.2;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
    max-width: 720px;
    color: #fff !important;
}

.carousel p {
    margin-top: 12px;
    opacity: 0.95;
    max-width: 620px;
    font-size: clamp(0.9rem, 1.4vw, 1.05rem);
    line-height: 1.55;
    color: #fff !important;
}

.carousel .cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 22px;
    background: var(--cta-bg);
    color: var(--cta-text) !important;
    padding: 12px 26px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    align-self: flex-start;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.carousel .cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.3);
}
.carousel .cta::after { content: '→'; transition: transform 0.25s; }
.carousel .cta:hover::after { transform: translateX(4px); }

.carousel-dots {
    position: absolute;
    bottom: 22px; right: 26px;
    display: flex; gap: 8px;
    z-index: 2;
}
.carousel-dots button {
    width: 10px; height: 10px;
    border-radius: 999px;
    border: none;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: 0.3s;
    padding: 0;
}
.carousel-dots button.active {
    background: #fff;
    width: 30px;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.7);
}

.carousel-progress {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    overflow: hidden;
}
.carousel-progress span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    width: 0%;
    animation: progressFill 4s linear infinite;
}
@keyframes progressFill {
    from { width: 0%; }
    to   { width: 100%; }
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============ FILTERS ============ */
.filter-sticky {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--filter-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 14px 16px;
    border-radius: var(--radius);
    margin-bottom: 22px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.section-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text) !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.count {
    font-size: 0.78rem;
    color: var(--count-text) !important;
    font-weight: 500;
    background: var(--count-bg);
    padding: 2px 10px;
    border-radius: 999px;
}

.filter-bar {
    display: grid;
    grid-template-columns: 1fr 1fr 1.4fr;
    gap: 12px;
}

.filter-bar select,
.search-wrap input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--input-border);
    border-radius: 10px;
    font-size: 0.92rem;
    font-family: inherit;
    outline: none;
    background: var(--input-bg);
    color: var(--input-text) !important;
    transition: 0.2s;
    font-weight: 500;
}

.filter-bar select::placeholder,
.search-wrap input::placeholder {
    color: var(--input-placeholder);
    opacity: 1;
}

.filter-bar select:focus,
.search-wrap input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.filter-bar select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.search-wrap { position: relative; }

.search-ico {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    pointer-events: none;
    opacity: 0.75;
    color: var(--text-muted) !important;
}

.search-wrap input { padding-left: 40px; }

/* ============ SCHEME GRID ============ */
.scheme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.scheme-card {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: var(--text) !important;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    animation: fadeUp 0.4s ease backwards;
}

.scheme-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-light), #7c3aed, #db2777);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s;
}
.scheme-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(30, 64, 175, 0.15);
    border-color: var(--border-strong);
}
.scheme-card:hover::before { transform: scaleX(1); }

.scheme-card .thumb {
    width: 100%;
    height: 130px;
    border-radius: 10px;
    background: var(--thumb-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    overflow: hidden;
    margin-bottom: 4px;
}
.scheme-card .thumb img {
    width: 100%; height: 100%; object-fit: cover;
}

.scheme-card .head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.scheme-card h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text) !important;
    line-height: 1.35;
    flex: 1;
}

.scheme-card .provider-tag {
    background: var(--provider-bg);
    color: var(--provider-text) !important;
    font-size: 0.66rem;
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.scheme-card .desc {
    color: var(--text-muted) !important;
    font-size: 0.87rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.scheme-card .meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.scheme-card .cat-tag {
    background: var(--cat-tag-bg);
    color: var(--cat-tag-text) !important;
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.scheme-card .view {
    color: var(--primary) !important;
    font-weight: 700;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: 0.2s;
}
.scheme-card:hover .view { gap: 8px; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============ STATES ============ */
.loading,
.no-results {
    text-align: center;
    color: var(--text-muted) !important;
    padding: 50px 20px;
    font-size: 0.95rem;
}

.no-res-ico {
    font-size: 3rem;
    display: inline-block;
    margin-bottom: 12px;
    opacity: 0.5;
}

.spinner {
    width: 42px; height: 42px;
    border: 3px solid var(--spinner-border);
    border-top-color: var(--spinner-top);
    border-radius: 50%;
    margin: 0 auto 14px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ DETAIL PAGE ============ */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary) !important;
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 16px;
    font-size: 0.9rem;
    padding: 8px 14px;
    border-radius: 8px;
    transition: 0.2s;
}
.back-btn:hover { background: var(--back-hover-bg); }

.detail-card {
    background: var(--bg-card);
    padding: 36px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    animation: fadeUp 0.4s ease;
    color: var(--text) !important;
}

.detail-card .hero {
    height: 200px;
    border-radius: 12px;
    background: var(--hero-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    margin-bottom: 22px;
    overflow: hidden;
}
.detail-card .hero img { width: 100%; height: 100%; object-fit: cover; }

.detail-card .head {
    display: flex; justify-content: space-between;
    align-items: flex-start; flex-wrap: wrap; gap: 12px;
}

.detail-card h1 {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(1.3rem, 2.5vw, 1.85rem);
    color: var(--text) !important;
    line-height: 1.25;
    letter-spacing: -0.5px;
}

.detail-card .provider-tag {
    background: var(--provider-bg);
    color: var(--provider-text) !important;
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-card .meta {
    color: var(--text-muted) !important;
    font-size: 0.9rem;
    margin-top: 8px;
}

.detail-card .desc {
    margin-top: 20px;
    color: var(--text-body) !important;
    line-height: 1.75;
    font-size: 1rem;
}

.detail-card h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    margin: 28px 0 12px;
    color: var(--text) !important;
    display: flex; align-items: center; gap: 8px;
}

.detail-card ul { list-style: none; padding-left: 0; }

.detail-card ul li {
    padding: 10px 0 10px 34px;
    position: relative;
    color: var(--text-body) !important;
    line-height: 1.55;
    border-bottom: 1px solid var(--list-border);
    font-size: 0.94rem;
}
.detail-card ul li:last-child { border-bottom: none; }

.detail-card ul li::before {
    content: '✓';
    position: absolute;
    left: 0; top: 8px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--list-check-bg);
    color: var(--list-check-text) !important;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.7rem;
}

.action-buttons {
    margin-top: 34px;
    display: flex; flex-wrap: wrap; gap: 12px;
}

.btn {
    padding: 13px 24px;
    border-radius: 10px;
    color: #fff !important;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0, 0, 0, 0.15); }

.btn-green { background: linear-gradient(135deg, #16a34a, #059669); }
.btn-blue  { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.btn-red   { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.btn-gray  { background: linear-gradient(135deg, #475569, #334155); color: #fff !important; }

/* ============ MOBILE TAB BAR ============ */
.mobile-tabbar { display: none; }

/* ===================================================== */
/*                   RESPONSIVE                          */
/* ===================================================== */

@media (max-width: 900px) {
    .app-shell {
        margin: 12px;
        border-radius: 14px;
        min-height: calc(100vh - 24px);
    }
    .carousel { min-height: 280px; padding: 30px; }
    .carousel .banner-img { width: 55%; }
}

@media (max-width: 640px) {
    html, body { background: #f8fafc; }

    .app-shell {
        margin: 0; border-radius: 0;
        min-height: 100vh; box-shadow: none;
    }

    .titlebar { display: none; }

    .navbar {
        padding: 12px 0; border-radius: 0;
        position: sticky; top: 0; z-index: 20;
    }
    .nav-container { padding: 0 16px; }
    .brand { font-size: 1.05rem; }
    .brand-icon { font-size: 1.3rem; }
    .brand-text { font-size: 1.05rem; color: #fff !important; }
    .nav-links { display: none; }

    .app-content { padding: 16px 14px 100px; }

    .carousel-section { margin: -16px -14px 18px; }
    .carousel {
        border-radius: 0;
        min-height: 340px;
        padding: 24px 20px 60px;
        margin: 0;
    }
    .carousel .banner-img {
        width: 100%; opacity: 0.18;
        mask-image: linear-gradient(to top, black 30%, transparent 90%);
        -webkit-mask-image: linear-gradient(to top, black 30%, transparent 90%);
    }
    .carousel h2 { font-size: 1.5rem; margin-top: 12px; }
    .carousel p  { font-size: 0.9rem; margin-top: 10px; }
    .carousel .cta {
        padding: 12px 22px; font-size: 0.9rem;
        width: 100%; justify-content: center;
        margin-top: 18px;
    }
    .carousel-dots { bottom: 20px; left: 0; right: 0; justify-content: center; }

    .filter-sticky {
        position: sticky; top: 56px;
        padding: 12px; margin: 0 -2px 16px;
        border-radius: 12px; z-index: 15;
    }
    .filter-bar { grid-template-columns: 1fr; gap: 10px; }

    .scheme-grid { grid-template-columns: 1fr; gap: 14px; }
    .scheme-card { padding: 18px; }

    .detail-card { padding: 22px; border-radius: 14px; }
    .detail-card .hero { height: 150px; font-size: 3.5rem; }
    .detail-card h1 { font-size: 1.3rem; }
    .action-buttons { flex-direction: column; }
    .btn { width: 100%; justify-content: center; }

    .mobile-tabbar {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        background: var(--tabbar-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--tabbar-border);
        padding: 8px 0 max(8px, env(safe-area-inset-bottom));
        z-index: 100;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
    }
    .mobile-tabbar .tab {
        flex: 1;
        display: flex; flex-direction: column;
        align-items: center; justify-content: center;
        gap: 3px; text-decoration: none;
        color: var(--tab-inactive) !important;
        font-size: 0.68rem; font-weight: 600;
        padding: 6px 0; transition: 0.2s; position: relative;
    }
    .mobile-tabbar .tab-ico {
        font-size: 1.3rem; filter: grayscale(1); transition: 0.2s;
    }
    .mobile-tabbar .tab.active { color: var(--tab-active) !important; }
    .mobile-tabbar .tab.active .tab-ico {
        filter: grayscale(0); transform: translateY(-2px);
    }
    .mobile-tabbar .tab.active::before {
        content: '';
        position: absolute;
        top: 0; left: 50%;
        transform: translateX(-50%);
        width: 30px; height: 3px;
        background: var(--tab-active);
        border-radius: 0 0 3px 3px;
    }
}

@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
    .carousel { min-height: 200px; padding: 20px; }
    .carousel h2 { font-size: 1.2rem; }
    .carousel p  { display: none; }
    .carousel .cta { margin-top: 12px; padding: 8px 18px; }
    .app-content { padding-bottom: 80px; }
}

@media (min-width: 1400px) {
    .app-shell { max-width: 1360px; }
    .carousel { min-height: 360px; padding: 50px; }
    .carousel h2 { font-size: 2.4rem; }
    .scheme-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 22px;
    }
}

/* ===================================================== */
/*                   DARK MODE                           */
/* ===================================================== */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1120;
        --bg-card: #1e293b;
        --bg-shell: #0f172a;

        --text: #f8fafc;
        --text-body: #e2e8f0;
        --text-muted: #cbd5e1;
        --text-invert: #ffffff;

        --border: #334155;
        --border-strong: #475569;

        --primary: #60a5fa;
        --primary-light: #93c5fd;
        --primary-dark: #3b82f6;

        --filter-bg: rgba(30, 41, 59, 0.92);
        --titlebar-bg: #1e293b;
        --titlebar-border: #334155;
        --titlebar-text: #cbd5e1;

        --input-bg: #1e293b;
        --input-border: #475569;
        --input-text: #f1f5f9;
        --input-placeholder: #94a3b8;

        --count-bg: #334155;
        --count-text: #e2e8f0;

        --cat-tag-bg: #334155;
        --cat-tag-text: #e2e8f0;

        --provider-bg: linear-gradient(135deg, #1e3a8a, #1e40af);
        --provider-text: #dbeafe;

        --thumb-bg: linear-gradient(135deg, #1e3a8a, #4c1d95);
        --hero-bg: linear-gradient(135deg, #1e3a8a, #4c1d95);

        --list-border: #334155;
        --list-check-bg: linear-gradient(135deg, #064e3b, #065f46);
        --list-check-text: #6ee7b7;

        --back-hover-bg: #1e293b;

        --tabbar-bg: rgba(15, 23, 42, 0.98);
        --tabbar-border: #334155;
        --tab-inactive: #94a3b8;
        --tab-active: #93c5fd;

        --spinner-border: #334155;
        --spinner-top: #93c5fd;

        --cta-bg: #f8fafc;
        --cta-text: #1e40af;
    }

    html, body {
        background: #0b1120 !important;
        color: #f8fafc !important;
    }

    .app-shell {
        background: #0f172a !important;
        box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8), 0 0 0 1px #1e293b;
    }

    /* Force card text bright */
    .scheme-card,
    .scheme-card h3,
    .detail-card,
    .detail-card h1,
    .detail-card h2,
    .detail-card .desc,
    .detail-card ul li,
    .detail-card .meta,
    .section-title,
    .back-btn {
        color: #f8fafc !important;
    }

    .scheme-card .desc,
    .detail-card .meta {
        color: #cbd5e1 !important;
    }

    .detail-card .desc,
    .detail-card ul li {
        color: #e2e8f0 !important;
    }

    .scheme-card:hover {
        border-color: #475569;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    }

    .btn { color: #fff !important; }
    .btn-gray { color: #f1f5f9 !important; }

    .carousel h2,
    .carousel p,
    .brand,
    .brand-text,
    .brand-icon { color: #fff !important; }

    .carousel .badge { color: #422006 !important; }

    .search-ico { color: #cbd5e1 !important; opacity: 0.9; }

    .filter-bar select option {
        background: #1e293b;
        color: #f1f5f9;
    }

    .no-results,
    .loading { color: #cbd5e1 !important; }
}