/* ==========================================================================
   QuickRead — design system
   Mirrors the mockup: indigo primary, deep-navy hero, soft neutral surfaces.
   ========================================================================== */

:root {
    --qr-primary:        #5B4FE9;
    --qr-primary-dark:   #4a3fd4;
    --qr-primary-light:  #ebe9ff;
    --qr-primary-soft:   #f4f2ff;
    --qr-navy:           #0d1733;
    --qr-navy-2:         #16224a;
    --qr-ink:            #101828;
    --qr-body:           #475467;
    --qr-muted:          #98a2b3;
    --qr-line:           #eaecf0;
    --qr-line-strong:    #d0d5dd;
    --qr-surface:        #ffffff;
    --qr-bg:             #f7f8fc;
    --qr-bg-2:           #eef0f7;
    --qr-success:        #12b76a;
    --qr-success-bg:     #ecfdf3;
    --qr-warning:        #f79009;
    --qr-warning-bg:     #fffaeb;
    --qr-danger:         #f04438;
    --qr-danger-bg:      #fef3f2;
    --qr-info:           #2e90fa;
    --qr-info-bg:        #eff8ff;

    --qr-radius-sm: 8px;
    --qr-radius:    14px;
    --qr-radius-lg: 20px;
    --qr-radius-xl: 28px;

    --qr-shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --qr-shadow-sm: 0 2px 8px rgba(16, 24, 40, .06);
    --qr-shadow:    0 8px 24px rgba(16, 24, 40, .08);
    --qr-shadow-lg: 0 18px 48px rgba(16, 24, 40, .14);

    --qr-header-h: 68px;
    --qr-maxw: 1180px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--qr-ink);
    background: var(--qr-bg);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--qr-line); margin: 24px 0; }

.container { width: 100%; max-width: var(--qr-maxw); margin: 0 auto; padding: 0 20px; }
.container-wide { max-width: 1440px; }
.container-narrow { max-width: 640px; }

/* ------------------------------- utilities ------------------------------ */
.muted     { color: var(--qr-muted); }
.text-body { color: var(--qr-body); }
.text-sm   { font-size: 13px; }
.text-xs   { font-size: 12px; }
.text-lg   { font-size: 17px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.strong    { font-weight: 700; }
.semibold  { font-weight: 600; }
.nowrap    { white-space: nowrap; }
.flex      { display: flex; }
.flex-1    { flex: 1; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-4  { gap: 4px; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.wrap   { flex-wrap: wrap; }
.grid   { display: grid; }
.mt-0 { margin-top: 0; } .mt-4 { margin-top: 4px; }  .mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; } .mt-40 { margin-top: 40px; }
.mb-0 { margin-bottom: 0; } .mb-4 { margin-bottom: 4px; } .mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; } .mb-32 { margin-bottom: 32px; }
.ml-auto { margin-left: auto; }
.hidden { display: none !important; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.clamp-3 {
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
    overflow: hidden;
}

/* -------------------------------- buttons ------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--qr-primary);
    color: #fff;
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    transition: background .15s, box-shadow .15s, transform .1s, border-color .15s;
    text-align: center;
    white-space: nowrap;
    line-height: 1.2;
}
.btn:hover  { background: var(--qr-primary-dark); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--qr-primary); outline-offset: 2px; }
.btn svg { width: 17px; height: 17px; flex: none; }

.btn-block { width: 100%; }
.btn-lg { padding: 14px 26px; font-size: 15px; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-xs { padding: 5px 10px; font-size: 12px; gap: 5px; }
.btn-xs svg { width: 14px; height: 14px; }

.btn-outline {
    background: #fff; color: var(--qr-ink); border-color: var(--qr-line-strong);
}
.btn-outline:hover { background: var(--qr-bg); border-color: var(--qr-muted); }

.btn-ghost { background: transparent; color: var(--qr-body); }
.btn-ghost:hover { background: var(--qr-bg-2); color: var(--qr-ink); }

.btn-light { background: var(--qr-primary-light); color: var(--qr-primary); }
.btn-light:hover { background: #ded9ff; }

.btn-navy { background: var(--qr-navy); }
.btn-navy:hover { background: var(--qr-navy-2); }

.btn-success { background: var(--qr-success); }
.btn-success:hover { background: #0f9f5c; }

.btn-danger { background: var(--qr-danger); }
.btn-danger:hover { background: #d92d20; }

.btn-danger-soft { background: var(--qr-danger-bg); color: var(--qr-danger); }
.btn-danger-soft:hover { background: #fdddd9; }

.btn-white { background: #fff; color: var(--qr-ink); }
.btn-white:hover { background: #f2f4f7; }

.btn[disabled], .btn.is-disabled {
    opacity: .55; cursor: not-allowed; pointer-events: none;
}

.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* --------------------------------- forms -------------------------------- */
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

label, .label {
    display: block; margin-bottom: 6px;
    font-size: 13px; font-weight: 600; color: var(--qr-ink);
}
.label .req { color: var(--qr-danger); }

.input, .select, .textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--qr-line-strong);
    border-radius: var(--qr-radius-sm);
    background: #fff;
    font-size: 14px;
    color: var(--qr-ink);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--qr-primary);
    box-shadow: 0 0 0 3px rgba(91, 79, 233, .14);
}
.input::placeholder, .textarea::placeholder { color: var(--qr-muted); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 36px;
}

.input-group { display: flex; }
.input-group .input { border-radius: var(--qr-radius-sm) 0 0 var(--qr-radius-sm); }
.input-group .btn  { border-radius: 0 var(--qr-radius-sm) var(--qr-radius-sm) 0; }

.input-icon { position: relative; }
.input-icon svg {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; color: var(--qr-muted); pointer-events: none;
}
.input-icon .input { padding-left: 40px; }

.help { font-size: 12px; color: var(--qr-muted); margin-top: 5px; }
.field-error { font-size: 12px; color: var(--qr-danger); margin-top: 5px; }

.checkbox, .radio {
    display: flex; align-items: flex-start; gap: 9px;
    font-size: 14px; font-weight: 400; color: var(--qr-body);
    cursor: pointer; margin-bottom: 0;
}
.checkbox input, .radio input { margin: 3px 0 0; accent-color: var(--qr-primary); flex: none; }
.checkbox a { color: var(--qr-primary); font-weight: 600; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
    width: 42px; height: 24px; border-radius: 999px; background: var(--qr-line-strong);
    position: relative; transition: background .18s; flex: none;
}
.switch .track::after {
    content: ''; position: absolute; top: 3px; left: 3px;
    width: 18px; height: 18px; border-radius: 50%; background: #fff;
    box-shadow: var(--qr-shadow-xs); transition: transform .18s;
}
.switch input:checked + .track { background: var(--qr-primary); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch .switch-label { font-size: 14px; font-weight: 500; }

/* --------------------------------- cards -------------------------------- */
.card {
    background: var(--qr-surface);
    border: 1px solid var(--qr-line);
    border-radius: var(--qr-radius);
    box-shadow: var(--qr-shadow-xs);
}
.card-pad { padding: 22px; }
.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--qr-line);
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.card-header h2, .card-header h3 { font-size: 16px; }
.card-body { padding: 22px; }
.card-footer {
    padding: 16px 22px; border-top: 1px solid var(--qr-line);
    background: #fcfcfd;
    border-radius: 0 0 var(--qr-radius) var(--qr-radius);
}

/* -------------------------------- badges -------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px; font-weight: 600;
    background: var(--qr-bg-2); color: var(--qr-body);
    white-space: nowrap;
}
.badge svg { width: 13px; height: 13px; }
.badge-primary { background: var(--qr-primary-light); color: var(--qr-primary); }
.badge-success { background: var(--qr-success-bg); color: #027a48; }
.badge-warning { background: var(--qr-warning-bg); color: #b54708; }
.badge-danger  { background: var(--qr-danger-bg);  color: #b42318; }
.badge-info    { background: var(--qr-info-bg);    color: #175cd3; }
.badge-navy    { background: var(--qr-navy);       color: #fff; }
.badge-outline { background: transparent; border: 1px solid var(--qr-line-strong); color: var(--qr-body); }

.badge-discount { background: #ecfdf3; color: #027a48; font-weight: 700; }

/* --------------------------------- alerts ------------------------------- */
.alert {
    display: flex; align-items: flex-start; gap: 11px;
    padding: 13px 16px;
    border-radius: var(--qr-radius-sm);
    font-size: 14px;
    border: 1px solid transparent;
    margin-bottom: 16px;
}
.alert svg { width: 19px; height: 19px; flex: none; margin-top: 1px; }
.alert-success { background: var(--qr-success-bg); color: #027a48; border-color: #a6f4c5; }
.alert-error   { background: var(--qr-danger-bg);  color: #b42318; border-color: #fecdca; }
.alert-warning { background: var(--qr-warning-bg); color: #b54708; border-color: #fedf89; }
.alert-info    { background: var(--qr-info-bg);    color: #175cd3; border-color: #b2ddff; }
.alert-close { margin-left: auto; background: none; border: 0; cursor: pointer; opacity: .6; padding: 0; }
.alert-close:hover { opacity: 1; }

.flash-stack { position: fixed; top: 82px; right: 22px; z-index: 200; width: 340px; max-width: calc(100vw - 44px); }
.flash-stack .alert { box-shadow: var(--qr-shadow); margin-bottom: 10px; background: #fff; }

/* -------------------------------- header -------------------------------- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--qr-line);
}
.header-inner {
    height: var(--qr-header-h);
    display: flex; align-items: center; gap: 26px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.logo svg, .logo img { width: 30px; height: 30px; flex: none; }
.logo-mark {
    width: 30px; height: 30px; border-radius: 9px;
    background: linear-gradient(135deg, var(--qr-primary), #8b5cf6);
    display: grid; place-items: center; color: #fff; flex: none;
}
.logo-mark svg { width: 17px; height: 17px; }

.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a {
    padding: 8px 14px; border-radius: 999px;
    font-size: 14px; font-weight: 500; color: var(--qr-body);
    transition: background .15s, color .15s;
}
.main-nav a:hover { background: var(--qr-bg-2); color: var(--qr-ink); }
.main-nav a.active { background: var(--qr-primary-light); color: var(--qr-primary); font-weight: 600; }

.header-search { position: relative; flex: 1; max-width: 420px; }
.header-search .input-icon svg { left: 14px; }
.header-search .input {
    border-radius: 999px; padding: 9px 16px 9px 42px;
    background: var(--qr-bg-2); border-color: transparent; font-size: 14px;
}
.header-search .input:focus { background: #fff; border-color: var(--qr-primary); }

.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn {
    position: relative;
    width: 40px; height: 40px; border-radius: 50%;
    display: grid; place-items: center;
    background: transparent; border: 0; cursor: pointer;
    color: var(--qr-body); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--qr-bg-2); color: var(--qr-ink); }
.icon-btn svg { width: 20px; height: 20px; }
.cart-count {
    position: absolute; top: 3px; right: 2px;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 999px; background: var(--qr-primary); color: #fff;
    font-size: 11px; font-weight: 700; display: grid; place-items: center;
    border: 2px solid #fff;
}

/* avatar + dropdown */
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--qr-primary), #8b5cf6);
    color: #fff; display: grid; place-items: center;
    font-weight: 700; font-size: 14px; flex: none; object-fit: cover;
}
.avatar-lg { width: 68px; height: 68px; font-size: 24px; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-xl { width: 96px; height: 96px; font-size: 34px; }

.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 10px);
    min-width: 232px;
    background: #fff; border: 1px solid var(--qr-line);
    border-radius: var(--qr-radius); box-shadow: var(--qr-shadow-lg);
    padding: 7px; z-index: 120;
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity .16s, transform .16s, visibility .16s;
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-menu a, .dropdown-menu button {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 9px 12px; border: 0; background: none;
    border-radius: var(--qr-radius-sm);
    font-size: 14px; font-weight: 500; color: var(--qr-body);
    cursor: pointer; text-align: left;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--qr-bg); color: var(--qr-ink); }
.dropdown-menu svg { width: 17px; height: 17px; }
.dropdown-head { padding: 11px 12px 9px; border-bottom: 1px solid var(--qr-line); margin-bottom: 6px; }
.dropdown-sep { height: 1px; background: var(--qr-line); margin: 6px 0; }

/* mobile nav */
.mobile-nav { display: none; }

/* --------------------------------- hero --------------------------------- */
.hero {
    position: relative;
    background:
        radial-gradient(900px 420px at 85% -10%, rgba(124, 58, 237, .5), transparent 62%),
        linear-gradient(150deg, var(--qr-navy) 0%, #1b2a5c 55%, #2a1f63 100%);
    color: #fff;
    overflow: hidden;
}
.hero::after {
    content: '';
    position: absolute; inset: 0;
    background-image:
        radial-gradient(circle at 78% 74%, rgba(91, 79, 233, .34), transparent 46%),
        radial-gradient(circle at 14% 88%, rgba(139, 92, 246, .26), transparent 40%);
    pointer-events: none;
}
.hero-inner {
    position: relative; z-index: 1;
    display: grid; grid-template-columns: 1.05fr .95fr;
    gap: 48px; align-items: center;
    padding: 68px 0 74px;
}
.hero h1 { font-size: 46px; font-weight: 800; letter-spacing: -.03em; line-height: 1.08; }
.hero h1 .accent {
    display: block;
    background: linear-gradient(100deg, #a78bfa, #7c3aed 55%, #c4b5fd);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { font-size: 16px; color: rgba(255, 255, 255, .78); max-width: 460px; margin: 16px 0 26px; }
.hero-search { max-width: 470px; }
.hero-search .input-icon svg { left: 16px; }
.hero-search .input {
    border-radius: 999px; padding: 14px 18px 14px 46px;
    border: 0; background: #fff; font-size: 15px;
}
.hero-stats { display: flex; gap: 34px; margin-top: 32px; }
.hero-stat .n { font-size: 22px; font-weight: 800; }
.hero-stat .l { font-size: 12.5px; color: rgba(255, 255, 255, .6); }

.hero-visual { position: relative; display: grid; place-items: center; min-height: 300px; }
.hero-visual::before {
    content: '';
    position: absolute; width: 300px; height: 300px; border-radius: 50%;
    background: radial-gradient(circle, rgba(124, 58, 237, .55), transparent 68%);
    filter: blur(30px);
}
.hero-books { position: relative; display: flex; align-items: flex-end; gap: 14px; }
.hero-books img {
    width: 118px; aspect-ratio: 2/3; object-fit: cover;
    border-radius: 10px; box-shadow: 0 22px 44px rgba(0, 0, 0, .42);
}
.hero-books img:nth-child(1) { transform: rotate(-8deg) translateY(10px); }
.hero-books img:nth-child(2) { transform: translateY(-14px) scale(1.06); z-index: 2; }
.hero-books img:nth-child(3) { transform: rotate(8deg) translateY(10px); }

/* --------------------------------- pages -------------------------------- */
.page { padding: 32px 0 72px; }
.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: 28px; }
.page-head p { color: var(--qr-body); margin: 6px 0 0; }

.section { margin-bottom: 44px; }
.section-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin-bottom: 18px;
}
.section-head h2 { font-size: 19px; }
.section-head .link {
    font-size: 13.5px; font-weight: 600; color: var(--qr-primary);
    display: inline-flex; align-items: center; gap: 4px;
}
.section-head .link:hover { text-decoration: underline; }

/* breadcrumbs */
.breadcrumbs {
    display: flex; align-items: center; gap: 7px;
    font-size: 13px; color: var(--qr-muted); margin-bottom: 16px;
}
.breadcrumbs a:hover { color: var(--qr-primary); }
.breadcrumbs svg { width: 14px; height: 14px; }

/* ------------------------------ category rail --------------------------- */
.cat-rail { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.cat-rail::-webkit-scrollbar { height: 5px; }
.cat-rail::-webkit-scrollbar-thumb { background: var(--qr-line-strong); border-radius: 99px; }

.cat-chip {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    min-width: 80px; padding: 4px 2px;
    font-size: 12.5px; font-weight: 600; color: var(--qr-body);
    transition: color .15s;
}
.cat-chip:hover { color: var(--qr-primary); }
.cat-chip .cat-icon {
    width: 52px; height: 52px; border-radius: 16px;
    display: grid; place-items: center; color: #fff;
    box-shadow: var(--qr-shadow-sm);
}
.cat-chip .cat-icon svg { width: 23px; height: 23px; }
.cat-chip.active .cat-icon { box-shadow: 0 0 0 3px var(--qr-primary-light); }
.cat-chip.active { color: var(--qr-primary); }

.cat-tile {
    display: flex; align-items: center; gap: 14px;
    padding: 16px; border-radius: var(--qr-radius);
    background: #fff; border: 1px solid var(--qr-line);
    transition: box-shadow .16s, transform .16s, border-color .16s;
}
.cat-tile:hover { box-shadow: var(--qr-shadow); transform: translateY(-2px); border-color: var(--qr-primary-light); }
.cat-tile .cat-icon {
    width: 46px; height: 46px; border-radius: 14px;
    display: grid; place-items: center; color: #fff; flex: none;
}
.cat-tile .cat-icon svg { width: 21px; height: 21px; }
.cat-tile .cat-name { font-weight: 600; font-size: 14.5px; }
.cat-tile .cat-count { font-size: 12.5px; color: var(--qr-muted); }

/* ------------------------------ book cards ------------------------------ */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 26px 20px;
}
.book-grid-lg { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }

.book-card { display: flex; flex-direction: column; position: relative; }
.book-card .cover-wrap {
    position: relative;
    border-radius: var(--qr-radius);
    overflow: hidden;
    background: var(--qr-bg-2);
    box-shadow: var(--qr-shadow-sm);
    transition: transform .2s, box-shadow .2s;
    aspect-ratio: 2/3;
}
.book-card:hover .cover-wrap { transform: translateY(-4px); box-shadow: var(--qr-shadow-lg); }
.book-card .cover-wrap img { width: 100%; height: 100%; object-fit: cover; }

.book-card .cover-badge {
    position: absolute; top: 9px; left: 9px;
    padding: 3px 8px; border-radius: 6px;
    background: rgba(13, 23, 51, .82); color: #fff;
    font-size: 11px; font-weight: 700; backdrop-filter: blur(4px);
}
.book-card .cover-fav {
    position: absolute; top: 8px; right: 8px;
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(255, 255, 255, .9); border: 0; cursor: pointer;
    display: grid; place-items: center; color: var(--qr-body);
    box-shadow: var(--qr-shadow-xs);
}
.book-card .cover-fav svg { width: 15px; height: 15px; }
.book-card .cover-fav.on { color: var(--qr-danger); }
.book-card .cover-actions {
    position: absolute; inset: auto 0 0 0; padding: 34px 10px 10px;
    background: linear-gradient(transparent, rgba(13, 23, 51, .82));
    display: flex; gap: 6px;
    opacity: 0; transition: opacity .18s;
}
.book-card:hover .cover-actions { opacity: 1; }
.book-card .cover-actions .btn { flex: 1; padding: 7px 10px; font-size: 12px; }

.book-card .book-title {
    margin: 12px 0 2px;
    font-size: 14px; font-weight: 600; line-height: 1.35;
    color: var(--qr-ink);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.book-card:hover .book-title { color: var(--qr-primary); }
.book-card .book-author { font-size: 12.5px; color: var(--qr-muted); }
.book-card .book-meta { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.book-card .rating { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--qr-body); font-weight: 600; }
.book-card .rating svg { width: 13px; height: 13px; color: var(--qr-warning); }
.book-card .price-row { display: flex; align-items: baseline; gap: 7px; margin-top: 7px; flex-wrap: wrap; }
.book-card .price { font-size: 15px; font-weight: 800; color: var(--qr-ink); }
.book-card .price-old { font-size: 12.5px; color: var(--qr-muted); text-decoration: line-through; }
.book-card .price-free { color: var(--qr-success); }

/* stars */
.stars { display: inline-flex; gap: 1px; color: var(--qr-warning); }
.star { width: 14px; height: 14px; }

/* ------------------------------ list rows ------------------------------- */
.book-row {
    display: flex; gap: 16px;
    padding: 16px;
    background: #fff; border: 1px solid var(--qr-line);
    border-radius: var(--qr-radius);
    transition: box-shadow .16s, border-color .16s;
}
.book-row:hover { box-shadow: var(--qr-shadow-sm); border-color: var(--qr-line-strong); }
.book-row .thumb {
    width: 68px; aspect-ratio: 2/3; flex: none;
    border-radius: 9px; overflow: hidden; background: var(--qr-bg-2);
    box-shadow: var(--qr-shadow-xs);
}
.book-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.book-row .info { flex: 1; min-width: 0; }
.book-row .info h3 { font-size: 15px; }
.book-row .info h3:hover { color: var(--qr-primary); }

/* ---------------------------- book detail ------------------------------- */
.detail-grid { display: grid; grid-template-columns: 320px 1fr; gap: 44px; align-items: start; }
.detail-cover {
    position: sticky; top: calc(var(--qr-header-h) + 20px);
}
.detail-cover .cover-box {
    border-radius: var(--qr-radius-lg); overflow: hidden;
    background: var(--qr-bg-2); box-shadow: var(--qr-shadow-lg);
    aspect-ratio: 2/3;
}
.detail-cover .cover-box img { width: 100%; height: 100%; object-fit: cover; }

.detail-title { font-size: 32px; letter-spacing: -.02em; }
.detail-sub { font-size: 16px; color: var(--qr-body); margin-top: 8px; }
.detail-author { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.detail-author a { font-weight: 600; color: var(--qr-primary); }

.detail-rating { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.detail-rating .score { font-weight: 800; font-size: 15px; }

.detail-price { display: flex; align-items: baseline; gap: 12px; margin: 22px 0 20px; flex-wrap: wrap; }
.detail-price .now { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.detail-price .was { font-size: 16px; color: var(--qr-muted); text-decoration: line-through; }

.format-tabs {
    display: inline-flex; padding: 4px; gap: 4px;
    background: var(--qr-bg-2); border-radius: 999px; margin-bottom: 20px;
}
.format-tabs span {
    padding: 7px 20px; border-radius: 999px;
    font-size: 13.5px; font-weight: 600; color: var(--qr-body);
    display: inline-flex; align-items: center; gap: 7px;
}
.format-tabs span svg { width: 15px; height: 15px; }
.format-tabs span.active { background: var(--qr-primary); color: #fff; }
.format-tabs span.disabled { opacity: .45; text-decoration: line-through; }

.detail-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.detail-actions .btn { flex: 1; min-width: 180px; }

.assurance {
    display: flex; gap: 22px; flex-wrap: wrap;
    margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--qr-line);
}
.assurance .item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--qr-body); }
.assurance svg { width: 15px; height: 15px; color: var(--qr-success); }

.spec-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.spec { font-size: 13px; }
.spec .k { color: var(--qr-muted); font-size: 12px; }
.spec .v { font-weight: 600; }

/* rating breakdown */
.rating-summary { display: grid; grid-template-columns: 150px 1fr; gap: 26px; align-items: center; }
.rating-summary .big { text-align: center; }
.rating-summary .big .n { font-size: 40px; font-weight: 800; line-height: 1; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; margin-bottom: 6px; }
.bar-row .bar { flex: 1; height: 7px; border-radius: 99px; background: var(--qr-bg-2); overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; background: var(--qr-warning); border-radius: 99px; }
.bar-row .n { width: 30px; text-align: right; color: var(--qr-muted); }

.review {
    padding: 18px 0; border-bottom: 1px solid var(--qr-line);
}
.review:last-child { border-bottom: 0; }
.review-head { display: flex; align-items: center; gap: 11px; margin-bottom: 9px; }
.review-head .who { font-weight: 600; font-size: 14px; }
.review-body { color: var(--qr-body); font-size: 14px; }
.review-form { background: var(--qr-bg); border-radius: var(--qr-radius); padding: 20px; }

.star-picker { display: inline-flex; gap: 4px; }
.star-picker button {
    background: none; border: 0; padding: 2px; cursor: pointer;
    color: var(--qr-line-strong); line-height: 1;
}
.star-picker button svg { width: 26px; height: 26px; }
.star-picker button.on { color: var(--qr-warning); }

/* ------------------------------- filters -------------------------------- */
.filter-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-bottom: 24px;
}
.chip {
    padding: 8px 16px; border-radius: 999px;
    background: #fff; border: 1px solid var(--qr-line-strong);
    font-size: 13.5px; font-weight: 600; color: var(--qr-body);
    cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: var(--qr-primary); color: var(--qr-primary); }
.chip.active { background: var(--qr-primary); border-color: var(--qr-primary); color: #fff; }

.search-top { max-width: 560px; margin-bottom: 22px; }
.search-top form { display: flex; align-items: center; gap: 8px; }
.results-label { display: none; }

.layout-sidebar { display: grid; grid-template-columns: 250px 1fr; gap: 30px; align-items: start; }
.sidebar { position: sticky; top: calc(var(--qr-header-h) + 20px); }
.filter-group { padding: 18px 0; border-bottom: 1px solid var(--qr-line); }
.filter-group:first-child { padding-top: 0; }
.filter-group:last-child { border-bottom: 0; }
.filter-group h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--qr-muted); margin-bottom: 11px; }

/* -------------------------------- banner -------------------------------- */
.promo-banner {
    position: relative; overflow: hidden;
    border-radius: var(--qr-radius-lg);
    padding: 30px 34px;
    color: #fff;
    display: flex; align-items: center; justify-content: space-between; gap: 26px;
    min-height: 160px;
}
.promo-banner .bg-img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; opacity: .42;
}
.promo-banner .content { position: relative; z-index: 1; max-width: 480px; }
.promo-banner h3 { font-size: 25px; letter-spacing: -.02em; }
.promo-banner p { color: rgba(255, 255, 255, .82); margin: 9px 0 16px; font-size: 14px; }
.promo-banner .art {
    position: relative; z-index: 1;
    display: flex; align-items: flex-end; gap: 10px;
}
.promo-banner .art img {
    width: 88px; aspect-ratio: 2/3; object-fit: cover; border-radius: 8px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, .38);
}
.promo-banner .art img:nth-child(1) { transform: rotate(-6deg); }
.promo-banner .art img:nth-child(3) { transform: rotate(6deg); }

.announcement {
    background: var(--qr-navy); color: #fff;
    font-size: 13.5px; text-align: center; padding: 9px 20px;
}
.announcement a { text-decoration: underline; font-weight: 600; }

/* --------------------------------- cart --------------------------------- */
.cart-layout { display: grid; grid-template-columns: 1fr 350px; gap: 30px; align-items: start; }
.cart-item {
    display: flex; gap: 16px; align-items: center;
    padding: 18px; background: #fff;
    border: 1px solid var(--qr-line); border-radius: var(--qr-radius);
    margin-bottom: 12px;
}
.cart-item .thumb {
    width: 64px; aspect-ratio: 2/3; flex: none; border-radius: 8px;
    overflow: hidden; background: var(--qr-bg-2);
}
.cart-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-item .info { flex: 1; min-width: 0; }
.cart-item .price { font-weight: 800; font-size: 16px; }

.qty {
    display: inline-flex; align-items: center;
    border: 1px solid var(--qr-line-strong); border-radius: 999px; overflow: hidden;
}
.qty button {
    width: 32px; height: 32px; border: 0; background: #fff;
    cursor: pointer; font-size: 15px; color: var(--qr-body); line-height: 1;
}
.qty button:hover { background: var(--qr-bg); color: var(--qr-ink); }
.qty input {
    width: 42px; height: 32px; border: 0; text-align: center; font-weight: 600;
    background: #fff; -moz-appearance: textfield;
}
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button {
    -webkit-appearance: none; margin: 0;
}

.summary-row {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 14px; margin-bottom: 11px; color: var(--qr-body);
}
.summary-row.total {
    font-size: 19px; font-weight: 800; color: var(--qr-ink);
    border-top: 1px solid var(--qr-line); padding-top: 15px; margin-top: 15px;
}
.summary-row .discount { color: var(--qr-success); font-weight: 700; }

.sticky-summary { position: sticky; top: calc(var(--qr-header-h) + 20px); }

/* -------------------------------- wallet -------------------------------- */
.balance-card {
    position: relative; overflow: hidden;
    border-radius: var(--qr-radius-lg);
    background: linear-gradient(135deg, var(--qr-navy) 0%, #2b2170 100%);
    color: #fff; padding: 28px 30px;
}
.balance-card::after {
    content: ''; position: absolute; right: -70px; top: -70px;
    width: 240px; height: 240px; border-radius: 50%;
    background: radial-gradient(circle, rgba(124, 58, 237, .62), transparent 68%);
}
.balance-card .label { color: rgba(255, 255, 255, .68); font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em; }
.balance-card .amount { font-size: 40px; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; }
.balance-card .sub { color: rgba(255, 255, 255, .68); font-size: 13px; margin-top: 6px; }
.balance-card .actions { position: relative; z-index: 1; }

.tx-row {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 0; border-bottom: 1px solid var(--qr-line);
}
.tx-row:last-child { border-bottom: 0; }
.tx-icon {
    width: 38px; height: 38px; border-radius: 11px; flex: none;
    display: grid; place-items: center;
}
.tx-icon svg { width: 18px; height: 18px; }
.tx-in  { background: var(--qr-success-bg); color: #027a48; }
.tx-out { background: var(--qr-danger-bg);  color: #b42318; }
.tx-neutral { background: var(--qr-bg-2); color: var(--qr-body); }
.tx-amount { font-weight: 700; font-size: 14.5px; }
.tx-amount.in  { color: #027a48; }
.tx-amount.out { color: var(--qr-ink); }

.amount-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.amount-presets button {
    padding: 8px 16px; border-radius: 999px;
    border: 1px solid var(--qr-line-strong); background: #fff;
    font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.amount-presets button:hover, .amount-presets button.active {
    background: var(--qr-primary-light); border-color: var(--qr-primary); color: var(--qr-primary);
}

.pay-method {
    display: flex; align-items: center; gap: 11px;
    padding: 13px 16px; border-radius: var(--qr-radius-sm);
    border: 1px solid var(--qr-line-strong); background: #fff;
    cursor: pointer; margin-bottom: 9px; transition: all .15s;
}
.pay-method:hover { border-color: var(--qr-primary); }
.pay-method input { accent-color: var(--qr-primary); flex: none; }
.pay-method.selected { border-color: var(--qr-primary); background: var(--qr-primary-soft); }

.detail-box {
    background: var(--qr-bg); border-radius: var(--qr-radius);
    padding: 16px 18px; font-size: 13.5px; color: var(--qr-body);
    white-space: pre-wrap; line-height: 1.75;
}
.copy-btn {
    background: none; border: 0; cursor: pointer; color: var(--qr-primary);
    font-size: 12.5px; font-weight: 600; padding: 0;
}

/* ------------------------------- library -------------------------------- */
.library-item {
    display: flex; gap: 15px; align-items: center;
    padding: 15px; background: #fff;
    border: 1px solid var(--qr-line); border-radius: var(--qr-radius);
    margin-bottom: 11px;
}
.library-item .thumb {
    width: 56px; aspect-ratio: 2/3; flex: none; border-radius: 8px;
    overflow: hidden; background: var(--qr-bg-2); box-shadow: var(--qr-shadow-xs);
}
.library-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.library-item .info { flex: 1; min-width: 0; }
.library-item .info h3 { font-size: 14.5px; }
.library-item .meta { font-size: 12.5px; color: var(--qr-muted); margin-top: 2px; }
.library-item .bar { height: 4px; border-radius: 99px; background: var(--qr-bg-2); margin-top: 9px; overflow: hidden; max-width: 360px; }
.library-item .bar i { display: block; height: 100%; background: var(--qr-primary); border-radius: 99px; }

.tabs {
    display: flex; gap: 4px; border-bottom: 1px solid var(--qr-line); margin-bottom: 22px;
    overflow-x: auto;
}
.tabs a, .tabs button {
    padding: 11px 16px; border: 0; background: none; cursor: pointer;
    font-size: 14px; font-weight: 600; color: var(--qr-muted);
    border-bottom: 2px solid transparent; white-space: nowrap;
    display: inline-flex; align-items: center; gap: 7px;
}
.tabs a:hover, .tabs button:hover { color: var(--qr-ink); }
.tabs a.active, .tabs button.active { color: var(--qr-primary); border-bottom-color: var(--qr-primary); }
.tabs svg { width: 16px; height: 16px; }

/* -------------------------------- tables -------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--qr-radius); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left; padding: 11px 14px;
    background: var(--qr-bg); color: var(--qr-muted);
    font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    white-space: nowrap;
    border-bottom: 1px solid var(--qr-line);
}
.table td {
    padding: 13px 14px; border-bottom: 1px solid var(--qr-line);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fcfcfd; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }

/* --------------------------------- stats -------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.stat {
    background: #fff; border: 1px solid var(--qr-line);
    border-radius: var(--qr-radius); padding: 18px 20px;
}
.stat .k { font-size: 12.5px; color: var(--qr-muted); display: flex; align-items: center; gap: 7px; }
.stat .k svg { width: 15px; height: 15px; }
.stat .v { font-size: 25px; font-weight: 800; letter-spacing: -.02em; margin-top: 7px; }
.stat .d { font-size: 12px; color: var(--qr-muted); margin-top: 3px; }
.stat.accent { background: linear-gradient(135deg, var(--qr-primary), #7c3aed); color: #fff; border: 0; }
.stat.accent .k, .stat.accent .d { color: rgba(255, 255, 255, .76); }

/* ----------------------------------- charts ----------------------------- */
.chart { display: flex; align-items: flex-end; gap: 5px; height: 130px; padding-top: 12px; }
.chart .bar {
    flex: 1; min-width: 6px; border-radius: 5px 5px 0 0;
    background: var(--qr-primary-light); position: relative;
    transition: background .15s;
}
.chart .bar:hover { background: var(--qr-primary); }
.chart .bar span {
    position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
    background: var(--qr-navy); color: #fff; padding: 5px 9px; border-radius: 7px;
    font-size: 11px; white-space: nowrap; opacity: 0; pointer-events: none;
    transition: opacity .15s; z-index: 5;
}
.chart .bar:hover span { opacity: 1; }
.chart-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--qr-muted); margin-top: 7px; }

/* -------------------------------- pagination ---------------------------- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 36px; flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 38px; height: 38px; padding: 0 12px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--qr-radius-sm); border: 1px solid var(--qr-line-strong);
    background: #fff; font-size: 13.5px; font-weight: 600; color: var(--qr-body);
}
.pagination a:hover { border-color: var(--qr-primary); color: var(--qr-primary); }
.pagination .current { background: var(--qr-primary); border-color: var(--qr-primary); color: #fff; }
.pagination .disabled { opacity: .45; pointer-events: none; }
.pagination .dots { border: 0; background: none; }

/* -------------------------------- empty --------------------------------- */
.empty { text-align: center; padding: 66px 24px; }
.empty svg { width: 56px; height: 56px; color: var(--qr-line-strong); margin: 0 auto 16px; }
.empty h3 { font-size: 18px; margin-bottom: 7px; }
.empty p { color: var(--qr-muted); max-width: 400px; margin: 0 auto 20px; }

/* --------------------------------- modal -------------------------------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(13, 23, 51, .55);
    backdrop-filter: blur(3px);
    display: none; align-items: center; justify-content: center;
    z-index: 300; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: #fff; border-radius: var(--qr-radius-lg);
    width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
    box-shadow: var(--qr-shadow-lg);
}
.modal-head {
    padding: 20px 24px; border-bottom: 1px solid var(--qr-line);
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 24px; }
.modal-foot {
    padding: 16px 24px; border-top: 1px solid var(--qr-line);
    display: flex; gap: 10px; justify-content: flex-end;
}

/* -------------------------------- footer -------------------------------- */
.site-footer {
    background: var(--qr-navy); color: rgba(255, 255, 255, .72);
    padding: 56px 0 26px; margin-top: 60px;
}
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 34px; }
.site-footer h4 {
    color: #fff; font-size: 13px; text-transform: uppercase;
    letter-spacing: .07em; margin-bottom: 15px;
}
.site-footer a { font-size: 14px; display: block; padding: 5px 0; }
.site-footer a:hover { color: #fff; }
.site-footer .logo { color: #fff; margin-bottom: 12px; }
.footer-about { font-size: 14px; max-width: 320px; line-height: 1.7; }
.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, .12);
    margin-top: 40px; padding-top: 22px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    font-size: 13px; flex-wrap: wrap;
}
.footer-social { display: flex; gap: 9px; }
.footer-social a {
    width: 36px; height: 36px; border-radius: 50%; padding: 0;
    display: grid; place-items: center; background: rgba(255, 255, 255, .1);
}
.footer-social a:hover { background: var(--qr-primary); }
.footer-social svg { width: 17px; height: 17px; }

/* -------------------------------- auth ---------------------------------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-aside {
    background:
        radial-gradient(700px 400px at 20% 10%, rgba(124, 58, 237, .5), transparent 60%),
        linear-gradient(160deg, var(--qr-navy), #241a5e);
    color: #fff; padding: 54px; display: flex; flex-direction: column; justify-content: center;
    position: relative; overflow: hidden;
}
.auth-aside h2 { font-size: 34px; letter-spacing: -.02em; margin-bottom: 14px; }
.auth-aside p { color: rgba(255, 255, 255, .76); max-width: 400px; }
.auth-features { margin-top: 34px; display: grid; gap: 15px; }
.auth-feature { display: flex; align-items: flex-start; gap: 12px; font-size: 14px; }
.auth-feature .ico {
    width: 34px; height: 34px; border-radius: 10px; flex: none;
    background: rgba(255, 255, 255, .14); display: grid; place-items: center;
}
.auth-feature .ico svg { width: 17px; height: 17px; }
.auth-main {
    display: flex; align-items: center; justify-content: center;
    padding: 44px 24px; background: var(--qr-bg); overflow-y: auto;
}
.auth-card { width: 100%; max-width: 420px; }
.auth-card .logo { margin-bottom: 26px; }
.auth-card h1 { font-size: 26px; margin-bottom: 7px; }
.auth-card .sub { color: var(--qr-body); margin-bottom: 26px; font-size: 14.5px; }

.role-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.role-option {
    padding: 15px; border-radius: var(--qr-radius);
    border: 2px solid var(--qr-line-strong); background: #fff;
    cursor: pointer; text-align: center; transition: all .15s;
}
.role-option:hover { border-color: var(--qr-primary); }
.role-option.selected { border-color: var(--qr-primary); background: var(--qr-primary-soft); }
.role-option svg { width: 22px; height: 22px; margin: 0 auto 7px; color: var(--qr-primary); }
.role-option .t { font-weight: 700; font-size: 14px; }
.role-option .d { font-size: 12px; color: var(--qr-muted); margin-top: 2px; }

/* --------------------------------- admin -------------------------------- */
.admin-layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.admin-side {
    background: var(--qr-navy); color: rgba(255, 255, 255, .72);
    padding: 22px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-side .logo { color: #fff; padding: 0 10px 20px; }
.admin-nav-group { margin-bottom: 20px; }
.admin-nav-group .t {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
    color: rgba(255, 255, 255, .38); padding: 0 10px 8px;
}
.admin-side a {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 11px; border-radius: var(--qr-radius-sm);
    font-size: 13.5px; font-weight: 500; margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.admin-side a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.admin-side a.active { background: var(--qr-primary); color: #fff; font-weight: 600; }
.admin-side a svg { width: 17px; height: 17px; flex: none; }
.admin-side .badge { margin-left: auto; }

.admin-main { background: var(--qr-bg); min-width: 0; }
.admin-top {
    background: #fff; border-bottom: 1px solid var(--qr-line);
    padding: 15px 26px; display: flex; align-items: center; justify-content: space-between;
    gap: 18px; position: sticky; top: 0; z-index: 50;
}
.admin-top h1 { font-size: 20px; }
.admin-top .sub { font-size: 13px; color: var(--qr-muted); }
.admin-content { padding: 26px; }
.admin-content-wide { max-width: 1500px; }

/* ---------------------------------- misc -------------------------------- */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 9px 16px; font-size: 14px; }
.kv .k { color: var(--qr-muted); font-size: 13px; }
.kv .v { font-weight: 500; word-break: break-word; }

.divider-text {
    display: flex; align-items: center; gap: 14px;
    color: var(--qr-muted); font-size: 12.5px; margin: 22px 0;
}
.divider-text::before, .divider-text::after {
    content: ''; flex: 1; height: 1px; background: var(--qr-line);
}

.progress { height: 7px; border-radius: 99px; background: var(--qr-bg-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--qr-primary); border-radius: 99px; }

.cover-preview {
    width: 138px; aspect-ratio: 2/3; border-radius: var(--qr-radius);
    object-fit: cover; background: var(--qr-bg-2);
    border: 1px dashed var(--qr-line-strong);
    display: grid; place-items: center; color: var(--qr-muted); overflow: hidden;
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-preview svg { width: 30px; height: 30px; }

.file-drop {
    border: 2px dashed var(--qr-line-strong); border-radius: var(--qr-radius);
    padding: 26px; text-align: center; background: #fff;
    transition: border-color .15s, background .15s; cursor: pointer;
}
.file-drop:hover, .file-drop.drag { border-color: var(--qr-primary); background: var(--qr-primary-soft); }
.file-drop svg { width: 30px; height: 30px; color: var(--qr-primary); margin: 0 auto 9px; }
.file-drop .t { font-weight: 600; font-size: 14px; }
.file-drop .d { font-size: 12.5px; color: var(--qr-muted); margin-top: 3px; }

.suggestion-list {
    position: absolute; left: 0; right: 0; top: calc(100% + 8px);
    background: #fff; border: 1px solid var(--qr-line);
    border-radius: var(--qr-radius); box-shadow: var(--qr-shadow-lg);
    overflow: hidden; z-index: 130;
}
.suggestion-item { display: flex; gap: 11px; padding: 10px 13px; align-items: center; }
.suggestion-item:hover { background: var(--qr-bg); }
.suggestion-item img { width: 34px; aspect-ratio: 2/3; object-fit: cover; border-radius: 5px; flex: none; }
.suggestion-item .t { font-size: 13.5px; font-weight: 600; }
.suggestion-item .a { font-size: 12px; color: var(--qr-muted); }
.suggestion-item .p { margin-left: auto; font-weight: 700; font-size: 13px; }

.scroll-x { overflow-x: auto; }
.scroll-x::-webkit-scrollbar { height: 6px; }
.scroll-x::-webkit-scrollbar-thumb { background: var(--qr-line-strong); border-radius: 99px; }

/* ============================ mobile app chrome ========================== */
/* Hamburger, back button, search sheet and slide-in drawer exist on every
   page but stay out of the way until the viewport is phone-sized. */
.nav-toggle, .page-back, .search-toggle, .mobile-search, .m-hero { display: none; }

.drawer-scrim {
    position: fixed; inset: 0; z-index: 240;
    background: rgba(13, 23, 51, .5);
    backdrop-filter: blur(2px);
}
.drawer-scrim[hidden] { display: none; }

.drawer {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 250;
    width: 302px; max-width: 86vw;
    display: flex; flex-direction: column;
    padding: 16px 14px calc(22px + env(safe-area-inset-bottom));
    background: #fff; box-shadow: var(--qr-shadow-lg);
    overflow-y: auto; overscroll-behavior: contain;
    transform: translateX(-102%);
    transition: transform .24s ease;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; margin-bottom: 14px;
}

.drawer-user {
    display: flex; align-items: center; gap: 11px;
    padding: 11px; border-radius: var(--qr-radius);
    background: var(--qr-bg); margin-bottom: 12px;
}
.drawer-user-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.drawer-user-name { font-weight: 700; font-size: 14px; }
.drawer-user-meta { font-size: 12px; color: var(--qr-muted); }
.drawer-user svg { width: 16px; height: 16px; color: var(--qr-muted); flex: none; }

.drawer-auth { display: grid; gap: 9px; margin-bottom: 12px; }
.drawer-sep { height: 1px; background: var(--qr-line); margin: 12px 0; flex: none; }

.drawer-nav { display: flex; flex-direction: column; gap: 2px; }
.drawer-nav a, .drawer-nav-link {
    display: flex; align-items: center; gap: 12px;
    width: 100%; padding: 11px 12px; border: 0; border-radius: var(--qr-radius-sm);
    background: none; cursor: pointer; text-align: left;
    font-size: 14.5px; font-weight: 500; color: var(--qr-body);
}
.drawer-nav a:hover, .drawer-nav-link:hover { background: var(--qr-bg); color: var(--qr-ink); }
.drawer-nav a.active { background: var(--qr-primary-light); color: var(--qr-primary); font-weight: 600; }
.drawer-nav a svg, .drawer-nav-link svg { width: 19px; height: 19px; flex: none; }
.drawer-nav-sub a { font-size: 14px; color: var(--qr-muted); }
.drawer-nav-link.danger { color: var(--qr-danger); }
.drawer-signout { margin: 0; }
.drawer-wa { margin-top: auto; flex: none; }
body.drawer-open { overflow: hidden; }

/* ================================ responsive ============================= */
@media (max-width: 1080px) {
    .hero-inner { grid-template-columns: 1fr; gap: 34px; }
    .hero-visual { display: none; }
    .detail-grid { grid-template-columns: 260px 1fr; gap: 30px; }
    .cart-layout { grid-template-columns: 1fr; }
    .layout-sidebar { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .admin-layout { grid-template-columns: 1fr; }
    .admin-side {
        position: fixed; left: 0; top: 0; bottom: 0; width: 248px; z-index: 200;
        transform: translateX(-100%); transition: transform .22s;
    }
    .admin-side.open { transform: translateX(0); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
}

@media (max-width: 820px) {

    /* ---------------------------- app shell ---------------------------- */
    html { touch-action: manipulation; }
    body {
        background: #fff;
        -webkit-tap-highlight-color: transparent;
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
    }
    .container { padding: 0 16px; }

    /* ------------------------------ header ----------------------------- */
    .site-header { background: #fff; }
    .header-inner { height: 58px; gap: 3px; }
    .nav-toggle, .page-back, .search-toggle { display: grid; }
    .main-nav, .header-search, .currency-drop { display: none; }
    .icon-btn { width: 37px; height: 37px; }
    .icon-btn svg { width: 21px; height: 21px; }
    .logo { font-size: 17px; gap: 8px; margin-right: auto; }
    .logo-mark { width: 27px; height: 27px; border-radius: 8px; }
    .header-actions { margin-left: 0; gap: 1px; }
    .avatar { width: 32px; height: 32px; }
    .cart-count { top: 2px; right: 1px; }

    /* search sheet that slides open under the header */
    .mobile-search {
        display: block; overflow: hidden; max-height: 0;
        transition: max-height .22s ease;
        border-top: 0 solid var(--qr-line);
    }
    .mobile-search.open { max-height: 78px; border-top-width: 1px; }
    .mobile-search form { display: flex; align-items: center; gap: 8px; padding: 10px 16px; }
    .mobile-search .input-icon { flex: 1; }
    .mobile-search .input {
        border-radius: 999px; border-color: transparent;
        background: var(--qr-bg-2); padding: 10px 14px 10px 40px;
    }
    .mobile-search .btn { background: none; color: var(--qr-primary); padding: 8px 4px; }

    /* ---------------------- hero: featured book card ------------------- */
    .hero { display: none; }
    .m-hero { display: block; padding: 4px 16px 0; }
    .m-hero-card {
        position: relative; display: flex; align-items: center; gap: 12px;
        min-height: 174px; padding: 20px 16px;
        border-radius: 20px; overflow: hidden; color: #fff;
        background: linear-gradient(135deg, #6d4a2f, #241610);
    }
    .m-hero-card::after {
        content: ''; position: absolute; inset: 0;
        background: linear-gradient(90deg, rgba(18,11,6,.88) 28%, rgba(18,11,6,.5) 66%, rgba(18,11,6,.12));
    }
    .m-hero-bg {
        position: absolute; inset: 0; width: 100%; height: 100%;
        object-fit: cover; opacity: .42;
    }
    .m-hero-body { position: relative; z-index: 1; flex: 1; min-width: 0; }
    .m-hero-eyebrow {
        display: block; font-size: 10px; font-weight: 700;
        letter-spacing: .17em; text-transform: uppercase;
        color: rgba(255, 255, 255, .7); margin-bottom: 7px;
    }
    .m-hero-title {
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
        font-size: 25px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em;
    }
    .m-hero-sub {
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
        font-size: 12.5px; color: rgba(255, 255, 255, .78); margin: 7px 0 15px;
    }
    .m-hero-cta {
        display: inline-flex; align-items: center; gap: 6px;
        padding: 9px 16px; border-radius: 999px;
        background: #fff; color: var(--qr-ink);
        font-size: 13px; font-weight: 700;
    }
    .m-hero-cover {
        position: relative; z-index: 1; flex: none;
        width: 94px; aspect-ratio: 2/3; object-fit: cover;
        border-radius: 8px; box-shadow: 0 14px 30px rgba(0, 0, 0, .45);
    }
    .m-hero-dots { display: flex; gap: 5px; justify-content: center; padding: 12px 0 2px; }
    .m-hero-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--qr-line-strong); }
    .m-hero-dots i.on { width: 16px; border-radius: 99px; background: var(--qr-primary); }

    /* ------------------------------ rhythm ----------------------------- */
    .page { padding: 18px 0 32px; }
    .page-head { margin-bottom: 16px; }
    .page-head h1 { font-size: 22px; }
    .page-head p { font-size: 14px; }
    .breadcrumbs { display: none; }
    .section { margin-bottom: 30px; }
    .section-head { margin-bottom: 13px; }
    .section-head h2 { font-size: 17px; }
    .section-head .link { font-size: 13px; }
    .mt-40 { margin-top: 28px; }

    /* ------------------------- category circles ------------------------ */
    .cat-rail {
        gap: 6px; margin: 0 -16px; padding: 0 16px 4px;
        scrollbar-width: none;
    }
    .cat-rail::-webkit-scrollbar { display: none; }
    .cat-chip { min-width: 68px; gap: 7px; font-size: 11.5px; }
    .cat-chip .cat-icon { width: 54px; height: 54px; border-radius: 50%; }
    .cat-chip .cat-icon svg { width: 22px; height: 22px; }

    /* ---------------------------- book cards --------------------------- */
    .book-grid, .book-grid-lg {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px 13px;
    }
    .book-card .cover-wrap { border-radius: 12px; box-shadow: 0 4px 14px rgba(16, 24, 40, .10); }
    .book-card:hover .cover-wrap { transform: none; box-shadow: 0 4px 14px rgba(16, 24, 40, .10); }
    .book-card .cover-badge { top: 7px; left: 7px; padding: 3px 7px; font-size: 10px; }
    /* Cards stay clean like the mockup — tap through to the detail page to buy. */
    .book-card .cover-actions { display: none; }
    .book-card .book-title { margin: 9px 0 2px; font-size: 13px; }
    .book-card .book-author { font-size: 11.5px; }
    .book-card .book-meta, .book-card .price-row { margin-top: 5px; }
    .book-card .price { font-size: 14px; }

    /* best sellers become a snap rail, as in the mockup */
    .book-rail {
        display: grid; grid-auto-flow: column;
        grid-template-columns: none; grid-auto-columns: 30%;
        gap: 13px; overflow-x: auto; scroll-snap-type: x mandatory;
        margin: 0 -16px; padding: 0 16px 6px;
        scrollbar-width: none;
    }
    .book-rail::-webkit-scrollbar { display: none; }
    .book-rail .book-card { scroll-snap-align: start; }
    .book-rail .book-card .cover-actions { display: none; }

    /* search results as a readable list */
    .book-list { grid-template-columns: 1fr; gap: 12px; }
    .book-list .book-card { flex-direction: row; align-items: center; gap: 13px; }
    .book-list .book-card .cover-wrap { width: 56px; flex: none; border-radius: 8px; box-shadow: var(--qr-shadow-xs); }
    .book-list .book-card .cover-actions, .book-list .book-card .cover-badge { display: none; }
    .book-list .book-card .book-title { margin: 0 0 2px; font-size: 14.5px; }

    /* search page: prominent query field, no page heading (mockup page 5) */
    .search-page .page-head { display: none; }
    .search-top { max-width: none; margin-bottom: 16px; }
    .search-top .input {
        border-radius: 999px; border-color: transparent;
        background: var(--qr-bg-2); padding: 11px 14px 11px 42px;
    }
    .search-top .btn { display: none; }
    .results-label {
        display: block; font-size: 16px; font-weight: 700;
        margin: 0 0 12px;
    }

    /* ------------------------------ filters ---------------------------- */
    .layout-sidebar { grid-template-columns: 1fr; }
    .layout-sidebar .sidebar { display: none; }
    .filter-bar {
        margin-bottom: 16px; gap: 8px; flex-wrap: nowrap;
        overflow-x: auto; padding-bottom: 4px; scrollbar-width: none;
    }
    .filter-bar::-webkit-scrollbar { display: none; }
    .filter-bar form.ml-auto { margin-left: 0; flex: none; }
    .filter-bar .select { width: auto; flex: none; }
    .chip { flex: none; padding: 7px 14px; font-size: 13px; }

    /* --------------------------- categories ---------------------------- */
    .cat-tile {
        flex-direction: column; align-items: flex-start; gap: 10px;
        min-height: 120px; padding: 16px; color: #fff;
        background: linear-gradient(135deg, var(--qr-primary), #7c3aed);
        border: 0;
    }
    .cat-tile:nth-child(4n+2) { background: linear-gradient(135deg, #0f766e, #0ea5e9); }
    .cat-tile:nth-child(4n+3) { background: linear-gradient(135deg, #b45309, #f59e0b); }
    .cat-tile:nth-child(4n+4) { background: linear-gradient(135deg, #7c3aed, #ec4899); }
    .cat-tile .cat-icon {
        background: rgba(255, 255, 255, .22) !important;
        border-radius: 12px; width: 40px; height: 40px;
    }
    .cat-tile .cat-name { color: #fff; font-size: 15px; }
    .cat-tile .cat-count { color: rgba(255, 255, 255, .78); }
    .cat-tile .ml-auto { display: none; }
    .cat-tile:hover { transform: none; box-shadow: var(--qr-shadow-sm); }

    /* --------------------------- book detail --------------------------- */
    .detail-grid { grid-template-columns: 1fr; gap: 20px; }
    .detail-cover {
        position: static; max-width: none;
        display: flex; flex-direction: column; align-items: center; gap: 14px;
    }
    .detail-cover .cover-box {
        width: 176px; border-radius: 14px;
        box-shadow: 0 16px 36px rgba(16, 24, 40, .20);
    }
    .detail-cover .card { display: none; }
    .detail-title { font-size: 23px; }
    .detail-sub { font-size: 14.5px; }
    .detail-rating { flex-wrap: wrap; gap: 8px; margin-top: 12px; }
    .detail-price { margin: 16px 0; }
    .detail-price .now { font-size: 26px; }
    .format-tabs { width: 100%; }
    .format-tabs span { flex: 1; justify-content: center; padding: 8px 10px; font-size: 12.5px; }
    .detail-actions { gap: 10px; }
    .detail-actions .btn { min-width: 100%; }
    .assurance { gap: 11px 18px; padding-top: 18px; margin-top: 20px; }
    .assurance .item { font-size: 12px; }
    .rating-summary { grid-template-columns: 1fr; gap: 16px; }

    /* ------------------------------ library ---------------------------- */
    .tabs { border-bottom: 0; gap: 8px; margin-bottom: 16px; overflow: visible; }
    .tabs a, .tabs button {
        border: 1px solid var(--qr-line-strong); border-radius: 999px;
        padding: 8px 16px; font-size: 13px; color: var(--qr-body);
    }
    .tabs a.active, .tabs button.active {
        background: var(--qr-primary); border-color: var(--qr-primary); color: #fff;
    }
    .library-item { padding: 13px; border-radius: 14px; gap: 13px; }
    .library-item .thumb { width: 52px; }
    .library-item .info h3 { font-size: 14px; }

    /* -------------------------------- cart ----------------------------- */
    .cart-layout { grid-template-columns: 1fr; }
    .cart-item { gap: 12px; padding: 13px; border-radius: 14px; align-items: flex-start; }
    .cart-item .thumb { width: 56px; }
    .cart-item .info { flex: 1 1 auto; min-width: 0; }
    .cart-item .text-right { margin-left: auto; }
    .cart-item .price { font-size: 15px; }
    .cart-item .icon-btn { width: 32px; height: 32px; }
    .sticky-summary { position: static; }

    /* -------------------------------- auth ----------------------------- */
    .auth-main { padding: 28px 18px; }
    .auth-card h1 { font-size: 23px; }
    .role-picker { grid-template-columns: 1fr; }

    /* -------------------------------- misc ----------------------------- */
    .form-row, .form-row-3 { grid-template-columns: 1fr; gap: 0; }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
    .site-footer { display: none; }
    .promo-banner { flex-direction: column; align-items: flex-start; padding: 22px; }
    .promo-banner .art { display: none; }
    .promo-banner h3 { font-size: 21px; }
    .admin-content { padding: 16px; }
    .flash-stack { top: auto; bottom: 88px; right: 14px; left: 14px; width: auto; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .stat { padding: 15px; }
    .empty { padding: 44px 20px; }
    .table-wrap { margin: 0 -16px; border-radius: 0; }

    /* ---------------------------- bottom tabs -------------------------- */
    .mobile-nav {
        display: flex; position: fixed; bottom: 0; left: 0; right: 0;
        background: rgba(255, 255, 255, .98); backdrop-filter: blur(14px);
        border-top: 1px solid var(--qr-line);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
        z-index: 150;
    }
    .mobile-nav a {
        position: relative; flex: 1;
        display: flex; flex-direction: column; align-items: center; gap: 3px;
        padding: 6px 2px 4px;
        font-size: 10.5px; font-weight: 600; color: var(--qr-muted);
    }
    .mobile-nav .tab-ico { display: grid; place-items: center; }
    .mobile-nav a.active { color: var(--qr-primary); }
    .mobile-nav a.active .tab-ico::before {
        content: ''; position: absolute; top: -6px; left: 50%;
        transform: translateX(-50%);
        width: 26px; height: 3px; border-radius: 0 0 4px 4px;
        background: var(--qr-primary);
    }
    .mobile-nav svg { width: 22px; height: 22px; }
}

@media (max-width: 380px) {
    .logo-text { display: none; }
    .m-hero-cover { width: 78px; }
    .m-hero-title { font-size: 22px; }
}

@media (max-width: 520px) {
    .balance-card .amount { font-size: 32px; }
}

/* ------------------------------- print ---------------------------------- */
@media print {
    .site-header, .site-footer, .mobile-nav, .flash-stack, .btn { display: none !important; }
    body { background: #fff; }
}