/* =========================================================
   BIPBOOP — DESIGN SYSTEM
   ========================================================= */

:root {

    /* Background */

    --color-background: #0f1115;
    --color-surface: #16191f;
    --color-surface-hover: #1d2129;

    /* Borders */

    --color-border: #2a2f38;
    --color-border-hover: #3a414c;

    /* Text */

    --color-text: #ebebeb;
    --color-text-secondary: #c0c0c0;
    --color-text-muted: #8f959e;

    /* Brand */

    --color-orange: #ff6700;
    --color-blue: #004e98;
    --color-blue-light: #3a6ea5;

    /* Layout */

    --topbar-height: 64px;
    --sidebar-width: 230px;
    --content-width: 1180px;

    /* Radius */

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;

    /* Animation */

    --transition: 150ms ease;

}


html[data-theme="light"] {
    --color-background: #f3f4f6;
    --color-surface: #ffffff;
    --color-surface-hover: #f0f2f5;
    --color-border: #d8dce2;
    --color-border-hover: #b9c0c9;
    --color-text: #20242a;
    --color-text-secondary: #505964;
    --color-text-muted: #747e8a;
    --color-blue: #1769aa;
    --color-blue-light: #2e7dbb;
    color-scheme: light;
}


/* =========================================================
   RESET
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}


html {
    min-height: 100%;

    background:
        var(--color-background);

    color-scheme: dark;
}


body {
    min-height: 100vh;

    margin: 0;

    background:
        var(--color-background);

    color:
        var(--color-text);

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    font-size: 16px;

    line-height: 1.5;

    -webkit-font-smoothing: antialiased;
}


a {
    color: inherit;
}


button,
input,
textarea,
select {
    font: inherit;
}


/* =========================================================
   ACCESSIBILITY
   ========================================================= */

:focus-visible {

    outline:
        2px solid var(--color-orange);

    outline-offset:
        3px;

}


::selection {

    background:
        var(--color-orange);

    color:
        #ffffff;

}


@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {

        scroll-behavior:
            auto !important;

        animation:
            none !important;

        transition:
            none !important;

    }

}


/* =========================================================
   TYPOGRAPHY
   ========================================================= */

h1,
h2,
h3 {

    margin-top: 0;

    color:
        var(--color-text);

    line-height: 1.25;

}


h1 {

    margin-bottom:
        10px;

    font-size:
        clamp(1.75rem, 4vw, 2.25rem);

    font-weight:
        650;

    letter-spacing:
        -0.02em;

}


h2 {

    margin-bottom:
        0;

    font-size:
        1.15rem;

    font-weight:
        600;

}


h3 {

    margin-bottom:
        8px;

    font-size:
        1rem;

    font-weight:
        600;

}


p {
    margin-top: 0;
}


/* =========================================================
   TOP BAR
   ========================================================= */

.topbar {

    position:
        sticky;

    top:
        0;

    z-index:
        100;

    height:
        var(--topbar-height);

    background:
        var(--color-surface);

    border-bottom:
        1px solid var(--color-border);

}


.topbar-inner {

    width:
        min(
            calc(100% - 40px),
            var(--content-width)
        );

    height:
        100%;

    margin:
        0 auto;

    display:
        flex;

    align-items:
        center;

    justify-content:
        space-between;

}


.brand {

    color:
        var(--color-text);

    font-size:
        0.9rem;

    font-weight:
        700;

    letter-spacing:
        0.12em;

    text-decoration:
        none;

}


.topbar-account-name {

    color:
        var(--color-text-secondary);

    font-size:
        0.875rem;

}


/* =========================================================
   APPLICATION LAYOUT
   ========================================================= */

.app-layout {

    display:
        flex;

    min-height:
        calc(
            100vh - var(--topbar-height)
        );

}


/* =========================================================
   SIDEBAR
   ========================================================= */

.navigation {

    width:
        var(--sidebar-width);

    flex-shrink:
        0;

    padding:
        24px 12px;

    display:
        flex;

    flex-direction:
        column;

    justify-content:
        space-between;

    background:
        var(--color-surface);

    border-right:
        1px solid var(--color-border);

}


.navigation-desktop {

    display:
        flex;

    flex-direction:
        column;

    gap:
        4px;

}


.navigation-desktop-bottom {

    display:
        flex;

    flex-direction:
        column;

}


.navigation-link {

    min-height:
        42px;

    padding:
        9px 12px;

    display:
        flex;

    align-items:
        center;

    gap:
        10px;

    color:
        var(--color-text-secondary);

    border-radius:
        var(--radius-sm);

    font-size:
        0.875rem;

    text-decoration:
        none;

    transition:
        color var(--transition),
        background var(--transition);

}


.navigation-link:hover {

    background:
        var(--color-surface-hover);

    color:
        var(--color-text);

}


.navigation-link.active {

    background:
        rgba(255, 103, 0, 0.08);

    color:
        var(--color-text);

}


.navigation-link.active
.navigation-link-icon {

    color:
        var(--color-orange);

}


.navigation-link-icon {

    width:
        18px;

    height:
        18px;

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

    color:
        var(--color-text-muted);

}


.navigation-link-icon svg {

    width:
        18px;

    height:
        18px;

    fill:
        currentColor;

}


/* =========================================================
   MOBILE NAVIGATION
   ========================================================= */

.mobile-navigation {

    display:
        none;

}


/* =========================================================
   MAIN
   ========================================================= */

.main-content {

    width:
        min(
            100%,
            var(--content-width)
        );

    flex:
        1;

    margin:
        0 auto;

    padding:
        48px 40px 72px;

}


/* =========================================================
   PAGE HEADER
   ========================================================= */

.page-header {

    padding-bottom:
        36px;

    border-bottom:
        1px solid var(--color-border);

}


.eyebrow {

    margin-bottom:
        10px;

    color:
        var(--color-orange);

    font-size:
        0.72rem;

    font-weight:
        650;

    letter-spacing:
        0.1em;

    text-transform:
        uppercase;

}


.page-description {

    margin:
        0;

    color:
        var(--color-text-secondary);

}


/* =========================================================
   SECTION
   ========================================================= */

.content-section {

    padding-top:
        34px;

}


.section-header {

    margin-bottom:
        16px;

}


/* =========================================================
   TOOL CARDS
   ========================================================= */

.tools-grid {

    display:
        grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(260px, 1fr)
        );

    gap:
        12px;

}


.tool-card {

    min-height:
        150px;

    padding:
        20px;

    display:
        flex;

    flex-direction:
        column;

    justify-content:
        space-between;

    background:
        var(--color-surface);

    border:
        1px solid var(--color-border);

    border-radius:
        var(--radius-md);

    text-decoration:
        none;

    transition:
        background var(--transition),
        border-color var(--transition);

}


.tool-card:hover {

    background:
        var(--color-surface-hover);

    border-color:
        var(--color-border-hover);

}


.tool-card:focus-visible {

    border-color:
        var(--color-orange);

}


.tool-card-content p {

    margin:
        0;

    color:
        var(--color-text-muted);

    font-size:
        0.875rem;

}


.tool-card-action {

    margin-top:
        24px;

    color:
        var(--color-orange);

    font-size:
        0.825rem;

    font-weight:
        600;

}


/* =========================================================
   FOOTER
   ========================================================= */

.footer {

    border-top:
        1px solid var(--color-border);

}


.footer-inner {

    width:
        min(
            calc(100% - 40px),
            var(--content-width)
        );

    min-height:
        60px;

    margin:
        0 auto;

    display:
        flex;

    align-items:
        center;

    color:
        var(--color-text-muted);

    font-size:
        0.75rem;

}


/* =========================================================
   LOGIN
   ========================================================= */

.login-page {

    min-height:
        100vh;

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

    padding:
        24px;

}


.login-card {

    width:
        min(
            100%,
            400px
        );

    padding:
        36px;

    background:
        var(--color-surface);

    border:
        1px solid var(--color-border);

    border-radius:
        var(--radius-lg);

}


.login-brand {

    margin-bottom:
        32px;

}


.login-brand-name {

    color:
        var(--color-text);

    font-size:
        0.9rem;

    font-weight:
        700;

    letter-spacing:
        0.12em;

}


.login-card h1 {

    margin-bottom:
        10px;

}


.login-card-description {

    margin-bottom:
        28px;

    color:
        var(--color-text-secondary);

    font-size:
        0.9rem;

}


/* =========================================================
   BUTTONS
   ========================================================= */

.button {

    min-height:
        44px;

    padding:
        10px 16px;

    display:
        inline-flex;

    align-items:
        center;

    justify-content:
        center;

    border:
        1px solid transparent;

    border-radius:
        var(--radius-sm);

    font:
        inherit;

    font-size:
        0.9rem;

    font-weight:
        600;

    text-decoration:
        none;

    cursor:
        pointer;

    transition:
        background var(--transition),
        border-color var(--transition);

}


.button-primary {

    background:
        var(--color-blue);

    color:
        #ffffff;

}


.button-primary:hover {

    background:
        var(--color-blue-light);

}


