:root {
  --bg: #f4fafb;
  --bg-grad: radial-gradient(1100px 480px at 50% -180px, #dff4f8 0%, rgba(223,244,248,0) 72%);
  --panel: #ecf8fa;
  --card: #ffffff;
  --line: #e4eff2;
  --line-strong: #d0e6ea;
  --ink: #123540;
  --muted: #64858d;
  --accent: #2fa6b8;
  --accent-2: #4b86c9;
  --accent-grad: linear-gradient(135deg, #34b1c3 0%, #4b86c9 100%);
  --accent-soft: #e4f6f9;
  --accent-ink: #fff;
  --good: #2e7d32;
  --good-bg: #d9f0da;
  --warn: #b47e12;
  --warn-bg: #f8ecca;
  --warn-ink: #7a5d10;
  --bad: #c0392b;
  --bad-bg: #f8dcd8;
  --shadow-sm: 0 1px 2px rgba(18,53,64,.05), 0 2px 8px rgba(18,53,64,.05);
  --shadow: 0 4px 14px rgba(18,53,64,.06), 0 16px 44px rgba(18,53,64,.07);
  --shadow-lg: 0 12px 32px rgba(18,53,64,.12), 0 32px 70px rgba(18,53,64,.12);
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Lora', 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-grad), var(--bg); background-repeat: no-repeat; background-attachment: fixed;
  color: var(--ink); -webkit-font-smoothing: antialiased; line-height: 1.55;
}
.cinzel { font-family: 'Cinzel', Georgia, serif; letter-spacing: .5px; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 30px 20px 110px; }
.center-narrow { max-width: 460px; margin: 40px auto; }

/* Top bar — frosted glass */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 26px; background: rgba(255,255,255,.72); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
  -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
}
.topbar .brand-left { display: flex; align-items: center; gap: 14px; }
.topbar .brand-left strong { font-family: 'Cinzel', Georgia, serif; font-size: 16px; letter-spacing: .6px; color: var(--ink); }
.topbar .logo { height: 44px; width: auto; object-fit: contain; }
.topbar .brand-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; line-height: 1.1; pointer-events: none; }
.topbar #brandTitle { font-family: 'Cinzel', Georgia, serif; font-size: 23px; margin: 0; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--ink); }
.topbar .who { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.topbar .who #whoami { font-weight: 600; color: var(--ink); }

/* Notification bell */
.notif-wrap { position: relative; display: inline-flex; }
.notif-bell {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink);
  cursor: pointer; transition: background .15s, border-color .15s, transform .1s;
}
.notif-bell:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.notif-bell:active { transform: scale(.94); }
.notif-badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700;
  line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--card);
}
.notif-panel {
  position: absolute; top: 46px; right: 0; width: 320px; max-width: 88vw; z-index: 60;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 14px;
  box-shadow: var(--shadow-lg); overflow: hidden; text-align: left;
}
@keyframes notifDrop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.notif-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 700; color: var(--ink);
  font-family: 'Cinzel', Georgia, serif; font-size: 14px; letter-spacing: .5px;
}
.notif-list { max-height: 340px; overflow-y: auto; }
.notif-empty { padding: 26px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.notif-item { padding: 11px 14px; border-bottom: 1px solid var(--line); position: relative; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--accent-soft); }
.notif-item.unread::before {
  content: ''; position: absolute; left: 5px; top: 16px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent);
}
.notif-item-title { font-weight: 600; color: var(--ink); font-size: 13.5px; padding-left: 8px; }
.notif-item-body { color: var(--muted); font-size: 12.5px; margin-top: 2px; padding-left: 8px; line-height: 1.4; }
.notif-item-time { color: var(--muted); font-size: 11px; margin-top: 4px; padding-left: 8px; opacity: .8; }

/* Toast pops */
.toast-wrap { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  display: flex; gap: 10px; align-items: flex-start; width: 300px; max-width: 90vw;
  background: var(--card); border: 1px solid var(--line-strong); border-left: 4px solid var(--accent);
  border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-lg); cursor: pointer;
  pointer-events: auto; opacity: 0; transform: translateX(24px); transition: opacity .28s, transform .28s;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-ico { font-size: 18px; line-height: 1.2; }
.toast-title { font-weight: 700; color: var(--ink); font-size: 13.5px; }
.toast-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; line-height: 1.4; }

/* Catalog */
.catalog-head { text-align: center; margin: 12px 0 34px; }
.catalog-head h2 { font-size: 33px; margin: 0 0 10px; color: var(--ink); font-weight: 700; letter-spacing: .3px; }
.catalog-head .hint { color: var(--muted); font-size: 14px; max-width: 620px; margin: 0 auto; }

.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(214px, 1fr)); gap: 22px; }
.book-card {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden; display: flex; flex-direction: column;
  transition: transform .22s cubic-bezier(.22,.61,.36,1), box-shadow .22s ease, border-color .22s ease;
}
.book-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.book-card .cover-wrap { position: relative; width: 100%; aspect-ratio: 3 / 4; background: #eef7f9; overflow: hidden; }
.book-card .cover-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s cubic-bezier(.22,.61,.36,1); }
.book-card:hover .cover-wrap img { transform: scale(1.045); }
.book-card .cover-ph { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted); font-size: 13px; text-align: center; padding: 16px; }
.book-card .card-body { padding: 15px 15px 17px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.book-card .b-title { font-family: 'Cinzel', Georgia, serif; font-size: 15px; font-weight: 600; line-height: 1.32; color: var(--ink); }
.book-card .b-price-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.book-card .b-price { font-size: 18px; font-weight: 700; color: var(--accent); font-family: 'Montserrat', sans-serif; }
.book-card .b-actions { margin-top: auto; }
.book-card .b-actions button { width: 100%; }
.book-card.oos .cover-wrap img { filter: grayscale(.35) opacity(.82); }

/* Stock badge — solid pill beside the price */
.stock-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px; border: 1px solid transparent;
  font-family: 'Montserrat', sans-serif; font-size: 10.5px; font-weight: 700;
  letter-spacing: .4px; text-transform: uppercase; white-space: nowrap; line-height: 1;
}
.stock-badge .dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.stock-badge.low { background: var(--warn-bg); color: var(--warn-ink); border-color: rgba(180,126,18,.28); }
.stock-badge.low .dot { background: var(--warn); }
.stock-badge.out { background: var(--bad-bg); color: var(--bad); border-color: rgba(192,57,43,.28); }
.stock-badge.out .dot { background: var(--bad); }

