/* =============================================================
   ระบบห้องสมุดโรงเรียน — Modern Red-Gold Theme v3
   Font: TH Sarabun New (self-hosted)
   ============================================================= */

@font-face {
  font-family: 'TH Sarabun New';
  src: url('../fonts/THSarabunNew.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'TH Sarabun New';
  src: url('../fonts/THSarabunNew-Bold.ttf') format('truetype');
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Core palette */
  --red:          #c0392b;
  --red-dark:     #922b21;
  --red-deep:     #7b241c;
  --red-soft:     #e74c3c;
  --red-pale:     #fdf2f1;
  --red-pale2:    #fbeae9;

  --gold:         #e67e22;
  --gold-dark:    #ca6f1e;
  --gold-light:   #f0a500;
  --gold-pale:    #fef5e4;

  --yellow:       #f9c74f;

  /* Surfaces */
  --bg:           #f4f4f7;
  --surface:      #ffffff;
  --surface-2:    #fafafa;
  --border:       #e8e0d8;
  --border-light: #f0ebe4;

  /* Text */
  --text-primary:   #1a1006;
  --text-secondary: #5a4a3a;
  --text-muted:     #998070;
  --text-on-red:    #ffffff;

  /* Semantic */
  --success:  #1a9347;
  --success-bg: #eafaf1;
  --danger:   var(--red);
  --warning:  var(--gold);
  --info:     #2471a3;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.06);
  --shadow-sm: 0 1px 6px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.14);
  --shadow-red: 0 4px 16px rgba(192,57,43,.22);

  /* Radius */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;

  font-size: 16px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'TH Sarabun New', 'Sarabun', 'Segoe UI', sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-dark); }
img { max-width: 100%; display: block; }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 200;
  height: 58px;
  display: -webkit-flex;
  display: flex;
  align-items: stretch;
  background: linear-gradient(90deg, var(--red-deep) 0%, var(--red-dark) 40%, var(--red) 100%);
  box-shadow: 0 2px 16px rgba(122,36,28,.4);
}

.topbar .brand {
  display: -webkit-flex;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 20px;
  border-right: 1px solid rgba(255,255,255,.15);
  white-space: nowrap;
  flex-shrink: 0;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .2px;
}
.topbar .brand img { height: 28px; }
.topbar .brand .icon { font-size: 20px; }

.topbar nav {
  display: -webkit-flex;
  display: flex;
  align-items: stretch;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}
.topbar nav::-webkit-scrollbar { display: none; }

.topbar nav a {
  display: -webkit-flex;
  display: flex;
  align-items: center;
  padding: 0 13px;
  color: rgba(255,255,255,.82);
  font-size: 14.5px;
  white-space: nowrap;
  position: relative;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
.topbar nav a::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--yellow);
  border-radius: 3px 3px 0 0;
  transform: scaleX(0);
  transition: transform .2s;
}
.topbar nav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.topbar nav a.active { color: #fff; font-weight: 700; }
.topbar nav a.active::after { transform: scaleX(1); }

.topbar .userbox {
  display: -webkit-flex;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-left: 1px solid rgba(255,255,255,.15);
  flex-shrink: 0;
}
.topbar .userbox .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--yellow), var(--gold));
  color: var(--red-deep);
  font-weight: 800;
  font-size: 13px;
  display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; -webkit-justify-content: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  flex-shrink: 0;
}
.topbar .userbox .uname {
  color: rgba(255,255,255,.9);
  font-size: 14px;
  max-width: 110px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar .userbox a.icon-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: rgba(255,255,255,.7);
  font-size: 15px;
  transition: background .15s;
}
.topbar .userbox a.icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.topbar .userbox a.logout-btn {
  font-size: 13px;
  color: rgba(255,255,255,.7);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.25);
  transition: all .15s;
}
.topbar .userbox a.logout-btn:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ── Layout ─────────────────────────────────────────────────── */
.container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

/* ── Page Header ─────────────────────────────────────────────── */
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--red-dark);
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--red-dark);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--gold-pale);
  display: flex; align-items: center; gap: 8px;
}

