:root{
  --bg:#eaeded;
  --panel:#ffffff;
  --panel2:#f7f8f8;
  --line:#d5d9d9;
  --line-strong:#c7cfd1;
  --text:#0f1111;
  --muted:#565959;
  --accent:#007185;
  --accent-hover:#c7511f;
  --button:#ffd814;
  --button-border:#fcd200;
  --button-hover:#f7ca00;
  --button-secondary:#ffa41c;
  --button-secondary-border:#ff8f00;
  --danger:#b12704;
  --success:#067d62;
  --shadow:0 2px 8px rgba(15,17,17,.08);
  --radius:12px;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  font-family:Arial,Helvetica,sans-serif;
  background:var(--bg);
  color:var(--text);
  line-height:1.55;
}
a{
  color:var(--accent);
  text-decoration:none;
}
a:hover{
  color:var(--accent-hover);
  text-decoration:underline;
}
img{
  max-width:100%;
  display:block;
}
.container{
  width:min(1280px,94vw);
  margin:0 auto;
}
.narrow{
  width:min(1100px,94vw);
}
.flex{display:flex}
.between{justify-content:space-between}
.center{align-items:center}
.wrap{flex-wrap:wrap}
.gap{gap:1rem}
.gap-lg{gap:1.5rem}
.stack{display:flex;flex-direction:column}
.grid-2,.grid-4{display:grid;gap:1rem}
.grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.grid-4{grid-template-columns:repeat(4,minmax(0,1fr))}

.site-header{
  background:#131921;
  border-bottom:1px solid #232f3e;
}
.site-footer{
  background:#131921;
  border-top:1px solid #232f3e;
  margin-top:3rem;
  padding:1rem 0;
  color:#fff;
}
.site-header .container{
  padding:1rem 0;
}
.brand{
  font-weight:700;
  font-size:1.2rem;
  color:#fff;
}
.brand:hover{
  color:#fff;
  text-decoration:none;
}
.site-nav{
  display:flex;
  gap:.6rem;
  flex-wrap:wrap;
}
.site-nav a{
  padding:.55rem .85rem;
  border-radius:8px;
  color:#fff;
  border:1px solid transparent;
}
.site-nav a.active,
.site-nav a:hover{
  border-color:#fff;
  background:rgba(255,255,255,.06);
  text-decoration:none;
  color:#fff;
}

.hero{
  padding:2rem 0 1.25rem;
  background:linear-gradient(180deg,#ffffff 0%, #f8f9fa 100%);
  border-bottom:1px solid var(--line);
}
.hero-grid{
  display:grid;
  grid-template-columns:2fr 1fr;
  gap:1.5rem;
  align-items:start;
}
.eyebrow{
  display:inline-block;
  margin-bottom:.75rem;
  padding:.28rem .65rem;
  border:1px solid var(--line);
  border-radius:999px;
  color:var(--muted);
  background:#fff;
  font-size:.85rem;
}
h1,h2,h3{
  line-height:1.2;
  margin:0 0 .75rem;
  color:var(--text);
}
h1{font-size:clamp(2rem,4vw,3rem)}
h2{font-size:clamp(1.35rem,2.5vw,2rem)}
h3{font-size:1.08rem}
.lead{
  font-size:1.05rem;
  color:var(--muted);
}
.search-bar{
  display:flex;
  gap:.75rem;
  margin:1.2rem 0 1rem;
}
.search-bar input{
  flex:1;
}
.hero-actions,.filter-actions,.actions{
  display:flex;
  gap:.75rem;
  flex-wrap:wrap;
}

.site-logo{
  display:block;
  max-height:85px;
  width:auto;
}

.footer-links{
  display:flex;
  gap:1rem;
  flex-wrap:wrap;
}

.footer-links a{
  color:#fff;
}

.footer-copy{
  color:#fff;
  font-size:.95rem;
}

input,select,textarea,button{
  width:100%;
  padding:.85rem 1rem;
  border-radius:8px;
  border:1px solid var(--line-strong);
  background:#fff;
  color:var(--text);
  font:inherit;
}
input:focus,select:focus,textarea:focus{
  outline:2px solid #f90;
  outline-offset:1px;
  border-color:#f90;
}
button,.button{
  display:inline-flex;
  justify-content:center;
  align-items:center;
  width:auto;
  cursor:pointer;
  background:var(--button);
  border:1px solid var(--button-border);
  color:#0f1111;
  padding:.85rem 1.15rem;
  border-radius:999px;
  box-shadow:none;
  text-decoration:none;
  font-weight:700;
}
.button-secondary{
  background:var(--button-secondary);
  border:1px solid var(--button-secondary-border);
  color:#0f1111;
}
.button:hover,
.button-secondary:hover,
button:hover{
  text-decoration:none;
  filter:none;
}
button:hover,.button:hover{
  background:var(--button-hover);
}
.button-secondary:hover{
  background:#fa8900;
}

.stats-card,.panel,.book-card,.panel-link{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.stats-card{
  padding:1.2rem;
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:1rem;
}
.stat{
  padding:1rem;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--panel2);
}
.stat strong{
  display:block;
  font-size:1.8rem;
  color:var(--text);
}
.quick-links{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:1rem;
  padding:1.25rem 0 0;
}
.panel-link{
  padding:1.1rem;
  font-weight:700;
  color:var(--text);
}
.panel-link:hover{
  text-decoration:none;
  border-color:#aab7b8;
}

.section{
  padding:1.75rem 0;
}
.section-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:1rem;
  margin-bottom:1rem;
  flex-wrap:wrap;
}

