*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f6fa;
  color: #222;
  min-height: 100vh;
}

/* ── Header ────────────────────────────────────── */
header {
  background: #1a3a5c;
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-left  { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.header-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }

header h1 { font-size: 1.2rem; font-weight: 600; letter-spacing: .02em; }
header p  { font-size: .8rem; opacity: .7; margin-top: 2px; }

.logo-area {
  height: 48px; width: 130px;
  display: flex; align-items: center; justify-content: center;
}
.logo-area img { max-height: 48px; max-width: 130px; object-fit: contain; }
.logo-placeholder {
  height: 48px; width: 120px;
  border: 2px dashed rgba(255,255,255,.3);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; color: rgba(255,255,255,.4);
  text-align: center; line-height: 1.4;
}

.btn-logout {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: .82rem;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
}
.btn-logout:hover { background: rgba(255,255,255,.22); }

/* ── Layout ─────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }

/* ── Search box ─────────────────────────────────── */
.search-box {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.search-row { display: flex; gap: 8px; flex-wrap: wrap; }

.search-row input[type=text] {
  flex: 1 1 240px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  padding: 9px 13px;
  font-size: .95rem;
  outline: none;
}
.search-row input[type=text]:focus {
  border-color: #1a3a5c;
  box-shadow: 0 0 0 3px rgba(26,58,92,.14);
}
.search-row select {
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  padding: 9px 10px;
  font-size: .88rem;
  background: #fff;
  cursor: pointer;
  outline: none;
}
.search-row select:focus { border-color: #1a3a5c; }

.btn-search {
  background: #1a3a5c;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 24px;
  font-size: .95rem;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
}
.btn-search:hover { background: #14304f; }

.filters-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.filters-row label { font-size: .84rem; color: #555; margin-right: 2px; }
.filter-btn {
  border: 1px solid #d0d5dd;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: .82rem;
  background: #fff;
  cursor: pointer;
  text-decoration: none;
  color: #444;
  transition: background .15s, color .15s;
}
.filter-btn:hover  { background: #f0f4f8; }
.filter-btn.active { background: #1a3a5c; color: #fff; border-color: #1a3a5c; }

/* ── Stats bar ──────────────────────────────────── */
.stats-bar {
  font-size: .84rem;
  color: #555;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.stats-bar a { color: #1a3a5c; font-size: .82rem; text-decoration: none; }
.stats-bar a:hover { text-decoration: underline; }

/* ── Table ──────────────────────────────────────── */
.table-wrap {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  overflow: hidden;          /* zamiast overflow-x: auto */
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
  table-layout: fixed;       /* klucz: stałe szerokości kolumn */
}

/* Szerokości kolumn przez <col> */
col.c-num    { width: 46px; }
col.c-sig    { width: 86px; }
col.c-title  { width: auto; }   /* reszta miejsca */
col.c-author { width: 155px; }
col.c-year   { width: 50px; }
col.c-pub    { width: 125px; }
col.c-topic  { width: 105px; }
col.c-isbn   { width: 108px; }
col.c-avail  { width: 105px; }

thead th {
  background: #f0f4f8;
  border-bottom: 2px solid #dde3ea;
  padding: 10px 10px;
  text-align: left;
  font-weight: 600;
  font-size: .82rem;
  color: #334;
  white-space: nowrap;
  overflow: hidden;
}
thead th.th-center { text-align: center; }

tbody tr { border-bottom: 1px solid #eef0f3; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f7f9fc; }

tbody td {
  padding: 8px 10px;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Wyjątki — komórki wieloliniowe */
.td-title {
  white-space: normal;      /* tytuł może się łamać */
  word-break: break-word;
  font-weight: 600;
  color: #1a3a5c;
  line-height: 1.35;
}
.td-title .sub {
  font-weight: 400;
  font-size: .76rem;
  color: #888;
  margin-top: 2px;
  white-space: normal;
}

.td-num    { text-align: center; color: #aaa; font-size: .79rem; }
.td-sig    { color: #777; font-family: monospace; font-size: .8rem; }
.td-author { color: #333; }
.td-isbn   { font-family: monospace; font-size: .79rem; color: #555; }
.td-year   { color: #555; text-align: center; }

/* ── Badges ─────────────────────────────────────── */
.badge {
  display: inline-block;
  border-radius: 12px;
  padding: 3px 10px;
  font-size: .77rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-ok  { background: #d4f4e0; color: #1a7a40; }
.badge-out { background: #fde8e8; color: #b91c1c; }

/* ── Pagination ─────────────────────────────────── */
.pagination {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
  padding-bottom: 10px;
}
.pagination a, .pagination span {
  border: 1px solid #d0d5dd;
  border-radius: 5px;
  padding: 6px 12px;
  font-size: .84rem;
  text-decoration: none;
  color: #333;
  background: #fff;
}
.pagination a:hover { background: #f0f4f8; }
.pagination .pg-current { background: #1a3a5c; color: #fff; border-color: #1a3a5c; }
.pagination .pg-disabled { color: #ccc; pointer-events: none; background: #fafafa; }

/* ── Empty / error states ───────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: #888; }
.empty-state svg { opacity: .4; }
.empty-state p { margin-top: 10px; font-size: .9rem; }

.alert-error {
  background: #fde8e8;
  border: 1px solid #f5c6c6;
  border-radius: 8px;
  padding: 14px 18px;
  color: #b91c1c;
  margin-bottom: 16px;
  font-size: .9rem;
}

/* ── Login page ─────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f5f6fa;
}
.login-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,.10);
  padding: 44px 40px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.login-logo {
  max-height: 80px;
  max-width: 200px;
  object-fit: contain;
  margin: 0 auto 20px;
  display: block;
}
.login-card h1 { font-size: 1.2rem; color: #1a3a5c; margin-bottom: 4px; }
.login-card .sub { font-size: .84rem; color: #777; margin-bottom: 28px; }

.login-card label {
  display: block;
  text-align: left;
  font-size: .82rem;
  color: #444;
  font-weight: 500;
  margin-bottom: 5px;
}
.login-card input[type=password] {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  padding: 10px 13px;
  font-size: .95rem;
  outline: none;
  margin-bottom: 16px;
}
.login-card input[type=password]:focus {
  border-color: #1a3a5c;
  box-shadow: 0 0 0 3px rgba(26,58,92,.14);
}
.btn-login {
  width: 100%;
  background: #1a3a5c;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px;
  font-size: .97rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-login:hover { background: #14304f; }

.login-error {
  background: #fde8e8;
  color: #b91c1c;
  border: 1px solid #f5c6c6;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: .84rem;
  margin-bottom: 16px;
  text-align: left;
}
