/* BookChop — main stylesheet */

/* ── Fonts: served locally, no CDN ── */
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 300 500;
    font-display: swap;
    src: url('/vendor/fonts/dm-sans-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 300 500;
    font-display: swap;
    src: url('/vendor/fonts/dm-sans-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'DM Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/vendor/fonts/dm-mono-400-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'DM Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/vendor/fonts/dm-mono-400-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'DM Mono';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/vendor/fonts/dm-mono-500-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'DM Mono';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/vendor/fonts/dm-mono-500-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Theme tokens ── */
:root {
    --bg:      #f7f5f2;
    --surface: #eeeae3;
    --border:  #d6d0c8;
    --accent:  #1a8c5e;
    --accent2: #1479a0;
    --amber:   #a86820;
    --text:    #1a1816;
    --muted:   #8a8278;
    --danger:  #b02840;
    --price:   #22c55e;
    --radius:  12px;
    /* Condition colours */
    --cond-new-bg: #dcfce7; --cond-new-text: #15803d; --cond-new-border: #86efac;
    --cond-great-bg: #ccfbf1; --cond-great-text: #0f766e; --cond-great-border: #5eead4;
    --cond-acceptable-bg: #dbeafe; --cond-acceptable-text: #1d4ed8; --cond-acceptable-border: #93c5fd;
    --cond-well_used-bg: #fef3c7; --cond-well_used-text: #b45309; --cond-well_used-border: #fcd34d;
    --cond-poor-bg: #ffedd5; --cond-poor-text: #c2410c; --cond-poor-border: #fdba74;
    --cond-damaged-bg: #fee2e2; --cond-damaged-text: #b91c1c; --cond-damaged-border: #fca5a5;
}

html[data-theme="dark"] {
    --bg:      #0d0f12;
    --surface: #151820;
    --border:  #252a35;
    --accent:  #4fffb0;
    --accent2: #00cfff;
    --amber:   #ffc340;
    --text:    #eceef5;
    --muted:   #8a95b0;
    --danger:  #ff4f6a;
    --price:   #4ade80;
    /* Condition colours (dark) */
    --cond-new-bg: #052e16; --cond-new-text: #4ade80; --cond-new-border: #166534;
    --cond-great-bg: #042f2e; --cond-great-text: #2dd4bf; --cond-great-border: #115e59;
    --cond-acceptable-bg: #172554; --cond-acceptable-text: #60a5fa; --cond-acceptable-border: #1e3a8a;
    --cond-well_used-bg: #451a03; --cond-well_used-text: #fbbf24; --cond-well_used-border: #92400e;
    --cond-poor-bg: #431407; --cond-poor-text: #fb923c; --cond-poor-border: #7c2d12;
    --cond-damaged-bg: #450a0a; --cond-damaged-text: #f87171; --cond-damaged-border: #7f1d1d;
}

/* ── Reset / Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 300;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    transition: background .2s ease, color .2s ease;
}

/* ── Layout ── */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem 2rem;
}

@media (max-width: 480px) {
    .container { padding: 1rem; }
}

/* ── Header & Nav ── */
header {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: .75rem;
    margin-bottom: 2rem;
    position: relative;
    gap: .5rem;
    transition: border-color .2s ease;
}

.site-logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    margin-right: auto;
    flex-shrink: 0;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text);
    letter-spacing: -.3px;
}

/* ── Theme toggle ── */
.header-actions {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .2rem .1rem;
    flex-shrink: 0;
    color: var(--muted);
}
.theme-toggle-icon { font-size: .72rem; transition: color .2s; }
.theme-toggle-icon--sun  { color: var(--muted); }
.theme-toggle-icon--moon { color: var(--muted); }
html[data-theme="dark"] .theme-toggle-icon--moon { color: var(--accent); }
html:not([data-theme="dark"]) .theme-toggle-icon--sun  { color: #f59e0b; }

.theme-toggle-track {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--border);
    border-radius: 999px;
    transition: background .22s;
    flex-shrink: 0;
}
html[data-theme="dark"] .theme-toggle-track { background: var(--accent); }

.theme-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform .22s cubic-bezier(.4,0,.2,1), box-shadow .22s;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
html[data-theme="dark"] .theme-toggle-thumb { transform: translateX(16px); }

/* ── Hamburger ── */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    padding: .25rem;
    line-height: 1;
    flex-shrink: 0;
}

.site-nav ul { list-style: none; display: flex; gap: 1.75rem; }

.site-nav a {
    display: flex;
    align-items: center;
    gap: .4rem;
    text-decoration: none;
    color: var(--muted);
    font-size: .9rem;
    font-family: 'DM Sans', sans-serif;
    transition: color .15s;
}
.site-nav a:hover { color: var(--text); }
.site-nav a i { font-size: .9rem; }

/* Home: icon only on desktop */
@media (min-width: 641px) { .nav-home a span { display: none; } }

@media (max-width: 640px) {

    /* ── Hamburger → × ── */
    .nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        width: 40px;
        height: 40px;
        padding: 8px;
        position: relative;
        z-index: 300;
    }

    .nav-toggle span {
        display: block;
        width: 22px;
        height: 2px;
        background: currentColor;
        border-radius: 2px;
        transform-origin: center;
        transition: transform .38s cubic-bezier(.4,0,.2,1),
                    opacity .22s ease,
                    width .32s cubic-bezier(.4,0,.2,1);
    }

    .nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .nav-toggle.open span:nth-child(2) { opacity: 0; width: 0; }
    .nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    /* ── Backdrop ── */
    .nav-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(8,8,8,.93);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        z-index: 200;
        opacity: 0;
        pointer-events: none;
        transition: opacity .38s ease;
    }
    .nav-backdrop.open { opacity: 1; pointer-events: auto; }

    /* ── Full-screen nav overlay ── */
    .site-nav {
        position: fixed;
        inset: 0;
        z-index: 250;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        pointer-events: none;
        opacity: 0;
        transform: translateY(-10px);
        transition: opacity .38s ease, transform .42s cubic-bezier(.4,0,.2,1);
    }
    .site-nav.open { pointer-events: auto; opacity: 1; transform: none; }

    .site-nav ul { flex-direction: column; align-items: center; gap: 0; text-align: center; }

    .site-nav a {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: .55rem;
        color: rgba(255,255,255,.65);
        font-size: 1.75rem;
        letter-spacing: -.3px;
        padding: .55rem 2rem;
        opacity: 0;
        transform: translateY(18px);
        transition: opacity .32s ease, transform .42s cubic-bezier(.4,0,.2,1), color .18s ease;
    }
    .site-nav a i { font-size: 1rem; opacity: .45; margin-top: .1rem; }
    .site-nav a:hover, .site-nav a:focus { color: #fff; outline: none; }
    .site-nav a:hover i, .site-nav a:focus i { opacity: .8; }

    .site-nav.open li:nth-child(1) a { opacity: 1; transform: none; transition-delay: .05s; }
    .site-nav.open li:nth-child(2) a { opacity: 1; transform: none; transition-delay: .10s; }
    .site-nav.open li:nth-child(3) a { opacity: 1; transform: none; transition-delay: .15s; }
    .site-nav.open li:nth-child(4) a { opacity: 1; transform: none; transition-delay: .20s; }
    .site-nav.open li:nth-child(5) a { opacity: 1; transform: none; transition-delay: .25s; }
    .site-nav.open li:nth-child(6) a { opacity: 1; transform: none; transition-delay: .30s; }

    .site-nav li + li { border-top: 1px solid rgba(255,255,255,.07); }

    /* keep toggle button above backdrop */
    .theme-toggle { z-index: 300; }
}

/* ── Footer ── */
.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 3rem;
    padding: 2.5rem 0 1.5rem;
    font-size: .82rem;
    color: var(--muted);
    font-family: 'DM Mono', monospace;
    transition: border-color .2s ease;
}
.footer-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 1.25rem;
}
.footer-cols {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}
.footer-logo {
    height: 28px;
    width: auto;
    margin-bottom: .85rem;
    opacity: .85;
}
.footer-brand p {
    font-size: .78rem;
    line-height: 1.6;
    max-width: 26ch;
}
.footer-col h4 {
    font-size: .65rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text);
    margin-bottom: .75rem;
    font-weight: 500;
}
.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .45rem;
}
.footer-col a {
    color: var(--muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .45rem;
    transition: color .15s;
}
.footer-col a:hover { color: var(--accent); }
.footer-social-icon { font-size: .95rem; }
.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    font-size: .72rem;
}
@media (max-width: 600px) {
    .footer-cols {
        grid-template-columns: 1fr 1fr;
    }
    .footer-brand {
        grid-column: 1 / -1;
    }
}

/* ── Nugget / build log ── */
.nugget {
    background: var(--surface);
    border-left: 3px solid var(--amber);
    padding: 1.25rem 1.5rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 2rem;
    transition: background .2s ease, border-color .2s ease;
}
.nugget h2 {
    font-family: 'DM Mono', monospace;
    font-size: .65rem;
    font-weight: 400;
    color: var(--muted);
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-bottom: .75rem;
}
.nugget p {
    font-size: 1rem;
    line-height: 1.75;
    margin-bottom: .5rem;
}
.nugget small {
    font-family: 'DM Mono', monospace;
    font-size: .68rem;
    color: var(--muted);
}

/* ── Homepage stats ── */
.home-stats { display: flex; gap: 1rem; margin-bottom: 1.75rem; }
.home-stat { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1rem; text-align: center; }
.home-stat-num { display: block; font-size: 2rem; font-weight: 500; font-family: 'DM Mono', monospace; color: var(--accent); line-height: 1.1; }
.home-stat-label { display: block; font-size: .78rem; color: var(--muted); margin-top: .3rem; letter-spacing: .04em; }

/* ── Recently listed ── */
.recent-listed { margin-bottom: 1.75rem; }
.recent-listed h2 { font-family: 'DM Mono', monospace; font-size: .65rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: .75rem; }
.recent-listed ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.recent-listed li { font-size: .9rem; line-height: 1.4; color: var(--text); }
.rs-title { font-weight: 500; }
.rs-author { color: var(--muted); font-size: .85rem; }

/* ── Nav user widget ── */
.nav-user {
    text-decoration: none;
    color: var(--text);
    font-size: .85rem;
    font-weight: 500;
    transition: color .15s;
}
.nav-user:hover { color: var(--accent); }

/* ── Login page ── */
.login-wrap {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2.5rem 0 5rem;
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.25rem 2rem 2rem;
    text-align: center;
}
.login-brand {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 1rem;
    line-height: 1;
}
.login-heading {
    font-size: 1.35rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: .4rem;
}
.login-sub {
    font-size: .85rem;
    color: var(--muted);
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* 2×2 grid of icon-over-text provider cards */
.login-providers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
    margin-bottom: 1.75rem;
}
.provider-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    text-decoration: none;
    padding: 1.25rem .75rem 1.1rem;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    color: var(--muted);
    background: var(--bg);
    transition: border-color .18s, color .18s, transform .12s;
    -webkit-tap-highlight-color: transparent;
}
.provider-btn:hover {
    color: var(--text);
    transform: translateY(-2px);
}
.provider-btn:active { transform: translateY(0); }

.provider-btn i {
    font-size: 1.75rem;
    line-height: 1;
    transition: color .18s;
}
.provider-btn span {
    font-family: 'DM Mono', monospace;
    font-size: .72rem;
    letter-spacing: .04em;
}