/* Cart pill (floating) */
.cart-pill {
  position: fixed; right: 24px; bottom: 24px; z-index: 50; display: flex; align-items: center; gap: 10px;
  background: var(--accent-grad); color: #fff; border: none; border-radius: 40px; padding: 14px 24px;
  font-family: 'Montserrat', sans-serif; font-size: 15px; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 24px rgba(47,166,184,.42); transition: transform .2s ease, box-shadow .2s ease;
}
.cart-pill:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(47,166,184,.5); }
.cart-pill .cart-ico { font-size: 18px; }
.cart-pill .cart-count { background: #fff; color: var(--accent); border-radius: 20px; min-width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; padding: 0 6px; }

/* Cart drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(18,53,64,.4); z-index: 60; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.cart-drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 408px; max-width: 92vw; background: var(--card);
  border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgba(18,53,64,.16); z-index: 70;
  transform: translateX(100%); transition: transform .3s cubic-bezier(.22,.61,.36,1); display: flex; flex-direction: column;
}
.cart-drawer.open { transform: translateX(0); }
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.cart-head h3 { margin: 0; font-size: 20px; color: var(--ink); }
.cart-items { flex: 1; overflow-y: auto; padding: 12px 22px; }
.cart-row { display: flex; gap: 13px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cart-row .ci-cover { width: 54px; height: 70px; object-fit: cover; border-radius: 8px; background: #eef7f9; flex: 0 0 auto; box-shadow: var(--shadow-sm); }
.cart-row .ci-mid { flex: 1; min-width: 0; }
.cart-row .ci-title { font-family: 'Cinzel', Georgia, serif; font-size: 14px; font-weight: 600; line-height: 1.28; }
.cart-row .ci-price { font-size: 13px; color: var(--muted); margin-top: 2px; }
.cart-row .ci-line { font-weight: 700; color: var(--accent); margin-top: 4px; font-size: 14px; }
.qty-stepper { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; }
.qty-stepper button { width: 30px; height: 30px; padding: 0; border-radius: 9px; font-size: 16px; line-height: 1; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--line-strong); box-shadow: none; }
.qty-stepper button:hover { background: #d3f2f6; transform: none; filter: none; }
.qty-stepper .qv { min-width: 22px; text-align: center; font-weight: 700; }
.cart-row .ci-remove { background: transparent; border: none; color: var(--bad); font-size: 12px; font-weight: 700; cursor: pointer; padding: 6px 0 0; box-shadow: none; }
.cart-row .ci-remove:hover { text-decoration: underline; transform: none; }
.cart-foot { border-top: 1px solid var(--line); padding: 18px 22px; background: #fbfeff; }
.cart-total-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; margin-bottom: 14px; }
.cart-total-row strong { font-size: 23px; color: var(--accent); font-family: 'Montserrat', sans-serif; }
.cart-empty { color: var(--muted); text-align: center; padding: 44px 10px; }

/* Checkout */
.back-link { display: inline-block; margin-bottom: 6px; }
.co-items { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 16px; background: #fbfeff; }
.co-item { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.co-item:last-child { border-bottom: none; }
.co-item .coi-name { color: var(--ink); }
.co-item .coi-amt { font-weight: 700; white-space: nowrap; }
.co-total { text-align: right; margin-top: 12px; font-size: 15px; }
.co-total strong { font-size: 21px; color: var(--accent); font-family: 'Montserrat', sans-serif; }

/* Payment page */
.pay-check { width: 62px; height: 62px; border-radius: 50%; background: var(--good-bg); color: var(--good); font-size: 30px; display: flex; align-items: center; justify-content: center; margin: 0 auto 8px; }
.order-num { font-family: 'Montserrat', sans-serif; font-size: 31px; font-weight: 800; color: var(--accent); letter-spacing: 1px; margin: 4px 0 10px; }
.pay-methods { display: flex; gap: 16px; margin: 22px 0 6px; flex-wrap: wrap; }
.pay-card { flex: 1 1 200px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px; background: #fbfeff; box-shadow: var(--shadow-sm); }
.pay-card-title { font-family: 'Cinzel', Georgia, serif; font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.pay-handle { font-family: 'Montserrat', sans-serif; font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 12px; overflow-wrap: anywhere; }

/* Admin header */
.admin-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 2px 0 4px; }
.admin-head .back-link { margin: 0; }
.admin-title { margin: 0; font-size: 26px; font-weight: 600; color: var(--ink); letter-spacing: .2px; }

/* Tabs — segmented control */
.tabs { display: inline-flex; gap: 4px; margin: 16px 0 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px; box-shadow: var(--shadow-sm); }
.tab { border: 1px solid transparent; background: transparent; color: var(--muted); padding: 8px 22px; border-radius: 999px; font-family: 'Montserrat', sans-serif; font-size: 14px; font-weight: 600; cursor: pointer; transition: color .18s ease, background .18s ease, box-shadow .18s ease; box-shadow: none; }
.tab:hover { background: rgba(255,255,255,.55); color: var(--ink); transform: none; }
.tab.active { background: var(--card); color: var(--accent); border-color: var(--line); box-shadow: var(--shadow-sm); }

/* Order status summary strip */
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); padding: 15px 16px; display: flex; flex-direction: column; gap: 5px; transition: box-shadow .18s ease, transform .18s ease; }
.stat:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-num { font-family: 'Montserrat', sans-serif; font-size: 27px; font-weight: 800; line-height: 1; color: var(--ink); }
.stat-label { font-family: 'Montserrat', sans-serif; font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.stat.s-new .stat-num { color: var(--warn-ink); }
.stat.s-paid .stat-num { color: #2a4d7a; }
.stat.s-prepared .stat-num { color: #0f6b7a; }
.stat.s-pickedup .stat-num { color: var(--good); }
.stat.s-cancelled .stat-num { color: var(--bad); }
.stat.s-sales { background: var(--accent-grad); border-color: transparent; box-shadow: var(--shadow); }
.stat.s-sales .stat-num { color: #fff; white-space: nowrap; }
.stat.s-sales .stat-label { color: #fff; opacity: .92; }

/* Cards & layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px; }
.card h2 { margin: 0 0 4px; font-size: 21px; font-weight: 700; color: var(--ink); }
.card .hint { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.section-count { font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 11px; line-height: 1.6; }

/* Forms */
label { display: block; font-family: 'Montserrat', sans-serif; font-size: 12px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
label .req { color: var(--bad); }
label .opt { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
input, select, textarea { width: 100%; padding: 11px 13px; font-size: 15px; color: var(--ink); font-family: inherit; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fbfeff; transition: border-color .15s ease, box-shadow .15s ease; }
input, select { height: 44px; line-height: 1.2; }
textarea { height: auto; min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,166,184,.18); }
.field { flex: 1 1 220px; margin-bottom: 15px; }
.field.full { flex-basis: 100%; }
.filebtn { display: flex; align-items: center; gap: 10px; }
.filename { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }

/* Buttons */
button, .btn {
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 10px 20px;
  font-family: 'Montserrat', sans-serif; font-size: 15px; font-weight: 600; cursor: pointer;
  background: var(--accent-grad); color: var(--accent-ink); text-decoration: none;
  display: inline-block; text-align: center; box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, filter .16s ease;
}
button:hover, .btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(47,166,184,.28); }
button:active, .btn:active { transform: translateY(0); }
button:disabled { opacity: .5; cursor: default; box-shadow: none; transform: none; }
button.ghost, .btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line-strong); }
button.ghost:hover { background: var(--accent-soft); border-color: var(--accent); box-shadow: var(--shadow-sm); }
button.subtle { background: var(--card); color: var(--muted); border-color: var(--line-strong); }
button.subtle:hover { color: var(--ink); }
button.danger { background: var(--bad); border-color: var(--bad); }
button.danger:hover { box-shadow: 0 6px 16px rgba(192,57,43,.28); }
button.small { padding: 6px 15px; font-size: 13px; border-radius: 9px; }
button.notify-on { background: var(--good); border-color: var(--good); }
button.notify-on:hover { box-shadow: 0 6px 16px rgba(46,125,50,.26); }
button.link { background: transparent; border: none; color: var(--accent); padding: 0; font-weight: 700; text-decoration: underline; box-shadow: none; }
button.link:hover { transform: none; box-shadow: none; filter: brightness(.9); }
button.block, .btn.block { width: 100%; display: block; }
button.warn { background: var(--warn); border-color: var(--warn); }
button.ok { background: var(--good); border-color: var(--good); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--card); }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: var(--accent-soft); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius-sm); }
td.num, th.num { text-align: right; white-space: nowrap; }
.book-thumb { width: 42px; height: 54px; object-fit: cover; border-radius: 7px; background: #eef7f9; box-shadow: var(--shadow-sm); }
.empty { color: var(--muted); font-size: 14px; padding: 14px 0; }

/* Pills / status */
.pill { display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 20px; font-family: 'Montserrat', sans-serif; font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
.pill.role { background: #d6ecef; color: #235a66; }
.pill.role.manager { background: var(--accent); color: #fff; }
.pill.role.editor { background: var(--accent-2); color: #fff; }
.pill.role.viewer { background: #b9d6dc; color: #235a66; }
.pill.st-new { background: var(--warn-bg); color: var(--warn-ink); }
.pill.st-paid { background: #d3e2f7; color: #2a4d7a; }
.pill.st-prepared { background: #cdeef2; color: #0f6b7a; }
.pill.st-pickedup { background: var(--good-bg); color: var(--good); }
.pill.st-cancelled { background: var(--bad-bg); color: var(--bad); }
.pill.badge-on { background: var(--good-bg); color: var(--good); }
.pill.badge-off { background: #e7eff1; color: var(--muted); }
.muted { color: var(--muted); }

/* Order accordions */
.order-section { margin-bottom: 26px; }
.order-section h3 { font-family: 'Cinzel', Georgia, serif; font-size: 17px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.order-acc { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); margin-bottom: 10px; box-shadow: var(--shadow-sm); overflow: hidden; transition: box-shadow .18s ease; }
.order-acc:hover { box-shadow: var(--shadow); }
.order-acc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 17px; cursor: pointer; }
.order-acc-head:hover { background: var(--accent-soft); }
.order-acc-title { font-weight: 700; font-size: 15px; color: var(--ink); }
.order-acc-title .caret { display: inline-block; color: var(--accent); margin-right: 8px; transition: transform .2s; }
.order-acc.open .caret { transform: rotate(90deg); }
.order-acc-meta { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.order-acc-body { display: none; padding: 4px 17px 17px; border-top: 1px solid var(--line); }
.order-acc.open .order-acc-body { display: block; }
.oi-line { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.oi-line:last-of-type { border-bottom: none; }
.oi-contact { font-size: 13px; color: var(--muted); margin: 10px 0; line-height: 1.6; }
.oi-contact b { color: var(--ink); }
.order-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* Refund / exchange log inside an order */
.adj-log { margin: 12px 0 4px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.adj-log-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 6px; }
.adj-row { font-size: 13px; color: var(--ink); margin: 4px 0; line-height: 1.5; }
.adj-tag { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; padding: 2px 8px; border-radius: 12px; margin-right: 6px; }
.adj-refund { background: #f6d7d2; color: #8a2b1e; }
.adj-exchange { background: #cdeef2; color: #0f6b7a; }
.adj-row .muted { color: var(--muted); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(18,53,64,.44); display: flex; align-items: flex-start; justify-content: center; padding: 44px 16px; z-index: 100; overflow: auto; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 24px; width: 100%; max-width: 560px; }
.modal h3 { font-family: 'Cinzel', Georgia, serif; font-size: 20px; margin: 0 0 6px; color: var(--ink); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 10px; flex-wrap: wrap; }
.cover-preview { width: 92px; height: 120px; object-fit: cover; border-radius: 10px; background: #eef7f9; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }

/* Notices */
.notice { padding: 12px 15px; border-radius: var(--radius-sm); font-size: 14px; margin: 10px 0; }
.notice.err { background: var(--bad-bg); color: var(--bad); }
.notice.ok { background: var(--good-bg); color: var(--good); }
.notice.info { background: var(--warn-bg); color: var(--warn-ink); }
.hidden { display: none !important; }
.spinner { color: var(--muted); font-size: 14px; padding: 26px 0; text-align: center; }
/* Loading state with an indeterminate progress bar, so it's clear something is happening
   (not frozen) even though we can't report real percent progress on these requests. */
.loading { padding: 28px 16px; text-align: center; }
.loading-label { color: var(--muted); font-size: 14px; margin-bottom: 13px; }
.loading-track { height: 6px; max-width: 260px; margin: 0 auto; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; position: relative; }
.loading-bar { position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; background: var(--accent-grad); border-radius: 999px; animation: loadingSlide 1.15s infinite cubic-bezier(.45,.05,.55,.95); }
@keyframes loadingSlide { 0% { left: -40%; } 60% { left: 100%; } 100% { left: 100%; } }
.btn-loading { position: relative; overflow: hidden; }
.btn-loading::after { content: ''; position: absolute; left: -35%; bottom: 0; height: 3px; width: 35%; background: currentColor; opacity: .85; border-radius: 2px; animation: btnBar 1.1s infinite ease-in-out; }
@keyframes btnBar { 0% { left: -35%; } 100% { left: 100%; } }

/* Auth modal */
.auth-toggle { display: flex; gap: 8px; margin-bottom: 18px; }
.auth-toggle button { flex: 1; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 20px 0; text-transform: uppercase; letter-spacing: .5px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
#googleBtn { display: flex; justify-content: center; margin: 4px 0; }

/* Sign-in progress */
.auth-progress { text-align: center; padding: 18px 6px 10px; }
.auth-progress-spinner { width: 40px; height: 40px; margin: 6px auto 16px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: authSpin .8s linear infinite; }
@keyframes authSpin { to { transform: rotate(360deg); } }
.auth-progress-label { font-family: 'Montserrat', sans-serif; font-size: 15px; font-weight: 600; color: var(--ink); }
.progress-track { height: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin: 16px 0 10px; }
.progress-bar { height: 100%; width: 0; background: var(--accent-grad); border-radius: 999px; transition: width .3s ease; }
.auth-progress-sub { font-size: 12.5px; color: var(--muted); }

/* Responsive */
@media (max-width: 760px) {
  .wrap { padding: 18px 12px 100px; }
  .topbar { position: static; flex-wrap: wrap; gap: 10px; padding: 12px 14px; justify-content: center; text-align: center; }
  .topbar .brand-left { width: 100%; justify-content: center; }
  .topbar .logo { height: 38px; }
  .topbar .brand-center { position: static; transform: none; left: auto; top: auto; width: 100%; pointer-events: auto; }
  .topbar #brandTitle { font-size: 21px; }
  .topbar .who { width: 100%; justify-content: center; flex-wrap: wrap; gap: 8px; }
  .catalog-head { margin: 6px 0 24px; }
  .catalog-head h2 { font-size: 27px; }
  .tabs { display: flex; width: 100%; margin: 14px 0 18px; gap: 4px; }
  .tabs::-webkit-scrollbar { height: 0; }
  .tab { flex: 1 1 0; padding: 8px 10px; font-size: 13px; }
  .admin-head { margin-bottom: 6px; }
  .admin-title { font-size: 22px; }
  .card { padding: 18px; border-radius: var(--radius-sm); }
  .card h2 { font-size: 19px; }
  input, select, textarea { font-size: 16px; }   /* stop iOS zoom on focus */
  .catalog-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .field { flex-basis: 100% !important; }
  .center-narrow { margin: 16px auto; }
  .table-scroll table { min-width: 560px; }
  .order-num { font-size: 27px; }
  .cart-pill { right: 16px; bottom: 16px; padding: 12px 20px; }
}

/* Phones: turn admin data tables into stacked label/value cards */
@media (max-width: 600px) {
  .table-scroll { border: none; border-radius: 0; }
  table.resp { min-width: 0; }
  table.resp thead { position: absolute; left: -9999px; }
  table.resp tr { display: block; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fbfeff; margin-bottom: 10px; padding: 4px 2px; box-shadow: var(--shadow-sm); }
  table.resp td { display: flex; justify-content: space-between; align-items: center; gap: 14px; text-align: right; border: none; border-bottom: 1px solid var(--line); padding: 10px 14px; overflow-wrap: anywhere; }
  table.resp tr td:last-child { border-bottom: none; }
  table.resp td::before { content: attr(data-label); font-family: 'Montserrat', sans-serif; font-weight: 700; color: var(--muted); text-transform: uppercase; font-size: 10.5px; letter-spacing: .05em; text-align: left; flex: 0 0 auto; }
  table.resp td:empty, table.resp td[data-label='']::before { display: none; }
  table.resp td[data-label=''] { justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
  tbody tr:hover { background: #fbfeff; }

  /* Order accordions stack their meta below the title */
  .order-acc-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .order-acc-title { font-size: 14.5px; }
  .order-acc-meta { width: 100%; justify-content: space-between; gap: 10px; }
  .order-actions { gap: 10px; }
  .order-actions button { flex: 1 1 auto; }

  /* Order summary: two even columns, sales card spans the full width */
  .stat-strip { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat.s-sales { grid-column: 1 / -1; }
  .stat { padding: 13px 14px; }
  .stat-num { font-size: 23px; }

  .cart-drawer { width: 100%; max-width: 100vw; }

  /* Notification panel: on phones, drop it into view as a full-width sheet just below the
     topbar instead of an absolutely-positioned dropdown anchored to the bell (which overflowed
     off-screen). Fixed positioning here is relative to the .topbar containing block (created by
     its backdrop-filter), which spans the full viewport width, so left/right margins keep it
     fully on-screen. */
  .notif-panel {
    position: fixed; top: 62px; left: 10px; right: 10px; width: auto; max-width: none;
    z-index: 75; animation: notifDrop .22s cubic-bezier(.22,.61,.36,1);
  }
  .notif-list { max-height: 60vh; }

  .modal-backdrop { padding: 16px 10px; }
  .modal { padding: 20px; }
  .modal-actions { flex-direction: column; align-items: stretch; }
  .modal-actions button { width: 100%; }
  .pay-methods { gap: 12px; }
}

/* Small phones */
@media (max-width: 380px) {
  .catalog-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .book-card .b-title { font-size: 14px; }
  .topbar #brandTitle { font-size: 19px; letter-spacing: 1.4px; }
  .stat-num { font-size: 21px; }
  .tab { padding: 8px 6px; font-size: 12.5px; }
}
