/* ============================================================
   Athenaeum — Library Management UI
   Editorial "reading room" theme: warm paper, deep ink,
   a single rust accent. Serif display + system-sans body.
   ============================================================ */

:root {
  --paper:      #faf7f2;
  --surface:    #ffffff;
  --ink:        #211c16;
  --ink-soft:   #6b6157;
  --line:       #e7ded2;
  --line-soft:  #f0e9df;
  --rust:       #b4531f;
  --rust-dark:  #8f4014;
  --green:      #2f7d4f;
  --green-bg:   #e8f3ec;
  --red:        #b5352a;
  --red-bg:     #f8eae8;
  --amber-bg:   #fbf1e3;
  --amber-ink:  #94601a;
  --radius:     10px;
  --shadow:     0 1px 2px rgba(33, 28, 22, .04), 0 8px 24px rgba(33, 28, 22, .06);
  --serif:      Georgia, "Times New Roman", serif;
  --sans:       system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 100% -10%, #fdf3e6 0%, transparent 60%),
    var(--paper);
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }
a { color: var(--rust); }

/* ---------- Layout shells ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.brand { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.brand .mark { font-size: 26px; }
.brand h1 { margin: 0; font-size: 28px; }
.login-card .tag { color: var(--ink-soft); margin: 0 0 24px; font-size: 14px; }
.login-card .hint {
  margin-top: 18px; font-size: 12.5px; color: var(--ink-soft);
  background: var(--line-soft); border-radius: 8px; padding: 10px 12px;
}
.login-card .hint code { color: var(--rust-dark); font-weight: 600; }

/* ---------- Top bar ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar-inner {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 20px; max-width: 1080px; margin: 0 auto;
}
.topbar .brand h1 { font-size: 20px; }
.topbar .spacer { flex: 1; }
.who { text-align: right; line-height: 1.25; }
.who .name { font-weight: 600; font-size: 14px; }
.who .role { font-size: 12px; color: var(--ink-soft); }

/* ---------- Tabs ---------- */
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding: 16px 0 0;
}
.tab {
  border: 1px solid transparent;
  background: transparent;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 500;
  color: var(--ink-soft);
}
.tab:hover { background: var(--line-soft); color: var(--ink); }
.tab.active {
  background: var(--ink); color: #fff;
}

/* ---------- Panels / cards ---------- */
.panel { padding: 22px 0 60px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 8px 0 16px;
}
.section-head h2 { margin: 0; font-size: 22px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card + .card { margin-top: 20px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 600; }

/* ---------- Forms ---------- */
.form-row {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
  padding: 16px 18px;
}
.field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 150px; }
.field label { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
input, select {
  font: inherit; font-size: 14px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff; color: var(--ink);
  min-width: 0;
}
input:focus, select:focus {
  outline: none; border-color: var(--rust);
  box-shadow: 0 0 0 3px rgba(180, 83, 31, .12);
}

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-size: 14px; font-weight: 600;
  padding: 9px 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line);
  background: #fff; color: var(--ink);
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-soft); }
.btn-primary { background: var(--rust); border-color: var(--rust); color: #fff; }
.btn-primary:hover { background: var(--rust-dark); border-color: var(--rust-dark); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-danger { color: var(--red); border-color: #ecc9c4; }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }

/* ---------- Search bar ---------- */
.searchbar { display: flex; gap: 8px; margin-bottom: 14px; }
.searchbar input { flex: 1; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-soft); font-weight: 700; background: #fbf9f5;
}
tbody tr:hover { background: #fcfaf6; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .actions { display: flex; gap: 6px; justify-content: flex-end; }
.muted { color: var(--ink-soft); }
.empty { padding: 34px; text-align: center; color: var(--ink-soft); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.5;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber-ink); }
.badge-red   { background: var(--red-bg); color: var(--red); }
.badge-ink   { background: var(--line-soft); color: var(--ink-soft); }
.fine-yes { color: var(--red); font-weight: 700; }
.fine-no  { color: var(--ink-soft); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  max-width: 340px; padding: 12px 16px; border-radius: 10px;
  box-shadow: var(--shadow); font-size: 14px; font-weight: 500;
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok   { background: #22331f; color: #eaf6e6; }
.toast.err  { background: #3a1b16; color: #f8e0da; }

/* ---------- Utilities ---------- */
.stack-gap { display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 620px) {
  .who { display: none; }
  .section-head { flex-direction: column; align-items: flex-start; }
}
