:root{
  --bg:#f3f4f6;
  --card:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --primary:#0f766e;
  --danger:#b91c1c;
  --border:#e5e7eb;
}

*{box-sizing:border-box}

body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
  line-height:1.45;
}

a{color:var(--primary);text-decoration:none}
a:hover{text-decoration:underline}
img{max-width:100%;display:block}

.navbar{
  background:#111827;
  color:#fff;
  border-bottom:1px solid #374151;
}

.nav-inner{
  max-width:1100px;
  margin:0 auto;
  padding:10px 14px;
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
}

.navbar-brand{
  color:#fff;
  font-weight:700;
  display:flex;
  align-items:center;
  gap:8px;
}

.navbar-brand:hover{
  color:#fff;
  text-decoration:none;
}

.brand-icon{
  font-size:18px;
}

.nav-links{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  align-items:center;
}

.nav-links a,
.nav-links button{
  color:#fff;
  background:transparent;
  border:0;
  font:inherit;
  font-size:13px;
  font-weight:600;
  padding:6px 8px;
  border-radius:6px;
  cursor:pointer;
}

.nav-links a:hover,
.nav-links button:hover{
  background:#374151;
  color:#fff;
  text-decoration:none;
}

.nav-links a.active{
  background:#0f766e;
  color:#fff;
}

.container{
  max-width:1100px;
  margin:0 auto;
  padding:18px 14px 30px;
}

.panel{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:10px;
  padding:16px;
  margin:14px 0;
}

.narrow{
  max-width:720px;
  margin-left:auto;
  margin-right:auto;
}

.flex-between{
  display:flex;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

.mt-0{margin-top:0}
.mb-0{margin-bottom:0}
.muted{color:var(--muted)}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding:8px 12px;
  border:1px solid var(--border);
  border-radius:8px;
  background:#fff;
  color:var(--text);
  font-weight:600;
  font-size:13px;
  cursor:pointer;
}

.btn:hover{
  background:#f9fafb;
  text-decoration:none;
}

.btn-primary{
  background:var(--primary);
  border-color:var(--primary);
  color:#fff;
}

.btn-primary:hover{
  background:#115e59;
}

.btn-danger{
  background:#fee2e2;
  border-color:#fecaca;
  color:var(--danger);
}

.btn-small{
  padding:5px 8px;
  font-size:12px;
}

.actions{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}

.inline-form{display:inline}

.table-wrap{
  overflow:auto;
  background:#fff;
  border:1px solid var(--border);
  border-radius:10px;
}

table{
  width:100%;
  border-collapse:collapse;
  min-width:760px;
}

th,td{
  padding:8px 10px;
  border-bottom:1px solid var(--border);
  vertical-align:top;
  font-size:13px;
}

th{
  background:#f9fafb;
  text-align:left;
  white-space:nowrap;
  font-weight:700;
}

tr:last-child td{border-bottom:0}

.cover{
  width:70px;
  height:100px;
  object-fit:cover;
  border-radius:8px;
  border:1px solid var(--border);
  background:#f3f4f6;
}

.cover-placeholder{
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:11px;
  color:var(--muted);
  text-align:center;
  padding:6px;
}

.form-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:12px;
}

label{
  display:block;
  font-size:13px;
  margin-bottom:4px;
  font-weight:700;
}

input,select,textarea{
  width:100%;
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:8px;
  font:inherit;
  background:#fff;
  outline:none;
}

input:focus,select:focus,textarea:focus{
  border-color:var(--primary);
}

textarea{
  min-height:100px;
  resize:vertical;
}

.checkbox{
  display:flex;
  align-items:center;
  gap:8px;
  font-weight:600;
}

.checkbox input{
  width:auto;
}

.stat-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(160px,1fr));
  gap:10px;
  margin-bottom:14px;
}

.stat{
  background:#fff;
  border:1px solid var(--border);
  border-radius:10px;
  padding:12px;
}

.stat strong{
  display:block;
  font-size:22px;
  margin-top:4px;
}

.badge{
  display:inline-block;
  padding:3px 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:700;
  border:1px solid;
  white-space:nowrap;
}

.badge-active{background:#ecfdf5;color:#065f46;border-color:#a7f3d0}
.badge-overdue{background:#fef2f2;color:#991b1b;border-color:#fecaca}
.badge-returned{background:#f3f4f6;color:#374151;border-color:#e5e7eb}

.flash{
  padding:10px 12px;
  border-radius:8px;
  margin:10px 0;
  border:1px solid;
  font-weight:600;
  font-size:13px;
}

.flash-success{background:#ecfdf5;border-color:#a7f3d0;color:#065f46}
.flash-error{background:#fef2f2;border-color:#fecaca;color:#991b1b}
.flash-info{background:#eff6ff;border-color:#bfdbfe;color:#1e40af}

.alert{
  padding:10px 12px;
  border-radius:8px;
  margin:10px 0;
  border:1px solid;
  font-size:13px;
}

.alert-info{background:#eff6ff;border-color:#bfdbfe}
.alert-success{background:#ecfdf5;border-color:#a7f3d0}
.alert-warning{background:#fffbeb;border-color:#fde68a}
.alert-danger{background:#fef2f2;border-color:#fecaca}

.info-list{
  display:grid;
  gap:6px;
  margin:12px 0;
}

.info-list div{
  display:grid;
  grid-template-columns:150px 1fr;
  gap:8px;
  padding:6px 0;
  border-bottom:1px dashed #e5e7eb;
  font-size:13px;
}

.pagination{
  display:flex;
  gap:5px;
  justify-content:center;
  align-items:center;
  flex-wrap:wrap;
  margin:16px 0 0;
}

.pagination a,
.pagination span{
  min-width:36px;
  text-align:center;
  padding:7px 10px;
  border-radius:8px;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  font-weight:700;
  font-size:13px;
}

.pagination a:hover{
  text-decoration:none;
  background:#f9fafb;
}

.pagination .active{
  background:var(--primary);
  color:#fff;
  border-color:var(--primary);
}

.pagination .disabled{
  opacity:.45;
  cursor:not-allowed;
}

/* ───────────────────────── ATTENDANCE BARS ───────────────────────── */
.att-bars{
  display:flex;
  align-items:flex-end;
  gap:4px;
  height:180px;
  padding:10px 4px 0;
  overflow-x:auto;
  border-bottom:2px solid var(--border);
}

.att-bar-col{
  flex:1 0 22px;
  min-width:22px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-end;
  height:100%;
}

.att-bar{
  width:100%;
  max-width:26px;
  background:linear-gradient(180deg, #14b8a6, #0f766e);
  border-radius:5px 5px 0 0;
  transition:height .3s ease;
  min-height:2px;
}

.att-bar-col:hover .att-bar{
  background:linear-gradient(180deg, #2dd4bf, #115e59);
}

.att-bar-label{
  margin-top:5px;
  font-size:10px;
  color:var(--muted);
  white-space:nowrap;
}

.site-footer{
  border-top:1px solid var(--border);
  background:#fff;
  padding:8px 14px;
  text-align:center;
  font-size:11px;
  color:var(--muted);
}

@media(max-width:720px){
  .info-list div{grid-template-columns:1fr;gap:2px}
}