.login-card .button {

    width:
        100%;

}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 700px) {

    :root {

        --topbar-height:
            56px;

    }


    .topbar-inner {

        width:
            calc(100% - 24px);

    }


    .topbar-account-name {

        max-width:
            150px;

        overflow:
            hidden;

        text-overflow:
            ellipsis;

        white-space:
            nowrap;

    }


    .navigation {

        display:
            none;

    }


    .app-layout {

        display:
            block;

        min-height:
            calc(
                100vh - var(--topbar-height)
            );

    }


    .main-content {

        width:
            100%;

        padding:
            32px 16px 96px;

    }


    .mobile-navigation {

        position:
            fixed;

        left:
            0;

        right:
            0;

        bottom:
            0;

        z-index:
            100;

        height:
            68px;

        padding:
            8px 16px;

        display:
            flex;

        align-items:
            stretch;

        justify-content:
            center;

        gap:
            8px;

        background:
            var(--color-surface);

        border-top:
            1px solid var(--color-border);

        padding-bottom:
            calc(
                8px +
                env(safe-area-inset-bottom)
            );

    }


    .mobile-navigation-link {

        min-width:
            90px;

        display:
            flex;

        flex-direction:
            column;

        align-items:
            center;

        justify-content:
            center;

        gap:
            3px;

        color:
            var(--color-text-muted);

        border-radius:
            var(--radius-sm);

        font-size:
            0.7rem;

        text-decoration:
            none;

    }


    .mobile-navigation-link svg {

        width:
            18px;

        height:
            18px;

        fill:
            currentColor;

    }


    .mobile-navigation-link.active {

        color:
            var(--color-orange);

        background:
            rgba(
                255,
                103,
                0,
                0.08
            );

    }


    .page-header {

        padding-bottom:
            28px;

    }


    .content-section {

        padding-top:
            28px;

    }


    .tools-grid {

        grid-template-columns:
            1fr;

    }


    .tool-card {

        min-height:
            140px;

    }


    .footer {

        display:
            none;

    }


    .login-card {

        padding:
            28px 24px;

    }

}

.topbar-account-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: block;
    object-fit: cover;
    background: var(--color-surface-hover);
    border: 1px solid var(--color-border);
    border-radius: 50%;
}

.topbar-mobile-tools-button {
    display: none;
}

.tool-card-icon {
    display: none;
}


/* =========================================================
   MOVIE TOOL
   ========================================================= */

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.page-header-with-action { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-header-with-action .page-description { margin-bottom: 0; }
.movie-tool-navigation { display: flex; gap: 4px; margin-top: 20px; border-bottom: 1px solid var(--color-border); }
.movie-tool-link { position: relative; padding: 11px 14px; color: var(--color-text-muted); border-radius: var(--radius-sm) var(--radius-sm) 0 0; font-size: 0.85rem; font-weight: 600; text-decoration: none; transition: color var(--transition), background var(--transition); }
.movie-tool-link:hover { color: var(--color-text); background: var(--color-surface); }
.movie-tool-link.active { color: var(--color-text); }
.movie-tool-link.active::after { content: ""; position: absolute; right: 10px; bottom: -1px; left: 10px; height: 2px; background: var(--color-orange); }
.movie-filter { display: flex; align-items: center; gap: 7px; margin-top: 18px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }
.movie-filter-label { flex: none; color: var(--color-text-muted); font-size: 0.78rem; }
.movie-filter-chip { flex: none; padding: 7px 11px; color: var(--color-text-muted); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 999px; font-size: 0.76rem; font-weight: 600; text-decoration: none; }
.movie-filter-chip:hover { color: var(--color-text); border-color: var(--color-border-hover); }
.movie-filter-chip.active { color: #fff; background: var(--color-blue); border-color: var(--color-blue); }
.movie-search { display: flex; gap: 10px; max-width: 720px; }
.search-input { min-width: 0; min-height: 46px; flex: 1; padding: 10px 14px; color: var(--color-text); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.search-input::placeholder { color: var(--color-text-muted); }
.search-input:focus { border-color: var(--color-orange); outline: none; }
.media-search-field { position: relative; min-width: 0; flex: 1; }
.media-search-field .search-input { width: 100%; }
.media-search-suggestions { position: absolute; z-index: 110; top: calc(100% + 8px); right: 0; left: 0; max-height: min(440px, 65vh); padding: 7px; overflow-y: auto; background: color-mix(in srgb, var(--color-surface) 97%, transparent); border: 1px solid var(--color-border); border-radius: 15px; box-shadow: 0 20px 45px var(--color-shadow); backdrop-filter: blur(18px); }
.media-search-suggestions[hidden] { display: none; }
.media-suggestion-item { display: flex; align-items: center; gap: 11px; min-height: 66px; padding: 7px; color: var(--color-text); background: transparent; border-radius: 10px; text-decoration: none; }
.media-suggestion-item:hover,
.media-suggestion-item.active { background: var(--color-surface-hover); }
.media-suggestion-poster { display: grid; width: 36px; height: 54px; flex: 0 0 36px; overflow: hidden; color: var(--color-orange); background: var(--color-background); border: 1px solid var(--color-border); border-radius: 7px; font-size: 0.85rem; font-weight: 700; place-items: center; }
.media-suggestion-poster img { width: 100%; height: 100%; display: block; object-fit: cover; }
.media-suggestion-item > span:last-child { min-width: 0; display: grid; gap: 4px; }
.media-suggestion-item strong { overflow: hidden; font-size: 0.86rem; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.media-suggestion-item small { color: var(--color-text-muted); font-size: 0.72rem; }
.media-suggestion-status { margin: 0; padding: 15px 12px; color: var(--color-text-muted); font-size: 0.8rem; text-align: center; }
.search-result-header { margin-top: 36px; }
.movie-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.movie-card { position: relative; min-width: 0; overflow: hidden; display: block; color: var(--color-text); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); text-decoration: none; transition: transform var(--transition), border-color var(--transition), background var(--transition); }
.movie-card:hover { transform: translateY(-2px); background: var(--color-surface-hover); border-color: var(--color-border-hover); }
.movie-poster-wrap { aspect-ratio: 2 / 3; overflow: hidden; background: #0a0c0f; }
.movie-poster,
.movie-detail-poster { width: 100%; height: 100%; display: block; object-fit: cover; }
.movie-poster { transition: transform 250ms ease; }
.movie-card:hover .movie-poster { transform: scale(1.025); }
.movie-poster-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; color: var(--color-text-muted); background: linear-gradient(145deg, #191c23, #101217); font-size: 0.8rem; text-align: center; }
.movie-card-body { padding: 14px; }
.movie-card-body h2 { margin-bottom: 5px; font-size: 0.95rem; }
.movie-card-body p { margin: 0; color: var(--color-text-muted); font-size: 0.78rem; }
.movie-card-main { display: block; color: inherit; text-decoration: none; }
.streaming-providers { min-height: 28px; margin-top: 9px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.streaming-provider { width: 28px; height: 28px; overflow: hidden; display: block; flex: none; background: #fff; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 7px; }
.streaming-provider img { width: 100%; height: 100%; display: block; object-fit: cover; }
.movie-added-by { margin-top: 7px !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.movie-user-label { max-width: 100%; margin-top: 9px; padding: 4px 8px; display: inline-block; overflow: hidden; color: #ffd3b5; background: rgba(255, 103, 0, 0.12); border: 1px solid rgba(255, 103, 0, 0.28); border-radius: 999px; font-size: 0.7rem; font-weight: 650; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.movie-user-label.empty { color: var(--color-text-muted); background: transparent; border-color: var(--color-border); }
.movie-label-editor { padding: 0 10px 8px; }
.movie-label-editor summary,
.movie-detail-label-editor summary { width: fit-content; max-width: 100%; min-height: 34px; display: flex; align-items: center; gap: 6px; color: var(--color-text-muted); list-style: none; cursor: pointer; }
.movie-label-editor summary::-webkit-details-marker,
.movie-detail-label-editor summary::-webkit-details-marker { display: none; }
.movie-label-editor summary .movie-user-label,
.movie-detail-label-editor summary .movie-user-label { margin-top: 0; }
.movie-label-editor summary svg,
.movie-detail-label-editor summary svg { width: 15px; height: 15px; flex: none; fill: currentColor; }
.movie-label-editor summary:hover,
.movie-detail-label-editor summary:hover { color: var(--color-orange); }
.movie-label-editor[open] summary,
.movie-detail-label-editor[open] summary { margin-bottom: 7px; }
.movie-label-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; padding: 0 10px 8px; }
.movie-label-editor .movie-label-form { padding: 0; }
.movie-user-select { min-width: 0; min-height: 38px; padding: 7px 30px 7px 9px; color: var(--color-text); background: var(--color-background); border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: 0.76rem; }
.movie-label-form button { min-width: 42px; min-height: 38px; padding: 6px 9px; color: var(--color-text); background: var(--color-surface-hover); border: 1px solid var(--color-border); border-radius: var(--radius-sm); font: inherit; font-size: 0.74rem; font-weight: 650; cursor: pointer; }
.watchlist-card { display: flex; flex-direction: column; }
.watchlist-card .movie-card-main { flex: 1; }
.movie-card-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; padding: 0 10px 10px; }
.movie-card-actions form { min-width: 0; }
.movie-card-actions button { width: 100%; min-height: 38px; padding: 7px 9px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font: inherit; font-size: 0.75rem; font-weight: 600; cursor: pointer; }
.movie-card-action-primary { color: #fff; background: var(--color-blue); }
.movie-card-action-primary:hover { background: var(--color-blue-light); }
.movie-card-action-remove { color: var(--color-text-muted); background: transparent; }
.movie-card-action-remove:hover { color: #ffc4c4; background: rgba(190, 55, 55, 0.12); border-color: rgba(190, 55, 55, 0.4); }
.watchlist-remove { position: absolute; top: 8px; right: 8px; }
.watchlist-remove button { padding: 6px 9px; color: #fff; background: rgba(15, 17, 21, 0.88); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: var(--radius-sm); font-size: 0.72rem; cursor: pointer; }
.watchlist-remove button:hover { background: #a93131; }
.notice { margin-bottom: 24px; padding: 13px 15px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: 0.9rem; }
.notice-error { color: #ffc4c4; background: rgba(190, 55, 55, 0.12); border-color: rgba(190, 55, 55, 0.4); }
.notice-success { color: #bde8c8; background: rgba(49, 145, 77, 0.12); border-color: rgba(49, 145, 77, 0.4); }
.empty-state { padding: 56px 24px; color: var(--color-text-secondary); background: var(--color-surface); border: 1px dashed var(--color-border); border-radius: var(--radius-md); text-align: center; }
.empty-state h2 { margin-bottom: 8px; }
.empty-state p { margin-bottom: 22px; }
.movie-detail { position: relative; }
.movie-backdrop { position: absolute; z-index: -1; top: 0; left: -40px; width: calc(100% + 80px); height: 380px; background-position: center 20%; background-repeat: no-repeat; background-size: cover; opacity: 0.36; }
.movie-detail-layout { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 42px; padding-top: 92px; }
.movie-detail-poster-wrap { aspect-ratio: 2 / 3; overflow: hidden; align-self: start; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35); }
.movie-detail-content { padding-top: 30px; }
.movie-tagline { color: var(--color-text-secondary); font-style: italic; }
.movie-facts { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--color-text-secondary); font-size: 0.88rem; }
.movie-facts span + span::before { content: "•"; margin-right: 18px; color: var(--color-orange); }
.movie-actions { min-height: 44px; margin: 28px 0 34px; display: flex; flex-wrap: wrap; gap: 10px; }
.movie-add-form { display: grid; grid-template-columns: minmax(150px, 210px) auto; gap: 8px 10px; }
.movie-add-form label { grid-column: 1 / -1; color: var(--color-text-secondary); font-size: 0.8rem; }
.movie-add-form label span { color: var(--color-text-muted); }
.movie-detail-label-editor { max-width: 420px; margin: -14px 0 30px; }
.movie-detail-label-form { max-width: 420px; margin: 0; }
.movie-detail-label-form > label { display: block; margin-bottom: 7px; color: var(--color-text-secondary); font-size: 0.8rem; font-weight: 600; }
.movie-detail-label-form > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.movie-detail-label-form .movie-user-select { min-height: 44px; }
.button-secondary { color: var(--color-text); background: var(--color-surface); border-color: var(--color-border); }
.button-secondary:hover { background: var(--color-surface-hover); border-color: var(--color-border-hover); }
.button-success { color: #bde8c8; background: rgba(49, 145, 77, 0.18); border-color: rgba(49, 145, 77, 0.4); cursor: default; }
.movie-info-section { margin-top: 28px; }
.movie-info-section p { color: var(--color-text-secondary); }
.streaming-detail-intro { margin-bottom: 12px; font-size: 0.86rem; }
.streaming-detail-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 9px; }
.streaming-detail-service { min-width: 0; padding: 9px; display: flex; align-items: center; gap: 10px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.streaming-detail-service > img,
.streaming-detail-placeholder { width: 44px; height: 44px; flex: none; border-radius: 9px; }
.streaming-detail-service > img { display: block; object-fit: cover; background: #fff; }
.streaming-detail-placeholder { display: flex; align-items: center; justify-content: center; color: var(--color-text); background: var(--color-surface-hover); font-weight: 700; }
.streaming-detail-service > span:last-child { min-width: 0; display: grid; gap: 3px; }
.streaming-detail-service strong { overflow: hidden; font-size: 0.84rem; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.streaming-detail-service small { color: var(--color-text-muted); font-size: 0.68rem; line-height: 1.25; }
.streaming-detail-link { width: fit-content; margin-top: 12px; display: inline-block; color: var(--color-orange); font-size: 0.76rem; text-decoration: none; }
.streaming-detail-link:hover { text-decoration: underline; }
.streaming-detail-empty { margin: 0; color: var(--color-text-muted) !important; font-size: 0.86rem; }
.movie-metadata { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 28px 0; }
.movie-metadata div { padding: 14px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.movie-metadata dt { color: var(--color-text-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
.movie-metadata dd { margin: 4px 0 0; }
.cast-list { display: flex; flex-wrap: wrap; gap: 8px; }
.cast-list > span { padding: 8px 10px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: 0.82rem; }
.cast-list small { display: block; color: var(--color-text-muted); font-size: 0.7rem; }
.text-link { color: var(--color-orange); }
.tmdb-attribution { margin: 40px 0 0; color: var(--color-text-muted); font-size: 0.7rem; }

@media (max-width: 700px) {
    .mobile-navigation-link { min-width: 62px; }
    .page-header-with-action { align-items: flex-start; flex-direction: column; }
    .movie-search { align-items: stretch; flex-direction: column; }
    .movie-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .movie-card-body { padding: 11px; }
    .movie-backdrop { left: -16px; width: calc(100% + 32px); height: 260px; }
    .movie-detail-layout { grid-template-columns: 112px minmax(0, 1fr); gap: 18px; padding-top: 52px; }
    .movie-detail-content { display: contents; }
    .movie-detail-content h1 { font-size: 1.55rem; }
    .movie-detail-content .eyebrow,
    .movie-tagline { display: none; }
    .movie-facts { gap: 4px 10px; }
    .movie-facts span { display: block; width: 100%; }
    .movie-facts span + span::before { content: none; }
    .movie-detail-content > .eyebrow,
    .movie-detail-content > h1,
    .movie-detail-content > .movie-tagline,
    .movie-detail-content > .movie-facts { grid-column: 2; }
    .movie-actions,
    .movie-info-section,
    .movie-metadata { grid-column: 1 / -1; }
    .movie-actions { margin: 18px 0 8px; }
    .movie-metadata { grid-template-columns: 1fr; margin: 16px 0; }
}


/* =========================================================
   MOVIE TOOL — MOBILE FIRST OVERRIDES
   ========================================================= */

@media (max-width: 700px) {
    body {
        overflow-x: hidden;
    }

    .main-content {
        padding: 24px 14px calc(92px + env(safe-area-inset-bottom));
    }

    .mobile-navigation {
        height: calc(68px + env(safe-area-inset-bottom));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-left: max(12px, env(safe-area-inset-left));
    }

    .mobile-navigation-link {
        min-width: 0;
        flex: 1;
        max-width: 120px;
        min-height: 48px;
    }

    .page-header {
        padding-bottom: 22px;
    }

    .page-header h1 {
        margin-bottom: 7px;
        font-size: clamp(1.65rem, 8vw, 2rem);
    }

    .page-description {
        font-size: 0.9rem;
    }

    .movie-tool-navigation {
        position: sticky;
        top: var(--topbar-height);
        z-index: 90;
        margin: 0 -14px;
        padding: 8px 14px 0;
        gap: 0;
        background: rgba(15, 17, 21, 0.96);
        backdrop-filter: blur(10px);
    }

    .movie-filter {
        margin-right: -14px;
        margin-left: -14px;
        padding-right: 14px;
        padding-bottom: 6px;
        padding-left: 14px;
    }

    .movie-filter-label {
        display: none;
    }

    .movie-filter-chip {
        min-height: 38px;
        display: inline-flex;
        align-items: center;
    }

    .movie-tool-link {
        min-height: 44px;
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px 8px;
        text-align: center;
    }

    .content-section {
        padding-top: 22px;
    }

    .movie-search {
        gap: 9px;
    }

    .search-input,
    .movie-search .button {
        width: 100%;
        min-height: 48px;
    }

    .search-input {
        font-size: 16px;
    }

    .search-result-header {
        margin-top: 28px;
    }

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

    .movie-card {
        border-radius: 7px;
    }

    .movie-card:hover {
        transform: none;
    }

    .movie-card-body {
        min-width: 0;
        padding: 10px;
    }

    .movie-card-body h2 {
        display: -webkit-box;
        overflow: hidden;
        margin-bottom: 4px;
        font-size: 0.88rem;
        line-height: 1.3;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .movie-added-by {
        font-size: 0.7rem !important;
    }

    .streaming-providers {
        min-height: 26px;
        margin-top: 7px;
        gap: 5px;
    }

    .streaming-provider {
        width: 26px;
        height: 26px;
        border-radius: 6px;
    }

    .movie-card-actions {
        grid-template-columns: 1fr;
        gap: 5px;
        padding: 0 8px 8px;
    }

    .movie-label-form {
        padding: 0 8px 6px;
    }

    .movie-label-editor {
        padding: 0 8px 7px;
    }

    .movie-label-editor summary,
    .movie-detail-label-editor summary {
        min-height: 40px;
    }

    .movie-label-editor .movie-label-form {
        padding: 0;
    }

    .movie-user-select,
    .movie-label-form button {
        min-height: 40px;
    }

    .movie-card-actions button {
        min-height: 40px;
        padding: 6px;
        font-size: 0.7rem;
    }

    .watchlist-remove {
        top: 6px;
        right: 6px;
    }

    .watchlist-remove button {
        min-width: 44px;
        min-height: 40px;
        padding: 7px 9px;
        border-radius: 7px;
    }

    .empty-state {
        padding: 38px 18px;
    }

    .empty-state .button {
        width: 100%;
    }

    .movie-detail {
        min-width: 0;
    }

    .movie-backdrop {
        left: -14px;
        width: calc(100% + 28px);
        height: 230px;
        opacity: 0.28;
    }

    .movie-detail-layout {
        display: flex;
        flex-direction: column;
        gap: 22px;
        padding-top: 34px;
    }

    .movie-detail-poster-wrap {
        width: min(48vw, 180px);
        margin: 0 auto;
        flex: none;
        border-radius: 9px;
    }

    .movie-detail-content {
        display: block;
        min-width: 0;
        padding-top: 0;
    }

    .movie-detail-content .eyebrow {
        display: block;
        margin-bottom: 7px;
        text-align: center;
    }

    .movie-detail-content h1 {
        margin-bottom: 8px;
        font-size: clamp(1.55rem, 8vw, 2rem);
        overflow-wrap: anywhere;
        text-align: center;
    }

    .movie-tagline {
        display: block;
        margin-bottom: 12px;
        font-size: 0.86rem;
        text-align: center;
    }

    .movie-facts {
        justify-content: center;
        gap: 6px 14px;
        text-align: center;
    }

    .movie-facts span {
        display: inline;
        width: auto;
    }

    .movie-facts span + span::before {
        content: "•";
        margin-right: 14px;
    }

    .movie-actions {
        display: grid;
        grid-template-columns: 1fr;
        margin: 22px 0 28px;
    }

    .movie-actions form,
    .movie-actions .button,
    .movie-actions form .button {
        width: 100%;
    }

    .movie-actions .button {
        min-height: 48px;
    }

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

    .movie-add-form label {
        grid-column: auto;
    }

    .movie-add-form .movie-user-select {
        width: 100%;
        min-height: 48px;
        font-size: 16px;
    }

    .movie-detail-label-editor {
        max-width: none;
        margin: -8px 0 28px;
    }

    .movie-detail-label-form {
        max-width: none;
        margin: 0;
    }

    .movie-detail-label-form > div {
        grid-template-columns: 1fr;
    }

    .movie-detail-label-form .movie-user-select,
    .movie-detail-label-form .button {
        width: 100%;
        min-height: 48px;
    }

    .movie-info-section {
        margin-top: 24px;
    }

    .movie-info-section h2 {
        margin-bottom: 10px;
    }

    .movie-info-section p {
        font-size: 0.94rem;
        line-height: 1.65;
    }

    .streaming-detail-list {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .streaming-detail-service {
        padding: 8px;
    }

    .streaming-detail-service > img,
    .streaming-detail-placeholder {
        width: 42px;
        height: 42px;
    }

    .movie-metadata {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin: 22px 0;
    }

    .movie-metadata div {
        min-width: 0;
        padding: 12px;
    }

    .movie-metadata dd {
        overflow-wrap: anywhere;
        font-size: 0.88rem;
    }

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

    .cast-list > span {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .tmdb-attribution {
        margin-top: 30px;
        padding-bottom: 4px;
        line-height: 1.45;
        text-align: center;
    }
}

@media (max-width: 360px) {
    .main-content {
        padding-right: 10px;
        padding-left: 10px;
    }

    .movie-tool-navigation {
        margin-right: -10px;
        margin-left: -10px;
        padding-right: 10px;
        padding-left: 10px;
    }

    .movie-grid {
        gap: 8px;
    }

    .movie-card-body {
        padding: 8px;
    }

    .movie-card-body h2 {
        font-size: 0.82rem;
    }

    .movie-detail-poster-wrap {
        width: min(54vw, 170px);
    }

    .movie-metadata,
    .cast-list {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   DESKTOP TOP NAVIGATION
   ========================================================= */

@media (min-width: 701px) {
    .topbar-inner {
        width: 100%;
        max-width: none;
        padding: 0 28px;
        display: grid;
        grid-template-columns: minmax(170px, 1fr) auto minmax(170px, 1fr);
        gap: 24px;
    }

    .brand {
        justify-self: start;
    }

    .topbar-navigation {
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }

    .topbar-navigation-link {
        position: relative;
        min-height: 40px;
        padding: 10px 14px;
        display: inline-flex;
        align-items: center;
        color: var(--color-text-muted);
        border-radius: var(--radius-sm);
        font-size: 0.86rem;
        font-weight: 600;
        text-decoration: none;
        transition: color var(--transition), background var(--transition);
    }

    .topbar-navigation-link:hover {
        color: var(--color-text);
        background: var(--color-surface-hover);
    }

    .topbar-navigation-link.active {
        color: var(--color-text);
    }

    .topbar-navigation-link.active::after {
        content: "";
        position: absolute;
        right: 14px;
        bottom: -12px;
        left: 14px;
        height: 2px;
        background: var(--color-orange);
    }

    .topbar-account {
        min-width: 0;
        justify-self: end;
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .topbar-logout-button {
        width: 38px;
        height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: var(--color-text-muted);
        border-radius: var(--radius-sm);
        text-decoration: none;
        transition: color var(--transition), background var(--transition);
    }

    .topbar-logout-button:hover {
        color: var(--color-text);
        background: var(--color-surface-hover);
    }

    .topbar-logout-button svg {
        width: 19px;
        height: 19px;
        fill: currentColor;
    }

    .navigation {
        display: none;
    }

    .app-layout {
        display: block;
    }

    .main-content {
        width: min(calc(100% - 64px), var(--content-width));
        padding-right: 0;
        padding-left: 0;
    }
}

@media (max-width: 700px) {
    .topbar-navigation {
        display: none;
    }
}


/* =========================================================
   ACCOUNT SETTINGS
   ========================================================= */

.topbar-account { display: flex; align-items: center; gap: 8px; }
.topbar-icon-button { width: 38px; height: 38px; padding: 0; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--color-text-muted); background: transparent; border: 0; border-radius: var(--radius-sm); text-decoration: none; cursor: pointer; transition: color var(--transition), background var(--transition); }
.topbar-icon-button:hover,
.topbar-icon-button[aria-expanded="true"] { color: var(--color-text); background: var(--color-surface-hover); }
.topbar-icon-button svg { width: 19px; height: 19px; fill: currentColor; }
.topbar-settings { position: relative; }
.settings-panel { position: fixed; top: calc(var(--topbar-height) + 8px); right: 28px; z-index: 300; width: min(340px, calc(100vw - 24px)); padding: 20px; color: var(--color-text); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28); }
.settings-panel[hidden] { display: none !important; }
.settings-panel header { margin-bottom: 18px; }
.settings-panel header p { margin: 0 0 3px; color: var(--color-orange); font-size: 0.68rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; }
.settings-panel header h2 { font-size: 1.2rem; }
.settings-profile-summary { margin-bottom: 12px; padding: 12px; display: flex; align-items: center; gap: 11px; background: var(--color-background); border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.settings-profile-summary img { width: 42px; height: 42px; flex: 0 0 42px; display: block; object-fit: cover; border: 1px solid var(--color-border); border-radius: 50%; }
.settings-profile-summary > div { min-width: 0; }
.settings-profile-summary strong,
.settings-profile-summary small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-profile-summary strong { color: var(--color-text); font-size: 0.86rem; }
.settings-profile-summary small { margin-top: 2px; color: var(--color-text-muted); font-size: 0.7rem; }
.settings-account-info,
.settings-theme-row { padding: 12px; background: var(--color-background); border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.settings-account-info { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-account-info span { color: var(--color-text-muted); font-size: 0.75rem; }
.settings-account-info code { min-width: 0; overflow: hidden; color: var(--color-text-secondary); font-size: 0.72rem; text-overflow: ellipsis; }
.settings-theme-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-theme-row strong,
.settings-theme-row small { display: block; }
.settings-theme-row strong { font-size: 0.82rem; }
.settings-theme-row small { margin-top: 2px; color: var(--color-text-muted); font-size: 0.68rem; }
.theme-toggle { min-height: 40px; padding: 5px 7px; display: flex; align-items: center; gap: 7px; color: var(--color-text-secondary); background: transparent; border: 0; border-radius: var(--radius-sm); font: inherit; font-size: 0.7rem; cursor: pointer; }
.theme-toggle-track { width: 38px; height: 22px; padding: 3px; display: block; background: var(--color-border-hover); border-radius: 999px; }
.theme-toggle-track i { width: 16px; height: 16px; display: block; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.28); transition: transform var(--transition); }
.theme-toggle[aria-checked="true"] .theme-toggle-track { background: var(--color-blue); }
.theme-toggle[aria-checked="true"] .theme-toggle-track i { transform: translateX(16px); }

@media (max-width: 700px) {
    .topbar-account { gap: 2px; }
    .topbar-account-name { max-width: 92px; font-size: 0.78rem; }
    .topbar-icon-button { width: 38px; height: 38px; }
    .settings-panel { top: calc(var(--topbar-height) + 6px); right: 12px; padding: 17px; }
}

@media (max-width: 360px) {
    .topbar-account-name { max-width: 70px; }
    .brand { font-size: 0.8rem; }
}


/* =========================================================
   NOTES
   ========================================================= */

.note-color-yellow { --note-color: #e7bc43; --note-tint: rgba(231, 188, 67, 0.10); }
.note-color-coral { --note-color: #ec7665; --note-tint: rgba(236, 118, 101, 0.10); }
.note-color-blue { --note-color: #579ad6; --note-tint: rgba(87, 154, 214, 0.10); }
.note-color-green { --note-color: #66b57a; --note-tint: rgba(102, 181, 122, 0.10); }
.note-color-purple { --note-color: #a680d1; --note-tint: rgba(166, 128, 209, 0.10); }
.note-color-gray { --note-color: #8f959e; --note-tint: rgba(143, 149, 158, 0.10); }

.note-add-button {
    width: 48px;
    height: 48px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--color-blue);
    border-radius: 50%;
    box-shadow: 0 8px 24px rgba(0, 78, 152, 0.28);
    font-size: 1.75rem;
    font-weight: 300;
    line-height: 1;
    text-decoration: none;
    transition: background var(--transition), transform var(--transition);
}

.note-add-button:hover { background: var(--color-blue-light); transform: translateY(-1px); }

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.note-card {
    position: relative;
    aspect-ratio: 1;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color: var(--color-text);
    background: linear-gradient(145deg, var(--note-tint), transparent 70%), var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.note-card:hover {
    transform: translateY(-3px);
    border-color: var(--note-color);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

.note-card-accent {
    height: 7px;
    flex: none;
    background: var(--note-color);
}

.note-card-content {
    min-height: 0;
    flex: 1;
    padding: 18px 18px 8px;
    overflow: hidden;
}

.note-card-content h2 {
    display: -webkit-box;
    overflow: hidden;
    margin-bottom: 12px;
    font-size: 1rem;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.note-card-content p {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 0.86rem;
    line-height: 1.55;
    white-space: pre-line;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 6;
}

.note-card-progress {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.note-card-progress > span {
    height: 5px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
}

.note-card-progress i {
    height: 100%;
    display: block;
    background: var(--note-color);
    border-radius: inherit;
}

.note-card-progress small {
    color: var(--color-text-muted);
    font-size: 0.65rem;
}

.note-card-footer {
    padding: 10px 18px 15px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: var(--color-text-muted);
    font-size: 0.66rem;
}

.note-card-footer span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-editor-header {
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

.note-back-link {
    min-height: 42px;
    padding: 8px 10px 8px 6px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--color-text-secondary);
    border-radius: var(--radius-sm);
    text-decoration: none;
}

.note-back-link:hover { color: var(--color-text); background: var(--color-surface); }
.note-back-link svg { width: 20px; height: 20px; fill: currentColor; }

.note-editor {
    position: relative;
    max-width: 900px;
    min-height: 640px;
    margin: 0 auto;
    padding: 28px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(145deg, var(--note-tint), transparent 55%), var(--color-surface);
    border: 1px solid var(--color-border);
    border-top: 7px solid var(--note-color);
    border-radius: var(--radius-lg);
}

.note-color-picker {
    margin: 0 0 20px;
    padding: 0;
    display: flex;
    gap: 9px;
    border: 0;
}

.note-color-picker legend {
    margin-bottom: 9px;
    color: var(--color-text-muted);
    font-size: 0.72rem;
}

.note-color-option { position: relative; display: block; cursor: pointer; }
.note-color-option input { position: absolute; opacity: 0; pointer-events: none; }
.note-color-option > span[aria-hidden] { width: 32px; height: 32px; display: block; background: var(--note-color); border: 3px solid transparent; border-radius: 50%; box-shadow: 0 0 0 1px rgba(255,255,255,.12); transition: transform var(--transition), border-color var(--transition); }
.note-color-option input:checked + span { border-color: #fff; transform: scale(1.08); }
.note-color-option input:focus-visible + span { outline: 2px solid var(--color-orange); outline-offset: 3px; }

.note-title-input,
.note-content-input {
    width: 100%;
    color: var(--color-text);
    background: transparent;
    border: 0;
    outline: 0;
}

.note-checklist {
    margin: 8px 0 26px;
    padding-top: 22px;
    border-top: 1px solid var(--color-border);
}

.note-checklist-header {
    margin-bottom: 12px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
}

.note-checklist-header h2 {
    margin-bottom: 3px;
    font-size: 1rem;
}

.note-checklist-header p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.72rem;
}

.note-item-add {
    min-height: 40px;
    padding: 8px 11px;
    flex: none;
    color: var(--color-text);
    background: var(--color-surface-hover);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.note-checklist-items {
    display: grid;
    gap: 7px;
}

.note-checklist-item {
    min-width: 0;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 38px;
    align-items: center;
    gap: 6px;
    padding: 5px 6px;
    background: rgba(15, 17, 21, 0.45);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.note-item-checkbox {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.note-item-checkbox input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.note-item-checkbox span {
    width: 21px;
    height: 21px;
    display: block;
    border: 2px solid var(--color-text-muted);
    border-radius: 5px;
    transition: background var(--transition), border-color var(--transition);
}

.note-item-checkbox input:checked + span {
    position: relative;
    background: var(--note-color);
    border-color: var(--note-color);
}

.note-item-checkbox input:checked + span::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.note-item-checkbox input:focus-visible + span {
    outline: 2px solid var(--color-orange);
    outline-offset: 3px;
}

.note-item-checkbox input:disabled + span { opacity: 0.55; }

.note-item-text {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 7px 5px;
    color: var(--color-text);
    background: transparent;
    border: 0;
    border-bottom: 1px solid transparent;
    outline: 0;
    font: inherit;
    font-size: 0.9rem;
}

.note-item-text:focus { border-bottom-color: var(--note-color); }
.note-checklist-item.completed .note-item-text { color: var(--color-text-muted); text-decoration: line-through; }

.note-item-remove {
    width: 36px;
    height: 36px;
    padding: 0;
    color: var(--color-text-muted);
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
    cursor: pointer;
}

.note-item-remove:hover { color: #ffc4c4; background: rgba(190, 55, 55, 0.12); }
.note-title-input {
    padding: 8px 0 16px;
    border-bottom: 1px solid var(--color-border);
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 650;
}

.note-title-input::placeholder,
.note-content-input::placeholder { color: var(--color-text-muted); }

.note-content-input {
    min-height: 360px;
    flex: 1;
    padding: 22px 0;
    resize: vertical;
    font-size: 1rem;
    line-height: 1.7;
}

.note-editor-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.note-autosave-status {
    margin-right: auto;
    color: var(--color-text-muted);
    font-size: 0.78rem;
}

.note-autosave-status[data-state="saved"] { color: #91d4a4; }
.note-autosave-status[data-state="error"] { color: #ffaaaa; }
.note-editor.autosave-enabled [data-note-manual-save] { display: none; }

.button-danger {
    color: #ffc4c4;
    background: rgba(190, 55, 55, 0.12);
    border-color: rgba(190, 55, 55, 0.35);
}

.button-danger:hover { background: rgba(190, 55, 55, 0.22); }

@media (max-width: 700px) {
    .note-add-button {
        position: fixed;
        right: 16px;
        bottom: calc(84px + env(safe-area-inset-bottom));
        z-index: 95;
        width: 56px;
        height: 56px;
        box-shadow: 0 10px 30px rgba(0, 78, 152, 0.42);
    }

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

    .note-card { border-radius: 7px; }
    .note-card:hover { transform: none; }
    .note-card-accent { height: 6px; }
    .note-card-content { padding: 12px 11px 5px; }
    .note-card-content h2 { margin-bottom: 8px; font-size: 0.9rem; -webkit-line-clamp: 2; }
    .note-card-content p { font-size: 0.76rem; line-height: 1.45; -webkit-line-clamp: 4; }
    .note-card-progress { margin-top: 9px; gap: 6px; }
    .note-card-footer { padding: 7px 11px 10px; display: block; font-size: 0.6rem; }
    .note-card-footer span { display: block; }
    .notes-empty-state .button { width: 100%; }

    .note-editor-header { margin-bottom: 10px; }
    .note-editor-header > span { display: none; }

    .note-editor {
        min-height: calc(100dvh - var(--topbar-height) - 116px);
        margin: 0 -14px;
        padding: 20px 16px;
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }

    .note-color-picker { margin-bottom: 14px; gap: 10px; overflow-x: auto; padding: 3px; }
    .note-color-option > span[aria-hidden] { width: 34px; height: 34px; }
    .note-title-input { font-size: 1.55rem; }
    .note-content-input { min-height: 45vh; padding-top: 18px; font-size: 16px; }
    .note-checklist { margin-bottom: 18px; padding-top: 18px; }
    .note-checklist-header { align-items: stretch; flex-direction: column; gap: 10px; }
    .note-item-add { width: 100%; min-height: 44px; }
    .note-checklist-item { grid-template-columns: 38px minmax(0, 1fr) 40px; gap: 3px; padding: 4px; }
    .note-item-checkbox { width: 38px; height: 42px; }
    .note-item-text { min-height: 42px; padding-right: 3px; padding-left: 3px; font-size: 16px; }
    .note-item-remove { width: 40px; height: 42px; }
    .note-editor-actions { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); padding-top: 12px; background: linear-gradient(transparent, var(--color-surface) 30%); }
    .note-editor-actions .button-primary { flex: 1; }
    .note-editor-actions .button { min-height: 48px; }
}

@media (max-width: 350px) {
    .notes-grid { gap: 8px; }
    .note-card-content { padding: 10px 9px 4px; }
    .note-card-content p { -webkit-line-clamp: 3; }
    .note-card-footer { padding: 6px 9px 8px; }
}


/* =========================================================
   MOBILE TOOLS MENU
   ========================================================= */

.mobile-tools-overlay,
.mobile-tools-sheet {
    display: none;
}

@media (max-width: 700px) {
    body.mobile-tools-open {
        overflow: hidden;
    }

    .mobile-navigation {
        justify-content: center;
        gap: 0;
    }

    .mobile-navigation-link {
        width: 92px;
        max-width: 92px;
        flex: 0 0 92px;
    }

    .mobile-tools-menu-button {
        padding: 0;
        font: inherit;
        background: transparent;
        border: 0;
        cursor: pointer;
    }

    .mobile-tools-menu-button[aria-expanded="true"] {
        color: var(--color-orange);
        background: rgba(255, 103, 0, 0.08);
    }

    .mobile-tools-overlay {
        position: fixed;
        top: 0;
        right: 0;
        bottom: calc(68px + env(safe-area-inset-bottom));
        left: 0;
        z-index: 180;
        display: block;
        background: rgba(0, 0, 0, 0.62);
        opacity: 0;
        transition: opacity 180ms ease;
    }

    .mobile-tools-overlay.open {
        opacity: 1;
    }

    .mobile-tools-sheet {
        position: fixed;
        right: 0;
        bottom: calc(68px + env(safe-area-inset-bottom));
        left: 0;
        z-index: 190;
        max-height: min(68vh, 520px);
        display: block;
        overflow-y: auto;
        padding: 18px max(16px, env(safe-area-inset-right)) 20px max(16px, env(safe-area-inset-left));
        background: var(--color-surface);
        border-top: 1px solid var(--color-border);
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.42);
        transform: translateY(105%);
        transition: transform 180ms ease;
    }

    .mobile-tools-sheet.open {
        transform: translateY(0);
    }

    .mobile-tools-overlay[hidden],
    .mobile-tools-sheet[hidden] {
        display: none !important;
    }

    .mobile-tools-header {
        margin-bottom: 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
    }

    .mobile-tools-header p {
        margin: 0 0 2px;
        color: var(--color-text-muted);
        font-size: 0.7rem;
        letter-spacing: 0.06em;
        text-transform: uppercase;
    }

    .mobile-tools-header h2 {
        font-size: 1.25rem;
    }

    .mobile-tools-header button {
        width: 44px;
        height: 44px;
        flex: none;
        color: var(--color-text-secondary);
        background: var(--color-surface-hover);
        border: 1px solid var(--color-border);
        border-radius: 50%;
        font: inherit;
        font-size: 1.4rem;
        cursor: pointer;
    }

    .mobile-tools-list {
        display: grid;
        gap: 8px;
    }

    .mobile-tool-item {
        min-height: 68px;
        padding: 11px 13px;
        display: flex;
        align-items: center;
        gap: 13px;
        color: var(--color-text-secondary);
        background: var(--color-background);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        text-decoration: none;
    }

    .mobile-tool-item.active {
        color: var(--color-text);
        background: rgba(255, 103, 0, 0.07);
        border-color: rgba(255, 103, 0, 0.35);
    }

    .mobile-tool-icon {
        width: 42px;
        height: 42px;
        flex: none;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--color-text-muted);
        background: var(--color-surface);
        border-radius: var(--radius-sm);
    }

    .mobile-tool-item.active .mobile-tool-icon {
        color: var(--color-orange);
    }

    .mobile-tool-icon svg {
        width: 21px;
        height: 21px;
        fill: currentColor;
    }

    .mobile-tool-item > span:last-child {
        min-width: 0;
    }

    .mobile-tool-item strong,
    .mobile-tool-item small {
        display: block;
    }

    .mobile-tool-item strong {
        font-size: 0.9rem;
    }

    .mobile-tool-item small {
        margin-top: 2px;
        color: var(--color-text-muted);
        font-size: 0.72rem;
    }
}


/* =========================================================
   LIGHT THEME ADJUSTMENTS
   ========================================================= */

html[data-theme="light"] .movie-poster-placeholder {
    background: linear-gradient(145deg, #e4e7eb, #f7f8fa);
}

html[data-theme="light"] .note-checklist-item {
    background: rgba(255, 255, 255, 0.62);
}

html[data-theme="light"] .note-card-progress > span {
    background: rgba(32, 36, 42, 0.10);
}

html[data-theme="light"] .mobile-tool-icon {
    background: #e9edf2;
}

html[data-theme="light"] .mobile-tools-overlay {
    background: rgba(32, 36, 42, 0.42);
}

@media (max-width: 700px) {
    html[data-theme="light"] .movie-tool-navigation {
        background: rgba(243, 244, 246, 0.96);
    }
}


/* =========================================================
   COSY REFRESH — START
   Bloc visuel isolé pour permettre un retour facile en arrière.
   ========================================================= */

:root {
    --color-background: #090909;
    --color-surface: #111111;
    --color-surface-hover: #191919;
    --color-border: #292929;
    --color-border-hover: #3d3d3d;
    --color-text: #f0f2f4;
    --color-text-secondary: #b7bdc5;
    --color-text-muted: #7f8792;
    --color-orange: #e16b32;
    --color-blue: #285c75;
    --color-blue-light: #36748f;
    --color-glow: rgba(37, 91, 128, 0.11);
    --color-shadow: rgba(0, 0, 0, 0.36);
    --radius-sm: 10px;
    --radius-md: 15px;
    --radius-lg: 20px;
    --transition: 180ms ease;
}

html[data-theme="light"] {
    --color-background: #f5f0e8;
    --color-surface: #fffaf2;
    --color-surface-hover: #f0e8dc;
    --color-border: #ded2c2;
    --color-border-hover: #c6b6a2;
    --color-text: #302a25;
    --color-text-secondary: #5f574e;
    --color-text-muted: #83786c;
    --color-orange: #bf6848;
    --color-blue: #587160;
    --color-blue-light: #6f8977;
    --color-glow: rgba(191, 104, 72, 0.08);
    --color-shadow: rgba(76, 58, 39, 0.10);
}

body {
    background:
        radial-gradient(circle at 8% 0%, var(--color-glow), transparent 30rem),
        var(--color-background);
    letter-spacing: 0.002em;
}

html:not([data-theme="light"]) .tool-card {
    background: var(--color-surface);
}

html:not([data-theme="light"]) .topbar {
    background: color-mix(in srgb, #0f0f10 95%, transparent);
}

h1 { font-weight: 620; letter-spacing: -0.025em; }
h2,
h3 { font-weight: 620; }

.topbar {
    background: color-mix(in srgb, var(--color-surface) 92%, transparent);
    border-bottom-color: color-mix(in srgb, var(--color-border) 80%, transparent);
    box-shadow: 0 5px 24px var(--color-shadow);
    backdrop-filter: blur(16px);
}

.brand {
    color: var(--color-orange);
    letter-spacing: 0.16em;
}

.topbar-navigation-link,
.navigation-link,
.mobile-navigation-link {
    font-weight: 580;
}

.topbar-navigation-link.active::after,
.movie-tool-link.active::after {
    border-radius: 999px;
}

.main-content {
    animation: cosy-content-in 240ms ease both;
}

@keyframes cosy-content-in {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    border-bottom-color: color-mix(in srgb, var(--color-border) 80%, transparent);
}

.eyebrow {
    color: var(--color-orange);
    letter-spacing: 0.13em;
}

.tool-card,
.movie-card,
.empty-state,
.movie-metadata div,
.cast-list > span,
.login-card {
    border-color: color-mix(in srgb, var(--color-border) 88%, transparent);
    box-shadow: 0 8px 24px var(--color-shadow);
}

.tool-card {
    min-height: 160px;
    padding: 22px;
    background:
        linear-gradient(145deg, color-mix(in srgb, var(--color-orange) 4%, transparent), transparent 55%),
        var(--color-surface);
}

.tool-card:hover,
.movie-card:hover {
    border-color: color-mix(in srgb, var(--color-orange) 48%, var(--color-border));
    box-shadow: 0 13px 30px var(--color-shadow);
}

.tool-card-action,
.text-link {
    color: var(--color-orange);
}

.button {
    border-radius: 11px;
}

.button-primary {
    background: var(--color-blue);
    box-shadow: 0 5px 14px color-mix(in srgb, var(--color-blue) 22%, transparent);
}

.button-primary:hover { background: var(--color-blue-light); }

.search-input,
.movie-user-select {
    background: color-mix(in srgb, var(--color-surface) 88%, var(--color-background));
    border-color: var(--color-border);
}

.movie-tool-navigation {
    border-bottom-color: var(--color-border);
}

.movie-tool-link {
    border-radius: 10px 10px 0 0;
}

.movie-filter-chip {
    background: var(--color-surface);
    border-color: var(--color-border);
}

.movie-filter-chip.active {
    background: var(--color-blue);
    border-color: var(--color-blue);
}

.movie-card {
    background: var(--color-surface);
}

.movie-user-label {
    color: color-mix(in srgb, var(--color-orange) 72%, var(--color-text));
    background: color-mix(in srgb, var(--color-orange) 12%, transparent);
    border-color: color-mix(in srgb, var(--color-orange) 32%, transparent);
}

.notice {
    border-radius: 12px;
}

.note-card {
    border-color: color-mix(in srgb, var(--note-color) 24%, var(--color-border));
    box-shadow: 0 8px 24px var(--color-shadow);
}

.note-card-accent {
    height: 6px;
    opacity: 0.88;
}

.note-editor {
    box-shadow: 0 18px 45px var(--color-shadow);
}

.note-checklist-item {
    background: color-mix(in srgb, var(--color-surface) 78%, var(--color-background));
}

.settings-panel,
.mobile-tools-sheet {
    box-shadow: 0 20px 50px var(--color-shadow);
}

.settings-account-info,
.settings-theme-row,
.mobile-tool-item {
    background: color-mix(in srgb, var(--color-surface) 72%, var(--color-background));
}

.footer {
    border-top-color: color-mix(in srgb, var(--color-border) 70%, transparent);
}

html[data-theme="light"] .movie-poster-placeholder {
    background: linear-gradient(145deg, #e9dfd1, #faf6ef);
}

html[data-theme="light"] .mobile-tool-icon {
    background: #eee6da;
}

@media (max-width: 700px) {
    :root { --topbar-height: 58px; }

    .topbar-inner {
        width: calc(100% - 20px);
    }

    .main-content {
        padding-top: 26px;
        padding-bottom: calc(96px + env(safe-area-inset-bottom));
    }

    .mobile-navigation {
        right: 12px;
        bottom: max(8px, env(safe-area-inset-bottom));
        left: 12px;
        height: 62px;
        padding: 6px;
        background: color-mix(in srgb, var(--color-surface) 94%, transparent);
        border: 1px solid var(--color-border);
        border-radius: 19px;
        box-shadow: 0 10px 28px var(--color-shadow);
        backdrop-filter: blur(16px);
    }

    .mobile-navigation-link {
        min-height: 48px;
        border-radius: 14px;
    }

    .mobile-tools-overlay {
        bottom: calc(78px + env(safe-area-inset-bottom));
    }

    .mobile-tools-sheet {
        right: 12px;
        bottom: calc(78px + env(safe-area-inset-bottom));
        left: 12px;
        border: 1px solid var(--color-border);
        border-radius: 19px;
    }

    .movie-tool-navigation {
        background: color-mix(in srgb, var(--color-background) 94%, transparent);
        backdrop-filter: blur(14px);
    }

    html[data-theme="light"] .movie-tool-navigation {
        background: color-mix(in srgb, var(--color-background) 94%, transparent);
    }

    .note-add-button {
        bottom: calc(84px + env(safe-area-inset-bottom));
        background: var(--color-blue);
    }

    .notes-grid {
        gap: 12px;
    }

    .note-card,
    .movie-card {
        border-radius: 13px;
    }

    .settings-panel {
        border-radius: 17px;
        box-shadow: 0 18px 45px var(--color-shadow);
    }
}

@media (prefers-reduced-motion: reduce) {
    .main-content { animation: none; }
}

/* Shopping list */

.shopping-app { display: grid; gap: 34px; }
.shopping-search-card { position: relative; z-index: 20; max-width: 720px; }
.shopping-search-row { display: flex; align-items: center; min-height: 58px; padding: 0 10px 0 18px; background: color-mix(in srgb, var(--color-surface) 94%, var(--color-background)); border: 1px solid var(--color-border); border-radius: 16px; box-shadow: 0 10px 26px var(--color-shadow); }
.shopping-search-icon { display: grid; width: 24px; height: 24px; margin-right: 11px; color: var(--color-text-muted); place-items: center; }
.shopping-search-icon svg,
.shopping-product-edit svg { width: 100%; fill: currentColor; }
.shopping-search-input { min-width: 0; flex: 1; padding: 16px 0; color: var(--color-text); background: transparent; border: 0; outline: 0; font: inherit; font-size: 1rem; }
.shopping-search-input::placeholder { color: var(--color-text-muted); }
.shopping-search-input::-webkit-search-cancel-button { display: none; }
.shopping-search-clear { width: 38px; height: 38px; color: var(--color-text-muted); background: transparent; border: 0; border-radius: 10px; font-size: 1.45rem; cursor: pointer; }
.shopping-suggestions { position: absolute; top: calc(100% + 8px); right: 0; left: 0; max-height: min(420px, 60vh); padding: 7px; overflow-y: auto; background: color-mix(in srgb, var(--color-surface) 97%, transparent); border: 1px solid var(--color-border); border-radius: 16px; box-shadow: 0 20px 45px var(--color-shadow); backdrop-filter: blur(18px); }
.shopping-suggestion { display: flex; width: 100%; align-items: center; gap: 12px; padding: 9px 10px; color: var(--color-text); text-align: left; background: transparent; border: 0; border-radius: 11px; cursor: pointer; }
.shopping-suggestion:hover,
.shopping-suggestion:focus-visible { background: var(--color-surface-hover); outline: 0; }
.shopping-suggestion-visual { display: grid; width: 42px; height: 42px; flex: 0 0 42px; background: color-mix(in srgb, var(--color-orange) 10%, var(--color-surface)); border: 1px solid color-mix(in srgb, var(--color-orange) 18%, var(--color-border)); border-radius: 12px; font-size: 1.35rem; place-items: center; }
.shopping-suggestion-visual.has-initial { color: var(--color-orange); font-size: 1rem; font-weight: 700; }
.shopping-suggestion > span:last-child { display: grid; gap: 2px; }
.shopping-suggestion strong { font-size: 0.9rem; }
.shopping-suggestion small { color: var(--color-text-muted); font-size: 0.74rem; }
.shopping-section { display: grid; gap: 18px; }
.shopping-section-header { display: flex; min-height: 46px; align-items: end; justify-content: space-between; gap: 18px; }
.shopping-section-header .eyebrow { margin-bottom: 5px; }
.shopping-section-header h2 { margin: 0; font-size: 1.22rem; }
.shopping-section-header > p { margin: 0 0 2px; color: var(--color-text-muted); font-size: 0.78rem; }
.shopping-gesture-hint { display: block; margin-top: 5px; color: var(--color-text-muted); font-size: 0.72rem; font-weight: 400; }
.shopping-count-badge { display: grid; min-width: 30px; height: 30px; padding: 0 8px; color: color-mix(in srgb, var(--color-orange) 80%, var(--color-text)); background: color-mix(in srgb, var(--color-orange) 11%, transparent); border: 1px solid color-mix(in srgb, var(--color-orange) 25%, transparent); border-radius: 999px; font-size: 0.8rem; font-weight: 700; place-items: center; }
.shopping-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.shopping-product-card { position: relative; min-width: 0; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 15px; box-shadow: 0 7px 20px var(--color-shadow); overflow: hidden; transition: transform var(--transition), opacity var(--transition), border-color var(--transition); }
.shopping-product-card:hover { border-color: color-mix(in srgb, var(--color-orange) 38%, var(--color-border)); }
.shopping-product-card-needed { background: color-mix(in srgb, #b9363e 19%, var(--color-surface)); border-color: color-mix(in srgb, #d64b55 48%, var(--color-border)); }
.shopping-product-card-needed:hover { border-color: color-mix(in srgb, #ef646d 72%, var(--color-border)); }
.shopping-product-card-needed .shopping-product-visual { background: color-mix(in srgb, #c43e48 17%, var(--color-background)); border-color: color-mix(in srgb, #e0525c 36%, var(--color-border)); }
.shopping-product-card-needed .shopping-product-edit { background: color-mix(in srgb, #8c2933 18%, var(--color-surface)); }
.shopping-product-card.is-leaving { opacity: 0; transform: scale(0.92); }
.shopping-product-card form { height: 100%; }
.shopping-product-main { display: grid; width: 100%; min-height: 142px; height: 100%; grid-template-rows: auto 1fr; align-content: start; justify-items: center; gap: 11px; padding: 15px; color: var(--color-text); text-align: center; background: transparent; border: 0; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-touch-callout: none; }
.shopping-product-main:focus-visible { outline: 2px solid var(--color-orange); outline-offset: -3px; }
.shopping-product-visual { display: grid; width: 64px; height: 64px; background: color-mix(in srgb, var(--color-orange) 9%, var(--color-background)); border: 1px solid color-mix(in srgb, var(--color-orange) 17%, var(--color-border)); border-radius: 17px; font-size: 2.05rem; place-items: center; }
.shopping-product-visual.has-initial { color: var(--color-orange); font-size: 1.55rem; font-weight: 750; }
.shopping-product-copy { display: grid; width: 100%; min-width: 0; align-content: end; justify-items: center; gap: 4px; align-self: stretch; text-align: center; }
.shopping-product-copy strong,
.shopping-product-copy small { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.shopping-product-copy strong { font-size: 0.92rem; line-height: 1.25; }
.shopping-product-copy small { color: var(--color-orange); font-size: 0.74rem; line-height: 1.25; white-space: nowrap; }
.shopping-product-check,
.shopping-product-add { position: absolute; top: 14px; right: 14px; display: grid; width: 26px; height: 26px; color: var(--color-text-muted); border: 1px solid var(--color-border); border-radius: 50%; font-size: 0.8rem; opacity: 0; place-items: center; transition: opacity var(--transition), color var(--transition), border-color var(--transition); }
.shopping-product-card:hover .shopping-product-check,
.shopping-product-card:hover .shopping-product-add { opacity: 1; }
.shopping-product-edit { position: absolute; right: 8px; bottom: 7px; width: 34px; height: 34px; padding: 9px; color: var(--color-text-muted); background: var(--color-surface); border: 0; border-radius: 9px; cursor: pointer; }
.shopping-product-edit:hover { color: var(--color-orange); background: var(--color-surface-hover); }
.shopping-recent-section { padding-top: 6px; border-top: 1px solid color-mix(in srgb, var(--color-border) 65%, transparent); }
.shopping-product-card-recent { background: color-mix(in srgb, var(--color-surface) 68%, var(--color-background)); box-shadow: none; }
.shopping-product-card-recent .shopping-product-main { min-height: 116px; opacity: 0.7; }
.shopping-product-card-recent:hover .shopping-product-main { opacity: 1; }
.shopping-product-card-recent .shopping-product-visual { width: 56px; height: 56px; font-size: 1.75rem; filter: saturate(0.72); }
.shopping-product-card-recent .shopping-product-visual.has-initial { font-size: 1.35rem; }
.shopping-recent-remove-form { position: absolute; top: 5px; right: 5px; height: auto !important; }
.shopping-recent-remove-form button { display: grid; width: 30px; height: 30px; color: var(--color-text-muted); background: transparent; border: 0; border-radius: 8px; font-size: 1.15rem; cursor: pointer; opacity: 0; place-items: center; }
.shopping-product-card-recent:hover .shopping-recent-remove-form button,
.shopping-recent-remove-form button:focus { opacity: 1; }
.shopping-empty { display: grid; min-height: 190px; align-content: center; justify-items: center; padding: 28px; color: var(--color-text-muted); text-align: center; background: color-mix(in srgb, var(--color-surface) 65%, transparent); border: 1px dashed var(--color-border); border-radius: 16px; }
.shopping-empty.is-hidden { display: none; }
.shopping-empty > span { display: grid; width: 48px; height: 48px; margin-bottom: 12px; color: var(--color-orange); border: 1px solid color-mix(in srgb, var(--color-orange) 35%, var(--color-border)); border-radius: 50%; place-items: center; }
.shopping-empty h3 { margin: 0 0 5px; color: var(--color-text); font-size: 1rem; }
.shopping-empty p { margin: 0; font-size: 0.82rem; }
body.shopping-dialog-open { overflow: hidden; }
.page-shopping .main-content { animation: none; transform: none; }
.shopping-dialog-backdrop { position: fixed; z-index: 210; inset: 0; background: rgba(0, 0, 0, 0.62); opacity: 0; backdrop-filter: blur(4px); transition: opacity var(--transition); }
.shopping-dialog-backdrop.open { opacity: 1; }
.shopping-dialog { position: fixed; z-index: 220; top: 50%; left: 50%; width: min(440px, calc(100% - 28px)); padding: 22px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 20px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55); opacity: 0; transform: translate(-50%, calc(-50% + 10px)) scale(0.98); transition: opacity var(--transition), transform var(--transition); }
.shopping-dialog.open { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.shopping-dialog[hidden],
.shopping-dialog-backdrop[hidden] { display: none; }
.shopping-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.shopping-dialog-product { display: flex; align-items: center; gap: 13px; min-width: 0; }
.shopping-dialog-product p { margin: 0 0 3px; color: var(--color-text-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; }
.shopping-dialog-product h2 { margin: 0; overflow: hidden; font-size: 1.12rem; text-overflow: ellipsis; white-space: nowrap; }
.shopping-dialog-header > button { width: 36px; height: 36px; flex: 0 0 36px; color: var(--color-text-muted); background: var(--color-surface-hover); border: 0; border-radius: 10px; font-size: 1.35rem; cursor: pointer; }
.shopping-dialog form { display: grid; gap: 10px; }
.shopping-dialog label { font-size: 0.82rem; font-weight: 600; }
.shopping-dialog label span { color: var(--color-text-muted); font-size: 0.72rem; font-weight: 400; }
.shopping-dialog input[type="text"] { width: 100%; padding: 13px 14px; color: var(--color-text); background: var(--color-background); border: 1px solid var(--color-border); border-radius: 11px; outline: 0; font: inherit; }
.shopping-dialog input[type="text"]:focus { border-color: var(--color-orange); }
.shopping-dialog-submit { width: 100%; margin-top: 8px; }
html[data-theme="light"] .shopping-product-card,
html[data-theme="light"] .shopping-dialog { background: var(--color-surface); }
html[data-theme="light"] .shopping-product-card-needed { background: #f9e3e3; border-color: #dea8aa; }
html[data-theme="light"] .shopping-product-card-needed .shopping-product-visual { background: #f8d8da; border-color: #dea8aa; }
html[data-theme="light"] .shopping-dialog-backdrop { background: rgba(48, 42, 37, 0.42); }

@media (max-width: 900px) {
    .shopping-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
    .shopping-page-header { padding-bottom: 18px; }
    .shopping-app { gap: 28px; padding-bottom: 74px; }
    .shopping-search-card { position: fixed; right: 12px; bottom: calc(78px + env(safe-area-inset-bottom)); left: 12px; z-index: 120; max-width: none; margin: 0; }
    .shopping-search-row { min-height: 54px; border-radius: 14px; }
    .shopping-suggestions { top: auto; bottom: calc(100% + 8px); max-height: min(390px, calc(100vh - 230px)); }
    .shopping-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .shopping-product-main { min-height: 118px; padding: 10px; gap: 8px; }
    .shopping-product-visual { width: 58px; height: 58px; border-radius: 15px; font-size: 1.85rem; }
    .shopping-product-visual.has-initial { font-size: 1.45rem; }
    .shopping-product-copy { padding: 0; }
    .shopping-product-copy strong { font-size: 0.78rem; }
    .shopping-product-copy small { font-size: 0.66rem; }
    .shopping-product-check,
    .shopping-product-add { display: none; }
    .shopping-product-edit { display: none; }
    .shopping-product-card-recent .shopping-product-main { min-height: 112px; }
    .shopping-product-card-recent .shopping-product-visual { width: 52px; height: 52px; font-size: 1.65rem; }
    .shopping-product-card-recent .shopping-product-visual.has-initial { font-size: 1.3rem; }
    .shopping-recent-remove-form button { opacity: 0.72; }
    .shopping-section-header > p { max-width: 125px; text-align: right; }
    .shopping-dialog { top: auto; bottom: 0; left: 0; width: 100%; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); border-right: 0; border-bottom: 0; border-left: 0; border-radius: 22px 22px 0 0; transform: translateY(100%); }
    .shopping-dialog.open { transform: translateY(0); }

    .tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .tool-card { min-height: 0; aspect-ratio: 1; padding: 14px; align-items: center; justify-content: center; gap: 12px; text-align: center; }
    .tool-card-icon { display: grid; width: 52px; height: 52px; color: var(--color-orange); background: color-mix(in srgb, var(--color-orange) 10%, var(--color-surface)); border: 1px solid color-mix(in srgb, var(--color-orange) 20%, var(--color-border)); border-radius: 15px; place-items: center; }
    .tool-card-icon svg { width: 25px; height: 25px; fill: currentColor; }
    .tool-card-content h3 { margin: 0; font-size: 0.95rem; }
    .tool-card-content p,
    .tool-card-action { display: none; }
}

@media (max-width: 700px) {
    .dashboard-tools-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    .dashboard-tools-grid .dashboard-tool-card {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 0 !important;
        height: auto !important;
        aspect-ratio: 1 / 1;
        padding: 12px !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 11px !important;
        text-align: center;
    }

    .dashboard-tools-grid .dashboard-tool-icon {
        display: grid !important;
        width: 82px;
        height: 82px;
        flex: 0 0 82px;
        color: var(--color-orange) !important;
        background: color-mix(in srgb, var(--color-orange) 12%, var(--color-surface));
        border: 1px solid color-mix(in srgb, var(--color-orange) 28%, var(--color-border));
        border-radius: 21px;
        place-items: center;
    }

    .dashboard-tools-grid .dashboard-tool-icon svg {
        display: block;
        width: 41px;
        height: 41px;
        color: inherit;
        fill: currentColor !important;
    }

    .dashboard-tools-grid .tool-card-content h3 {
        margin: 0 !important;
        color: var(--color-text);
        font-size: 1.27rem;
    }

    .dashboard-tools-grid .tool-card-content p,
    .dashboard-tools-grid .tool-card-action {
        display: none !important;
    }

    .media-live-search { align-items: stretch; }
    .media-live-search .media-search-field { width: 100%; }
    .media-live-search .button { width: auto; flex: 0 0 auto; }
    .media-search-suggestions { max-height: min(390px, calc(100vh - 220px)); }
}

@media (max-width: 360px) {
    .shopping-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .shopping-product-main { min-height: 112px; padding: 8px; }
    .shopping-product-copy { padding: 0; }
}

@media (max-width: 700px) {
    .topbar-inner {
        position: relative;
    }

    .topbar-mobile-tools-button {
        position: absolute;
        left: 50%;
        display: inline-flex;
        max-width: 108px;
        min-height: 38px;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 7px 8px;
        color: var(--color-orange);
        background: transparent;
        border: 0;
        border-radius: 10px;
        font: inherit;
        font-size: 0.7rem;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        cursor: pointer;
        transform: translateX(-50%);
    }

    .topbar-mobile-tools-button:hover,
    .topbar-mobile-tools-button[aria-expanded="true"] {
        background: color-mix(in srgb, var(--color-orange) 10%, transparent);
    }

    .topbar-mobile-tools-button span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar-mobile-tools-button svg {
        width: 15px;
        height: 15px;
        flex: 0 0 15px;
        fill: currentColor;
        transition: transform var(--transition);
    }

    .topbar-mobile-tools-button[aria-expanded="true"] svg {
        transform: rotate(180deg);
    }

    .topbar-account-name {
        max-width: 58px;
    }

    .topbar-icon-button {
        width: 34px;
        height: 34px;
    }

    .main-content {
        padding-bottom: calc(38px + env(safe-area-inset-bottom));
    }

    .page-header .eyebrow {
        display: none;
    }

    .page-header {
        padding-bottom: 22px;
    }

    .mobile-tools-overlay {
        bottom: 0;
    }

    .mobile-tools-sheet {
        right: 12px;
        bottom: max(12px, env(safe-area-inset-bottom));
        left: 12px;
    }

    .shopping-app {
        padding-bottom: 72px;
    }

    .shopping-search-card {
        bottom: max(12px, env(safe-area-inset-bottom));
    }

    .note-add-button {
        bottom: max(18px, env(safe-area-inset-bottom));
    }

    .page-notes .main-content {
        padding-bottom: calc(88px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 360px) {
    .topbar-account-name {
        display: none;
    }
}

/* Notes refinements */

.notes-grid .note-card {
    background: color-mix(in srgb, var(--note-color) 17%, var(--color-surface));
}

.page-notes .main-content {
    animation: none;
    transform: none;
}

.page-notes .note-editor {
    background: color-mix(in srgb, var(--note-color) 17%, var(--color-surface));
}

.page-notes .note-editor > section.note-content {
    margin: 8px 0 0;
    padding: 0 0 22px;
    border-bottom: 1px solid var(--color-border);
}

.page-notes .note-editor-actions .button,
.page-notes .note-editor-actions .button:hover,
.page-notes .note-editor-actions .button:focus-visible {
    box-shadow: none;
}

.page-notes .note-editor-actions {
    background: none;
}

html[data-theme="light"] .notes-grid .note-card {
    background: color-mix(in srgb, var(--note-color) 20%, var(--color-surface));
}

html[data-theme="light"] .page-notes .note-editor {
    background: color-mix(in srgb, var(--note-color) 20%, var(--color-surface));
}

@media (max-width: 700px) {
    .page-notes .note-add-button {
        position: fixed !important;
        right: 16px;
        bottom: max(18px, env(safe-area-inset-bottom));
        z-index: 120;
        width: 58px;
        height: 58px;
        background: var(--color-blue);
        border: 1px solid color-mix(in srgb, var(--color-blue-light) 55%, transparent);
        box-shadow: 0 12px 32px var(--color-shadow);
    }

    .page-notes .note-editor-actions {
        bottom: env(safe-area-inset-bottom);
    }

    .page-notes .note-editor > section.note-content {
        padding-bottom: 18px;
    }

    .topbar-account-avatar {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
    }

    .topbar-account-name {
        display: none;
    }

    .topbar-icon-button {
        width: 32px;
        height: 32px;
    }
}

/* =========================================================
   COSY REFRESH — END
   ========================================================= */