/* Brand colours on hover */
.provider-google:hover    i { color: #EA4335; }
.provider-microsoft:hover i { color: #00a4ef; }
.provider-facebook:hover  i { color: #1877F2; }
.provider-discord:hover   i { color: #5865F2; }

/* Border accent on hover */
.provider-google:hover    { border-color: #EA4335; }
.provider-microsoft:hover { border-color: #00a4ef; }
.provider-facebook:hover  { border-color: #1877F2; }
.provider-discord:hover   { border-color: #5865F2; }

.login-terms {
    font-size: .7rem;
    color: var(--muted);
    font-family: 'DM Mono', monospace;
    line-height: 1.6;
}

/* ── Profile page ── */
.profile-wrap {
    display: flex;
    justify-content: center;
    padding: 2rem 0 4rem;
}
.profile-card {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}
.profile-avatar-row {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    margin-bottom: 1.75rem;
}
.profile-name  { font-size: 1.15rem; font-weight: 500; margin-bottom: .2rem; }
.profile-email { font-size: .82rem; color: var(--muted); font-family: 'DM Mono', monospace; }

.profile-meta {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    padding: 1.25rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}
.profile-meta-item { display: flex; align-items: baseline; gap: .75rem; }
.profile-meta-item label {
    font-family: 'DM Mono', monospace;
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    min-width: 100px;
}
.profile-meta-item span { font-size: .88rem; }
.profile-meta-item i { margin-right: .3rem; }

.profile-username { font-family: 'DM Mono', monospace; font-size: .88rem; }
.profile-meta-days { font-family: 'DM Mono', monospace; font-size: .72rem; color: var(--muted); margin-left: .4rem; }

.profile-saved { color: var(--accent); font-size: .85rem; display: flex; align-items: center; gap: .4rem; margin: 0 0 1rem; }

.profile-edit-form { display: flex; flex-direction: column; gap: 1rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.profile-fields-row { display: grid; grid-template-columns: 1fr 148px 1fr; gap: .65rem; align-items: start; }
.profile-edit-field { display: flex; flex-direction: column; gap: .4rem; }
.profile-edit-field label { font-family: 'DM Mono', monospace; font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.profile-edit-field input,
.profile-edit-field select { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: .7rem .9rem; font-size: .95rem; color: var(--text); font-family: inherit; outline: none; transition: border-color .15s; }
.profile-edit-field input:focus,
.profile-edit-field select:focus { border-color: var(--accent); }
.profile-edit-field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .9rem center; padding-right: 2.2rem; }
.profile-save-btn { background: var(--accent); color: var(--bg); border: none; border-radius: 10px; padding: .8rem; font-size: .9rem; font-weight: 500; font-family: inherit; cursor: pointer; transition: opacity .15s; }
.profile-save-btn:hover { opacity: .88; }
.profile-username-cooldown { font-size: .75rem; color: var(--danger); margin: .3rem 0 0; display: flex; align-items: center; gap: .3rem; }
.profile-username-cooldown--ok { color: var(--muted); }
.profile-settings { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.profile-settings-heading { font-family: 'DM Mono', monospace; font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .85rem; }
.profile-settings-row { display: flex; align-items: center; justify-content: space-between; }
.profile-settings-label { font-size: .88rem; }
@media (max-width: 480px) {
    .profile-fields-row { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════
   Page: Scan
   ════════════════════════════════════════ */
body.page-sell {
    --accent:  #1a8c5e;
    --accent2: #0e7490;
    --radius:  12px;
}

body.page-sell header { margin-bottom: 1.5rem; }

body.page-sell main {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 4rem;
    width: 100%;
}

.sell-entry-btns { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; width: 100%; max-width: 520px; }
@media (max-width: 480px) { .sell-entry-btns { grid-template-columns: 1fr; } }
.sell-mode-btn {
    display: flex; align-items: flex-start; gap: .85rem;
    padding: 1.1rem 1.15rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    cursor: pointer; text-decoration: none; color: var(--text);
    text-align: left; transition: border-color .15s, box-shadow .15s;
    -webkit-tap-highlight-color: transparent;
}
.sell-mode-btn:hover { border-color: var(--accent); box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 12%, transparent); opacity: 1; color: var(--text); }
.sell-mode-btn--primary { background: var(--accent); color: var(--bg); border-color: transparent; box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 35%, transparent); }
.sell-mode-btn--primary:hover { border-color: transparent; box-shadow: 0 0 36px color-mix(in srgb, var(--accent) 50%, transparent); }
.sell-mode-btn--primary .sell-mode-sub { color: var(--bg); }
.sell-mode-icon { font-size: 1.1rem; padding-top: .15rem; flex-shrink: 0; width: 1.4rem; text-align: center; }
.sell-mode-title { display: block; font-family: 'DM Mono', monospace; font-size: .78rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; margin-bottom: .3rem; line-height: 1.2; }
.sell-mode-sub { display: block; font-size: .75rem; color: var(--muted); line-height: 1.4; font-family: 'DM Sans', sans-serif; text-transform: none; letter-spacing: 0; }

.sell-isbn-wrap { width: 100%; max-width: 520px; margin-top: .5rem; }
.sell-isbn-desktop-row { display: flex; align-items: center; gap: .75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1.15rem; transition: border-color .15s; }
.sell-isbn-desktop-row:focus-within { border-color: var(--accent); }
.sell-isbn-desktop-row i { color: var(--muted); font-size: .95rem; flex-shrink: 0; }
.sell-isbn-desktop-row input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-family: 'DM Mono', monospace; font-size: .9rem; min-width: 0; }
.sell-isbn-desktop-row input::placeholder { color: var(--muted); }
.sell-isbn-desktop-row button { background: var(--accent); color: var(--bg); border: none; border-radius: 8px; padding: .45rem 1rem; font-family: 'DM Mono', monospace; font-size: .78rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; cursor: pointer; transition: opacity .15s; flex-shrink: 0; }
.sell-isbn-desktop-row button:hover { opacity: .85; }

#result-area { width: 100%; max-width: 480px; margin-top: 1.5rem; }

.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    animation: scFadeIn .3s ease;
}

@keyframes scFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.result-isbn {
    font-family: 'DM Mono', monospace;
    font-size: .72rem;
    color: var(--accent2);
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-bottom: .75rem;
    display: flex;
    justify-content: space-between;
}

.result-source   { font-size: .68rem; color: var(--muted); }
.result-title    { font-size: 1.2rem; font-weight: 500; line-height: 1.3; }
.result-subtitle { font-size: .85rem; color: var(--muted); font-style: italic; margin-top: .25rem; }

.result-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.meta-item label {
    display: block;
    font-family: 'DM Mono', monospace;
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--muted);
    margin-bottom: .2rem;
}
.meta-item span { font-size: .85rem; }

.status-bar {
    font-family: 'DM Mono', monospace;
    font-size: .78rem;
    color: var(--muted);
    padding: .75rem 0;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.status-bar.error   { color: var(--danger); }
.status-bar.loading { color: var(--accent2); }

.dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: currentColor;
    animation: scPulse 1s ease-in-out infinite;
}
@keyframes scPulse { 0%,100%{opacity:1} 50%{opacity:.3} }

.cache-pill {
    display: inline-flex;
    align-items: center;
    background: #e8295a;
    color: #fff;
    font-family: 'DM Mono', monospace;
    font-size: .6rem;
    letter-spacing: .07em;
    text-transform: uppercase;
    padding: .18rem .5rem;
    border-radius: 20px;
    vertical-align: middle;
    margin-left: .4rem;
}

/* ── Scanner overlay ── */
#scanner-overlay,
#bulkScannerOverlay,
#seriesScannerOverlay,
#bundleScannerOverlay,
#libScannerOverlay { display: none; position: fixed; inset: 0; z-index: 200; background: #000; }
#scanner-overlay.open,
#bulkScannerOverlay.open,
#seriesScannerOverlay.open,
#bundleScannerOverlay.open,
#libScannerOverlay.open { display: block; }

#preview-container { position: absolute; inset: 0; overflow: hidden; }
#preview-container video { position: absolute; top: 0; left: 0; width: 100% !important; height: 100% !important; object-fit: cover; }
#preview-container canvas { display: none !important; }

.sc-grad-top { position: absolute; top: 0; left: 0; right: 0; height: 35%; background: linear-gradient(to bottom, rgba(0,0,0,.72), transparent); z-index: 5; pointer-events: none; }
.sc-grad-bot { position: absolute; bottom: 0; left: 0; right: 0; height: 40%; background: linear-gradient(to top, rgba(0,0,0,.82), transparent); z-index: 5; pointer-events: none; }

.sc-topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; padding: 2.75rem 1.25rem 0; }
.sc-label  { font-family: 'DM Mono', monospace; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.5); }
.sc-close  { background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.18); color: rgba(255,255,255,.85); font-family: 'DM Mono', monospace; font-size: .72rem; letter-spacing: .05em; padding: .45rem .8rem; border-radius: 8px; cursor: pointer; }

.sc-vf { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -60%); width: 78%; max-width: 300px; aspect-ratio: 3 / 1; z-index: 10; pointer-events: none; }

.sc-corner { position: absolute; width: 20px; height: 20px; border-style: solid; border-color: var(--accent); transition: border-color .25s; }
.sc-corner.tl { top:0; left:0;   border-width: 2px 0 0 2px; border-radius: 3px 0 0 0; }
.sc-corner.tr { top:0; right:0;  border-width: 2px 2px 0 0; border-radius: 0 3px 0 0; }
.sc-corner.bl { bottom:0; left:0;  border-width: 0 0 2px 2px; border-radius: 0 0 0 3px; }
.sc-corner.br { bottom:0; right:0; border-width: 0 2px 2px 0; border-radius: 0 0 3px 0; }

.sc-line { position: absolute; left: 2px; right: 2px; height: 1.5px; background: linear-gradient(to right, transparent, var(--accent) 20%, var(--accent) 80%, transparent); top: 0; animation: scSweep 1.7s ease-in-out infinite; }
@keyframes scSweep { 0% { top: 6%; opacity: .4; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { top: 88%; opacity: .4; } }

.sc-prog-wrap { position: absolute; bottom: -12px; left: 0; right: 0; height: 2px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; }
.sc-prog { height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width .1s linear, background .25s; }

.sc-status { position: absolute; bottom: -34px; left: 0; right: 0; text-align: center; font-family: 'DM Mono', monospace; font-size: .67rem; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.35); transition: color .25s; }

.sc-vf.locking .sc-corner { border-color: var(--amber); }
.sc-vf.locking .sc-line   { background: linear-gradient(to right, transparent, var(--amber) 20%, var(--amber) 80%, transparent); animation-duration: .45s; }
.sc-vf.locking .sc-prog   { background: var(--amber); }
.sc-vf.locking .sc-status { color: var(--amber); }
.sc-vf.locked  .sc-corner { border-color: #fff; }
.sc-vf.locked  .sc-line   { display: none; }
.sc-vf.locked  .sc-prog   { background: #fff; width: 100% !important; }
.sc-vf.locked  .sc-status { color: #fff; }

.sc-bottom { position: absolute; bottom: 0; left: 0; right: 0; z-index: 10; padding: 1rem 1.5rem 3.5rem; display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.sc-manual-btn { background: none; border: none; color: rgba(255,255,255,.35); font-family: 'DM Mono', monospace; font-size: .68rem; letter-spacing: .06em; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.sc-manual-row { display: none; width: 100%; max-width: 300px; gap: .5rem; }
.sc-manual-row.open { display: flex; }
.sc-manual-row input { flex: 1; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); color: #fff; font-family: 'DM Mono', monospace; font-size: .9rem; padding: .65rem .85rem; border-radius: 8px; outline: none; }
.sc-manual-row input::placeholder { color: rgba(255,255,255,.28); }
.sc-manual-row input:focus { border-color: var(--accent); }
.sc-manual-row button { background: var(--accent); color: var(--bg); border: none; font-family: 'DM Mono', monospace; font-size: .8rem; font-weight: 500; padding: .65rem 1rem; border-radius: 8px; cursor: pointer; }

/* ── Setup page ── */
.setup-wrap { display: flex; justify-content: center; align-items: flex-start; padding: 3rem 1rem 4rem; }
.setup-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 2.5rem 2rem; width: 100%; max-width: 440px; }
.setup-heading { font-size: 1.6rem; font-weight: 500; margin: 0 0 .4rem; }
.setup-sub { color: var(--muted); font-size: .95rem; margin: 0 0 1.75rem; }

.setup-errors { background: color-mix(in srgb, var(--danger) 12%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); border-radius: 10px; padding: .75rem 1rem .75rem 1.5rem; margin: 0 0 1.5rem; color: var(--danger); font-size: .9rem; list-style: disc; }
.setup-errors li + li { margin-top: .3rem; }

.setup-form { display: flex; flex-direction: column; gap: 1.25rem; }
.setup-field { display: flex; flex-direction: column; gap: .45rem; }
.setup-field label { font-size: .82rem; font-weight: 500; color: var(--muted); letter-spacing: .03em; }
.setup-field input { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: .7rem .9rem; font-size: .95rem; color: var(--text); font-family: inherit; outline: none; transition: border-color .15s; }
.setup-field input:focus { border-color: var(--accent); }
.setup-hint { font-size: .78rem; color: var(--muted); margin: 0; }

.username-input-wrap { position: relative; display: flex; align-items: center; }
.username-at { position: absolute; left: .9rem; color: var(--muted); font-size: .95rem; pointer-events: none; }
.username-input-wrap input { padding-left: 1.8rem; padding-right: 2.5rem; width: 100%; }
.username-status { position: absolute; right: .85rem; font-size: .85rem; font-family: 'DM Mono', monospace; transition: color .15s; }
.username-status.status-ok      { color: var(--accent); }
.username-status.status-error   { color: var(--danger); }
.username-status.status-checking { color: var(--muted); }

.setup-submit { margin-top: .5rem; background: var(--accent); color: var(--bg); border: none; border-radius: 10px; padding: .85rem; font-size: .95rem; font-weight: 500; font-family: inherit; cursor: pointer; transition: opacity .15s; width: 100%; }
.setup-submit:disabled { opacity: .4; cursor: not-allowed; }
.setup-submit:not(:disabled):hover { opacity: .88; }

@media (max-width: 480px) {
    .setup-wrap { padding: 1.25rem .75rem 3rem; align-items: flex-start; }
    .setup-card { padding: 1.75rem 1.25rem; border-radius: 14px; }
    .setup-heading { font-size: 1.35rem; }
    .setup-field input { font-size: 1rem; padding: .85rem .9rem; }
    .username-input-wrap input { padding-left: 1.8rem; font-size: 1rem; }
    .setup-submit { padding: 1rem; font-size: 1rem; }
    .home-stats { gap: .75rem; }
    .home-stat-num { font-size: 1.6rem; }
}

/* ── List-now button (sell result) ── */
.list-now-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    margin-top: 1rem;
    width: 100%;
    max-width: 480px;
    background: var(--accent);
    color: var(--bg);
    text-decoration: none;
    font-family: 'DM Mono', monospace;
    font-size: .9rem;
    font-weight: 500;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 1.1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: opacity .15s, transform .1s;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 35%, transparent);
}
.list-now-btn:hover  { opacity: .88; }
.list-now-btn:active { opacity: .75; transform: scale(.98); }

/* ── Not supported card ── */
.result-unsupported .unsupported-msg {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid var(--border);
}
.result-unsupported .unsupported-msg i { font-size: 1.4rem; color: var(--amber); margin-top: .1rem; flex-shrink: 0; }
.result-unsupported .unsupported-msg strong { display: block; margin-bottom: .25rem; }
.result-unsupported .unsupported-msg p { font-size: .85rem; color: var(--muted); margin: 0; }

/* ── Listing flow ── */
.list-wrap { width: 100%; max-width: 480px; margin: 0 auto; padding-bottom: 4rem; }

.list-book-summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.5rem; }
.list-book-title   { font-size: 1rem; font-weight: 500; margin-bottom: .2rem; }
.list-book-author  { font-size: .85rem; color: var(--muted); }
.list-book-isbn    { font-family: 'DM Mono', monospace; font-size: .7rem; color: var(--muted); margin-top: .35rem; }

.list-errors { background: color-mix(in srgb, var(--danger) 12%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); border-radius: 10px; padding: .75rem 1rem .75rem 1.5rem; margin-bottom: 1.25rem; color: var(--danger); font-size: .88rem; list-style: disc; }

/* Photo wizard steps */
.photo-step { display: none; }
.photo-step.active { display: block; animation: scFadeIn .25s ease; }

.photo-step-label { display: flex; align-items: center; gap: .65rem; margin-bottom: .5rem; }
.photo-step-num      { font-family: 'DM Mono', monospace; font-size: .68rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: .2rem .5rem; }
.photo-step-optional { font-size: .68rem; color: var(--amber); background: color-mix(in srgb, var(--amber) 12%, transparent); border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent); border-radius: 6px; padding: .2rem .5rem; font-family: 'DM Mono', monospace; letter-spacing: .04em; }
.photo-skip-btn      { margin-top: .5rem; background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 9px; padding: .6rem 1.25rem; font-size: .85rem; font-family: inherit; cursor: pointer; transition: border-color .15s, color .15s; display: inline-flex; align-items: center; gap: .4rem; }
.photo-skip-btn:hover { border-color: var(--accent); color: var(--accent); }
.photo-step-label i { font-size: 1.1rem; color: var(--accent); }
.photo-step-label strong { font-size: 1rem; }
.photo-step-hint { font-size: .85rem; color: var(--muted); margin-bottom: 1.25rem; }

.photo-capture-btn {
    display: flex; align-items: center; justify-content: center; gap: .6rem;
    width: 100%; background: transparent; border: 1.5px dashed var(--accent);
    color: var(--accent); font-family: 'DM Mono', monospace; font-size: .88rem;
    letter-spacing: .07em; padding: 1.5rem; border-radius: var(--radius); cursor: pointer;
    transition: background .15s;
}
.photo-capture-btn:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.photo-file-input { display: none; }

/* Crop UI */
.crop-ui { display: none; margin-top: 1rem; }
.crop-ui.visible { display: block; animation: scFadeIn .25s ease; }
.crop-canvas-wrap { width: 100%; border-radius: var(--radius); overflow: hidden; touch-action: none; }
.crop-canvas { display: block; width: 100%; height: auto; cursor: crosshair; }
.crop-actions { display: flex; gap: .75rem; margin-top: .75rem; }

/* Confirmed photo thumbnail row */
.photo-done { display: none; flex-direction: row; align-items: center; gap: .75rem; margin-top: 1rem; }
.photo-done.visible { display: flex; animation: scFadeIn .2s ease; }
.photo-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); flex-shrink: 0; }

.preview-retake { display: flex; align-items: center; gap: .4rem; cursor: pointer; font-size: .85rem; color: var(--muted); font-family: 'DM Mono', monospace; padding: .65rem .9rem; border: 1px solid var(--border); border-radius: 8px; transition: border-color .15s, color .15s; white-space: nowrap; }
.preview-retake:hover { color: var(--text); border-color: var(--text); }
.preview-continue { flex: 1; background: var(--accent); color: var(--bg); border: none; border-radius: 8px; padding: .75rem; font-family: 'DM Mono', monospace; font-size: .88rem; font-weight: 500; letter-spacing: .05em; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .5rem; transition: opacity .15s; }
.preview-continue:hover { opacity: .88; }

/* Step 5 price/condition */
.list-field { display: flex; flex-direction: column; gap: .45rem; margin-bottom: 1.25rem; }
.list-field label { font-size: .8rem; font-weight: 500; color: var(--muted); letter-spacing: .03em; }
.price-input-wrap { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.price-prefix { padding: .75rem .75rem .75rem 1rem; color: var(--muted); font-size: .95rem; }
.price-input-wrap input { flex: 1; border: none; background: transparent; font-size: .95rem; color: var(--text); padding: .75rem .75rem .75rem 0; outline: none; font-family: 'DM Mono', monospace; }
.price-input-wrap:focus-within { border-color: var(--accent); }

.condition-options { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.condition-opt { display: flex; align-items: center; gap: .5rem; cursor: pointer; background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: .55rem .75rem; transition: border-color .15s; }
.condition-opt input { accent-color: var(--accent); flex-shrink: 0; }
.condition-opt:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.condition-opt span { font-size: .8rem; line-height: 1.3; }

.list-submit-btn { width: 100%; margin-top: .5rem; background: var(--accent); color: var(--bg); border: none; border-radius: 10px; padding: 1rem; font-size: .95rem; font-weight: 500; font-family: inherit; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .6rem; transition: opacity .15s; box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 30%, transparent); }
.list-submit-btn:hover { opacity: .88; }

/* ── My Listings page ── */
.mylistings-wrap { max-width: 720px; margin: 0 auto; padding-bottom: 4rem; }
.mylistings-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; gap: .75rem; }
.mylistings-header h1 { font-size: 1.4rem; font-weight: 500; }
.mylistings-header-right { display: flex; align-items: center; gap: .6rem; }
.mylistings-add { display: inline-flex; align-items: center; gap: .4rem; background: var(--accent); color: var(--bg); text-decoration: none; font-size: .8rem; font-weight: 500; padding: .5rem .85rem; border-radius: 9px; transition: opacity .15s; white-space: nowrap; }
.mylistings-add:hover { opacity: .88; }

.mylistings-sort { display: flex; align-items: center; gap: .35rem; }
.mylistings-sort-label { color: var(--muted); font-size: .8rem; cursor: default; }
.mylistings-sort-select { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-family: inherit; font-size: .78rem; padding: .4rem .6rem; cursor: pointer; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a8278'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .5rem center; padding-right: 1.6rem; }
.mylistings-sort-select:focus { outline: none; border-color: var(--accent); }

.mylistings-empty { text-align: center; padding: 4rem 1rem; color: var(--muted); }
.mylistings-empty i { font-size: 2.5rem; display: block; margin-bottom: 1rem; }
.mylistings-empty p { margin-bottom: 1rem; }

.mylistings-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.mylistings-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .55rem .75rem; display: flex; gap: .75rem; align-items: center; }

.mylistings-thumb { flex-shrink: 0; width: 48px; height: 64px; position: relative; border-radius: 4px; overflow: hidden; border: 1px solid var(--border); background: var(--bg); }
.mylistings-thumb img { width: 48px; height: 64px; object-fit: cover; display: block; }
.mylistings-thumb-placeholder { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; color: var(--muted); font-size: .7rem; }
.mylistings-thumb:not(:has(img)) .mylistings-thumb-placeholder,
.mylistings-thumb.no-photo .mylistings-thumb-placeholder { display: flex; }

.mylistings-info { flex: 1; min-width: 0; }
.mylistings-title  { font-weight: 500; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; color: var(--text); text-decoration: none; display: block; }
.mylistings-meta   { display: flex; gap: .5rem; margin-top: .2rem; align-items: center; flex-wrap: wrap; }
.mylistings-price  { font-family: 'DM Mono', monospace; font-size: .78rem; color: var(--price); font-weight: 600; }
.mylistings-author { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.mylistings-condition { font-size: .68rem; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: .1rem .35rem; color: var(--muted); }
.mylistings-date   { font-size: .68rem; color: var(--muted); white-space: nowrap; }

.mylistings-actions { flex-shrink: 0; display: flex; flex-direction: row; gap: .3rem; }
.mylistings-action-btn { background: none; border: 1px solid var(--border); color: var(--muted); width: 28px; height: 28px; border-radius: 7px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: .72rem; transition: border-color .15s, color .15s; text-decoration: none; }
.mylistings-action-btn:hover { border-color: var(--accent); color: var(--accent); }
.mylistings-delete:hover { border-color: var(--danger) !important; color: var(--danger) !important; }

/* ── Removal reason modal ── */
.sold-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; align-items: center; justify-content: center; padding: 1rem; }
.sold-modal-overlay.visible { display: flex; animation: scFadeIn .15s ease; }
.sold-modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.75rem; width: 100%; max-width: 400px; }
.sold-modal-title { font-size: 1.1rem; font-weight: 500; margin: 0 0 .35rem; }
.sold-modal-book { font-size: .85rem; color: var(--muted); margin: 0 0 1.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sold-modal-reasons { border: none; padding: 0; margin: 0 0 1.5rem; display: flex; flex-direction: column; gap: .5rem; }
.sold-modal-legend { font-size: .8rem; font-weight: 500; color: var(--muted); margin-bottom: .75rem; padding: 0; }
.sold-reason-opt { display: flex; align-items: center; gap: .65rem; cursor: pointer; background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: .65rem .9rem; transition: border-color .15s; font-size: .88rem; }
.sold-reason-opt:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.sold-reason-opt input { accent-color: var(--accent); flex-shrink: 0; }
.sold-modal-actions { display: flex; gap: .65rem; }
.sold-modal-cancel { flex: 1; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 9px; padding: .7rem; font-size: .88rem; font-family: inherit; cursor: pointer; transition: border-color .15s; }
.sold-modal-cancel:hover { border-color: var(--text); }
.sold-modal-confirm { flex: 1; background: var(--danger); color: #fff; border: none; border-radius: 9px; padding: .7rem; font-size: .88rem; font-weight: 500; font-family: inherit; cursor: pointer; opacity: 1; transition: opacity .15s; }
.sold-modal-confirm:hover { opacity: .88; }

/* ── Edit Listing page ── */
.editlisting-wrap { max-width: 520px; margin: 0 auto; padding-bottom: 4rem; }
.editlisting-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.editlisting-back { display: inline-flex; align-items: center; gap: .45rem; font-size: .85rem; color: var(--muted); text-decoration: none; transition: color .15s; }
.editlisting-back:hover { color: var(--text); }
.editlisting-preview { display: inline-flex; align-items: center; gap: .45rem; font-size: .85rem; color: var(--muted); text-decoration: none; transition: color .15s; }
.editlisting-preview:hover { color: var(--accent); }
.editlisting-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.75rem; }
.editlisting-book { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.editlisting-thumb { width: 52px; height: 68px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); flex-shrink: 0; display: block; }
.editlisting-title { font-weight: 500; font-size: .95rem; margin-bottom: .2rem; }
.editlisting-author { font-size: .82rem; color: var(--muted); margin-bottom: .3rem; }
.editlisting-isbn { font-size: .72rem; color: var(--muted); font-family: 'DM Mono', monospace; }
.editlisting-saved { color: var(--accent); font-size: .85rem; display: flex; align-items: center; gap: .4rem; margin: 0 0 1.25rem; }
.editlisting-form { display: flex; flex-direction: column; gap: 1.25rem; margin-top: 1.25rem; }

@media (max-width: 480px) {
    .condition-options { grid-template-columns: 1fr 1fr; }
    .mylistings-author { display: none; }
    .mylistings-header { flex-wrap: wrap; }
    .mylistings-header h1 { width: 100%; }
    .mylistings-header-right { width: 100%; flex-wrap: wrap; }
    .mylistings-add-btns { width: 100%; }
    .mylistings-add-btns .mylistings-add { flex: 1; justify-content: center; }
}

/* ── Setup postcode / suburb ── */
.postcode-input-wrap { display: flex; align-items: center; gap: .6rem; }
.postcode-input-wrap input { width: 90px; flex-shrink: 0; }
.postcode-state { font-size: .8rem; font-weight: 500; color: var(--muted); font-family: 'DM Mono', monospace; letter-spacing: .04em; }
.postcode-state.status-error { color: var(--danger); }
.setup-field select { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: .7rem .9rem; font-size: .95rem; color: var(--text); font-family: inherit; outline: none; transition: border-color .15s; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .9rem center; padding-right: 2.2rem; }
.setup-field select:focus { border-color: var(--accent); }

/* ── 404 page ── */
.error-page { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6rem 1rem; text-align: center; }
.error-code { font-size: 7rem; font-weight: 500; font-family: 'DM Mono', monospace; color: var(--accent); line-height: 1; margin-bottom: .5rem; }
.error-title { font-size: 1.5rem; font-weight: 500; margin: 0 0 .75rem; }
.error-sub { color: var(--muted); margin: 0 0 2rem; }
.error-home { display: inline-flex; align-items: center; background: var(--accent); color: var(--bg); text-decoration: none; padding: .75rem 1.5rem; border-radius: 10px; font-weight: 500; transition: opacity .15s; }
.error-home:hover { opacity: .88; }

/* ── Item view page ── */
.itemview-wrap { max-width: 900px; margin: 0 auto; padding-bottom: 4rem; display: grid; grid-template-columns: 320px 1fr; grid-template-areas: "seriesheader seriesheader" "gallery sidebar" "main main"; column-gap: 2rem; row-gap: 1.5rem; align-items: start; }
.itemview-404 { text-align: center; color: var(--muted); padding: 4rem 1rem; }

/* Series / bundle header banner */
.itemview-series-header { grid-area: seriesheader; display: flex; align-items: center; gap: .75rem; padding: .9rem 1.1rem; background: var(--surface); border: 1.5px solid var(--accent); border-radius: 12px; }
.itemview-series-badge { display: inline-flex; align-items: center; gap: .4rem; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: .28rem .7rem; border-radius: 20px; flex-shrink: 0; white-space: nowrap; }
.itemview-series-name-wrap { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.itemview-series-title { font-size: 1.15rem; font-weight: 700; margin: 0; color: var(--text); }
.itemview-series-count { font-size: .78rem; font-weight: 500; color: var(--muted); }

/* Swipe gallery */
.gallery { position: relative; width: 100%; margin-bottom: 2rem; border-radius: 12px; overflow: hidden; background: var(--bg); border: 1px solid var(--border); aspect-ratio: 3/4; max-width: 320px; }
.gallery--empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 2.5rem; }
.gallery-track { display: flex; height: 100%; transition: transform .3s ease; will-change: transform; }
.gallery-slide { flex: 0 0 100%; position: relative; }
.gallery-img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; }
.gallery-label { position: absolute; bottom: .6rem; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.55); color: #fff; font-size: .7rem; font-family: 'DM Mono', monospace; letter-spacing: .05em; padding: .2rem .55rem; border-radius: 20px; white-space: nowrap; pointer-events: none; }
.gallery-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.45); color: #fff; border: none; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: .8rem; transition: background .15s; z-index: 2; }
.gallery-btn:hover { background: rgba(0,0,0,.7); }
.gallery-prev { left: .6rem; }
.gallery-next { right: .6rem; }
.gallery-dots { position: absolute; bottom: .55rem; left: 0; right: 0; display: flex; justify-content: center; gap: .35rem; z-index: 2; }
.gallery-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.45); border: none; cursor: pointer; padding: 0; transition: background .15s, transform .15s; }
.gallery-dot.active { background: #fff; transform: scale(1.25); }

.itemview-body { display: contents; }
.itemview-main { grid-area: main; min-width: 0; }
.itemview-title { font-size: 1.5rem; font-weight: 500; margin: 0 0 .35rem; }
.itemview-subtitle { font-size: 1rem; color: var(--muted); margin: 0 0 .6rem; }
.itemview-author { font-size: .95rem; color: var(--muted); margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.itemview-meta-row { display: flex; flex-wrap: wrap; gap: .4rem .5rem; align-items: center; margin-bottom: 1rem; }
.itemview-meta-row span { font-size: .78rem; color: var(--muted); font-family: 'DM Mono', monospace; background: var(--bg); border: 1px solid var(--border); border-radius: 5px; padding: .15rem .45rem; }
.itemview-pill { display: inline-block; font-size: .78rem; font-family: 'DM Mono', monospace; background: var(--bg); border: 1px solid var(--border); border-radius: 5px; padding: .15rem .45rem; color: var(--accent); text-decoration: none; transition: background .12s, border-color .12s; }
.itemview-pill:hover { background: color-mix(in srgb, var(--accent) 8%, var(--bg)); border-color: var(--accent); }
.itemview-author .itemview-pill { font-size: .95rem; font-family: 'DM Sans', sans-serif; background: none; border: none; padding: 0; border-radius: 0; border-bottom: 1px dashed var(--border); }
.itemview-topics { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem; }
.itemview-topic-pill { font-size: .72rem; font-family: 'DM Mono', monospace; color: var(--muted); background: none; border: 1px solid var(--border); border-radius: 5px; padding: .12rem .4rem; text-decoration: none; transition: color .12s, border-color .12s; }
.itemview-topic-pill:hover { color: var(--accent); border-color: var(--accent); }
.itemview-description { font-size: .9rem; line-height: 1.65; color: var(--text); }

.itemview-sidebar { flex-shrink: 0; width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1.5rem 1.25rem; display: flex; flex-direction: column; gap: .85rem; }
.itemview-book-count { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.itemview-price { font-size: 1.75rem; font-weight: 500; font-family: 'DM Mono', monospace; color: var(--accent); }
.itemview-condition { font-size: .8rem; border: 1px solid var(--border); border-radius: 6px; padding: .25rem .6rem; display: inline-flex; align-items: center; gap: .4rem; }
/* Condition colour classes — applied to .itemview-condition and .bundle-contents-condition */
.cond--new      { background: var(--cond-new-bg);       color: var(--cond-new-text);       border-color: var(--cond-new-border); }
.cond--great    { background: var(--cond-great-bg);     color: var(--cond-great-text);     border-color: var(--cond-great-border); }
.cond--acceptable { background: var(--cond-acceptable-bg); color: var(--cond-acceptable-text); border-color: var(--cond-acceptable-border); }
.cond--well_used  { background: var(--cond-well_used-bg);  color: var(--cond-well_used-text);  border-color: var(--cond-well_used-border); }
.cond--poor     { background: var(--cond-poor-bg);      color: var(--cond-poor-text);      border-color: var(--cond-poor-border); }
.cond--damaged  { background: var(--cond-damaged-bg);   color: var(--cond-damaged-text);   border-color: var(--cond-damaged-border); }
.itemview-isbn-search { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .78rem; text-decoration: none; transition: color .15s; }
.itemview-isbn-search:hover { color: var(--accent); text-decoration: underline; }
.itemview-seller { display: flex; flex-direction: column; gap: .25rem; padding-top: .25rem; border-top: 1px solid var(--border); }
.itemview-seller-label { font-size: .72rem; color: var(--muted); letter-spacing: .04em; }
.itemview-seller-name { font-size: .9rem; font-weight: 500; }
.itemview-seller-link { color: var(--accent); text-decoration: none; }
.itemview-seller-link:hover { text-decoration: underline; }
.itemview-seller-location { font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: .35rem; }
.itemview-isbn { font-size: .72rem; color: var(--muted); font-family: 'DM Mono', monospace; border-top: 1px solid var(--border); padding-top: .75rem; }
.itemview-sold-banner { background: var(--danger); color: #fff; border-radius: 7px; padding: .4rem .75rem; font-size: .8rem; font-weight: 500; display: flex; align-items: center; gap: .4rem; }
.itemview-price--sold { text-decoration: line-through; opacity: .5; }
.itemview-cta { display: block; text-align: center; background: var(--accent); color: var(--bg); text-decoration: none; border-radius: 9px; padding: .75rem; font-size: .85rem; font-weight: 500; transition: opacity .15s; }
.itemview-cta--sold { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.itemview-cta:hover { opacity: .88; }

@media (max-width: 640px) {
    .itemview-wrap { grid-template-columns: 1fr; grid-template-areas: "seriesheader" "gallery" "sidebar" "main"; }
    .itemview-body { flex-direction: column; }
    .itemview-sidebar { width: 100%; position: static; }
    .gallery { max-width: 100%; }
}

/* ── Homepage ── */
.home-wrap { max-width: 960px; margin: 0 auto; padding-bottom: 4rem; }

.home-heading { font-size: .82rem; font-weight: 400; color: var(--muted); text-align: center; margin-bottom: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.home-search { margin-bottom: 2rem; }
.home-search-inner { position: relative; display: flex; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0 1rem; transition: border-color .15s; }
.home-search-inner:focus-within { border-color: var(--accent); }
.home-search-inner > .fa-magnifying-glass { color: var(--muted); font-size: .9rem; flex-shrink: 0; }
.home-search-inner input { flex: 1; background: none; border: none; outline: none; padding: .85rem .65rem; font-size: 1rem; color: var(--text); font-family: inherit; }
.home-search-inner input::placeholder { color: var(--muted); }
.home-search-clear { color: var(--muted); text-decoration: none; padding: .25rem; line-height: 1; transition: color .15s; }
.home-search-clear:hover { color: var(--text); }

.home-results-label { font-size: .88rem; color: var(--muted); margin: -.75rem 0 1.5rem; }

.listings-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }

.listing-card { text-decoration: none; color: inherit; border-radius: 12px; overflow: hidden; transition: transform .12s, box-shadow .12s; display: block; position: relative; }
.listing-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.18); }

.listing-card-thumb { aspect-ratio: 3/4; background: var(--surface); overflow: hidden; position: relative; border-radius: 12px; }
.listing-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.listing-card-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 2rem; opacity: 0; pointer-events: none; }
.listing-card-thumb:not(:has(img)) .listing-card-placeholder,
.listing-card-thumb.no-photo .listing-card-placeholder { opacity: 1; }

.listing-card-overlay-top { position: absolute; top: 0; left: 0; right: 0; padding: .55rem .6rem; background: linear-gradient(to bottom, rgba(0,0,0,.55) 0%, transparent 100%); border-radius: 12px 12px 0 0; display: flex; align-items: center; justify-content: space-between; gap: .35rem; }
.listing-card-suburb { font-size: .65rem; color: rgba(255,255,255,.9); background: rgba(0,0,0,.35); border-radius: 20px; padding: .2rem .5rem; display: inline-flex; align-items: center; gap: .3rem; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.listing-card-suburb i { font-size: .6rem; }
.listing-card-type { font-size: .6rem; font-weight: 500; border-radius: 20px; padding: .2rem .5rem; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); letter-spacing: .02em; white-space: nowrap; }
.listing-card-type--single { background: rgba(0,0,0,.35);      color: rgba(255,255,255,.85); }
.listing-card-type--bulk   { background: rgba(26,140,94,.75);  color: #fff; }
.listing-card-type--bundle { background: rgba(20,121,160,.75); color: #fff; }
.listing-card-overlay { position: absolute; bottom: 0; left: 0; right: 0; padding: .65rem .7rem .7rem; background: linear-gradient(to top, rgba(0,0,0,.82) 0%, rgba(0,0,0,.5) 65%, transparent 100%); border-radius: 0 0 12px 12px; display: flex; flex-direction: column; gap: .2rem; }
.listing-card-title { font-size: .8rem; font-weight: 500; line-height: 1.3; color: #fff; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.listing-card-price { font-size: .85rem; font-family: 'DM Mono', monospace; color: var(--price); font-weight: 600; }

.home-empty { text-align: center; padding: 5rem 1rem; color: var(--muted); }
.home-empty i { font-size: 3rem; display: block; margin-bottom: 1rem; }
.home-empty a { color: var(--accent); }

@media (max-width: 640px) {
    .listings-grid { grid-template-columns: repeat(2, 1fr); gap: .85rem; }
}
@media (max-width: 380px) {
    .listings-grid { grid-template-columns: 1fr; }
}

/* ── Seller page ── */
.seller-wrap { max-width: 960px; margin: 0 auto; padding-bottom: 4rem; }

.seller-profile { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.seller-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 500; flex-shrink: 0; }
.seller-name { font-size: 1.4rem; font-weight: 500; margin: 0 0 .4rem; }
.seller-meta { display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .8rem; color: var(--muted); }
.seller-meta span { display: flex; align-items: center; gap: .35rem; }
.seller-meta i { font-size: .72rem; }

/* ── Avatar — shared ── */
.seller-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

/* ── Avatar — profile page ── */
.profile-avatar-wrap { position: relative; flex-shrink: 0; width: 72px; height: 72px; }
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; display: block; }
.profile-avatar--initial { width: 72px; height: 72px; border-radius: 50%; background: var(--accent); color: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 500; }
.profile-avatar-change { position: absolute; bottom: 0; right: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--border); color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: .65rem; transition: background .15s, color .15s; }
.profile-avatar-change:hover { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.profile-avatar-remove { background: none; border: none; color: var(--danger); font-size: .75rem; cursor: pointer; padding: .2rem 0; text-align: left; font-family: inherit; display: flex; align-items: center; gap: .35rem; margin-top: .25rem; }
.profile-avatar-remove:hover { opacity: .75; }

/* ── Avatar upload modal ── */
.avatar-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 200; align-items: center; justify-content: center; padding: 1rem; }
.avatar-modal-overlay.visible { display: flex; }
.avatar-modal { background: var(--bg); border: 1px solid var(--border); border-radius: 16px; padding: 1.5rem; width: min(480px, 96vw); display: flex; flex-direction: column; gap: 1rem; }
.avatar-modal-title { font-size: 1.1rem; font-weight: 500; margin: 0; }
.avatar-preview-wrap { width: 120px; height: 120px; border-radius: 50%; overflow: hidden; background: var(--surface); border: 1px solid var(--border); margin: 0 auto; display: flex; align-items: center; justify-content: center; }
.avatar-preview-placeholder { color: var(--muted); font-size: 2rem; }
.avatar-file-label { display: inline-flex; align-items: center; gap: .45rem; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: .6rem 1.1rem; font-size: .85rem; cursor: pointer; transition: border-color .15s; align-self: center; }
.avatar-file-label:hover { border-color: var(--accent); }
.avatar-retake-btn { padding: .55rem .9rem; font-size: .8rem; }
.avatar-crop-wrap { width: 100%; background: #000; border-radius: 10px; overflow: hidden; line-height: 0; }
.avatar-crop-canvas { display: block; width: 100%; cursor: crosshair; touch-action: none; }
.avatar-modal-hint { font-size: .75rem; color: var(--muted); text-align: center; margin: 0; }
.avatar-modal-actions { display: flex; gap: .6rem; align-items: center; }
.avatar-modal-actions .sold-modal-cancel { margin-right: auto; }

/* ── Avatar — itemview seller ── */
.itemview-seller-identity { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: inherit; }
.itemview-seller-identity:hover .itemview-seller-name { text-decoration: underline; color: var(--accent); }
.itemview-seller-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; display: block; }
.itemview-seller-avatar--initial { background: var(--accent); color: var(--bg); display: flex; align-items: center; justify-content: center; font-size: .9rem; font-weight: 500; }

/* ── Bulk listing wizard ── */
.bulk-wrap { max-width: 520px; margin: 0 auto; padding: 2rem 1rem 4rem; }
.bulk-h1 { font-size: 1.5rem; font-weight: 500; margin-bottom: .35rem; }
.bulk-sub { color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }
.bulk-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; display: flex; flex-direction: column; gap: 1.1rem; }
.bulk-field { display: flex; flex-direction: column; gap: .4rem; }
.bulk-field label { font-family: 'DM Mono', monospace; font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.bulk-field-hint { font-weight: 300; color: var(--muted); }
.bulk-field input[type="text"],
.bulk-field input[type="number"],
.bulk-field select { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: .7rem .9rem; font-size: .95rem; color: var(--text); font-family: inherit; outline: none; transition: border-color .15s; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .9rem center; padding-right: 2.2rem; }
.bulk-field input:focus,
.bulk-field select:focus { border-color: var(--accent); }
.bulk-photo-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; border: 2px dashed var(--border); border-radius: 10px; padding: 1.5rem; cursor: pointer; color: var(--muted); font-size: .9rem; transition: border-color .15s; }
.bulk-photo-zone:hover { border-color: var(--accent); color: var(--accent); }
.bulk-photo-zone i { font-size: 1.6rem; }
.bulk-photo-preview { width: 100%; max-height: 180px; object-fit: contain; border-radius: 8px; border: 1px solid var(--border); }
.bulk-btn-primary { background: var(--accent); color: var(--bg); border: none; border-radius: 10px; padding: .85rem 1.25rem; font-size: .95rem; font-weight: 500; font-family: inherit; cursor: pointer; transition: opacity .15s; display: flex; align-items: center; justify-content: center; gap: .5rem; }
.bulk-btn-primary:hover:not(:disabled) { opacity: .88; }
.bulk-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.bulk-btn-ghost { background: none; border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: .75rem 1.1rem; font-size: .9rem; font-family: inherit; cursor: pointer; transition: border-color .15s; }
.bulk-btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.bulk-error { color: var(--danger); font-size: .82rem; margin: 0; }

/* progress header */
.bulk-entry-header { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.bulk-book-label { font-family: 'DM Mono', monospace; font-size: .75rem; color: var(--muted); letter-spacing: .06em; }
.bulk-progress-track { height: 4px; background: var(--border); border-radius: 2px; }
.bulk-progress-fill { height: 4px; background: var(--accent); border-radius: 2px; transition: width .3s; }

/* scan area */
.bulk-scan-btn { width: 100%; background: var(--accent); color: var(--bg); border: none; border-radius: 10px; padding: .85rem; font-size: .95rem; font-weight: 500; font-family: inherit; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .5rem; transition: opacity .15s; }
.bulk-scan-btn:hover { opacity: .88; }
.bulk-isbn-row { display: flex; gap: .5rem; }
.bulk-isbn-row input { flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: .65rem .9rem; font-size: .9rem; color: var(--text); font-family: inherit; outline: none; transition: border-color .15s; }
.bulk-isbn-row input:focus { border-color: var(--accent); }
.bulk-isbn-go { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 10px; padding: .65rem .9rem; font-size: .82rem; font-family: inherit; cursor: pointer; white-space: nowrap; transition: border-color .15s, color .15s; }
.bulk-isbn-go:hover { border-color: var(--accent); color: var(--accent); }

/* book result */
.bulk-found-info { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: .75rem 1rem; font-size: .88rem; line-height: 1.5; }
.bulk-found-title { font-weight: 500; }
.bulk-found-author { color: var(--muted); }
.bulk-found-year { color: var(--muted); font-family: 'DM Mono', monospace; font-size: .75rem; }
.bulk-looking { color: var(--muted); font-style: italic; font-size: .88rem; }
.bulk-manual-fields { display: flex; flex-direction: column; gap: .75rem; }
.bulk-manual-fields input { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: .7rem .9rem; font-size: .9rem; color: var(--text); font-family: inherit; outline: none; transition: border-color .15s; }
.bulk-manual-fields input:focus { border-color: var(--accent); }
.bulk-price-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.bulk-price-row input,
.bulk-price-row select { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: .65rem .9rem; font-size: .9rem; color: var(--text); font-family: inherit; outline: none; transition: border-color .15s; }
.bulk-price-row input:focus,
.bulk-price-row select:focus { border-color: var(--accent); }
.bulk-entry-actions { display: flex; gap: .6rem; justify-content: flex-end; }

/* review */
.bulk-review-list { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.25rem; }
.bulk-review-item { display: flex; align-items: center; gap: .75rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .6rem .85rem; }
.bulk-review-thumb { width: 2.6rem; height: 3.4rem; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.bulk-review-thumb--none { display: flex; align-items: center; justify-content: center; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; color: var(--muted); font-size: .85rem; }
.bulk-review-num { font-family: 'DM Mono', monospace; font-size: .7rem; color: var(--muted); min-width: 1.4rem; }
.bulk-review-info { flex: 1; min-width: 0; }
.bulk-review-title { font-size: .85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bulk-review-author { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bulk-review-price-wrap { display: flex; align-items: center; gap: .15rem; flex-shrink: 0; }
.bulk-review-currency { font-family: 'DM Mono', monospace; font-size: .82rem; color: var(--price); font-weight: 600; }
.bulk-review-price-input { font-family: 'DM Mono', monospace; font-size: .82rem; color: var(--price); font-weight: 600; width: 5rem; background: none; border: none; border-bottom: 1px dashed var(--border); border-radius: 0; padding: .1rem .2rem; text-align: right; outline: none; transition: border-color .15s; }
.bulk-review-price-input:focus { border-bottom-color: var(--accent); }
.bulk-review-empty { color: var(--muted); font-size: .9rem; text-align: center; padding: 1rem 0; }
.bulk-review-actions { display: flex; gap: .75rem; justify-content: flex-end; }

/* ── My Listings — bulk section ── */
.bulk-collections-section { margin-bottom: 2rem; }
.bulk-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.bulk-section-label { font-family: 'DM Mono', monospace; font-size: .65rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.mylistings-section { margin-bottom: 2rem; }
.mylistings-section-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.mylistings-section-label { font-family: 'DM Mono', monospace; font-size: .65rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.bulk-col-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .75rem; overflow: hidden; }
.bulk-col-head { display: flex; align-items: center; gap: .85rem; padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
.bulk-col-thumb { width: 52px; height: 70px; object-fit: cover; border-radius: 5px; flex-shrink: 0; }
.bulk-col-name { font-weight: 500; font-size: .9rem; }
.bulk-col-stats { display: flex; align-items: center; gap: .5rem; margin-top: .2rem; flex-wrap: wrap; }
.bulk-col-active { font-family: 'DM Mono', monospace; font-size: .72rem; color: var(--accent); font-weight: 600; }
.bulk-col-total { font-size: .72rem; color: var(--muted); }
.bulk-book-list { list-style: none; padding: 0; margin: 0; }
.bulk-book-item { display: flex; align-items: center; gap: .6rem; padding: .5rem 1rem; border-bottom: 1px solid var(--border); font-size: .83rem; }
.bulk-book-item:last-child { border-bottom: none; }
.bulk-book-sold { opacity: .45; }
.bulk-book-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); text-decoration: none; font-weight: 500; }
.bulk-book-title:hover { color: var(--accent); }
.bulk-book-author { font-size: .75rem; color: var(--muted); white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.bulk-book-price { font-family: 'DM Mono', monospace; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.bulk-book-sold-badge { font-size: .68rem; color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: .1rem .4rem; white-space: nowrap; }
.mylistings-add-btns { display: flex; gap: .4rem; }

/* ── My Listings — bulk inline editors ── */
.bulk-col-name-wrap { display: flex; align-items: center; gap: .4rem; }
.bulk-col-name-input { background: none; border: none; border-bottom: 1px dashed var(--border); border-radius: 0; font-size: .9rem; font-weight: 500; color: var(--text); font-family: inherit; padding: .1rem .2rem; outline: none; width: 100%; transition: border-color .15s; }
.bulk-col-name-input:focus { border-bottom-color: var(--accent); }
.bulk-col-name-status { font-size: .72rem; white-space: nowrap; flex-shrink: 0; }
.bulk-col-name-ok  { color: var(--accent); }
.bulk-col-name-err { color: var(--danger); }
.bulk-book-price-wrap { display: flex; align-items: center; gap: .1rem; flex-shrink: 0; }
.bulk-book-currency { font-family: 'DM Mono', monospace; font-size: .78rem; color: var(--price); font-weight: 600; }
.bulk-book-price-input { font-family: 'DM Mono', monospace; font-size: .78rem; color: var(--price); font-weight: 600; width: 4.2rem; background: none; border: none; border-bottom: 1px dashed var(--border); border-radius: 0; padding: .05rem .15rem; text-align: right; outline: none; transition: border-color .15s; }
.bulk-book-price-input:focus { border-bottom-color: var(--accent); }
.bulk-col-delete { margin-left: auto; flex-shrink: 0; }

/* ── Bundle contents — itemview ── */
.bundle-contents { margin-top: 1.25rem; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.bundle-contents-label { font-family: 'DM Mono', monospace; font-size: .65rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); padding: .6rem .9rem; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .4rem; }
.bundle-contents-list { list-style: none; padding: 0; margin: 0; }
.bundle-contents-item { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .5rem .9rem; border-bottom: 1px solid var(--border); font-size: .85rem; }
.bundle-contents-item:last-child { border-bottom: none; }
.bundle-contents-info { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.bundle-contents-title { font-weight: 500; }
.bundle-contents-author { color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bundle-contents-meta { flex-shrink: 0; display: flex; align-items: center; gap: .35rem; }
.bundle-contents-condition { font-size: .68rem; border: 1px solid; border-radius: 4px; padding: .15rem .4rem; white-space: nowrap; }
.bundle-contents-search { color: var(--muted); font-size: .8rem; line-height: 1; padding: .2rem; transition: color .15s; }
.bundle-contents-search:hover { color: var(--accent); }

/* ── Bundle badge — my-listings ── */
.mylistings-bundle-badge { font-size: .65rem; background: var(--accent); color: var(--bg); border-radius: 4px; padding: .1rem .4rem; font-weight: 500; display: inline-flex; align-items: center; gap: .25rem; }

/* ── Bundle review price row ── */
.bundle-review-price-row { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .6rem .85rem; font-size: .9rem; display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.bundle-review-price-row strong { color: var(--price); font-family: 'DM Mono', monospace; }

/* ── Notes textarea + counter ── */
.notes-wrap { position: relative; }
.notes-textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 4rem; padding: .55rem .75rem; padding-bottom: 1.6rem; font-family: inherit; font-size: .9rem; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; outline: none; transition: border-color .15s; line-height: 1.5; }
.notes-textarea:focus { border-color: var(--accent); }
.notes-counter { position: absolute; right: .6rem; bottom: .45rem; font-family: 'DM Mono', monospace; font-size: .68rem; color: var(--muted); pointer-events: none; }
.notes-optional { font-size: .78rem; font-weight: 400; color: var(--muted); margin-left: .2rem; }

/* ── Seller notes — itemview ── */
.itemview-notes { margin-top: 1rem; padding: .75rem .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.itemview-notes-label { font-family: 'DM Mono', monospace; font-size: .65rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-bottom: .4rem; display: flex; align-items: center; gap: .4rem; }
.itemview-notes-body { margin: 0; font-size: .88rem; color: var(--text); line-height: 1.55; white-space: pre-wrap; word-break: break-word; }

/* ── Suburb map — pill interaction ── */
.listing-card-suburb[data-suburb] { cursor: pointer; transition: background .12s; }
.listing-card-suburb[data-suburb]:hover { background: rgba(255,255,255,.22); border-radius: 5px; }

/* ── Suburb map — modal ── */
.map-modal { position: fixed; inset: 0; background: rgba(0,0,0,.52); z-index: 500; display: flex; align-items: flex-end; justify-content: center; }
.map-modal-inner { background: var(--bg); border-radius: 18px 18px 0 0; width: 100%; max-width: 680px; height: 82vh; display: flex; flex-direction: column; overflow: hidden; }
.map-modal-header { display: flex; align-items: flex-start; gap: .75rem; padding: .85rem 1rem .7rem; flex-shrink: 0; border-bottom: 1px solid var(--border); }
.map-modal-heading { flex: 1; min-width: 0; }
.map-modal-title { font-weight: 700; font-size: 1rem; color: var(--text); }
.map-modal-sub { font-size: .78rem; color: var(--muted); margin-top: .15rem; min-height: 1em; }
.map-modal-close { background: var(--surface); border: 1px solid var(--border); border-radius: 50%; width: 30px; height: 30px; cursor: pointer; font-size: .8rem; color: var(--text); flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: background .12s; }
.map-modal-close:hover { background: var(--border); }
.map-container { flex: 1; min-height: 0; }

/* ── Suburb map — count badge (Leaflet divIcon) ── */
.map-count-badge { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .75rem; color: #fff; border: 2px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.4); font-family: 'DM Mono', monospace; }

@media (min-width: 640px) {
  .map-modal { align-items: center; }
  .map-modal-inner { border-radius: 14px; width: 90%; height: 78vh; }
}

/* ── Map popup search link ── */
.map-popup-link { display: inline-block; margin-top: .45rem; font-size: .8rem; font-weight: 600; color: var(--accent); text-decoration: none; }
.map-popup-link:hover { text-decoration: underline; }

/* ── Search page ── */
.search-wrap { max-width: 900px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
/* Search hub — dropdown entry point */
.search-hub { display: flex; flex-direction: column; gap: .4rem; }
.search-by-label { font-size: .72rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.search-hub-row { display: flex; align-items: stretch; gap: .5rem; }
.search-mode-select { flex-shrink: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-size: .85rem; font-family: inherit; padding: 0 .75rem; cursor: pointer; appearance: auto; }
.search-hub-input { flex: 1; }
.search-hub-form { margin: 0; }
.search-meta { margin: 1.1rem 0 .75rem; }
.search-heading { font-size: 1.15rem; font-weight: 700; margin: 0 0 .2rem; color: var(--text); }
.search-sub { font-size: .83rem; color: var(--muted); margin: 0; }
.search-hint-at { font-family: 'DM Mono', monospace; color: var(--accent); }
/* ISBN lookup results list */
.isbn-result-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.isbn-result-list li { border-bottom: 1px solid var(--border); }
.isbn-result-list li:last-child { border-bottom: none; }
.isbn-result-item { display: flex; flex-direction: column; }
.isbn-result-link { display: flex; align-items: center; gap: .9rem; padding: .65rem 1rem; text-decoration: none; color: var(--text); transition: background .12s; }
.isbn-result-link:hover { background: var(--surface); }
.isbn-result-cover { flex-shrink: 0; width: 36px; height: 50px; border-radius: 3px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .85rem; }
.isbn-result-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.isbn-result-info { flex: 1; min-width: 0; }
.isbn-result-title { font-weight: 500; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.isbn-result-author { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.isbn-result-year { font-size: .72rem; color: var(--muted); font-family: 'DM Mono', monospace; }
.isbn-result-count { flex-shrink: 0; font-size: .7rem; font-family: 'DM Mono', monospace; white-space: nowrap; }
.isbn-result-count--listed { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 5px; padding: .15rem .45rem; font-weight: 600; }
.isbn-result-count--none { color: var(--muted); }
.author-result-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.author-result-list li { border-bottom: 1px solid var(--border); }
.author-result-list li:last-child { border-bottom: none; }
.author-result-link { display: flex; align-items: center; gap: .9rem; padding: .75rem 1rem; text-decoration: none; color: var(--text); transition: background .12s; }
.author-result-link:hover { background: var(--surface); }
.author-result-avatar { flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .85rem; }
.author-result-info { flex: 1; min-width: 0; }
.author-result-name { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.author-result-meta { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.author-result-count { flex-shrink: 0; font-size: .7rem; font-family: 'DM Mono', monospace; color: var(--muted); white-space: nowrap; }
.search-no-listings-alert { display: flex; align-items: flex-start; gap: .6rem; padding: .85rem 1.1rem; margin-bottom: 1rem; border-radius: 10px; background: color-mix(in srgb, var(--muted) 8%, transparent); border: 1px solid var(--border); color: var(--muted); font-size: .875rem; line-height: 1.5; }
.search-no-listings-alert i { flex-shrink: 0; margin-top: .15rem; }
.search-no-listings-alert strong { color: var(--text); }
.search-overflow { text-align: center; font-size: .82rem; color: var(--muted); margin-top: 1.25rem; padding: .6rem; border: 1px dashed var(--border); border-radius: 8px; }
.search-empty-link { display: inline-block; margin-top: .6rem; font-size: .85rem; color: var(--accent); text-decoration: none; }
.search-empty-link:hover { text-decoration: underline; }
.api-debug-wrap { max-width: 860px; margin: 2rem auto; padding: 0 1rem 3rem; font-family: 'DM Mono', monospace; }
.api-debug-heading { font-size: .85rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 .75rem; display: flex; align-items: center; gap: .4rem; }
.api-debug-block { border: 1px solid var(--border); border-radius: 8px; margin-bottom: .5rem; overflow: hidden; }
.api-debug-summary { display: flex; align-items: baseline; gap: .6rem; padding: .5rem .75rem; cursor: pointer; background: var(--surface); font-size: .78rem; list-style: none; flex-wrap: wrap; }
.api-debug-summary::-webkit-details-marker { display: none; }
.api-debug-summary::before { content: '▶'; font-size: .6rem; color: var(--muted); transition: transform .15s; flex-shrink: 0; }
details[open] .api-debug-summary::before { transform: rotate(90deg); }
.api-debug-status { border-radius: 4px; padding: .1rem .4rem; font-size: .7rem; font-weight: 700; }
.api-debug-status--ok  { background: color-mix(in srgb, #2ecc71 15%, transparent); color: #27ae60; }
.api-debug-status--err { background: color-mix(in srgb, #e74c3c 15%, transparent); color: #c0392b; }
.api-debug-label { font-weight: 600; color: var(--text); font-size: .78rem; }
.api-debug-url { color: var(--muted); font-size: .7rem; word-break: break-all; }
.api-debug-body { margin: 0; padding: .75rem; background: var(--bg); border-top: 1px solid var(--border); font-size: .72rem; overflow-x: auto; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow-y: auto; color: var(--text); }

/* ── ISBN info card (no listings but book found in our DB or external API) ── */
.isbn-alert { display: flex; align-items: center; gap: .65rem; padding: 1rem 1.25rem; margin: 1.25rem 0 .75rem; border-radius: 10px; background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber); border: 1.5px solid color-mix(in srgb, var(--amber) 40%, transparent); font-weight: 700; font-size: .95rem; letter-spacing: .04em; text-transform: uppercase; }
.isbn-alert i { font-size: 1.1rem; flex-shrink: 0; }
.isbn-card { display: flex; gap: 1.5rem; align-items: flex-start; margin: 1.5rem 0; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1.25rem 1.5rem; }
.isbn-card-cover { flex-shrink: 0; width: 100px; border-radius: 6px; overflow: hidden; background: var(--bg); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; min-height: 140px; }
.isbn-card-cover img { display: block; width: 100%; height: auto; }
.isbn-card-cover--empty { color: var(--muted); font-size: 2rem; }
.isbn-card-body { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.isbn-card-title-row { display: flex; align-items: flex-start; gap: .5rem; flex-wrap: wrap; }
.isbn-card-title { font-size: 1.1rem; font-weight: 500; line-height: 1.3; }
.isbn-card-cached-pill { flex-shrink: 0; margin-top: .2rem; font-size: .65rem; font-family: 'DM Mono', monospace; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; background: var(--danger); color: #fff; border-radius: 4px; padding: .1rem .4rem; line-height: 1.6; }
.isbn-card-author { font-size: .9rem; color: var(--muted); }
.isbn-card-year { font-size: .8rem; color: var(--muted); font-family: 'DM Mono', monospace; }
.isbn-card-note { font-size: .85rem; color: var(--muted); margin: .4rem 0 0; }
.isbn-card-cta { display: inline-block; margin-top: .5rem; font-size: .85rem; color: var(--accent); text-decoration: none; font-weight: 500; }
.isbn-card-cta:hover { text-decoration: underline; }
@media (max-width: 480px) {
  .isbn-card { flex-direction: column; gap: 1rem; }
  .isbn-card-cover { width: 80px; min-height: 110px; }
}

/* ── ISBN book hero (search/isbn/<isbn>) ── */
.isbn-hero { display: flex; gap: 2rem; align-items: flex-start; margin: 1.25rem 0 0; padding: 1.75rem 2rem; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.isbn-hero-cover { flex-shrink: 0; width: 150px; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,.15); }
.isbn-hero-cover img { display: block; width: 100%; height: auto; }
.isbn-hero-cover--empty { width: 150px; min-height: 210px; display: flex; align-items: center; justify-content: center; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--muted); font-size: 2.5rem; }
.isbn-hero-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .45rem; }
.isbn-hero-title { font-size: 1.65rem; font-weight: 700; line-height: 1.2; margin: 0; }
.isbn-hero-author { font-size: 1rem; color: var(--muted); }
.isbn-hero-meta { display: flex; gap: .75rem; font-size: .82rem; color: var(--muted); font-family: 'DM Mono', monospace; }
.isbn-hero-desc { font-size: .93rem; line-height: 1.65; color: var(--text); margin: .35rem 0 0; display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
.isbn-hero-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: .5rem; }
.isbn-hero-sell { font-size: .88rem; color: var(--accent); text-decoration: none; font-weight: 500; }
.isbn-hero-sell:hover { text-decoration: underline; }
.isbn-listings-heading { display: flex; align-items: center; gap: .5rem; font-size: .9rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 1.75rem 0 .85rem; }
.isbn-no-listings { display: flex; flex-direction: column; align-items: center; gap: .75rem; padding: 3rem 1.5rem; text-align: center; color: var(--muted); }
.isbn-no-listings i { font-size: 1.8rem; color: var(--amber); }
.isbn-no-listings p { margin: 0; font-size: .95rem; }
.isbn-no-listings-cta { display: inline-block; margin-top: .25rem; font-size: .9rem; color: var(--accent); text-decoration: none; font-weight: 500; }
.isbn-no-listings-cta:hover { text-decoration: underline; }
@media (max-width: 560px) {
  .isbn-hero { flex-direction: column; gap: 1.25rem; padding: 1.25rem; }
  .isbn-hero-cover { width: 110px; }
  .isbn-hero-cover--empty { width: 110px; min-height: 155px; }
  .isbn-hero-title { font-size: 1.25rem; }
}

/* ── ISBN action buttons (star / like / dislike / library) ── */
.isba { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap;
        padding: .15rem 1rem .55rem calc(1rem + 36px + .9rem); }
.isbn-card-body .isba { padding: .6rem 0 .2rem; }
.isbn-hero-actions .isba { padding: 0; }
.isbn-act-bar .isba { padding: .1rem 0 .85rem; }
.isba-btn { display: inline-flex; align-items: center; gap: .3rem; background: none;
            border: 1px solid var(--border); border-radius: 20px; padding: .22rem .6rem;
            font-size: .72rem; color: var(--muted); cursor: pointer; font-family: inherit;
            transition: background .12s, border-color .12s, color .12s; white-space: nowrap; line-height: 1.4; }
.isba-btn:hover { background: var(--surface); border-color: var(--muted); color: var(--text); }
.isba-star--on  { color: #f59e0b !important; border-color: #f59e0b !important; background: rgba(245,158,11,.08) !important; }
.isba-like--on  { color: #22c55e !important; border-color: #22c55e !important; background: rgba(34,197,94,.08) !important; }
.isba-dislike--on { color: var(--danger) !important; border-color: var(--danger) !important; background: rgba(239,68,68,.08) !important; }
.isba-lib--on   { color: var(--accent) !important; border-color: var(--accent) !important; background: color-mix(in srgb, var(--accent) 8%, transparent) !important; }
.isba-n { font-family: 'DM Mono', monospace; font-size: .68rem; }
.isba-label { font-size: .72rem; }

/* ── Star rating display ── */
.star-row { display: inline-flex; gap: .06em; color: var(--amber); font-size: .9rem; }
.star-row--sm { font-size: .78rem; }
.itemview-seller-rating { display: flex; align-items: center; gap: .4rem; margin-top: .35rem; }
.itemview-seller-rating-count { font-size: .78rem; color: var(--muted); }

/* ── Profile feedback section ── */
.profile-feedback { max-width: 540px; margin: 1.75rem auto 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem 1.5rem; }
.profile-feedback-heading { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem; }
.profile-feedback-heading i { color: var(--amber); }
.profile-feedback-count { margin-left: auto; font-size: .78rem; font-weight: 400; color: var(--muted); }
.profile-feedback-empty { font-size: .88rem; color: var(--muted); }
.profile-feedback-summary { display: flex; flex-direction: column; gap: .85rem; margin-bottom: 1.25rem; }
.profile-feedback-overall { display: flex; align-items: center; gap: .55rem; }
.profile-feedback-overall-num { font-size: .9rem; font-weight: 600; color: var(--text); }
.profile-feedback-cats { display: flex; flex-direction: column; gap: .45rem; }
.profile-feedback-cat { display: flex; align-items: center; gap: .5rem; }
.profile-feedback-cat-label { font-size: .8rem; color: var(--muted); width: 130px; flex-shrink: 0; }
.profile-feedback-cat-num { font-size: .78rem; color: var(--muted); font-family: 'DM Mono', monospace; }
.profile-feedback-list { display: flex; flex-direction: column; gap: .75rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.profile-feedback-item { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: .7rem .85rem; }
.profile-feedback-item-header { display: flex; align-items: center; gap: .6rem; margin-bottom: .35rem; flex-wrap: wrap; }
.profile-feedback-item-outcome { font-size: .72rem; font-weight: 600; padding: .15rem .45rem; border-radius: 999px; }
.profile-feedback-item-outcome--sold { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.profile-feedback-item-outcome--didnt_sell { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.profile-feedback-item-date { font-size: .72rem; color: var(--muted); margin-left: auto; }
.profile-feedback-item-comment { font-size: .84rem; color: var(--text); margin: 0; line-height: 1.5; }

/* ── Nav message badge ── */
.nav-msg-link { position: relative; }
.nav-msg-badge { position: absolute; top: -5px; right: -8px; background: var(--danger); color: #fff; font-size: .65rem; font-weight: 700; font-family: 'DM Mono', monospace; min-width: 16px; height: 16px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; padding: 0 3px; line-height: 1; }
@media (max-width: 640px) {
  .nav-msg-badge { top: -2px; right: -6px; }
}

/* ── itemview Message Seller button ── */
.itemview-msg-form { margin-bottom: .6rem; }
.itemview-msg-btn { display: flex; align-items: center; justify-content: center; gap: .5rem; width: 100%; padding: .65rem 1rem; background: var(--accent2); color: #fff; border: none; border-radius: var(--radius); font-size: .95rem; font-family: 'DM Sans', sans-serif; font-weight: 500; cursor: pointer; text-decoration: none; transition: opacity .15s; }
.itemview-msg-btn:hover { opacity: .88; }
.itemview-msg-btn--login { background: var(--surface); color: var(--muted); border: 1px solid var(--border); margin-bottom: .6rem; }

/* ── Full-height conversation page layout ── */
body.page-conv { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body.page-conv > .container { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: 0; }
body.page-conv > .container > main { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ── Messaging inbox ── */
.msg-inbox-wrap { max-width: 640px; margin: 0 auto; padding: 0 0 3rem; }
.msg-inbox-heading { font-size: 1.4rem; font-weight: 700; margin-bottom: 1.25rem; }
.msg-inbox-empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.msg-inbox-empty i { font-size: 2.5rem; display: block; margin-bottom: .75rem; }
.msg-inbox-empty p { margin-bottom: .5rem; }
.msg-inbox-empty-link { color: var(--accent); text-decoration: none; font-size: .9rem; }
.msg-inbox-empty-link:hover { text-decoration: underline; }
.msg-inbox-list { list-style: none; display: flex; flex-direction: column; gap: 0; }
.msg-inbox-row { border-bottom: 1px solid var(--border); }
.msg-inbox-row:first-child { border-top: 1px solid var(--border); }
.msg-inbox-link { display: flex; align-items: center; gap: .85rem; padding: .9rem .25rem; text-decoration: none; color: var(--text); transition: background .12s; }
.msg-inbox-link:hover { background: var(--surface); }
.msg-inbox-row--unread .msg-inbox-name { font-weight: 600; }
.msg-inbox-row--unread .msg-inbox-snippet { color: var(--text); }
.msg-inbox-avatar { position: relative; flex-shrink: 0; }
.msg-inbox-content { flex: 1; min-width: 0; }
.msg-inbox-header { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.msg-inbox-name { font-weight: 500; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-inbox-time { font-size: .75rem; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.msg-inbox-subject { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: .1rem; }
.msg-inbox-snippet { font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-mine-prefix { color: var(--muted); }
.msg-no-text { color: var(--muted); font-style: normal; }
.msg-unread-badge { background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; flex-shrink: 0; font-family: 'DM Mono', monospace; }
.msg-unread-dot { position: absolute; bottom: 0; right: 0; width: 10px; height: 10px; background: var(--danger); border-radius: 50%; border: 2px solid var(--bg); }
.msg-status-tag { font-size: .7rem; font-weight: 600; padding: .2rem .45rem; border-radius: 999px; flex-shrink: 0; margin-left: auto; }
.msg-status-tag--sold { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.msg-status-tag--closed { background: var(--surface); color: var(--muted); }

/* ── Shared avatar ── */
.msg-avatar-img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: block; }
.msg-avatar-initial { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 1rem; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.msg-avatar-initial--sm { width: 32px; height: 32px; font-size: .85rem; }
.msg-avatar-sm { flex-shrink: 0; }
.msg-avatar-sm .msg-avatar-img { width: 32px; height: 32px; }

/* ── Conversation page ── */
.msg-conv-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.msg-conv-header { display: flex; align-items: center; gap: .75rem; padding: .6rem 0 .6rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.msg-back-btn { color: var(--muted); font-size: 1.1rem; text-decoration: none; padding: .25rem; transition: color .12s; flex-shrink: 0; }
.msg-back-btn:hover { color: var(--text); }
.msg-conv-other { display: flex; align-items: center; gap: .65rem; flex: 1; min-width: 0; }
.msg-conv-other-name { font-weight: 600; font-size: .95rem; }
.msg-conv-other-name a { color: var(--text); text-decoration: none; }
.msg-conv-other-name a:hover { color: var(--accent); }
.msg-conv-other-loc { font-size: .75rem; color: var(--muted); }
.msg-conv-other-loc i { margin-right: .2rem; }

.msg-conv-menu-wrap { position: relative; flex-shrink: 0; }
.msg-conv-menu-btn { background: none; border: none; color: var(--muted); cursor: pointer; padding: .35rem .5rem; font-size: 1rem; border-radius: 6px; transition: background .12s; }
.msg-conv-menu-btn:hover { background: var(--surface); color: var(--text); }
.msg-conv-menu { position: absolute; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,.12); min-width: 170px; z-index: 50; overflow: hidden; }
.msg-menu-item { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--text); font-family: 'DM Sans', sans-serif; font-size: .88rem; padding: .65rem 1rem; cursor: pointer; transition: background .1s; }
.msg-menu-item:hover { background: var(--border); }
.msg-menu-item--danger { color: var(--danger); }

.msg-error-bar { background: color-mix(in srgb, var(--danger) 12%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); padding: .55rem .8rem; border-radius: 8px; font-size: .85rem; margin: .5rem 0; flex-shrink: 0; }
.msg-success-bar { background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); color: var(--accent); padding: .55rem .8rem; border-radius: 8px; font-size: .85rem; margin: .5rem 0; flex-shrink: 0; }

/* ── Thread ── */
.msg-thread { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem 0; display: flex; flex-direction: column; gap: .35rem; }
.msg-thread-empty { color: var(--muted); font-size: .9rem; text-align: center; margin-top: 2rem; }

/* ── Bubbles ── */
.msg-bubble-row { display: flex; align-items: flex-end; gap: .45rem; }
.msg-bubble-row--mine { flex-direction: row-reverse; }
.msg-bubble { max-width: min(72%, 480px); padding: .55rem .8rem .45rem; border-radius: 18px; font-size: .9rem; line-height: 1.5; word-break: break-word; position: relative; }
.msg-bubble--mine { background: var(--accent2); color: #fff; border-bottom-right-radius: 4px; }
.msg-bubble--theirs { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-bubble-time { display: block; font-size: .68rem; margin-top: .25rem; opacity: .65; text-align: right; }
.msg-bubble--theirs .msg-bubble-time { text-align: left; }

/* ── System pill ── */
.msg-system-pill { text-align: center; font-size: .78rem; color: var(--muted); padding: .3rem .8rem; margin: .4rem auto; max-width: 90%; }

/* ── Listing card (injected context) ── */
.msg-listing-card { display: flex; gap: .75rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .75rem; margin: .3rem auto; max-width: 340px; width: 100%; }
.msg-lc-photo { width: 60px; height: 80px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.msg-lc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.msg-lc-title { font-weight: 600; font-size: .88rem; color: var(--text); line-height: 1.3; }
.msg-lc-author { font-size: .78rem; color: var(--muted); }
.msg-lc-meta { font-size: .78rem; color: var(--muted); }
.msg-lc-price { font-weight: 600; color: var(--price); }
.msg-lc-link { font-size: .78rem; color: var(--accent); text-decoration: none; margin-top: auto; }
.msg-lc-link:hover { text-decoration: underline; }

/* ── Status / outcome bar ── */
.msg-status-bar { flex-shrink: 0; border-top: 1px solid var(--border); padding: .9rem 0; display: flex; flex-direction: column; gap: .75rem; }
.msg-outcome-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .8rem; border-radius: 999px; font-size: .82rem; font-weight: 600; align-self: center; }
.msg-outcome-pill--sold { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.msg-outcome-pill--closed { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }

/* ── Seller action bar ── */
.msg-seller-bar { flex-shrink: 0; display: flex; gap: .6rem; padding: .65rem 0; border-top: 1px solid var(--border); }
.msg-seller-form { flex: 1; }
.msg-seller-btn { width: 100%; padding: .55rem .75rem; border: none; border-radius: 8px; font-size: .85rem; font-family: 'DM Sans', sans-serif; font-weight: 500; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .4rem; transition: opacity .12s; }
.msg-seller-btn--sold { background: var(--accent); color: #fff; }
.msg-seller-btn--close { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.msg-seller-btn:hover { opacity: .82; }

/* ── Compose ── */
.msg-compose { flex-shrink: 0; display: flex; align-items: flex-end; gap: .5rem; padding: .65rem 0 .5rem; border-top: 1px solid var(--border); }
.msg-compose-input { flex: 1; resize: none; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--text); font-family: 'DM Sans', sans-serif; font-size: .9rem; padding: .55rem .9rem; line-height: 1.45; outline: none; transition: border-color .15s; max-height: 120px; overflow-y: auto; }
.msg-compose-input:focus { border-color: var(--accent2); }
.msg-compose-send { background: var(--accent2); color: #fff; border: none; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: .9rem; flex-shrink: 0; transition: opacity .12s; }
.msg-compose-send:hover { opacity: .85; }
.msg-compose-send:disabled { opacity: .4; cursor: not-allowed; }
.msg-compose-blocked { flex-shrink: 0; padding: .65rem 0 .5rem; border-top: 1px solid var(--border); text-align: center; font-size: .83rem; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: .5rem; }

/* ── Rating widget ── */
.msg-rating-form { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; display: flex; flex-direction: column; gap: .65rem; }
.msg-rating-title { font-weight: 600; font-size: .9rem; }
.msg-rating-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.msg-rating-label { font-size: .83rem; color: var(--muted); flex-shrink: 0; }
.msg-stars { display: flex; gap: .15rem; }
.msg-star-label { cursor: pointer; color: var(--amber); font-size: 1.1rem; }
.msg-star-label input { display: none; }
.msg-rating-comment { border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-family: 'DM Sans', sans-serif; font-size: .85rem; padding: .55rem .7rem; resize: none; outline: none; transition: border-color .15s; }
.msg-rating-comment:focus { border-color: var(--accent2); }
.msg-rating-submit { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: .55rem 1.2rem; font-family: 'DM Sans', sans-serif; font-size: .88rem; font-weight: 500; cursor: pointer; align-self: flex-start; transition: opacity .12s; }
.msg-rating-submit:hover { opacity: .85; }
.msg-rating-done { font-size: .85rem; color: var(--muted); text-align: center; padding: .5rem; display: flex; align-items: center; justify-content: center; gap: .5rem; }
.msg-rating-done--mutual { color: var(--accent); }

/* ── Contact form ── */
.contact-wrap { display: flex; justify-content: center; padding: 2.5rem 1rem 3rem; min-height: 70vh; }
.contact-card { width: 100%; max-width: 540px; }
.contact-heading { font-size: 1.6rem; font-weight: 700; margin: 0 0 .35rem; color: var(--text); }
.contact-sub { font-size: .9rem; color: var(--muted); margin: 0 0 1.5rem; }
.contact-form { display: flex; flex-direction: column; gap: 1.1rem; }
.contact-field { display: flex; flex-direction: column; gap: .35rem; }
.contact-field label { font-size: .85rem; font-weight: 500; color: var(--text); }
.contact-field select,
.contact-textarea { width: 100%; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-family: 'DM Sans', sans-serif; font-size: .93rem; padding: .6rem .85rem; outline: none; transition: border-color .15s; box-sizing: border-box; }
.contact-field select:focus,
.contact-textarea:focus { border-color: var(--accent2); }
.contact-textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.contact-char-count { font-size: .75rem; color: var(--muted); text-align: right; margin-top: -.2rem; }
.contact-char-count--near { color: var(--amber); }
.contact-meta { font-size: .82rem; color: var(--muted); padding: .4rem .75rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.contact-submit { background: var(--accent); color: #fff; border: none; border-radius: 10px; padding: .75rem 1.5rem; font-family: 'DM Sans', sans-serif; font-size: .95rem; font-weight: 600; cursor: pointer; transition: opacity .12s; align-self: flex-start; }
.contact-submit:hover { opacity: .87; }
.contact-submit:disabled { opacity: .45; cursor: not-allowed; }
.contact-errors { list-style: none; padding: .8rem 1rem; margin: 0 0 .5rem; background: color-mix(in srgb, #e74c3c 10%, transparent); border: 1px solid color-mix(in srgb, #e74c3c 30%, transparent); border-radius: 10px; display: flex; flex-direction: column; gap: .3rem; }
.contact-errors li { font-size: .88rem; color: #c0392b; }
.contact-success { display: flex; align-items: flex-start; gap: .75rem; padding: .9rem 1rem; background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 10px; font-size: .9rem; color: var(--text); margin-bottom: 1.25rem; }
.contact-success i { color: var(--accent); font-size: 1.1rem; flex-shrink: 0; margin-top: .1rem; }
.contact-success a { color: var(--accent); text-decoration: none; font-weight: 500; }
.contact-success a:hover { text-decoration: underline; }
.contact-honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ── Admin bubble & avatar ── */
.msg-bubble--admin { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); border-bottom-left-radius: 4px; }
.msg-avatar-initial--admin { background: var(--accent); color: #fff; }

/* ── Admin panel ── */
.adm-wrap { max-width: 1100px; margin: 0 auto; padding: 2rem 1rem 3rem; }
.adm-topbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.75rem; border-bottom: 1px solid var(--border); padding-bottom: 1rem; }
.adm-heading { font-size: 1.5rem; font-weight: 700; margin: 0; color: var(--text); }
.adm-nav { display: flex; gap: .35rem; }
.adm-nav-link { font-size: .85rem; padding: .35rem .8rem; border-radius: 8px; text-decoration: none; color: var(--muted); border: 1px solid transparent; transition: background .12s, color .12s; }
.adm-nav-link:hover { background: var(--surface); color: var(--text); }
.adm-nav-link--active { background: var(--surface); color: var(--text); border-color: var(--border); font-weight: 500; }

.adm-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.adm-stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.1rem 1.25rem; }
.adm-stat-val { font-size: 2rem; font-weight: 700; color: var(--text); line-height: 1.1; }
.adm-stat-lbl { font-size: .83rem; font-weight: 500; color: var(--text); margin-top: .3rem; }
.adm-stat-sub { font-size: .75rem; color: var(--muted); margin-top: .2rem; }

.adm-section { margin-bottom: 2.5rem; }
.adm-section-title { font-size: 1.05rem; font-weight: 600; margin: 0 0 .4rem; color: var(--text); }
.adm-section-desc { font-size: .85rem; color: var(--muted); margin: 0 0 1rem; line-height: 1.5; }
.adm-section-desc code { background: var(--surface); border: 1px solid var(--border); padding: .1rem .35rem; border-radius: 4px; font-size: .82rem; }

.adm-tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin-top: .75rem; }
.adm-tool-card { display: flex; align-items: flex-start; gap: 1rem; padding: 1.1rem 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.adm-tool-card:hover { border-color: var(--accent); box-shadow: 0 2px 12px rgba(0,0,0,.07); }
.adm-tool-icon { flex-shrink: 0; width: 2.4rem; height: 2.4rem; display: flex; align-items: center; justify-content: center; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; font-size: 1.05rem; color: var(--accent); }
.adm-tool-name { font-size: .9rem; font-weight: 600; margin-bottom: .25rem; color: var(--text); }
.adm-tool-desc { font-size: .78rem; color: var(--muted); line-height: 1.45; }

.adm-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.adm-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.adm-table thead th { text-align: left; padding: .65rem 1rem; font-size: .78rem; font-weight: 600; color: var(--muted); background: var(--surface); border-bottom: 1px solid var(--border); }
.adm-table tbody tr:not(:last-child) td { border-bottom: 1px solid var(--border); }
.adm-table tbody td { padding: .65rem 1rem; color: var(--text); vertical-align: middle; }
.adm-table a { color: var(--accent); text-decoration: none; }
.adm-table a:hover { text-decoration: underline; }
.adm-td-muted { color: var(--muted) !important; font-size: .8rem; }
.adm-td-email { font-size: .8rem; }
.adm-td-empty { text-align: center; color: var(--muted); padding: 1.5rem !important; }
.adm-td-mono  { font-family: monospace; font-size: .8rem; word-break: break-all; }
.adm-flash { padding: .75rem 1rem; border-radius: 8px; font-size: .88rem; margin-bottom: 1rem; }
.adm-flash--ok   { background: rgba(39,174,96,.12); color: #1e7e43; border: 1px solid rgba(39,174,96,.3); }
.adm-flash--warn { background: rgba(217,119,6,.12);  color: #92400e; border: 1px solid rgba(217,119,6,.3); }

.adm-provider-tag { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 500; background: var(--surface); border: 1px solid var(--border); }
.adm-provider-google    { background: #fde8e8; color: #c0392b; border-color: #f5c6c6; }
.adm-provider-discord   { background: #eaebf8; color: #4752c4; border-color: #c5c8ef; }
.adm-provider-microsoft { background: #e8f0fe; color: #1967d2; border-color: #c5d7fa; }
.adm-provider-facebook  { background: #e7f0fb; color: #1877f2; border-color: #c3d8f7; }

.adm-add-form { margin-top: 1rem; }
.adm-add-row { display: flex; gap: .65rem; }
.adm-input { flex: 1; max-width: 320px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-family: 'DM Sans', sans-serif; font-size: .9rem; padding: .55rem .8rem; outline: none; transition: border-color .15s; }
.adm-input:focus { border-color: var(--accent2); }
.adm-hint { font-size: .78rem; color: var(--muted); margin: .4rem 0 0; }
.adm-btn { border: none; border-radius: 8px; padding: .55rem 1rem; font-family: 'DM Sans', sans-serif; font-size: .85rem; font-weight: 500; cursor: pointer; transition: opacity .12s; }
.adm-btn--primary { background: var(--accent); color: #fff; }
html[data-theme="dark"] .adm-btn--primary { color: #0d1f17; }
.adm-btn--danger  { background: color-mix(in srgb, #e74c3c 12%, transparent); color: #c0392b; border: 1px solid color-mix(in srgb, #e74c3c 25%, transparent); }
.adm-btn--sm { padding: .3rem .65rem; font-size: .78rem; }
.ui-search-form { display: flex; gap: .5rem; flex-wrap: wrap; }
.ui-search-input { flex: 1; min-width: 200px; }
.ui-meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem .75rem; margin-top: .75rem; }
.ui-meta-item { display: flex; flex-direction: column; gap: .1rem; }
.ui-meta-label { font-family: 'DM Mono', monospace; font-size: .62rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.ui-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.ui-sub-heading { font-size: .82rem; font-weight: 600; margin: 0 0 .6rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-family: 'DM Mono', monospace; }
.ui-count-badge { font-family: 'DM Mono', monospace; font-size: .72rem; background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: .1rem .5rem; margin-left: .4rem; color: var(--muted); }
@media (max-width: 640px) { .ui-two-col { grid-template-columns: 1fr; } }
.adm-btn:hover { opacity: .82; }
.adm-pattern { background: var(--surface); border: 1px solid var(--border); padding: .15rem .5rem; border-radius: 4px; font-size: .85rem; }
.adm-alert { padding: .75rem 1rem; border-radius: 8px; font-size: .88rem; margin-bottom: 1rem; }
.adm-alert--error   { background: color-mix(in srgb, #e74c3c 10%, transparent); color: #c0392b; border: 1px solid color-mix(in srgb, #e74c3c 25%, transparent); }
.adm-alert--success { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }

/* ── Admin logo badge ── */
.site-logo--admin { background: #e74c3c; color: #fff !important; padding: .28rem .7rem; border-radius: 7px; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.site-logo--admin:hover { background: #c0392b; }

/* ── Conversation safety notice ── */
.msg-safety-notice { flex-shrink: 0; display: flex; align-items: center; gap: .5rem; padding: .45rem .75rem; background: color-mix(in srgb, var(--amber) 12%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--amber) 25%, transparent); font-size: .76rem; color: var(--text); line-height: 1.4; }
.msg-safety-notice i { color: var(--amber); font-size: .85rem; flex-shrink: 0; }

/* ── Admin activity chart ── */
.adm-chart-section { margin-bottom: 1.5rem; }
.adm-chart-wrap { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1rem .5rem; }
.adm-chart-canvas { display: block; width: 100%; height: 200px; cursor: crosshair; }
.adm-chart-tip { position: absolute; pointer-events: none; background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: .6rem .8rem; box-shadow: 0 4px 16px rgba(0,0,0,.12); min-width: 130px; z-index: 10; }
.adm-tip-date { font-size: .75rem; font-weight: 600; color: var(--muted); margin-bottom: .4rem; }
.adm-tip-row { display: flex; align-items: center; gap: .45rem; font-size: .8rem; padding: .15rem 0; }
.adm-tip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.adm-tip-label { flex: 1; color: var(--text); }
.adm-tip-val { font-weight: 600; color: var(--text); }
.adm-chart-legend { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: .75rem; padding: 0 .25rem; }
.adm-legend-item { display: flex; align-items: center; gap: .4rem; font-size: .78rem; }
.adm-legend-swatch { width: 20px; height: 3px; border-radius: 2px; flex-shrink: 0; }
.adm-legend-label { color: var(--text); font-weight: 500; }
.adm-legend-max { color: var(--muted); font-size: .73rem; }

/* ── IP Logs admin page ── */
.ipl-filters { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.ipl-filter-group { display: flex; flex-direction: column; gap: .35rem; }
.ipl-filter-label { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.ipl-filter-pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.ipl-pill { display: inline-flex; align-items: center; padding: .3rem .75rem; border-radius: 999px; font-size: .8rem; border: 1px solid var(--border); background: var(--bg); color: var(--muted); cursor: pointer; transition: background .12s, color .12s, border-color .12s; }
.ipl-pill input[type=radio] { display: none; }
.ipl-pill:hover { color: var(--text); border-color: var(--accent2); }
.ipl-pill--active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 500; }
.ipl-filter-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.ipl-ip-input { max-width: 200px; }
.ipl-select { max-width: 180px; cursor: pointer; }
.ipl-filter-submit { display: flex; gap: .5rem; }
.ipl-summary { font-size: .82rem; color: var(--muted); margin-bottom: .75rem; }
.ipl-td-time { white-space: nowrap; font-family: 'DM Mono', monospace; font-size: .78rem !important; }
.ipl-td-path { font-family: 'DM Mono', monospace; font-size: .76rem !important; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ipl-td-ip { font-family: 'DM Mono', monospace; font-size: .78rem !important; white-space: nowrap; }
.ipl-ip-v6 { cursor: help; border-bottom: 1px dashed var(--border); }
.ipl-na { opacity: .35; }
.ipl-badge { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 500; white-space: nowrap; }
.ipl-badge--view    { background: color-mix(in srgb, var(--muted) 12%, transparent); color: var(--muted); }
.ipl-badge--login   { background: color-mix(in srgb, #1a8c5e 14%, transparent); color: #1a8c5e; border: 1px solid color-mix(in srgb, #1a8c5e 28%, transparent); }
.ipl-badge--signup  { background: color-mix(in srgb, #5865F2 14%, transparent); color: #5865F2; border: 1px solid color-mix(in srgb, #5865F2 28%, transparent); }
.ipl-badge--logout  { background: color-mix(in srgb, #d97706 14%, transparent); color: #d97706; border: 1px solid color-mix(in srgb, #d97706 28%, transparent); }
.ipl-badge--admin   { background: color-mix(in srgb, #e74c3c 14%, transparent); color: #c0392b; border: 1px solid color-mix(in srgb, #e74c3c 25%, transparent); }
.ipl-badge--other   { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.ipl-pagination { display: flex; align-items: center; gap: .75rem; margin-top: 1.25rem; }
.ipl-page-info { font-size: .82rem; color: var(--muted); }
.ipl-autocomplete { position: relative; display: inline-flex; align-items: center; }
.ipl-user-input { max-width: 180px; }
.ipl-clear-user { position: absolute; right: .5rem; background: none; border: none; color: var(--muted); font-size: 1rem; cursor: pointer; line-height: 1; padding: 0; }
.ipl-clear-user:hover { color: var(--text); }
.ipl-suggest { position: absolute; top: calc(100% + 4px); left: 0; min-width: 180px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.12); list-style: none; padding: .3rem 0; margin: 0; z-index: 200; }
.ipl-suggest-item { padding: .45rem .85rem; font-size: .85rem; cursor: pointer; color: var(--text); transition: background .1s; }
.ipl-suggest-item:hover, .ipl-suggest-item--active { background: var(--surface); }
.ipl-td-icon { text-align: center; width: 2.5rem; }
.ipl-info-btn { background: none; border: none; cursor: pointer; color: var(--muted); font-size: .9rem; padding: .1rem .2rem; line-height: 1; transition: color .12s; }
.ipl-info-btn:hover { color: var(--accent); }
.ipl-info-pop { position: absolute; z-index: 500; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 18px rgba(0,0,0,.15); padding: .6rem .75rem; display: flex; align-items: center; gap: .6rem; max-width: 420px; }
.ipl-info-val { font-family: 'DM Mono', monospace; font-size: .78rem; color: var(--text); word-break: break-all; flex: 1; }
.ipl-info-copy { flex-shrink: 0; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 6px; font-size: .75rem; padding: .25rem .6rem; cursor: pointer; transition: background .12s; white-space: nowrap; }
.ipl-info-copy:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.ipl-group-hdr td { background: var(--surface); padding: .5rem 1rem !important; cursor: pointer; user-select: none; border-top: 2px solid var(--border) !important; }
.ipl-group-hdr:hover td { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.ipl-group-toggle { display: inline-block; width: 1.1rem; font-family: 'DM Mono', monospace; font-size: .8rem; font-weight: 700; color: var(--muted); margin-right: .4rem; }
.ipl-group-user { font-weight: 600; font-size: .88rem; margin-right: .5rem; }
.ipl-group-count { font-size: .75rem; color: var(--muted); font-family: 'DM Mono', monospace; }

/* ── Admin inline edit on /book pages ── */
.iv-admin-edit { margin: .75rem 0 .5rem; border: 1px solid color-mix(in srgb, #e74c3c 30%, transparent); border-radius: 10px; background: color-mix(in srgb, #e74c3c 5%, transparent); }
.iv-admin-edit-toggle { list-style: none; cursor: pointer; padding: .5rem .85rem; font-size: .82rem; font-weight: 600; color: #c0392b; user-select: none; }
.iv-admin-edit-toggle::-webkit-details-marker { display: none; }
.iv-admin-edit-toggle:hover { opacity: .8; }
.iv-admin-edit-form { padding: .15rem .85rem .85rem; }
.iv-admin-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem 1rem; margin-bottom: .75rem; }
.iv-admin-edit-label { display: flex; flex-direction: column; gap: .3rem; font-size: .78rem; font-weight: 600; color: var(--muted); }
.iv-admin-edit-label--full { grid-column: 1 / -1; }
.iv-admin-edit-input { width: 100%; }
.iv-admin-edit-textarea { width: 100%; resize: vertical; font-family: 'DM Sans', sans-serif; font-size: .88rem; }
.iv-admin-edit-actions { margin-top: .25rem; }

/* ── Admin photo rotate button on /book gallery ── */
.gallery-rotate-btns { position: absolute; bottom: 2.6rem; right: .6rem; display: flex; gap: .25rem; z-index: 10; }
.gallery-rotate-btn { background: rgba(0,0,0,.55); color: #fff; border: none; border-radius: 6px; padding: 0 .45rem; height: 2.1rem; display: flex; align-items: center; justify-content: center; font-size: .72rem; font-family: 'DM Mono', monospace; font-weight: 600; cursor: pointer; transition: background .15s, opacity .15s; }
.gallery-rotate-btn:hover { background: rgba(0,0,0,.8); }
.gallery-rotate-btn:disabled { opacity: .5; cursor: not-allowed; }
.gallery-rotate-btn--spinning { animation: spin180 .6s linear infinite; }
@keyframes spin180 { to { transform: rotate(360deg); } }

/* ── Blank Book Fields admin page ── */
.bb-record { display: flex; align-items: center; gap: .9rem; padding: .65rem 1rem; margin-bottom: .75rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.bb-record-cover { flex-shrink: 0; width: 42px; height: 58px; border-radius: 4px; object-fit: cover; display: block; }
.bb-record-cover--empty { background: var(--bg); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .9rem; }
.bb-record-info { flex: 1; min-width: 0; }
.bb-record-isbn { font-family: 'DM Mono', monospace; font-size: .72rem; color: var(--muted); margin-bottom: .1rem; }
.bb-record-title { font-size: .88rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-record-author { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem 1.4rem; margin-bottom: 1.5rem; }
.bb-card-meta { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.bb-isbn { font-family: 'DM Mono', monospace; font-size: .85rem; font-weight: 600; color: var(--accent); text-decoration: none; }
.bb-isbn:hover { text-decoration: underline; }
.bb-listing-count { font-size: .78rem; color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: .15rem .6rem; }
.bb-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem 1rem; margin-bottom: 1rem; }
.bb-label { display: flex; flex-direction: column; gap: .3rem; font-size: .78rem; font-weight: 600; color: var(--muted); }
.bb-label--blank { color: #c0392b; }
.bb-label--blank .bb-input,
.bb-label--blank .bb-textarea { border-color: color-mix(in srgb, #e74c3c 40%, transparent); background: color-mix(in srgb, #e74c3c 5%, var(--surface)); }
.bb-label--full { grid-column: 1 / -1; }
.bb-input { width: 100%; }
.bb-input--short { max-width: 110px; }
.bb-textarea { width: 100%; resize: vertical; font-family: 'DM Sans', sans-serif; font-size: .88rem; }
.bb-actions { display: flex; gap: .75rem; }
.bb-ai-badge { font-size: .72rem; color: var(--muted); display: inline-flex; align-items: center; gap: .3rem; flex-wrap: wrap; }

/* ── API cover image gallery ── */
.cover-gallery { display: flex; flex-direction: column; gap: .6rem; margin: .75rem 0 1rem; }
.cover-gallery-heading { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.cover-gallery-scroll { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: .5rem; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.cover-gallery-scroll::-webkit-scrollbar { height: 4px; }
.cover-gallery-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.cover-gallery-item { flex: 0 0 auto; scroll-snap-align: start; cursor: pointer; border-radius: 8px; border: 2px solid var(--border); overflow: hidden; transition: border-color .15s, box-shadow .15s; position: relative; }
.cover-gallery-item:hover { border-color: var(--accent2); }
.cover-gallery-item.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.cover-gallery-img { display: block; width: 90px; height: 130px; object-fit: cover; }
.cover-gallery-badge { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; font-size: .6rem; font-family: 'DM Mono', monospace; color: rgba(255,255,255,.9); background: rgba(0,0,0,.55); padding: .15rem .3rem; }
.cover-gallery-check { display: none; position: absolute; top: 4px; right: 4px; background: var(--accent); color: #fff; border-radius: 50%; width: 18px; height: 18px; align-items: center; justify-content: center; font-size: .7rem; }
.cover-gallery-item.selected .cover-gallery-check { display: flex; }
.cover-gallery-none { padding: .75rem 1rem; color: var(--muted); font-size: .82rem; border: 1px dashed var(--border); border-radius: 8px; text-align: center; }
.cover-gallery-loading { padding: .5rem 0; color: var(--muted); font-size: .82rem; display: flex; align-items: center; gap: .5rem; }
.cover-gallery-no-photo-btn { background: none; border: none; color: var(--muted); font-size: .8rem; text-decoration: underline; cursor: pointer; padding: 0; align-self: flex-start; }

/* ── Global utility buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .6rem 1.1rem; border-radius: var(--radius); font-family: inherit; font-size: .88rem; font-weight: 500; cursor: pointer; border: 1px solid transparent; transition: opacity .15s, background .15s, border-color .15s, color .15s; white-space: nowrap; text-decoration: none; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn--primary  { background: var(--accent); color: #fff; border-color: transparent; }
.btn--primary:not(:disabled):hover { opacity: .88; }
html[data-theme="dark"] .btn--primary { color: #0d1f17; }
.btn--secondary { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.btn--secondary:not(:disabled):hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:not(:disabled):hover { background: var(--surface); border-color: var(--text); }
.btn--danger { background: color-mix(in srgb, #e74c3c 12%, transparent); color: #c0392b; border-color: color-mix(in srgb, #e74c3c 25%, transparent); }
.btn--danger:not(:disabled):hover { background: color-mix(in srgb, #e74c3c 20%, transparent); }
.btn--sm { padding: .3rem .65rem; font-size: .78rem; }

/* ── Search page — responsive fixes ── */
@media (max-width: 520px) {
  .search-hub-row { flex-direction: column; gap: .4rem; }
  .search-mode-select { width: 100%; padding: .65rem .75rem; height: auto; border-radius: 10px; }
  .isbn-result-count--none { display: none; }
  .isbn-result-item { gap: .6rem; padding: .6rem .75rem; }
}

/* ── My Library ── */
.lib-page { max-width: 900px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

/* Hero banner */
.lib-hero { display: flex; align-items: flex-start; gap: 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.5rem 1.6rem; margin-bottom: 1.75rem; }
.lib-hero-icon { font-size: 2.2rem; color: var(--accent2); flex-shrink: 0; line-height: 1; padding-top: .1rem; }
.lib-hero-body { flex: 1; min-width: 0; }
.lib-hero-title-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.lib-hero-title { font-size: 1.4rem; font-weight: 700; margin: 0; }
.lib-hero-dismiss { background: none; border: none; color: var(--muted); cursor: pointer; padding: .15rem .35rem; border-radius: 5px; font-size: .85rem; line-height: 1; margin-left: auto; transition: color .12s; }
.lib-hero-dismiss:hover { color: var(--text); }
.lib-hero-desc { font-size: .9rem; color: var(--muted); margin: 0 0 .85rem; line-height: 1.6; }
.lib-hero-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.lib-hero-steps li { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: .55rem; }
.lib-hero-steps li i { color: var(--accent2); width: 14px; text-align: center; flex-shrink: 0; }

/* Inline add panel */
.lib-add-panel { display: none; background: var(--surface); border: 1.5px solid var(--accent); border-radius: 14px; padding: 1.25rem 1.4rem; margin-bottom: 1.5rem; }
.lib-add-panel--open { display: block; }
.lib-add-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.lib-add-panel-title { font-size: 1rem; font-weight: 700; margin: 0; }
.lib-add-panel-close { background: none; border: none; color: var(--muted); font-size: .85rem; cursor: pointer; font-family: inherit; padding: .25rem .5rem; border-radius: 6px; transition: color .12s; }
.lib-add-panel-close:hover { color: var(--text); }

/* Panel steps */
.lib-panel-step { display: flex; flex-direction: column; gap: .75rem; }
.lib-panel-step--hidden { display: none; }

/* Scan CTA button */
.lib-panel-scan-cta { display: flex; align-items: center; justify-content: center; gap: .6rem; width: 100%; background: var(--accent); color: #fff; border: none; border-radius: 10px; padding: .9rem 1.4rem; font-size: 1rem; font-weight: 600; font-family: inherit; cursor: pointer; transition: opacity .15s; }
.lib-panel-scan-cta:hover { opacity: .9; }

/* Divider */
.lib-panel-divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .8rem; }
.lib-panel-divider::before,
.lib-panel-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ISBN input row */
.lib-isbn-row { display: flex; gap: .5rem; align-items: stretch; }
.lib-isbn-input { flex: 1; min-width: 0; }
.lib-isbn-row .btn { flex-shrink: 0; white-space: nowrap; }
.lib-panel-hint { font-size: .83rem; color: var(--muted); margin: 0; min-height: 1.2em; }

/* Step 2 preview */
.lib-panel-preview { display: flex; gap: 1rem; align-items: flex-start; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: .85rem 1rem; }
.lib-panel-cover { width: 56px; height: 80px; object-fit: cover; border-radius: 5px; flex-shrink: 0; display: block; }
.lib-panel-preview-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .25rem; padding-top: .1rem; }
.lib-panel-preview-title { font-size: .95rem; font-weight: 600; display: block; }
.lib-panel-preview-author { font-size: .82rem; color: var(--muted); display: block; }
.lib-panel-already-owned { display: none; font-size: .78rem; color: var(--accent); font-weight: 600; }
.lib-panel-step2-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* Trigger area */
.lib-add-trigger { margin-bottom: 1.5rem; }
.lib-cta-btn { display: flex; align-items: center; justify-content: center; gap: .65rem; width: 100%; padding: 1.1rem 1.5rem; background: var(--accent); color: #fff; border: none; border-radius: 12px; font-size: 1.05rem; font-weight: 700; font-family: inherit; cursor: pointer; transition: opacity .15s; }
.lib-cta-btn:hover { opacity: .9; }
.lib-library-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.lib-library-count { font-size: .9rem; color: var(--muted); }

/* Empty state hint */
.lib-empty-hint { text-align: center; padding: 3rem 1rem 1.5rem; color: var(--muted); }
.lib-empty-hint p { margin: 0; font-size: .95rem; }
.lib-empty-hint-arrow { display: block; font-size: 1.8rem; margin-bottom: .75rem; color: var(--accent2); }

/* Search row */
.lib-search-row { display: flex; gap: .5rem; margin-bottom: 1.75rem; }
.lib-search-wrap { flex: 1; position: relative; display: flex; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0 1rem; transition: border-color .15s; }
.lib-search-wrap:focus-within { border-color: var(--accent); }
.lib-search-icon { color: var(--muted); font-size: .9rem; flex-shrink: 0; }
.lib-search-input { flex: 1; background: none; border: none; outline: none; padding: .85rem .65rem; font-size: 1rem; color: var(--text); font-family: inherit; width: 100%; }
.lib-search-input::placeholder { color: var(--muted); }

/* No results */
.lib-no-results { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }

/* Books grid */
.lib-books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 1rem; }
.lib-book-card { display: flex; flex-direction: column; gap: .5rem; position: relative; }
.lib-book-cover-wrap { position: relative; aspect-ratio: 2/3; border-radius: 8px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); }
.lib-book-cover { display: block; width: 100%; height: 100%; object-fit: cover; }
.lib-book-cover-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 2rem; }
.lib-book-info { display: flex; flex-direction: column; gap: .15rem; }
.lib-book-title { font-size: .8rem; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lib-book-author { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-book-isbn-link { font-size: .68rem; color: var(--accent); text-decoration: none; font-weight: 500; margin-top: .1rem; }
.lib-book-isbn-link:hover { text-decoration: underline; }
.lib-book-org { font-size: .68rem; color: var(--accent); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-book-edit { position: absolute; top: .3rem; left: .3rem; background: rgba(0,0,0,.55); color: #fff; border: none; border-radius: 6px; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; font-size: .65rem; cursor: pointer; opacity: 0; transition: opacity .15s; }
.lib-book-remove { position: absolute; top: .3rem; right: .3rem; background: rgba(0,0,0,.55); color: #fff; border: none; border-radius: 6px; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; font-size: .75rem; cursor: pointer; opacity: 0; transition: opacity .15s; }
.lib-book-card:hover .lib-book-edit,
.lib-book-card:hover .lib-book-remove,
.lib-book-edit:focus,
.lib-book-remove:focus { opacity: 1; }

/* ── Library header actions ── */
.lib-header-actions { display: flex; gap: .5rem; align-items: center; }

/* ── Collection filter dropdown ── */
.lib-filter-bar { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.lib-filter-select { -webkit-appearance: none; appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E") no-repeat right .75rem center; background-size: 10px 6px; padding: .42rem 2.25rem .42rem .75rem; border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-family: inherit; font-size: .88rem; cursor: pointer; min-width: 160px; }

/* ── Book cover link (my-library individual card) ── */
.lib-book-cover-link { display: block; }

/* ── Series card (my-library grid) ── */
.lib-series-card { display: flex; flex-direction: column; gap: .5rem; position: relative; text-decoration: none; color: inherit; }
.lib-series-card:hover .lib-book-cover-wrap { border-color: var(--accent); }
.lib-series-badge { position: absolute; bottom: .35rem; right: .35rem; background: var(--accent); color: #fff; font-size: .65rem; font-weight: 700; border-radius: 10px; padding: .1rem .4rem; line-height: 1.4; }
.lib-series-count { font-size: .72rem; color: var(--muted); }
.lib-series-link-hint { font-size: .68rem; color: var(--accent); font-weight: 500; margin-top: .1rem; }

/* ── Pagination ── */
.lib-pager { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: center; margin-top: 2rem; padding-bottom: 1rem; }
.lib-pager-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; height: 2rem; padding: 0 .5rem; border: 1px solid var(--border); border-radius: 7px; font-size: .85rem; text-decoration: none; color: var(--muted); background: var(--surface); transition: border-color .12s, color .12s; }
.lib-pager-btn:hover { border-color: var(--accent); color: var(--accent); }
.lib-pager-btn--active { background: var(--accent); border-color: var(--accent); color: #fff; pointer-events: none; }

/* ── Placeholder book card ── */
.lib-book-card--placeholder { opacity: .5; filter: grayscale(.85); }
.lib-placeholder-badge { position: absolute; top: .35rem; left: .35rem; background: rgba(0,0,0,.6); color: #ddd; font-size: .6rem; font-weight: 600; border-radius: 5px; padding: .15rem .35rem; line-height: 1.3; letter-spacing: .02em; text-transform: uppercase; pointer-events: none; }

/* ── Collections management modal ── */
.lib-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1200; align-items: center; justify-content: center; }
.lib-modal-overlay--open { display: flex; }
.lib-modal { background: var(--surface); border-radius: 16px; padding: 1.5rem; width: min(90vw, 420px); box-shadow: 0 8px 32px rgba(0,0,0,.2); }
.lib-modal--wide { width: min(90vw, 520px); }
.lib-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.lib-modal-title { font-size: 1rem; font-weight: 700; margin: 0; }
.lib-modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--muted); line-height: 1; padding: 0; }
.lib-modal-book-name { font-size: .82rem; color: var(--muted); margin: 0 0 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-modal-fields { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; }
.lib-edit-label { display: flex; flex-direction: column; gap: .3rem; font-size: .82rem; font-weight: 600; color: var(--text); }
.lib-edit-select, .lib-edit-input { padding: .45rem .65rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-family: inherit; font-size: .85rem; width: 100%; }
.lib-edit-new-wrap { display: none; }
.lib-edit-actions { display: flex; gap: .6rem; }
.lib-col-modal-create { display: flex; gap: .5rem; margin-bottom: .75rem; }
.lib-col-modal-input { flex: 1; min-width: 0; padding: .4rem .65rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-family: inherit; font-size: .85rem; }
.lib-col-modal-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .3rem; max-height: 280px; overflow-y: auto; }
.lib-col-modal-item { display: flex; align-items: center; gap: .5rem; padding: .4rem .5rem; border-radius: 8px; background: var(--bg); }
.lib-col-modal-name { flex: 1; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-col-modal-name-input { flex: 1; font-size: .9rem; font-family: inherit; border: 1px solid var(--accent); border-radius: 6px; padding: .2rem .45rem; background: var(--bg); color: var(--text); outline: none; min-width: 0; }
.lib-col-modal-item-actions { display: flex; gap: .15rem; flex-shrink: 0; }
.lib-col-modal-btn { background: none; border: none; padding: .3rem .4rem; color: var(--muted); cursor: pointer; border-radius: 6px; font-size: .75rem; line-height: 1; transition: color .12s; }
.lib-col-modal-btn:hover { color: var(--accent); }
.lib-col-modal-btn--del:hover { color: #c0392b; }
.lib-col-modal-empty { color: var(--muted); font-size: .85rem; text-align: center; padding: .75rem 0; }

/* ── Series detection modal body ── */
.lib-series-modal-body { min-height: 2rem; }
.lib-series-loading { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 0; color: var(--muted); font-size: .9rem; }
.lib-series-none, .lib-series-error { padding: 1.25rem 0; color: var(--muted); font-size: .9rem; }
.lib-series-intro { font-size: .9rem; margin-bottom: .75rem; }
.lib-series-results { display: flex; flex-direction: column; gap: .4rem; max-height: 320px; overflow-y: auto; padding: .1rem 0; margin-bottom: .75rem; }
.lib-series-result-group { font-size: .8rem; font-weight: 700; color: var(--accent); padding: .5rem .25rem .2rem; display: flex; align-items: center; gap: .35rem; }
.lib-series-result-item { display: flex; gap: .65rem; align-items: flex-start; padding: .4rem; background: var(--bg); border-radius: 8px; }
.lib-series-result-cover { width: 40px; height: 56px; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: var(--border); }
.lib-series-result-cover--fb { width: 40px; height: 56px; display: flex; align-items: center; justify-content: center; border-radius: 4px; background: var(--border); color: var(--muted); flex-shrink: 0; }
.lib-series-result-info { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.lib-series-result-title { font-size: .85rem; font-weight: 600; line-height: 1.3; }
.lib-series-result-author { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-series-result-series { font-size: .72rem; color: var(--accent); }
.lib-series-result-isbn { font-size: .7rem; font-family: monospace; color: var(--muted); }

/* ── My Collections page ── */
.mycol-page { max-width: 860px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.mycol-topbar { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.mycol-back { font-size: .88rem; color: var(--muted); text-decoration: none; display: flex; align-items: center; gap: .4rem; }
.mycol-back:hover { color: var(--accent); }
.mycol-title { font-size: 1.4rem; font-weight: 700; margin: 0; }
.mycol-controls { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.mycol-col-select-wrap { flex: 1; min-width: 160px; max-width: 300px; }
.mycol-col-select-wrap .lib-filter-select { width: 100%; }
.mycol-empty { color: var(--muted); text-align: center; padding: 3rem 1rem; font-size: .95rem; }
.mycol-series-section { margin-bottom: 2.25rem; }
.mycol-series-title { font-size: .95rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; margin-bottom: .85rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.mycol-series-counts { font-size: .8rem; font-weight: 400; color: var(--muted); }
.mycol-series-empty { color: var(--muted); font-size: .85rem; padding: .5rem 0; }

/* Responsive */
@media (max-width: 600px) {
  .lib-hero { flex-direction: column; gap: .75rem; }
  .lib-hero-icon { font-size: 1.8rem; }
}
@media (max-width: 480px) {
  .lib-books-grid { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: .75rem; }
  .lib-panel-step2-actions { flex-direction: column; }
}
.cover-gallery-no-photo-btn:hover { color: var(--fg); }