/* ── Stats Grid ─────────────────────────────────────────────── */
.grid-stats {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 22px;
}
.grid-stats .stat-box {
  -webkit-flex: 1 1 180px;
  flex: 1 1 180px;
  min-width: 160px;
}

.stat-box {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  border-top: 4px solid var(--red);
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s, transform .18s;
}
.stat-box::after {
  content: '';
  position: absolute;
  bottom: -20px; right: -16px;
  width: 70px; height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(192,57,43,.08), transparent 70%);
  pointer-events: none;
}
.stat-box:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-box.accent   { border-top-color: var(--gold); }
.stat-box.accent::after { background: radial-gradient(circle, rgba(230,126,34,.08), transparent 70%); }
.stat-box.success  { border-top-color: var(--success); }
.stat-box.danger   { border-top-color: var(--red-soft); }

.stat-box .s-icon {
  font-size: 28px;
  margin-bottom: 8px;
  display: block;
}
.stat-box .s-num {
  font-size: 32px;
  font-weight: 800;
  color: var(--red-dark);
  line-height: 1;
  margin-bottom: 5px;
}
.stat-box.accent .s-num  { color: var(--gold-dark); }
.stat-box.success .s-num { color: var(--success); }
.stat-box.danger .s-num  { color: var(--red-soft); }
.stat-box .s-label {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.35;
}

/* ── Table ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
thead { background: linear-gradient(90deg, #fcf0ea, #fdf5ee); }
th {
  padding: 11px 14px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: var(--red-dark);
  text-transform: uppercase;
  letter-spacing: .4px;
  border-bottom: 2px solid #f5d5c8;
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text-secondary);
}
tbody tr { transition: background .12s; }
tbody tr:hover { background: #fffaf7; }
tbody tr:last-child td { border-bottom: none; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  text-decoration: none;
  transition: all .18s;
  outline: none;
}
.btn:active { transform: scale(.97); }

/* Primary (Red) */
.btn, .btn-primary {
  background: var(--red);
  color: #fff;
  box-shadow: 0 2px 8px rgba(192,57,43,.28);
}
.btn:hover, .btn-primary:hover {
  background: var(--red-dark);
  box-shadow: 0 4px 16px rgba(192,57,43,.38);
  color: #fff;
}

/* Accent (Gold) */
.btn.accent {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
  color: #fff;
  box-shadow: 0 2px 8px rgba(230,126,34,.28);
}
.btn.accent:hover {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  box-shadow: 0 4px 16px rgba(230,126,34,.38);
}