.card-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:1.2rem;
}
.book-card{
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.book-image{
  display:block;
  background:#fff;
  padding:.85rem;
  border-bottom:1px solid var(--line);
}
.book-image img{
  width:100%;
  height:300px;
  object-fit:contain;
}
.book-body{
  padding:1rem;
}
.book-body p{
  margin-top:0;
}
.book-title{
  margin:0 0 .35rem;
  line-height:1.35;
  font-size:1.02rem;
  font-weight:400;
}
.book-title a{
  color:#007185;
}
.book-title a:hover{
  color:#c7511f;
}
.book-subtitle{
  margin:0 0 .55rem;
  font-size:.93rem;
  line-height:1.45;
  color:var(--muted);
}
.subtle-subtitle{
  color:var(--muted);
  font-size:1rem;
  line-height:1.55;
  max-width:760px;
}
.book-meta{
  display:flex;
  justify-content:flex-start;
  align-items:center;
  gap:1rem;
  margin-top:1rem;
  font-size:.95rem;
}
.muted,.help{
  color:var(--muted);
}

.page-hero{
  padding:1.8rem 0 1rem;
}
.catalogue-layout{
  display:grid;
  grid-template-columns:280px 1fr;
  gap:1.5rem;
  padding-bottom:2rem;
}
.filters,.panel{
  padding:1rem;
}
.filters{
  background:#fff;
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.filters form,.auth-panel form{
  display:flex;
  flex-direction:column;
  gap:1rem;
}
.listing-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:1rem;
}

.amazon-book-layout{
  display:grid;
  grid-template-columns:320px 1fr 320px;
  gap:1.5rem;
  align-items:start;
}

.amazon-book-cover{
  padding:1rem;
}

.amazon-book-cover img{
  width:100%;
  height:auto;
  object-fit:contain;
}

.amazon-book-main{
  min-width:0;
}

.amazon-book-title{
  font-size:2rem;
  line-height:1.2;
  margin-bottom:.4rem;
}

.amazon-book-subtitle{
  font-size:1rem;
  line-height:1.5;
  color:var(--muted);
  margin:0 0 1rem;
}

.amazon-book-author{
  margin:0 0 1rem;
  padding-bottom:1rem;
  border-bottom:1px solid var(--line);
}

.amazon-book-summary{
  font-size:1rem;
  margin-bottom:1rem;
}

.amazon-book-description{
  margin-bottom:1.25rem;
}

.amazon-book-meta{
  display:grid;
  gap:.65rem;
  padding-top:1rem;
  border-top:1px solid var(--line);
}

.amazon-buy-box{
  padding:1rem;
  position:sticky;
  top:1rem;
}

.amazon-buy-box h2{
  font-size:1.2rem;
  margin-bottom:1rem;
}

.edition-buy-row{
  border:1px solid var(--line);
  border-radius:10px;
  padding:1rem;
  background:var(--panel2);
}

.edition-buy-head{
  margin-bottom:.35rem;
}

.edition-buy-meta{
  font-size:.92rem;
  margin-bottom:.55rem;
}

.edition-buy-price{
  font-size:1.2rem;
  font-weight:700;
  margin-bottom:.85rem;
  color:#b12704;
}

.gap-sm{
  gap:.55rem;
}

@media (max-width: 1100px){
  .amazon-book-layout{
    grid-template-columns:280px 1fr;
  }

  .amazon-buy-box{
    grid-column:1 / -1;
    position:static;
  }
}

@media (max-width: 700px){
  .amazon-book-layout{
    grid-template-columns:1fr;
  }

  .amazon-book-cover,
  .amazon-book-main,
  .amazon-buy-box{
    width:100%;
  }
}

.book-detail{
  display:grid;
  grid-template-columns:320px 1fr;
  gap:2rem;
  align-items:start;
}
.book-cover-large{
  background:#fff;
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:1rem;
  box-shadow:var(--shadow);
}
.book-cover-large img{
  width:100%;
  height:auto;
  object-fit:contain;
  border-radius:8px;
}
.placeholder.large{
  border-radius:12px;
}
.meta-list{
  display:grid;
  gap:.55rem;
  margin-top:1rem;
}
.rich-text{
  color:#242424;
}

.table-wrap{
  overflow:auto;
}
table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
  border:1px solid var(--line);
  border-radius:12px;
  overflow:hidden;
}
th,td{
  padding:.85rem .9rem;
  border-bottom:1px solid var(--line);
  text-align:left;
  vertical-align:top;
}
th{
  background:#f3f3f3;
  color:#0f1111;
}
.link-button{
  background:none;
  border:none;
  padding:0;
  color:var(--accent);
  box-shadow:none;
}
.link-button.danger{
  color:var(--danger);
}

