:root {
  --primary: #0f5c55;
  --primary-600: #0b4a44;
  --primary-50: #e7f3f1;
  --accent: #e9a23b;
  --accent-50: #fdf3e2;
  --danger: #c0392b;
  --danger-50: #fbeaea;
  --success: #1e8e5a;
  --success-50: #e5f5ec;
  --text: #1f2a2e;
  --muted: #6b7a80;
  --border: #e4e8ea;
  --bg: #f6f7f5;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 40, 40, .06), 0 6px 20px rgba(16, 40, 40, .06);
  --font: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--text); background: var(--bg);
  line-height: 1.75; font-size: 15px; min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; padding-top: 24px; padding-bottom: 48px; outline: none; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.4; margin: 0 0 12px; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden, [hidden] { display: none !important; }
.ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }

/* ---------- header ---------- */
.site-header { background: var(--card); box-shadow: 0 1px 0 var(--border); position: sticky; top: 0; z-index: 50; }
.header-row { display: flex; align-items: center; gap: 16px; padding-top: 12px; padding-bottom: 12px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); flex-shrink: 0; }
.logo span { display: flex; flex-direction: column; line-height: 1.2; }
.logo strong { font-size: 1.35rem; color: var(--primary); font-weight: 800; }
.logo small { color: var(--muted); font-size: .75rem; }
.search { flex: 1; display: flex; max-width: 560px; margin: 0 auto; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.search input { flex: 1; border: 0; background: transparent; padding: 10px 18px; outline: none; min-width: 0; }
.search button { border: 0; background: transparent; padding: 0 16px; cursor: pointer; font-size: 1rem; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.cart-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: var(--primary); color: #fff; font-weight: 500; }
.cart-btn:hover { background: var(--primary-600); color: #fff; }
.badge { background: var(--accent); color: #2b1d00; border-radius: 999px; min-width: 22px; height: 22px; padding: 0 6px; font-size: .75rem; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.user-menu { position: relative; }
.user-menu > button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); cursor: pointer; }
.dropdown { position: absolute; top: calc(100% + 6px); left: 0; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); min-width: 190px; padding: 6px; display: none; z-index: 60; }
.dropdown.open { display: block; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: right; padding: 8px 12px; border-radius: 8px; color: var(--text); background: none; border: 0; cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: var(--bg); }
.icon-btn { border: 0; background: none; font-size: 1.4rem; cursor: pointer; padding: 4px 8px; }
.menu-toggle { display: none; }
.cat-nav { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.cat-nav::-webkit-scrollbar { display: none; }
.cat-nav a { white-space: nowrap; padding: 4px 12px; border-radius: 999px; color: var(--muted); font-size: .9rem; }
.cat-nav a:hover, .cat-nav a.active { background: var(--primary-50); color: var(--primary); }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: 10px; border: 1px solid transparent; background: var(--primary); color: #fff; cursor: pointer; font-weight: 500; transition: background .15s, transform .05s; text-align: center; }
.btn:hover { background: var(--primary-600); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-accent { background: var(--accent); color: #2b1d00; }
.btn-accent:hover { background: #d8902a; color: #2b1d00; }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-50); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #a93226; }
.btn-sm { padding: 5px 12px; font-size: .85rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 26px; font-size: 1.05rem; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field label { font-weight: 500; font-size: .9rem; }
.input, .field input, .field select, .field textarea, select.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; outline: none; transition: border .15s, box-shadow .15s;
}
.field textarea { min-height: 90px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.field .error { color: var(--danger); font-size: .8rem; min-height: 0; }
.field .hint { color: var(--muted); font-size: .8rem; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 3px 0; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; }
.alert-error { background: var(--danger-50); color: var(--danger); }
.alert-success { background: var(--success-50); color: var(--success); }
.alert-info { background: var(--primary-50); color: var(--primary-600); }
.alert-warn { background: var(--accent-50); color: #8a5a00; }

/* ---------- cards / layout ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.section { margin-top: 36px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.section-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }
.empty { text-align: center; padding: 56px 16px; color: var(--muted); }
.empty .emoji { font-size: 3rem; display: block; margin-bottom: 8px; }

/* ---------- hero ---------- */
.hero { border-radius: 22px; padding: 44px 40px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(circle at 15% 20%, rgba(233,162,59,.35), transparent 40%), linear-gradient(135deg, #0f5c55, #12403d 70%); }
.hero > h1, .hero > p, .hero > form { position: relative; z-index: 1; max-width: 620px; }
.hero h1 { font-size: 2.1rem; font-weight: 800; margin-bottom: 10px; }
.hero p { opacity: .9; max-width: 560px; margin: 0 0 22px; font-size: 1.05rem; }
.hero .hero-books { position: absolute; left: 40px; bottom: -20px; display: flex; gap: 12px; transform: rotate(-6deg); }
.hero .hero-books .cover { width: 110px; box-shadow: 0 12px 30px rgba(0,0,0,.35); }
.hero-search { display: flex; max-width: 520px; background: #fff; border-radius: 12px; overflow: hidden; }
.hero-search input { flex: 1; border: 0; padding: 14px 18px; outline: none; color: var(--text); min-width: 0; }
.hero-search button { border-radius: 0; }
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.feature { background: var(--card); border-radius: 12px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow); }
.feature .fi { font-size: 1.6rem; }
.feature b { display: block; font-size: .95rem; }
.feature span { color: var(--muted); font-size: .8rem; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.cat-card { background: var(--card); border-radius: 14px; padding: 18px 12px; text-align: center; box-shadow: var(--shadow); color: var(--text); transition: transform .15s; }
.cat-card:hover { transform: translateY(-3px); color: var(--primary); }
.cat-card .ci { font-size: 2rem; display: block; }
.cat-card b { display: block; margin-top: 4px; font-size: .95rem; }
.cat-card small { color: var(--muted); }

/* ---------- book cards ---------- */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 18px; }
.book-row { display: grid; grid-auto-flow: column; grid-auto-columns: 178px; gap: 18px; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x mandatory; }
.book-row > * { scroll-snap-align: start; }
.book-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 8px; position: relative; transition: transform .15s, box-shadow .15s; }
.book-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(16,40,40,.12); }
.book-card .cover-link { display: block; }
.book-card h3 { font-size: .98rem; margin: 4px 0 0; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.book-card h3 a { color: var(--text); }
.book-card .author { color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-card .translator { font-size: .78rem; }
.book-card .bottom { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; }
.book-card .add { width: 38px; height: 38px; border-radius: 10px; padding: 0; font-size: 1.1rem; flex-shrink: 0; }
.ribbon { position: absolute; top: 22px; left: 22px; background: var(--danger); color: #fff; border-radius: 8px; padding: 1px 8px; font-size: .78rem; font-weight: 700; z-index: 2; }
.ribbon.out { background: #59656a; }
.price { display: flex; flex-direction: column; line-height: 1.4; }
.price .old { color: var(--muted); text-decoration: line-through; font-size: .8rem; }
.price .now { font-weight: 700; font-size: 1rem; }
.price .now small { font-weight: 400; color: var(--muted); font-size: .75rem; }
.rating { color: #e6a100; font-size: .82rem; }
.rating .muted { font-size: .78rem; }

.cover { aspect-ratio: 2 / 3; border-radius: 6px 10px 10px 6px; position: relative; overflow: hidden; color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 14% 12% 12% 16%; box-shadow: inset 6px 0 8px -4px rgba(0,0,0,.35), 0 4px 10px rgba(0,0,0,.12); width: 100%; }
.cover::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 7%; background: rgba(255,255,255,.12); border-left: 1px solid rgba(0,0,0,.15); }
.cover::after { content: ""; position: absolute; left: 12%; right: 10%; top: 9%; height: 2px; background: rgba(255,255,255,.45); }
.cover .ct { font-weight: 800; font-size: 1.05em; line-height: 1.45; text-shadow: 0 1px 2px rgba(0,0,0,.3); position: relative; }
.cover .ca { font-size: .72em; opacity: .9; position: relative; }
.cover .cm { position: absolute; bottom: 8%; left: 10%; font-size: 1.6em; opacity: .25; }
.cover.img { padding: 0; background: #ddd; }
.cover.img img { width: 100%; height: 100%; object-fit: cover; }
.cover.sm { font-size: 9px; border-radius: 3px 5px 5px 3px; }
.cover.lg { font-size: 22px; }
.thumb { width: 54px; flex-shrink: 0; }

/* ---------- catalog ---------- */
.catalog { display: grid; grid-template-columns: 250px 1fr; gap: 24px; align-items: start; }
.filters { position: sticky; top: 130px; }
.filters h3 { font-size: 1rem; margin: 18px 0 8px; }
.filters h3:first-child { margin-top: 0; }
.filters .cats { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow: auto; }
.filters .cats a { padding: 6px 10px; border-radius: 8px; color: var(--text); display: flex; justify-content: space-between; font-size: .92rem; }
.filters .cats a.active, .filters .cats a:hover { background: var(--primary-50); color: var(--primary); }
.price-range { display: flex; gap: 8px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar select { width: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--primary-50); color: var(--primary); border-radius: 999px; padding: 3px 12px; font-size: .82rem; display: inline-flex; gap: 6px; align-items: center; }
.chip a { color: inherit; font-weight: 700; }
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 28px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--card); box-shadow: var(--shadow); color: var(--text); padding: 0 10px; }
.pagination .current { background: var(--primary); color: #fff; }
.filter-toggle { display: none; }

/* ---------- book detail ---------- */
.detail { display: grid; grid-template-columns: 300px 1fr 300px; gap: 28px; align-items: start; }
.detail .cover { max-width: 300px; }
.detail h1 { font-size: 1.7rem; margin-bottom: 6px; }
.meta-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: .92rem; }
.meta-table td { padding: 7px 0; border-bottom: 1px dashed var(--border); }
.meta-table td:first-child { color: var(--muted); width: 120px; }
.buy-box .price .now { font-size: 1.5rem; }
.buy-box .stock-ok { color: var(--success); font-weight: 500; }
.buy-box .stock-low { color: #b86e00; font-weight: 500; }
.buy-box .stock-out { color: var(--danger); font-weight: 500; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.qty button { width: 36px; height: 38px; border: 0; background: var(--bg); cursor: pointer; font-size: 1.1rem; }
.qty button:hover { background: var(--primary-50); }
.qty input { width: 46px; text-align: center; border: 0; outline: none; height: 38px; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.description { white-space: pre-line; }
.review { border-bottom: 1px solid var(--border); padding: 14px 0; }
.review:last-child { border-bottom: 0; }
.review-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.verified { background: var(--success-50); color: var(--success); font-size: .75rem; padding: 1px 8px; border-radius: 999px; }
.stars-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; }
.stars-input input { display: none; }
.stars-input label { font-size: 1.7rem; color: #d5d9db; cursor: pointer; line-height: 1; }
.stars-input input:checked ~ label, .stars-input label:hover, .stars-input label:hover ~ label { color: #f0a800; }

/* ---------- cart / checkout ---------- */
.two-col { display: grid; grid-template-columns: 1fr 360px; gap: 24px; align-items: start; }
.cart-line { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); align-items: center; }
.cart-line:last-child { border-bottom: 0; }
.cart-line .thumb { width: 72px; }
.cart-line .info { flex: 1; min-width: 0; }
.cart-line .info h3 { font-size: 1rem; margin: 0; }
.cart-line .line-total { font-weight: 700; min-width: 120px; text-align: left; }
.cart-line .issue { color: var(--danger); font-size: .82rem; }
.link-btn { border: 0; background: none; color: var(--danger); cursor: pointer; padding: 0; font-size: .85rem; }
.summary { position: sticky; top: 130px; }
.summary .row { display: flex; justify-content: space-between; padding: 6px 0; }
.summary .row.total { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 14px; font-size: 1.15rem; font-weight: 800; }
.summary .discount { color: var(--success); }
.coupon-form { display: flex; gap: 8px; margin: 12px 0; }
.coupon-form input { flex: 1; min-width: 0; }
.progress { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; margin: 6px 0 2px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary)); border-radius: 999px; }
.steps { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.steps span { padding: 4px 14px; border-radius: 999px; background: var(--card); color: var(--muted); font-size: .85rem; box-shadow: var(--shadow); }
.steps span.on { background: var(--primary); color: #fff; }

/* ---------- payment gateway ---------- */
.gateway { max-width: 520px; margin: 0 auto; }
.gateway .bank-head { background: linear-gradient(135deg, #253b80, #172554); color: #fff; border-radius: var(--radius) var(--radius) 0 0; padding: 22px; display: flex; justify-content: space-between; align-items: center; }
.gateway .bank-body { background: var(--card); border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow); padding: 24px; }
.gateway .amount { font-size: 1.7rem; font-weight: 800; }
.gateway .actions { display: grid; gap: 10px; margin-top: 18px; }

/* ---------- orders ---------- */
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 500; white-space: nowrap; }
.st-pending_payment { background: var(--accent-50); color: #8a5a00; }
.st-paid { background: #e8eefc; color: #2c4fb5; }
.st-processing { background: #f1e9fb; color: #6b37b0; }
.st-shipped { background: var(--primary-50); color: var(--primary); }
.st-delivered { background: var(--success-50); color: var(--success); }
.st-cancelled { background: #eceff0; color: #59656a; }
.timeline { display: flex; justify-content: space-between; position: relative; margin: 24px 0 8px; }
.timeline::before { content: ""; position: absolute; top: 15px; right: 8%; left: 8%; height: 3px; background: var(--border); }
.timeline .tl { position: relative; text-align: center; flex: 1; font-size: .8rem; color: var(--muted); }
.timeline .tl i { display: flex; width: 32px; height: 32px; border-radius: 50%; margin: 0 auto 6px; background: var(--card); border: 3px solid var(--border); align-items: center; justify-content: center; font-style: normal; font-size: .8rem; }
.timeline .tl.done i { background: var(--primary); border-color: var(--primary); color: #fff; }
.timeline .tl.done { color: var(--text); font-weight: 500; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: right; color: var(--muted); font-weight: 500; padding: 10px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; background: #fafbfa; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #fafcfb; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.order-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; color: var(--text); flex-wrap: wrap; }
.order-card:hover { border-color: var(--primary); color: var(--text); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 16px; color: var(--muted); border: 0; background: none; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs .active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

/* ---------- auth ---------- */
.auth-box { max-width: 420px; margin: 20px auto; }
.auth-box h1 { text-align: center; }
.demo-accounts { font-size: .82rem; background: var(--bg); border-radius: 10px; padding: 10px 14px; margin-top: 16px; }

/* ---------- admin ---------- */
.admin { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.admin-nav { position: sticky; top: 130px; padding: 10px; }
.admin-nav a { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text); }
.admin-nav a.active, .admin-nav a:hover { background: var(--primary-50); color: var(--primary); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.5rem; font-weight: 800; margin-top: 4px; }
.stat .value small { font-size: .8rem; font-weight: 400; color: var(--muted); }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 10px; }
.chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.chart .bar span { width: 100%; max-width: 34px; background: linear-gradient(180deg, var(--primary), #3a8f86); border-radius: 6px 6px 2px 2px; min-height: 3px; transition: height .3s; }
.chart .bar small { font-size: .68rem; color: var(--muted); }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); gap: 8px; }
.list-plain li:last-child { border-bottom: 0; }
.book-form { display: grid; grid-template-columns: 1fr 220px; gap: 24px; align-items: start; }
.hue-input { width: 100%; accent-color: var(--primary); }

/* ---------- modal & toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 30, 30, .45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; animation: fade .15s; }
.modal { background: var(--card); border-radius: 16px; max-width: 640px; width: 100%; max-height: 90vh; overflow: auto; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.sm { max-width: 420px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h3 { margin: 0; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-start; margin-top: 18px; }
.toasts { position: fixed; bottom: 20px; left: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #1f2a2e; color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); animation: slide .2s; max-width: 340px; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateY(10px); opacity: 0; } }
.skeleton { background: linear-gradient(90deg, #eceeed 25%, #f6f7f6 50%, #eceeed 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }
.loading { min-height: 50vh; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--primary-50); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 80px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- footer ---------- */
.site-footer { background: #12302d; color: #cfdcda; margin-top: 40px; padding-top: 32px; }
.site-footer h4 { color: #fff; }
.site-footer a { color: #cfdcda; }
.site-footer a:hover { color: #fff; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { padding: 3px 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1.3fr 1fr; gap: 24px; }
.copyright { border-top: 1px solid rgba(255,255,255,.1); margin-top: 24px; padding-top: 14px; padding-bottom: 14px; font-size: .82rem; color: #8fa5a2; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .detail { grid-template-columns: 240px 1fr; }
  .detail .buy-box { grid-column: 1 / -1; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .hero .hero-books { display: none; }
}
@media (max-width: 900px) {
  .catalog, .two-col, .admin, .book-form, .admin-grid { grid-template-columns: 1fr; }
  .filters, .summary, .admin-nav { position: static; }
  .filters.collapsed { display: none; }
  .filter-toggle { display: inline-flex; }
  .admin-nav { display: flex; overflow-x: auto; gap: 4px; }
  .admin-nav a { white-space: nowrap; }
  .features { grid-template-columns: repeat(2, 1fr); }
  .hero .hero-books { display: none; }
  .footer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  body { font-size: 14px; }
  .header-row { flex-wrap: wrap; gap: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .header-actions { margin-right: auto; }
  .hide-sm { display: none; }
  .hero { padding: 28px 20px; }
  .hero h1 { font-size: 1.5rem; }
  .detail { grid-template-columns: 1fr; }
  .detail .cover { max-width: 200px; margin: 0 auto; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .book-row { grid-auto-columns: 150px; }
  .book-card { padding: 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .cart-line { flex-wrap: wrap; }
  .cart-line .line-total { min-width: 0; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .timeline .tl span { display: none; }
  .modal { padding: 18px; }
}

/* ---------- Foros editorial visual refresh ---------- */
:root {
  --primary: #17324d;
  --primary-600: #0f2438;
  --primary-50: #edf3f8;
  --accent: #c39a52;
  --text: #172333;
  --muted: #718096;
  --bg: #f7f5f0;
  --card: #fffdf9;
  --border: #e7e1d6;
  --radius: 18px;
  --shadow: 0 8px 30px rgba(23,50,77,.08);
}
body { background: radial-gradient(circle at 10% 0%, #fffdf8 0, var(--bg) 42%, #f2f5f7 100%); }
.site-header { background: rgba(255,253,249,.94); backdrop-filter: blur(16px); box-shadow: 0 1px 0 rgba(23,50,77,.08), 0 8px 28px rgba(23,50,77,.05); }
.header-row { padding-top: 16px; padding-bottom: 16px; }
.logo { gap: 12px; }
.logo img { width: 48px; height: 48px; filter: drop-shadow(0 5px 10px rgba(23,50,77,.12)); }
.logo strong { color: var(--primary); letter-spacing: -.02em; }
.logo small { color: var(--accent); font-weight: 500; }
.search { background: #f4f6f7; border-color: transparent; box-shadow: inset 0 0 0 1px rgba(23,50,77,.04); }
.search:focus-within { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(195,154,82,.14); }
.cart-btn, button.primary, .btn-primary { background: var(--primary); border-radius: 12px; box-shadow: 0 8px 18px rgba(23,50,77,.16); }
.cart-btn:hover, button.primary:hover, .btn-primary:hover { background: var(--primary-600); }
.cat-nav { gap: 8px; padding-bottom: 12px; }
.cat-nav a { border-radius: 999px; padding: 8px 14px; transition: .2s ease; }
.cat-nav a:hover, .cat-nav a.active { background: var(--primary-50); color: var(--primary); }
.hero { padding: 58px 48px; border-radius: 28px; background: radial-gradient(circle at 12% 15%, rgba(195,154,82,.32), transparent 34%), linear-gradient(125deg, #102a43 0%, #1d4665 58%, #285e78 100%); box-shadow: 0 18px 45px rgba(23,50,77,.18); }
.hero:after { content: ""; position: absolute; inset: auto -8% -65% 35%; height: 420px; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; transform: rotate(-12deg); }
.hero h1 { font-size: clamp(2rem, 4vw, 3.25rem); letter-spacing: -.04em; }
.hero p { color: rgba(255,255,255,.82); }
.hero-search { box-shadow: 0 12px 26px rgba(0,0,0,.14); }
.section-head h2 { color: var(--primary); letter-spacing: -.025em; }
.feature, .cat-card, .book-card, .card { border: 1px solid rgba(23,50,77,.06); box-shadow: var(--shadow); }
.feature { background: rgba(255,253,249,.86); }
.feature .fi { color: var(--accent); }
.cat-card:hover, .book-card:hover { border-color: rgba(195,154,82,.55); box-shadow: 0 14px 34px rgba(23,50,77,.13); }
.book-card .add { background: var(--primary); color: #fff; }
.book-card .add:hover { background: var(--accent); }
.site-footer { background: #102a43; color: rgba(255,255,255,.78); border-top: 4px solid var(--accent); }
.site-footer a { color: #fff; }

/* ---------- announcement, content pages, invoice ---------- */
.announce { background: var(--accent); color: #2b1d00; text-align: center; font-size: .88rem; padding: 6px 16px; font-weight: 500; }
.page-content { max-width: 820px; margin: 0 auto; }
.page-content .prose { white-space: pre-line; font-size: 1.02rem; line-height: 2.1; }
.faq details { border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin-bottom: 10px; background: var(--card); }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details[open] summary { color: var(--primary); margin-bottom: 6px; }
.contact-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 24px; align-items: start; }
.contact-info li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.socials { display: flex; gap: 10px; margin-top: 10px; }
.socials a { background: rgba(255,255,255,.1); padding: 4px 12px; border-radius: 999px; }
.enamad { margin-top: 10px; }
.enamad img { max-width: 110px; background: #fff; border-radius: 10px; }
.msg { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; background: var(--card); }
.msg.unread { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-50); }
.msg .msg-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.msg p { white-space: pre-line; margin: 8px 0; }
.upload-box { border: 2px dashed var(--border); border-radius: 12px; padding: 12px; text-align: center; cursor: pointer; font-size: .85rem; color: var(--muted); display: block; }
.upload-box:hover { border-color: var(--primary); color: var(--primary); }
.settings-section { margin-bottom: 18px; }
.settings-section h3 { border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.admin-nav .count { margin-right: auto; background: var(--danger); color: #fff; border-radius: 999px; font-size: .72rem; min-width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.invoice { max-width: 860px; margin: 0 auto; background: #fff; padding: 32px; border-radius: var(--radius); box-shadow: var(--shadow); }
.invoice-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--text); padding-bottom: 14px; margin-bottom: 16px; gap: 16px; }
.invoice table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.invoice th, .invoice td { border: 1px solid #cfd6d8; padding: 8px 10px; text-align: right; }
.invoice th { background: #f1f4f3; }
.invoice .totals td { font-weight: 700; }
.invoice-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.invoice-parties > div { border: 1px solid #cfd6d8; border-radius: 10px; padding: 12px 14px; font-size: .9rem; }
.no-print-bar { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }
@media print {
  .site-header, .site-footer, .announce, .no-print-bar, .toasts { display: none !important; }
  body { background: #fff; }
  main { padding: 0; }
  .invoice { box-shadow: none; padding: 0; max-width: none; }
}

/* ---------- mobile app (PWA) ---------- */
.bottom-nav { display: none; }
.install-btn { display: none; }
.install-btn.show { display: inline-flex; }
.app-steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.app-steps li { counter-increment: step; display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.app-steps li::before { content: counter(step, persian); background: var(--primary); color: #fff; border-radius: 50%; min-width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.app-hero { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.app-hero img { width: 96px; height: 96px; border-radius: 22px; box-shadow: var(--shadow); }
.app-banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: var(--primary-50); border-radius: 14px; padding: 12px 16px; margin-bottom: 18px; flex-wrap: wrap; }
@media (max-width: 680px) {
  .bottom-nav { display: flex; position: fixed; bottom: 0; right: 0; left: 0; z-index: 60; background: var(--card); border-top: 1px solid var(--border); box-shadow: 0 -4px 20px rgba(16,40,40,.08); padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; color: var(--muted); font-size: .72rem; }
  .bottom-nav a span { font-size: 1.25rem; line-height: 1.2; position: relative; }
  .bottom-nav a.active { color: var(--primary); font-weight: 700; }
  .bottom-nav .badge { position: absolute; top: -4px; left: -12px; min-width: 18px; height: 18px; font-size: .65rem; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(76px + env(safe-area-inset-bottom)); left: 12px; right: 12px; }
  .site-header .cart-btn { display: none; }
  .site-footer { margin-top: 24px; }
}
/* when opened as an installed app */
@media (display-mode: standalone) {
  .site-header { padding-top: env(safe-area-inset-top); }
  .hide-in-app { display: none !important; }
}

/* ---------------------------------------------------------------- e-books: badges & library */
.ebook-badge { align-self: flex-start; font-size: .72rem; background: var(--primary-50); color: var(--primary); border-radius: 999px; padding: 1px 8px; margin-top: 4px; }
.ebook-note { color: var(--primary); }
.lib-hero { display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 24px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary) 0%, #134e6f 100%); color: #fff; box-shadow: var(--shadow); }
.lib-hero h1 { margin: 0 0 4px; color: #fff; }
.lib-hero p { margin: 0; opacity: .85; max-width: 520px; }
.lib-stats { display: flex; gap: 10px; }
.lib-stats div { background: rgba(255,255,255,.12); border-radius: 12px; padding: 10px 16px; text-align: center; min-width: 84px; }
.lib-stats b { display: block; font-size: 1.5rem; line-height: 1.2; }
.lib-stats span { font-size: .78rem; opacity: .85; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.lib-card { display: flex; gap: 14px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; transition: transform .15s; }
.lib-card:hover { transform: translateY(-2px); }
.lib-cover { position: relative; width: 96px; flex-shrink: 0; }
.lib-cover .cover { font-size: .7rem; }
.lib-pct, .lib-new { position: absolute; bottom: 6px; left: 6px; background: rgba(0,0,0,.65); color: #fff; font-size: .72rem; border-radius: 999px; padding: 0 8px; }
.lib-new { background: var(--accent); }
.lib-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lib-info h3 { font-size: 1rem; margin: 0; }
.lib-info h3 a { color: var(--text); }
.lib-progress { margin: 8px 0 2px; background: var(--primary-50); }
.lib-btn { margin-top: auto; align-self: flex-start; }

/* ---------------------------------------------------------------- e-book reader */
body.reading .announce, body.reading .site-header, body.reading .site-footer, body.reading .bottom-nav { display: none !important; }
body.reading main { padding: 0; max-width: none; }
.reader { --rd-bg: #eef0ef; --rd-bar: #ffffff; --rd-text: var(--text); --rd-filter: none;
  position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; background: var(--rd-bg); color: var(--rd-text);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.reader.theme-sepia { --rd-bg: #e9dfc8; --rd-bar: #f6efdf; --rd-text: #4a3b28; --rd-filter: sepia(.45) saturate(.9); }
.reader.theme-dark { --rd-bg: #121516; --rd-bar: #1c2124; --rd-text: #dfe6e6; --rd-filter: invert(.88) hue-rotate(180deg); }
.rd-top, .rd-bottom { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--rd-bar); box-shadow: 0 1px 6px rgba(0,0,0,.08); z-index: 2; }
.rd-bottom { box-shadow: 0 -1px 6px rgba(0,0,0,.08); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.rd-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.rd-title b, .rd-title small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-title small { opacity: .7; font-size: .78rem; }
.rd-tools { display: flex; gap: 4px; }
.rd-btn { border: 0; background: transparent; color: inherit; border-radius: 10px; min-width: 38px; height: 38px; padding: 0 8px; cursor: pointer; font-size: 1.05rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; text-decoration: none; }
.rd-btn span { font-size: .8rem; }
.rd-btn:hover, .rd-btn.on { background: rgba(127,127,127,.16); color: inherit; }
.rd-btn.on { color: var(--accent); }
.rd-sample { text-align: center; font-size: .82rem; background: var(--accent-50); color: #7a5414; padding: 4px; }
.rd-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: auto; }
.rd-pages { --rd-zoom: 1; margin: 0 auto; padding: 16px 12px 40px; width: min(100%, calc(820px * var(--rd-zoom))); display: flex; flex-direction: column; gap: 14px; }
.rd-page { position: relative; width: 100%; aspect-ratio: 1 / var(--rd-ratio, 1.414); background: #fff; border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,.12); overflow: hidden;
  filter: var(--rd-filter) brightness(var(--rd-bright, 1)); }
.rd-page canvas { display: block; width: 100%; height: 100%; pointer-events: none; }
.rd-page:not(.ready)::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, #f3f3f3 30%, #e9e9e9 50%, #f3f3f3 70%); background-size: 200% 100%; animation: rdShimmer 1.2s infinite; }
.rd-page.failed::after { content: "⚠ بارگذاری این صفحه ناموفق بود"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--danger); }
@keyframes rdShimmer { to { background-position: -200% 0; } }
.rd-pn { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); font-size: .72rem; color: #999; }
.rd-locked { text-align: center; padding: 28px 20px; color: var(--text); }
.rd-bottom input[type=range] { flex: 1; accent-color: var(--primary); direction: rtl; }
.rd-pageno { border: 0; background: rgba(127,127,127,.12); color: inherit; border-radius: 999px; padding: 4px 12px; font-size: .82rem; cursor: pointer; white-space: nowrap; }
.rd-panel { position: absolute; top: 56px; left: 12px; width: min(360px, calc(100% - 24px)); max-height: calc(100% - 130px); overflow-y: auto; z-index: 3;
  background: var(--rd-bar); color: var(--rd-text); border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0,0,0,.25); padding: 12px 14px; }
.rd-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.rd-list { list-style: none; margin: 0; padding: 0; }
.rd-list li { display: flex; align-items: stretch; border-bottom: 1px solid rgba(127,127,127,.15); }
.rd-list li.sub button { padding-right: 22px; font-size: .9rem; }
.rd-list button[data-go] { flex: 1; display: flex; justify-content: space-between; gap: 10px; text-align: right; border: 0; background: none; color: inherit; padding: 9px 4px; cursor: pointer; }
.rd-list button[data-go]:hover { color: var(--primary); }
.rd-list button[data-go]:disabled { opacity: .45; cursor: default; }
.rd-list small { opacity: .65; white-space: nowrap; }
.rd-del { border: 0; background: none; cursor: pointer; opacity: .6; }
.rd-search, .rd-note-form { display: flex; gap: 6px; margin-bottom: 10px; }
.rd-note-form { flex-direction: column; }
.rd-search .input { flex: 1; }
.rd-set { margin-bottom: 16px; }
.rd-set label { display: flex; justify-content: space-between; font-size: .88rem; margin-bottom: 6px; }
.rd-set input[type=range] { width: 100%; accent-color: var(--primary); }
.rd-seg { display: flex; gap: 6px; }
.rd-seg button { flex: 1; border: 1px solid rgba(127,127,127,.3); background: transparent; color: inherit; border-radius: 10px; padding: 8px 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.rd-seg button.on { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.sw { width: 14px; height: 14px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,.2); }
.sw-light { background: #fff; } .sw-sepia { background: #f1e5c9; } .sw-dark { background: #222; }
.rd-shield { position: absolute; inset: 0; z-index: 5; background: var(--rd-bg); display: flex; align-items: center; justify-content: center; text-align: center; font-size: 1.1rem; cursor: pointer; }
.rd-shield div { font-size: 1rem; line-height: 2; }
.rd-noprint { display: none; }
@media (max-width: 760px) {
  .rd-btn span { display: none; }
  .rd-tools { gap: 0; }
  .rd-btn { min-width: 34px; padding: 0 4px; }
  .rd-pages { padding: 8px 6px 30px; gap: 8px; }
  .rd-panel { left: 0; right: 0; bottom: 0; top: auto; width: 100%; max-height: 70%; border-radius: 18px 18px 0 0; }
}
@media print {
  body.reading * { display: none !important; }
  body.reading::after { content: "این کتاب فقط برای مطالعه آنلاین است و قابل چاپ نیست."; display: block; padding: 40px; font-size: 18px; }
}


/* ================================================================ brand "129": navy & gold, from the logo */
:root {
  --primary: #16233b;
  --primary-600: #0d172a;
  --primary-50: #eef0f5;
  --accent: #b08d57;
  --accent-600: #957443;
  --accent-50: #f6efe2;
  --gold-soft: #d8c19a;
  --text: #1a2233;
  --muted: #6e7383;
  --bg: #f7f4ee;
  --card: #ffffff;
  --border: #e9e2d5;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(22,35,59,.05), 0 10px 30px rgba(22,35,59,.07);
  --shadow-lg: 0 18px 50px rgba(22,35,59,.16);
}
body { background: var(--bg); }
::selection { background: var(--accent-50); color: var(--primary); }
.ico { width: 20px; height: 20px; display: inline-block; vertical-align: middle; flex-shrink: 0; }
a { transition: color .15s; }

/* header */
.announce { background: var(--primary); color: var(--gold-soft); font-weight: 500; letter-spacing: .01em; }
.site-header { background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  box-shadow: none; border-bottom: 1px solid var(--border); }
.site-header::after { content: ""; display: block; height: 2px; background: linear-gradient(90deg, transparent, var(--accent) 20%, var(--gold-soft) 50%, var(--accent) 80%, transparent); opacity: .55; }
.header-row { padding-top: 12px; padding-bottom: 12px; }
.logo img { width: 52px; height: 52px; filter: drop-shadow(0 4px 10px rgba(22,35,59,.14)); transition: transform .3s; }
.logo:hover img { transform: rotate(-6deg) scale(1.04); }
.logo strong { color: var(--primary); font-size: 1.3rem; font-weight: 800; letter-spacing: -.01em; }
.logo small { color: var(--accent-600); font-weight: 500; }
.search { background: #f5f2ec; border: 1px solid transparent; border-radius: 14px; }
.search:focus-within { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(176,141,87,.15); }
.search button { color: var(--primary); display: inline-flex; align-items: center; }
.cart-btn { background: var(--primary); border-radius: 12px; padding: 9px 16px; box-shadow: 0 6px 16px rgba(22,35,59,.18); }
.cart-btn:hover { background: var(--primary-600); }
.badge { background: var(--accent); color: #fff; }
.user-menu > button { border-color: var(--border); border-radius: 12px; }
.icon-btn { color: var(--primary); display: inline-flex; align-items: center; }
.icon-btn .ico { width: 24px; height: 24px; }
.dropdown { border-radius: 14px; box-shadow: var(--shadow-lg); border-color: var(--border); }
.cat-nav { gap: 6px; padding-bottom: 10px; }
.cat-nav a { color: var(--muted); padding: 6px 14px; font-weight: 500; border: 1px solid transparent; }
.cat-nav a:hover { color: var(--primary); background: transparent; border-color: var(--border); }
.cat-nav a.active { background: var(--primary); color: #fff; }

/* buttons & forms */
.btn { border-radius: 12px; font-weight: 600; transition: background .15s, box-shadow .15s, transform .08s; }
.btn:not(.btn-ghost):not(.btn-outline):not(:disabled):hover { box-shadow: 0 8px 18px rgba(22,35,59,.18); }
.btn-accent { background: linear-gradient(135deg, #c3a06a, var(--accent) 55%, var(--accent-600)); color: #fff; }
.btn-accent:hover { background: linear-gradient(135deg, #b8955f, var(--accent-600)); color: #fff; }
.btn-outline { border-color: var(--primary); color: var(--primary); }
.btn-ghost { border-color: var(--border); background: #fff; }
.input, .field input, .field select, .field textarea, select.input { border-color: var(--border); border-radius: 12px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(176,141,87,.14); }
.check input, .hue-input { accent-color: var(--primary); }

/* cards & sections */
.card, .feature, .cat-card, .book-card, .stat, .lib-card { background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); }
.section { margin-top: 44px; }
.section-head h2 { color: var(--primary); font-weight: 800; font-size: 1.3rem; position: relative; padding-right: 14px; }
.section-head h2::before { content: ""; position: absolute; right: 0; top: 18%; bottom: 18%; width: 4px; border-radius: 4px; background: linear-gradient(180deg, var(--gold-soft), var(--accent)); }
.section-head a { color: var(--accent-600); font-weight: 600; font-size: .92rem; }
.section-head a:hover { color: var(--primary); }

/* hero: navy with the logo's gold ring as a watermark */
.hero { background:
    radial-gradient(ellipse at 85% 0%, rgba(216,193,154,.18), transparent 55%),
    linear-gradient(135deg, #1d2d4d 0%, var(--primary) 55%, #0b1424 100%);
  border-radius: 28px; padding: 64px 52px; box-shadow: var(--shadow-lg); border: 1px solid rgba(216,193,154,.25); }
.hero::before { content: ""; position: absolute; width: 420px; height: 420px; left: -60px; top: 50%; transform: translateY(-50%);
  background: url(/img/logo.png) center / contain no-repeat; opacity: .10; filter: brightness(2.2) sepia(1) saturate(.6); pointer-events: none; }
.hero::after { content: ""; position: absolute; inset: 14px; border: 1px solid rgba(216,193,154,.22); border-radius: 20px; pointer-events: none; transform: none; height: auto; }
.hero h1 { color: #fff; font-size: clamp(1.8rem, 3.6vw, 3rem); line-height: 1.35; letter-spacing: -.02em; }
.hero h1::after { content: ""; display: block; width: 72px; height: 3px; margin-top: 14px; border-radius: 3px; background: linear-gradient(90deg, var(--gold-soft), var(--accent)); }
.hero p { color: rgba(255,255,255,.78); }
.hero-search { border-radius: 14px; padding: 5px; box-shadow: 0 14px 30px rgba(0,0,0,.25); }
.hero-search input { padding: 12px 14px; }
.hero-search button { border-radius: 10px; }
.hero .hero-books { left: 70px; z-index: 1; }
.hero .hero-books .cover { box-shadow: 0 18px 40px rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.08); }

.features { gap: 14px; margin-top: 22px; }
.feature { border-radius: 16px; padding: 16px 18px; }
.feature .fi { width: 46px; height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-50); font-size: 1.4rem; flex-shrink: 0; }
.feature b { color: var(--primary); }
.cat-card { border-radius: 18px; padding: 20px 12px; }
.cat-card .ci { width: 58px; height: 58px; margin: 0 auto 6px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 30%, #fff, var(--accent-50)); border: 1px solid var(--border); font-size: 1.7rem; }
.cat-card:hover { transform: translateY(-4px); border-color: var(--gold-soft); box-shadow: var(--shadow-lg); color: var(--primary); }

/* book cards */
.book-card { border-radius: 18px; padding: 12px 12px 14px; gap: 6px; }
.book-card:hover { transform: translateY(-5px); border-color: var(--gold-soft); box-shadow: var(--shadow-lg); }
.book-card .cover-link { padding: 8px 8px 4px; background: linear-gradient(180deg, #f6f1e7, #fbf9f5); border-radius: 12px; }
.book-card .cover { box-shadow: inset 6px 0 8px -4px rgba(0,0,0,.35), 0 10px 18px rgba(22,35,59,.18); transition: transform .25s; }
.book-card:hover .cover { transform: translateY(-2px) rotate(-1deg); }
.book-card h3 { font-weight: 700; color: var(--primary); }
.book-card .translator { color: var(--accent-600); }
.book-card .add { background: var(--primary); color: #fff; border-radius: 12px; }
.book-card .add:hover { background: var(--accent); }
.price .now { color: var(--primary); font-weight: 800; }
.ribbon { top: 18px; left: 18px; background: #a3343a; border-radius: 999px; padding: 1px 10px; box-shadow: 0 4px 10px rgba(163,52,58,.3); }
.ribbon.out { background: #5d6372; box-shadow: none; }
.ebook-badge { background: var(--accent-50); color: var(--accent-600); font-weight: 600; }
.rating { color: var(--accent); }

/* catalog, detail, cart */
.filters h3, .buy-box h3 { color: var(--primary); }
.filters .cats a.active { background: var(--primary); color: #fff; }
.chip { background: var(--accent-50); color: var(--accent-600); }
.pagination .current { background: var(--primary); }
.detail h1 { color: var(--primary); font-weight: 800; }
.buy-box { border-top: 4px solid var(--accent); }
.buy-box .price .now { color: var(--primary); }
.steps span.on { background: var(--primary); }
.summary .row.total { color: var(--primary); }
.progress span { background: linear-gradient(90deg, var(--gold-soft), var(--accent)); }
.tabs .active { color: var(--primary); border-bottom-color: var(--accent); }
.status { font-weight: 600; }
.timeline .tl.done i { background: var(--primary); border-color: var(--accent); }

/* library & reader accents */
.lib-hero { background: linear-gradient(135deg, #1d2d4d, var(--primary) 60%, #0b1424); border: 1px solid rgba(216,193,154,.25); }
.lib-stats div { background: rgba(216,193,154,.12); border: 1px solid rgba(216,193,154,.2); }
.lib-stats b { color: var(--gold-soft); }

/* footer */
.site-footer { background: linear-gradient(180deg, #16233b, #0b1424); color: rgba(255,255,255,.72); border-top: 0; position: relative; margin-top: 56px; padding-top: 44px; }
.site-footer::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--accent), var(--gold-soft), var(--accent), transparent); }
.site-footer h4 { color: var(--gold-soft); font-weight: 700; }
.footer-grid > div:first-child h4 { display: flex; align-items: center; gap: 12px; }
.footer-grid > div:first-child h4::before { content: ""; width: 52px; height: 52px; flex-shrink: 0; border-radius: 50%;
  background: #faf7f1 url(/img/logo.png) center / 86% no-repeat; box-shadow: 0 0 0 3px rgba(216,193,154,.35); }
.site-footer a { color: rgba(255,255,255,.85); }
.site-footer a:hover { color: var(--gold-soft); }
.socials a { border: 1px solid rgba(216,193,154,.3); background: transparent; }
.copyright { color: rgba(255,255,255,.5); border-top-color: rgba(216,193,154,.18); }

/* misc */
.toast { background: var(--primary); border-right: 3px solid var(--accent); }
.spinner { border-color: var(--accent-50); border-top-color: var(--accent); }
.modal { border-radius: 20px; }
.auth-box { border-top: 4px solid var(--accent); }
.auth-box h1 { color: var(--primary); }
.auth-box::before { content: ""; display: block; width: 72px; height: 72px; margin: 0 auto 6px; background: url(/img/logo.png) center / contain no-repeat; }
.app-banner { background: var(--accent-50); border: 1px solid var(--border); }
.app-steps li::before { background: var(--primary); }
.admin-nav a.active { background: var(--primary); color: #fff; }
.chart .bar span { background: linear-gradient(180deg, var(--accent), var(--primary)); }

/* rating stars stay keyboard-accessible (visually hidden, still focusable) */
.stars-input input { display: inline; position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars-input input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.stars-input input:checked ~ label, .stars-input label:hover, .stars-input label:hover ~ label { color: var(--accent); }

/* phone */
@media (max-width: 680px) {
  .hero { padding: 36px 22px; border-radius: 22px; }
  .hero::before { width: 260px; height: 260px; left: -70px; opacity: .08; }
  .hero::after { inset: 8px; border-radius: 16px; }
  .logo img { width: 44px; height: 44px; }
  .logo strong { font-size: 1.15rem; }
  .bottom-nav { background: rgba(255,255,255,.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--border); }
  .bottom-nav a span .ico { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--primary); }
  .bottom-nav a.active span::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--accent); }
  .book-card .cover-link { padding: 6px 6px 2px; }
  .section { margin-top: 32px; }
}
@media print { .hero::before, .auth-box::before { display: none; } }

.icon-btn.menu-toggle { display: none; }

/* ---------------------------------------------------------------- gifts */
.gift-btn { border-color: var(--gold-soft, #d8c19a); color: var(--accent-600, #957443); }
.gift-note { color: var(--accent-600, #957443); font-weight: 500; }
.gifts-card { margin-top: 20px; }
.gift-row { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin-top: 10px; background: linear-gradient(180deg, #fffdf8, #fff); }
.gift-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.gift-link { display: flex; gap: 6px; margin-top: 10px; }
.gift-link .input { flex: 1; min-width: 0; font-size: .82rem; }
.gift-msg { display: flex; gap: 6px; margin-top: 8px; }
.gift-msg .input { flex: 1; min-width: 0; }
.gift-page { max-width: 760px; margin: 10px auto; padding: 0; overflow: hidden; border-top: 4px solid var(--accent); }
.gift-ribbon { background: linear-gradient(135deg, #1d2d4d, var(--primary)); color: var(--gold-soft, #d8c19a); text-align: center; padding: 14px; font-weight: 800; font-size: 1.15rem; letter-spacing: .02em; }
.gift-body { display: grid; grid-template-columns: 200px 1fr; gap: 28px; padding: 28px; align-items: start; }
.gift-body h1 { color: var(--primary); margin-bottom: 4px; }
.gift-from { margin: 16px 0 10px; }
.gift-quote { margin: 0 0 18px; padding: 12px 16px; border-right: 3px solid var(--accent); background: var(--accent-50); border-radius: 10px; font-size: 1.02rem; white-space: pre-line; }
@media (max-width: 680px) {
  .gift-body { grid-template-columns: 1fr; padding: 20px; }
  .gift-cover { max-width: 160px; margin: 0 auto; }
  .gift-link, .gift-msg { flex-wrap: wrap; }
}

/* ---------------------------------------------------------------- reading report */
.report .section-head { flex-wrap: wrap; }
.report-grid { display: grid; grid-template-columns: 170px 1fr; gap: 24px; align-items: center; }
.ring { --p: 0; width: 160px; height: 160px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--accent-50) 0); }
.ring > div { width: 126px; height: 126px; border-radius: 50%; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring b { font-size: 2rem; color: var(--primary); line-height: 1.1; }
.ring small { color: var(--muted); font-size: .75rem; }
.report-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.report-stats > div { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; }
.report-stats .ri { font-size: 1.1rem; }
.report-stats b { font-size: 1.35rem; color: var(--primary); line-height: 1.3; }
.report-stats small { color: var(--muted); font-size: .76rem; }
.heat { display: grid; grid-template-columns: repeat(35, 1fr); gap: 4px; margin-top: 18px; direction: ltr; }
.heat i, .heat-legend i { display: block; aspect-ratio: 1; border-radius: 4px; background: #efe9dd; }
.heat .l1, .heat-legend .l1 { background: #e8d9b8; } .heat .l2, .heat-legend .l2 { background: #d6bb85; }
.heat .l3, .heat-legend .l3 { background: #b9965a; } .heat .l4, .heat-legend .l4 { background: var(--primary); }
.heat-legend { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.heat-legend i { width: 12px; }
.heat-legend span { margin: 0 4px; }
.goal-presets { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 680px) {
  .report-grid { grid-template-columns: 1fr; justify-items: center; }
  .heat { grid-template-columns: repeat(18, 1fr); }
  .heat i:nth-child(-n+17) { display: none; }
}

/* ---------------------------------------------------------------- wishlist */
.heart { position: absolute; top: 18px; right: 18px; z-index: 3; width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.92); box-shadow: 0 2px 8px rgba(22,35,59,.18); display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0; transition: transform .15s; }
.heart:hover { transform: scale(1.08); }
.heart svg { width: 18px; height: 18px; fill: none; stroke: #a3343a; stroke-width: 1.8; }
.heart.on svg { fill: #c2414a; stroke: #c2414a; }
.heart.big { position: static; width: auto; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); box-shadow: none; color: var(--text); flex-shrink: 0; }
.heart.big span { font-size: .85rem; }
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.title-row h1 { margin-bottom: 6px; }
.deal-dot { background: #c2414a; color: #fff; border-radius: 999px; padding: 0 7px; font-size: .7rem; margin-right: 4px; }
.wish-item { position: relative; display: flex; flex-direction: column; }
.wish-item .book-card { flex: 1; }
.deal-tag { background: var(--success-50); color: var(--success); font-size: .78rem; font-weight: 600; border-radius: 10px 10px 0 0; padding: 4px 10px; text-align: center; margin-bottom: -8px; padding-bottom: 12px; }

a.feature { color: inherit; } a.feature:hover { border-color: var(--gold-soft); }


/* ---------------------------------------------------------------- highlights & notes */
.rd-hls { position: absolute; inset: 0; pointer-events: none; }
.rd-hl { position: absolute; border-radius: 3px; mix-blend-mode: multiply; pointer-events: auto; cursor: pointer; }
.rd-hl.drawing { pointer-events: none; outline: 1px dashed rgba(0,0,0,.35); }
.rd-hl.has-note::after { content: "✎"; position: absolute; top: -9px; left: -9px; font-size: 11px; background: #fff; border-radius: 50%; width: 16px; height: 16px; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.hl-yellow { background: rgba(255, 221, 87, .55); } .hl-green { background: rgba(132, 214, 140, .55); }
.hl-blue { background: rgba(122, 182, 255, .55); } .hl-pink { background: rgba(255, 150, 190, .55); }
.reader.hl-mode .rd-page { cursor: crosshair; touch-action: none; }
.reader.hl-mode .rd-hl { pointer-events: none; }
.rd-hlbar { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 6px 10px; background: var(--accent-50); color: var(--text); font-size: .85rem; flex-wrap: wrap; }
.hl-sw { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15); cursor: pointer; display: inline-block; vertical-align: middle; padding: 0; }
.hl-sw.on { box-shadow: 0 0 0 3px var(--primary); }
.rd-list .hl-sw { width: 12px; height: 12px; border-width: 1px; cursor: default; }
.rd-seg .hl-sw { width: 14px; height: 14px; cursor: default; }
.rd-sub { margin: 14px 0 4px; font-size: .9rem; }
.notes-book { margin-bottom: 16px; }
.notes-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.notes-head .thumb { width: 56px; }
.notes-head h2 { margin: 0; font-size: 1.1rem; color: var(--primary); }
.notes-head > div:nth-child(2) { flex: 1; min-width: 160px; }
.note-item { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; align-items: start; padding: 12px; border: 1px solid var(--border); border-right: 4px solid; border-radius: 12px; margin-top: 10px; background: #fffdf8; }
.note-item img { width: 100%; border-radius: 6px; border: 1px solid var(--border); background: #fff; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.note-item p { margin: 6px 0; white-space: pre-line; }
.note-meta span { font-size: .8rem; color: var(--muted); }
.hlc-yellow { border-right-color: #f2c94c; } .hlc-green { border-right-color: #6fcf97; } .hlc-blue { border-right-color: #56a0f5; } .hlc-pink { border-right-color: #f08bb4; }
.notes-marks li a { white-space: nowrap; }
@media (max-width: 680px) { .note-item { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- quote cards */
.modal.quote-modal { max-width: 520px; }
.quote-canvas { width: 100%; height: auto; border-radius: 12px; box-shadow: var(--shadow); display: block; }
.quote-themes { display: flex; gap: 8px; margin-bottom: 10px; }
.qt { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.qt.on { box-shadow: 0 0 0 3px var(--accent); }
.qt-paper { background: #faf6ee; } .qt-navy { background: #16233b; } .qt-rose { background: #f6e9ea; }
.quote-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.note-links { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }

/* ---------------------------------------------------------------- shelves */
.shelf-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.shelf-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: .88rem; cursor: pointer; }
.shelf-chip small { color: var(--muted); }
.shelf-chip:hover { border-color: var(--gold-soft); color: var(--primary); }
.shelf-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.shelf-chip.on small { color: var(--gold-soft); }
.shelf-chip.add { border-style: dashed; color: var(--accent-600); }
.lib-actions { display: flex; gap: 6px; align-items: center; margin-top: auto; }
.lib-actions .lib-btn { margin-top: 0; }

/* ---------------------------------------------------------------- my devices */
.devices-card { max-width: 560px; margin-top: 16px; }
.device-list li { align-items: center; }

/* ---------------------------------------------------------------- print + e-book bundle */
.bundle-box { margin-top: 14px; padding: 14px; border-radius: 14px; border: 1px dashed var(--gold-soft); background: var(--accent-50); }
.bundle-box p { margin: 6px 0; }
.bundle-price { margin: 6px 0 10px; font-size: 1.05rem; color: var(--primary); }
.bundle-note { color: var(--accent-600); }

/* ---------------------------------------------------------------- loyalty points */
.pts { background: var(--accent-50); color: var(--accent-600); border-radius: 999px; padding: 0 7px; font-size: .72rem; margin-right: 4px; }
.points-hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding: 24px; border-radius: var(--radius);
  background: linear-gradient(135deg, #1d2d4d, var(--primary) 60%, #0b1424); color: #fff; border: 1px solid rgba(216,193,154,.25); box-shadow: var(--shadow); }
.points-hero h1 { color: #fff; margin: 0 0 4px; }
.points-hero p { margin: 0; opacity: .85; }
.points-balance { text-align: center; background: rgba(216,193,154,.14); border: 1px solid rgba(216,193,154,.3); border-radius: 16px; padding: 12px 26px; }
.points-balance b { display: block; font-size: 2.2rem; line-height: 1.1; color: var(--gold-soft); }
.points-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.reward { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; margin-top: 8px; }
.reward div { display: flex; flex-direction: column; }
.reward.locked { opacity: .6; }
.pts-plus { color: var(--success); } .pts-minus { color: var(--danger); }
@media (max-width: 760px) { .points-grid { grid-template-columns: 1fr; } }