/* Success */
.btn.success {
  background: linear-gradient(135deg, #27ae60, #1a8a49);
  color: #fff;
}

/* Danger */
.btn.danger {
  background: linear-gradient(135deg, var(--red-soft), var(--red-dark));
  color: #fff;
}

/* Outline */
.btn.outline {
  background: transparent;
  color: var(--red);
  border: 1.5px solid var(--red);
  box-shadow: none;
}
.btn.outline:hover { background: var(--red); color: #fff; }

/* Ghost */
.btn.ghost {
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  box-shadow: none;
}
.btn.ghost:hover { border-color: var(--red); color: var(--red); background: var(--red-pale); }

/* Sizes */
.btn.small { padding: 5px 12px; font-size: 13px; border-radius: 6px; }
.btn.large { padding: 13px 28px; font-size: 17px; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 13px; font-weight: 700;
}
.badge.green  { background: #eafaf1; color: #1a7a40; }
.badge.red    { background: var(--red-pale2); color: var(--red-dark); }
.badge.gray   { background: #f0ede8; color: #666; }
.badge.yellow { background: var(--gold-pale); color: var(--gold-dark); }
.badge.blue   { background: #eaf3fb; color: var(--info); }

/* ── Forms ──────────────────────────────────────────────────── */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 14px; font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
input[type=text], input[type=number], input[type=password],
input[type=date], input[type=email], input[type=file],
select, textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 15px;
  color: var(--text-primary);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(230,126,34,.14);
}
input[type=file] { cursor: pointer; padding: 8px 12px; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23998070' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.row { display: -webkit-flex; display: flex; gap: 16px; }
.row .field { flex: 1; min-width: 0; }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

/* Toolbar (filter bars) */
.toolbar {
  display: flex; gap: 10px;
  align-items: flex-end; flex-wrap: wrap;
}
.toolbar .field { margin-bottom: 0; }
.toolbar .field.grow { flex: 2; min-width: 220px; }
.toolbar .field { min-width: 150px; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  display: -webkit-flex; display: flex; -webkit-align-items: flex-start; align-items: flex-start; gap: 12px;
  padding: 14px 18px;
  border-radius: var(--r-sm);
  margin-bottom: 18px;
  font-size: 15px;
  border-left: 4px solid;
}
.alert.success { background: var(--success-bg); color: #145a32; border-color: var(--success); }
.alert.error   { background: var(--red-pale);   color: #7b241c; border-color: var(--red); }
.alert.warning { background: var(--gold-pale);  color: #784212; border-color: var(--gold); }

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs {
  display: -webkit-flex;
  display: flex;
  gap: 2px;
  margin-bottom: 22px;
  border-bottom: 2px solid var(--border);
}
.tabs a {
  padding: 9px 20px;
  font-size: 15px; font-weight: 600;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tabs a:hover { color: var(--red); }
.tabs a.active { color: var(--red); border-bottom-color: var(--red); }

/* ── Scan Box ───────────────────────────────────────────────── */
.scan-box {
  background: linear-gradient(135deg, var(--red-deep) 0%, var(--red) 100%);
  border-radius: var(--r-lg);
  padding: 32px 28px;
  text-align: center;
  color: #fff;
  margin-bottom: 22px;
  box-shadow: var(--shadow-red);
  position: relative;
  overflow: hidden;
}
.scan-box::before {
  content: '';
  position: absolute; top: -40px; right: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
}
.scan-box h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.scan-box p  { font-size: 14px; opacity: .8; margin-bottom: 18px; }
.scan-box .step { font-size: 14px; opacity: .85; margin: 12px 0 6px; }
.scan-box input {
  width: 100%; max-width: 460px;
  padding: 14px 18px;
  font-size: 18px; text-align: center;
  border: 2px solid rgba(255,255,255,.3);
  border-radius: var(--r-sm);
  background: rgba(255,255,255,.12);
  color: #fff;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, background .15s;
}
.scan-box input::placeholder { color: rgba(255,255,255,.5); }
.scan-box input:focus {
  border-color: var(--yellow);
  background: rgba(255,255,255,.2);
  box-shadow: 0 0 0 3px rgba(249,199,79,.2);
}

/* ── Login Page ─────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: -webkit-flex;
  display: flex;
  background: var(--red-deep);
  background: linear-gradient(135deg, var(--red-deep) 0%, var(--red-dark) 50%, #a93226 100%);
  position: relative;
  overflow: hidden;
}
.login-wrap::before {
  content: '';
  position: absolute; top: -15%; right: -10%;
  width: 60vmin; height: 60vmin; border-radius: 50%;
  background: rgba(249,199,79,.12);
}
.login-wrap::after {
  content: '';
  position: absolute; bottom: -10%; left: -8%;
  width: 50vmin; height: 50vmin; border-radius: 50%;
  background: rgba(255,255,255,.04);
}
.login-side {
  display: none;
  -webkit-flex: 1; flex: 1;
  -webkit-flex-direction: column; flex-direction: column;
  -webkit-justify-content: center; justify-content: center;
  padding: 60px 64px;
  color: rgba(255,255,255,.9);
  position: relative; z-index: 1;
}
@media (min-width: 900px) { .login-side { display: -webkit-flex; display: flex; } }
.login-side h1 { font-size: 34px; font-weight: 800; margin-bottom: 12px; color: #fff; }
.login-side p  { font-size: 16px; opacity: .8; line-height: 1.7; max-width: 380px; }
.login-side .features { margin-top: 32px; display: flex; flex-direction: column; gap: 14px; }
.login-side .feat { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.login-side .feat span.dot { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }

.login-panel {
  width: 100%;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  padding: 32px 20px;
  position: relative; z-index: 1;
}
@media (min-width: 900px) { .login-panel { width: 420px; flex-shrink: 0; } }

.login-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 40px 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.login-card .logo { text-align: center; margin-bottom: 8px; }
.login-card .logo img { height: 60px; margin: 0 auto; }
.login-card .emoji { font-size: 44px; }
.login-card h1 { text-align: center; color: var(--red-dark); font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.login-card .btn { width: 100%; justify-content: center; font-size: 16px; padding: 12px; }
.login-card .links { margin-top: 16px; text-align: center; display: flex; flex-direction: column; gap: 8px; }
.login-card .links a { font-size: 14px; color: var(--text-muted); }
.login-card .links a:hover { color: var(--red); }

/* ── Public Hero ────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--red-deep) 0%, var(--red-dark) 50%, var(--red) 100%);
  color: #fff;
  padding: 60px 24px 52px;
  text-align: center;
  position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; top: -60px; left: 50%; transform: translateX(-50%);
  width: 800px; height: 400px; border-radius: 50%;
  background: rgba(255,255,255,.04);
  pointer-events: none;
}
.hero .logo-wrap { margin-bottom: 10px; }
.hero .logo-wrap img { height: 56px; margin: 0 auto; }
.hero h1 { font-size: 32px; font-weight: 800; margin-bottom: 8px; position: relative; }
.hero .affil { font-size: 16px; opacity: .8; margin-bottom: 4px; }
.hero .tagline { font-size: 15px; opacity: .7; margin-bottom: 28px; }
.hero-actions { display: -webkit-flex; display: flex; gap: 14px; -webkit-justify-content: center; justify-content: center; -webkit-flex-wrap: wrap; flex-wrap: wrap; }
.hero-btn {
  display: -webkit-inline-flex; display: inline-flex; -webkit-align-items: center; align-items: center; gap: 8px;
  padding: 13px 30px;
  border-radius: var(--r-md);
  font-family: inherit; font-size: 16px; font-weight: 700;
  cursor: pointer; border: none; transition: all .18s;
  text-decoration: none;
}
.hero-btn.primary {
  background: linear-gradient(135deg, var(--yellow), var(--gold));
  color: var(--red-deep);
  box-shadow: 0 4px 16px rgba(249,199,79,.4);
}
.hero-btn.primary:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(249,199,79,.5); }
.hero-btn.ghost {
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,.4);
}
.hero-btn.ghost:hover { background: rgba(255,255,255,.2); transform: translateY(-2px); }

/* Search bar on hero */
.search-bar-wrap {
  max-width: 600px; margin: 24px auto 0;
  display: flex; gap: 8px;
}
.search-bar-wrap input {
  flex: 1; padding: 13px 18px;
  border-radius: var(--r-sm); border: 2px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.14); color: #fff;
  font-family: inherit; font-size: 16px; outline: none;
  transition: border-color .15s, background .15s;
}
.search-bar-wrap input::placeholder { color: rgba(255,255,255,.55); }
.search-bar-wrap input:focus { border-color: var(--yellow); background: rgba(255,255,255,.2); }
.search-bar-wrap button {
  padding: 0 24px; border-radius: var(--r-sm); border: none;
  background: var(--yellow); color: var(--red-deep);
  font-family: inherit; font-weight: 700; font-size: 16px; cursor: pointer;
  transition: all .15s;
}
.search-bar-wrap button:hover { background: #f0d02a; }

/* ── Book grid (public search) ──────────────────────────────── */
.book-grid {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 18px;
}
.book-card { -webkit-flex: 0 1 160px; flex: 0 1 160px; min-width: 140px; max-width: 200px;
  background: var(--surface); border-radius: var(--r-md);
  border: 1px solid var(--border-light); overflow: hidden;
  box-shadow: var(--shadow-xs);
  display: flex; flex-direction: column;
  transition: box-shadow .2s, transform .18s;
}
.book-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.book-card .cover { width: 100%; height: 200px; object-fit: cover; background: #f5ede0; }
.book-card .info  { padding: 12px 12px 14px; flex: 1; }
.book-card .title { font-size: 14px; font-weight: 700; color: var(--text-primary); line-height: 1.35; margin-bottom: 4px; }
.book-card .author { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }

/* ── Member ID Card ─────────────────────────────────────────── */
.id-card {
  width: 5.4cm; height: 8.6cm;
  border-radius: 10px; overflow: hidden;
  font-family: 'TH Sarabun New', sans-serif;
  background: #fff;
  display: -webkit-flex; display: flex; -webkit-flex-direction: column; flex-direction: column;
  box-shadow: 0 6px 24px rgba(0,0,0,.18);
  border: 1px solid #ddd;
}
.id-card .head {
  background: linear-gradient(135deg, var(--red-deep), var(--red));
  color: #fff; padding: 7px 8px; text-align: center; flex-shrink: 0;
}
.id-card .head .logo { height: 22px; margin: 0 auto 2px; }
.id-card .head .school { font-size: 9.5px; font-weight: 700; line-height: 1.2; }
.id-card .head .affil  { font-size: 7px; color: rgba(255,255,255,.75); }
.id-card .head .type   { font-size: 9px; color: var(--yellow); font-weight: 700; margin-top: 2px; }
.id-card .photo-wrap   { text-align: center; padding: 8px 0 4px; }
.id-card .photo-wrap img { width: 2.4cm; height: 2.9cm; object-fit: cover; border-radius: 5px; border: 2px solid #eee; display: block; margin: 0 auto; }
.id-card .body { flex: 1; padding: 4px 10px; text-align: center; }
.id-card .body .name   { font-size: 12px; font-weight: 700; color: var(--red-dark); margin-bottom: 3px; }
.id-card .body .detail { font-size: 10px; color: var(--text-secondary); line-height: 1.5; }
.id-card .barcode-area { text-align: center; padding: 2px 8px 8px; }
.id-card .barcode-area img { max-width: 100%; display: block; margin: 0 auto; }
.id-card .barcode-area .bcode-text { font-size: 8px; color: #777; letter-spacing: 1px; margin-top: 2px; }

/* ── Thumbnail images ───────────────────────────────────────── */
.photo-thumb {
  width: 38px; height: 38px; border-radius: 50%;
  object-fit: cover; background: #f0e8d8;
  border: 2px solid var(--border);
  display: inline-block; vertical-align: middle;
}
.member-photo-lg {
  width: 110px; height: 130px; object-fit: cover;
  border-radius: var(--r-sm); border: 2px solid var(--border);
  background: #eee; display: block;
}
.book-cover-thumb {
  width: 36px; height: 50px; object-fit: cover;
  border-radius: 3px; background: #f5ede0;
  border: 1px solid var(--border); display: block;
}

/* ── Pagination ─────────────────────────────────────────────── */
.pagination { display: -webkit-flex; display: flex; gap: 6px; margin-top: 18px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 7px 14px; border: 1.5px solid var(--border);
  border-radius: var(--r-sm); font-size: 14px; color: var(--text-secondary);
  transition: all .15s; text-decoration: none;
}
.pagination a:hover { border-color: var(--red); color: var(--red); }
.pagination a.active, .pagination span.active {
  background: var(--red); border-color: var(--red); color: #fff;
}

/* ── Fine check result ──────────────────────────────────────── */
.result-box {
  margin-top: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
}

/* ── Import info table ──────────────────────────────────────── */
.info-table th { font-weight: 700; font-size: 13px; }
.info-table td { font-size: 14px; }
.info-table code {
  background: var(--gold-pale);
  color: var(--red-dark);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 13px;
}

/* ── Print ──────────────────────────────────────────────────── */
@media print {
  .no-print { display: none !important; }
  .topbar   { display: none !important; }
  body { background: #fff; }
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .container { padding: 16px 14px 32px; }
  .topbar .brand { padding: 0 14px; font-size: 15px; }
  .topbar nav a { padding: 0 10px; font-size: 13px; }
  .topbar .userbox .uname { display: none; }
  .row { flex-direction: column; gap: 0; }
  .card { padding: 16px 16px; }
  .login-card { padding: 28px 22px; }
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #e0d0c0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }
