:root{
  --primary:#014712;
  --secondary:#BE9843;
  --bg:#FFFFFF;
  --card:#ffffff;
  --text:#000000;
  --muted:#5b6b7a;
  --border:rgba(20,38,54,.16);
  --shadow:0 6px 18px rgba(16,24,40,.08);
  --radius:0px;
  --radius-sm:0px;
  --focus:0 0 0 3px rgba(21,70,112,.25);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color:var(--text);
  background:var(--bg);
}

a{color:var(--primary); text-decoration:none}
a:hover{text-decoration:underline}

h1{color:var(--primary); text-decoration:none}

p{text-decoration:none; font-weight:700}

logo {
  display: flex;
  justify-content: center;
}

.container{max-width:1100px; margin:0 auto; padding:20px}

.topbar{position:sticky; top:0; z-index:50; background:var(--card); border:1px solid var(--primary)}
.topbar__inner{max-width:1100px; margin:0 auto; padding:7px 20px; display:flex; align-items:center; gap:16px}
.brand{display:flex; align-items:center; gap:10px; font-weight:700}
.brand__mark{width:34px; height:34px; display:grid; place-items:center; background:rgba(21,70,112,.08); border-radius:0px}
.nav{display:flex; gap:14px; margin-right:auto}
.nav a{padding:8px 10px; border-radius:0px; font-weight:bold}
.nav a:hover{background:#FFFFFF; text-decoration:none; border:1px solid var(--primary)}
.userbox{display:flex; align-items:center; gap:10px}
.userbox__name{color:var(--muted); font-size:14px}

.footer{padding:22px 0; color:var(--muted)}
.footer__inner{display:flex; justify-content:space-between; border-top:1px solid var(--border); padding-top:18px}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}

.card__hd{padding:16px 16px 0 16px}
.card__bd{padding:16px}

.h1{font-size:22px; margin:0 0 6px 0}
.sub{color:var(--muted); font-size:14px}

.alert{padding:12px 14px; border-radius:0px; margin-bottom:14px; border:1px solid var(--border); background:var(--card)}
.alert--success{border-color:rgba(22,163,74,.35)}
.alert--error{border-color:rgba(220,38,38,.35)}

.btn{
  display:inline-flex; align-items:center; justify-content:center;
  gap:8px;
  padding:10px 12px;
  border-radius:0px;
  border:1px solid rgba(21,70,112,.25);
  background:var(--primary);
  color:white;
  cursor:pointer;
  font-weight:650;
  font-size:14px;
  text-decoration:none;
}
.btn:hover{text-decoration:none; filter:brightness(.98)}
.btn:focus{outline:none; box-shadow:var(--focus)}
.btn--ghost{background:transparent; color:var(--primary)}
.btn--secondary{background:var(--secondary); border-color:rgba(238,132,0,.35)}

.input, select, textarea{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:0px;
  background:white;
  font-size:14px;
}
textarea{min-height:90px; resize:vertical}
.input:focus, select:focus, textarea:focus{outline:none; box-shadow:var(--focus); border-color:rgba(21,70,112,.35)}

.grid{display:grid; gap:14px}
.grid--2{grid-template-columns: repeat(2, minmax(0,1fr))}
.grid--3{grid-template-columns: repeat(3, minmax(0,1fr))}
@media (max-width:900px){.grid--3{grid-template-columns:1fr}.grid--2{grid-template-columns:1fr}}

.kv{display:flex; gap:10px; align-items:center}
.kv label{min-width:120px; color:var(--text); font-size:13px}
.kv .value{flex:1}

.badge{display:inline-flex; align-items:center; padding:6px 10px; border-radius:0px; border:1px solid var(--border); background:rgba(21,70,112,.06); font-size:12px; font-weight:700}
.badge--ok{background:rgba(22,163,74,.10); border-color:rgba(22,163,74,.25)}
.badge--warn{background:rgba(245,158,11,.14); border-color:rgba(245,158,11,.35)}

.tablelike{display:flex; flex-direction:column; gap:10px}
.row{display:grid; grid-template-columns: 170px 1fr; gap:10px; align-items:center}
.row__lbl{color:var(--muted); font-size:13px}

hr.sep{border:none; border-top:1px solid var(--border); margin:12px 0}

/* Browse */
.browse__grid{display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:14px}
@media (max-width:980px){.browse__grid{grid-template-columns: repeat(2, minmax(0,1fr))}}
@media (max-width:650px){.browse__grid{grid-template-columns:1fr}}
.bookcard{overflow:hidden}
.bookcard__img{height:170px; background:rgba(21,70,112,.06); display:flex; align-items:center; justify-content:center}
.bookcard__img img{height:170px; width:100%; object-fit:cover}
.bookcard__body{padding:12px 12px 14px 12px}
.bookcard__title{font-weight:800; margin:0 0 6px 0; font-size:15px}
.bookcard__meta{color:var(--muted); font-size:13px}
.bookcard__foot{display:flex; align-items:center; justify-content:space-between; margin-top:10px}

/* Book editor layout (Access-like sections, but modern) */
.editor{
  display:grid;
  grid-template-columns: 210px 1fr 280px;
  gap:14px;
  align-items:start;
}
@media (max-width:1050px){.editor{grid-template-columns: 1fr}}

.coverbox{padding:14px}
.coverbox__img{width:100%; aspect-ratio: 1/1.25; border-radius:0px; border:1px solid var(--border); background:rgba(21,70,112,.06); overflow:hidden; display:flex; align-items:center; justify-content:center}
.coverbox__img img{width:100%; height:100%; object-fit:cover}
.coverbox__actions{display:flex; gap:8px; margin-top:10px}
.coverbox small{color:var(--muted)}

.panel{padding:14px}
.panel__title{display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px}
.panel__title h2{font-size:14px; margin:0; color:var(--muted); letter-spacing:.02em; text-transform:uppercase}

.avail{
  padding:14px;
}
.avail__state{display:flex; align-items:center; justify-content:space-between; gap:10px}
.avail__state h3{margin:0; font-size:18px}
.avail__state .badge{margin-left:auto}

.star{font-family: var(--mono); letter-spacing:2px}

.pills{display:flex; flex-wrap:wrap; gap:8px}
.pill{border:1px solid var(--border); border-radius:0px; padding:7px 10px; background:rgba(21,70,112,.06); font-size:12px}

.listbox{border:1px solid var(--border); border-radius:0px; background:white; padding:10px}
.listbox ul{margin:0; padding-left:18px}

.actions{display:flex; gap:10px; flex-wrap:wrap}

.smallgrid{display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:10px}
@media(max-width:1050px){.smallgrid{grid-template-columns:1fr}}


/* New templates helpers */
.pagehead{display:flex; align-items:flex-end; justify-content:space-between; gap:14px; margin:6px 0 14px}
.pagehead h1{margin:0; font-size:22px}
.muted{color:var(--muted)}
.small{font-size:12px}
.mono{font-family:var(--mono)}

.filters{display:flex; flex-wrap:wrap; gap:12px; align-items:flex-end; margin:0 0 16px}
.field{min-width:220px; flex:1}
.field label{display:block; font-size:12px; color:var(--text); margin:0 0 6px}
.field--check{min-width:auto; flex:0}
.field--check label{display:flex; align-items:center; gap:8px; margin:0; padding:10px 0}
.field--actions{min-width:auto; flex:0; display:flex; gap:10px}

.cards{display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:14px}
@media (max-width:980px){.cards{grid-template-columns: repeat(2, minmax(0,1fr))}}
@media (max-width:650px){.cards{grid-template-columns:1fr}}

.card{display:grid; grid-template-columns: 120px 1fr; overflow:hidden}
.card:hover{transform:translateY(-1px)}
.card__cover{background:rgba(21,70,112,.06); border-right:1px solid var(--border); min-height:150px; display:flex; align-items:center; justify-content:center}
.card__cover img{width:100%; height:100%; object-fit:cover}
.cover__placeholder{color:var(--muted); font-size:12px}
.card__body{padding:12px}
.card__title{font-weight:800; margin:0 0 6px 0; color:var(--text)}
.card__meta{color:var(--muted); font-size:13px; margin-bottom:10px}
.card__chips{display:flex; flex-wrap:wrap; gap:8px}

.chip{display:inline-flex; align-items:center; padding:6px 10px; border-radius:0px; border:1px solid var(--border); background:rgba(21,70,112,.06); font-size:12px; font-weight:700; color:var(--text)}
.chip--ok{background:rgba(22,163,74,.10); border-color:rgba(22,163,74,.25)}
.chip--bad{background:rgba(220,38,38,.08); border-color:rgba(220,38,38,.22)}

.tablelike{border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; background:var(--card)}
.tablelike__head{display:grid; grid-template-columns: 1fr 190px 110px 120px; gap:10px; padding:10px 12px; font-size:12px; color:var(--muted); background:rgba(21,70,112,.06)}
.tablelike__row{display:grid; grid-template-columns: 1fr 190px 110px 120px; gap:10px; padding:10px 12px; border-top:1px solid var(--border); align-items:center; color:inherit}
.tablelike__row:hover{background:rgba(21,70,112,.04); text-decoration:none}
.t-right{text-align:right}

.auth{display:grid; place-items:center; min-height:60vh}
.auth__panel{max-width:520px}

.bookhero{display:grid; grid-template-columns: 240px 1fr; gap:14px; align-items:start}
@media (max-width:800px){.bookhero{grid-template-columns:1fr}}
.bookhero__cover{background:var(--card); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow)}
.bookhero__cover img{width:100%; height:100%; object-fit:cover}
.bookhero__main{background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:16px; box-shadow:var(--shadow)}
.bookhero__title{margin:0 0 6px 0}
.bookhero__meta{color:var(--muted); font-size:13px; margin-bottom:10px}
.bookhero__actions{display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-top:12px}
.inline{display:inline}

.twocol{display:grid; grid-template-columns: 1.6fr 1fr; gap:14px; margin-top:14px}
@media(max-width:900px){.twocol{grid-template-columns:1fr}}

.prose{color:var(--text); line-height:1.55}
.dl{display:flex; flex-direction:column; gap:10px}
.dl > div{display:grid; grid-template-columns: 130px 1fr; gap:10px; align-items:center}
.dl dt{color:var(--muted); font-size:12px}
.dl dd{margin:0}

.tabs{display:flex; gap:8px; flex-wrap:wrap}

/* -------- Access-like Book Editor (CSS Grid, no tables) -------- */
.access-form{margin-top:10px}
.access-grid{
  display:grid;
  grid-template-columns: 200px 1fr 320px;
  gap:14px;
  align-items:start;
}
@media (max-width:1050px){
  .access-grid{grid-template-columns:1fr}
}

.panel{background:var(--card); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); padding:14px}
.panel__title{font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; margin:0 0 10px 0}
.panel__divider{height:1px; background:var(--border); margin:12px 0}

.panel--cover .coverbox{border:1px solid var(--border); border-radius:0px; overflow:hidden; background:rgba(21,70,112,.06); min-height:230px; display:flex; align-items:center; justify-content:center}
.panel--cover .coverbox img{width:100%; height:100%; object-fit:cover}
.coverbox__ph{color:var(--muted); font-size:12px}

.row{display:grid; gap:12px; margin-bottom:12px}
.row--top{grid-template-columns: 1fr 180px 140px}
.row--mini{grid-template-columns: 1.3fr 120px 140px 120px 120px 90px}
.row--meta{grid-template-columns: 1fr 1fr 160px 140px 120px 140px 170px 140px}
.row--purchase{grid-template-columns: 160px 170px 1fr 160px 140px}
.row--text3{grid-template-columns: 1fr 1fr 1fr}
@media (max-width:1050px){
  .row--top,.row--mini,.row--meta,.row--purchase,.row--text3{grid-template-columns:1fr}
}

.hint{margin-top:6px; font-size:12px; color:var(--muted)}
.check{display:flex; align-items:center; gap:8px; padding:10px 0}

.authors-box{display:grid; grid-template-columns: 1fr 1fr; gap:12px}
@media (max-width:900px){.authors-box{grid-template-columns:1fr}}

.status-head{
  font-weight:900;
  font-size:22px;
  text-align:center;
  padding:10px 12px;
  border-radius:0px;
  border:1px solid var(--border);
  margin-bottom:12px;
}
.status-head--ok{background:rgba(22,163,74,.10); border-color:rgba(22,163,74,.25)}
.status-head--bad{background:rgba(220,38,38,.08); border-color:rgba(220,38,38,.22)}

.status-grid{display:grid; gap:10px}
.status-row{display:flex; justify-content:space-between; gap:10px; align-items:center}
.status-row span{color:var(--muted); font-size:12px}
.status-row strong{font-family:var(--mono); font-size:12px}

/* -------- Public Book Page -------- */
.bookpage{display:grid; grid-template-columns: 260px 1fr; gap:14px; align-items:start}
@media (max-width:900px){.bookpage{grid-template-columns:1fr}}

.kvgrid{display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:10px; margin-top:6px}
@media (max-width:900px){.kvgrid{grid-template-columns:1fr}}
.kvgrid > div{display:flex; justify-content:space-between; gap:10px; padding:10px 12px; border:1px solid var(--border); border-radius:0px; background:rgba(21,70,112,.04)}
.kvgrid span{color:var(--muted); font-size:12px}
.kvgrid strong{font-family:var(--mono); font-size:12px}

.pill{display:inline-flex; align-items:center; padding:6px 10px; border-radius:0px; border:1px solid var(--border); background:rgba(21,70,112,.06)}
.pill--ok{background:rgba(22,163,74,.10); border-color:rgba(22,163,74,.25)}
.pill--bad{background:rgba(220,38,38,.08); border-color:rgba(220,38,38,.22)}

.textblock{margin-top:14px}
.textblock h3{margin:0 0 6px 0; font-size:14px}
.textblock p{margin:0; color:var(--text); line-height:1.55}
.tab{padding:8px 10px; border:1px solid var(--border); border-radius:0px; background:rgba(21,70,112,.06); color:var(--primary)}
.tab--active{background:var(--primary); color:white; border-color:rgba(21,70,112,.35)}

.admincards{display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:14px}
@media(max-width:900px){.admincards{grid-template-columns:1fr}}
.acard{display:block; padding:16px; border:1px solid var(--border); border-radius:var(--radius); background:var(--card); box-shadow:var(--shadow)}
.acard:hover{text-decoration:none; transform:translateY(-1px)}
.acard__title{font-weight:900; color:var(--text)}
.acard__desc{color:var(--muted); margin-top:6px; font-size:13px}

.btn--danger{background:rgba(220,38,38,.1); border-color:rgba(220,38,38,.35); color:#b91c1c}
.btn--danger:hover{filter:none; background:rgba(220,38,38,.14)}

.alert--ok{border-color:rgba(22,163,74,.35)}
.alert--bad{border-color:rgba(220,38,38,.35)}
.alert--info{border-color:rgba(59,130,246,.35)}



/* Browse card cover: show full image, no cropping, no distortion */
.card__cover{
  background: #fff;           /* or a light gray if you prefer */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card__cover img{
  width: 100%;
  height: 100%;
  object-fit: contain;        /* ✅ no crop, no distortion */
  object-position: center;
  display: block;
}


.card__cover{
  background: linear-gradient(180deg, #fafafa, #f1f5f9);
}

/* --- Admin/Members layout fix ---
   app.css contains a generic .card rule used for book-cover cards (display:grid; grid-template-columns:120px 1fr).
   That rule breaks admin forms/tables that also use .card.
   We override it for the members/admin pages to keep cards as normal blocks.
*/
.page.members-page .card,
.page.members-page form.card,
.page.members-page .card:hover,
.page.members-page .card:focus-within{
  display:block !important;
  grid-template-columns:none !important;
}
.page.members-page .card > *{
  min-width:0;
}