.flash-wrap{
  padding-top:1rem;
}
.flash{
  padding:1rem 1.1rem;
  border-radius:12px;
  border:1px solid var(--line);
  margin-bottom:.75rem;
  background:#fff;
}
.flash-error{
  border-color:#f1b7b7;
  background:#fff3f3;
}
.flash-success{
  border-color:#bfe3d4;
  background:#f2fbf7;
}
.flash-warning{
  border-color:#f3d78f;
  background:#fff8e7;
}

.pagination{
  display:flex;
  gap:.5rem;
  flex-wrap:wrap;
  justify-content:center;
  margin-top:1.5rem;
}
.pagination a{
  padding:.7rem .95rem;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
  color:var(--text);
}
.pagination a.current{
  background:#ffd814;
  border-color:#fcd200;
}

.placeholder{
  display:grid;
  place-items:center;
  min-height:220px;
  background:#f8f8f8;
  color:var(--muted);
  border:1px dashed var(--line-strong);
}
.back-top{
  padding:.55rem .85rem;
  border:1px solid rgba(255,255,255,.25);
  border-radius:999px;
  color:#fff;
}
.back-top:hover{
  color:#fff;
  text-decoration:none;
  border-color:#fff;
}
.sr-only{
  position:absolute;
  left:-9999px;
}
.checkbox{
  display:flex;
  align-items:center;
  gap:.7rem;
}
.checkbox input{
  width:auto;
}

@media (max-width: 1000px){
  .hero-grid,.catalogue-layout,.book-detail{
    grid-template-columns:1fr;
  }
  .card-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .listing-grid,.quick-links,.grid-4{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media (max-width: 640px){
  .card-grid,.listing-grid,.quick-links,.grid-2,.grid-4{
    grid-template-columns:1fr;
  }
  .search-bar{
    flex-direction:column;
  }
  .site-nav{
    gap:.4rem;
  }
  .book-image img{
    height:280px;
  }
}