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

html { height: 100%; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: #0d2a4a;
  color: #e0eaf4;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* Nav */
header nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: #194e90;
  border-bottom: 2px solid #f4a52f;
}
header nav a { color: #f4a52f; text-decoration: none; font-weight: 600; }
.nav-logo { height: 52px; width: auto; vertical-align: middle; }
.nav-divider {
  width: 1px; height: 24px;
  background: rgba(255,255,255,0.2);
  flex-shrink: 0;
}

header nav .nav-tab {
  font-size: 13px;
  font-weight: 600;
  color: rgba(220, 234, 244, 0.75);
  text-decoration: none;
  padding: 0.3rem 0.9rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
header nav .nav-tab:hover { color: #fff; background: rgba(255,255,255,0.1); }
header nav .nav-tab.active { color: #fff; background: rgba(255,255,255,0.15); }

header nav .spacer { flex: 1; }

/* Brand + user stacked on the right */
.nav-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}
.nav-brand {
  font-size: 26px;
  line-height: 1.1;
}
.nav-user-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 12px;
}
.nav-user { color: #a8c4e0; }

/* Logout button */
.nav-logout-btn {
  background: none;
  border: none;
  padding: 0;
  color: #f4a52f;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
}
.nav-logout-btn:hover { color: #d48a18; }

/* Footer */
footer {
  background: #0a1a2e;
  border-top: 1px solid #1e4d7a;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  font-size: 11px;
  color: #3a6a9a;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

/* Main */
main {
  padding: 1.5rem;
  overflow-y: auto;
}
h1 { font-size: 1.4rem; margin-bottom: 1rem; color: #f4a52f; }
h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid #1e4d7a; }
th { background: #194e90; color: #a8c4e0; font-weight: 600; }
tr:hover td { background: rgba(30, 115, 190, 0.15); }
tr.status-done td { opacity: 0.6; }

/* Progress bar */
.progress-bar {
  width: 120px; height: 8px; background: #0d3a6e;
  border-radius: 4px; overflow: hidden; display: inline-block; vertical-align: middle;
  margin-right: 0.5rem;
}
.progress-fill { height: 100%; background: #f4a52f; border-radius: 4px; }
.progress-fill-meta { background: #4caf8a; }
.muted { color: #7a9ab8; }

/* Buttons / links */
a.btn-open, button, .btn-open {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border-radius: 4px;
  border: 1px solid #1e73be;
  background: #194e90;
  color: #e0eaf4;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
}
a.btn-open:hover, button:hover { background: #1e73be; }
button.primary { background: #f4a52f; border-color: #f4a52f; color: #0d2a4a; font-weight: 700; }
button.primary:hover { background: #d48a18; border-color: #d48a18; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Forms */
label { display: block; margin-bottom: 0.5rem; color: #a8c4e0; }
input[type="text"], input[type="number"] {
  display: block; width: 100%; max-width: 320px;
  padding: 0.35rem 0.5rem; margin-top: 0.2rem;
  background: #0d3a6e; border: 1px solid #1e73be; border-radius: 4px;
  color: #e0eaf4; font-size: 14px;
}
.boek-registreer { margin-bottom: 1.5rem; }
.boek-registreer details { background: #194e90; border: 1px solid #1e73be; border-radius: 6px; padding: 0.75rem; }
.boek-registreer summary { cursor: pointer; font-weight: 600; margin-bottom: 0.5rem; }
.boek-registreer form { display: flex; flex-direction: column; gap: 0.5rem; max-width: 400px; }
#boek-open-status { font-size: 13px; color: #6dca8a; }

/* Book header with approval controls */
.book-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.book-header h1 { margin: 0; }

/* Approval badges and buttons */
.badge-approved {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  background: #1a6b3a;
  color: #7de8a8;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.btn-approve {
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  border: 1px solid #1a6b3a;
  background: #0d3a1f;
  color: #7de8a8;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-approve:hover { background: #1a6b3a; }
.btn-approve.is-approved { border-color: #8b5a00; background: #3d2900; color: #f4a52f; }
.btn-approve.is-approved:hover { background: #8b5a00; }

tr.page-approved td { opacity: 0.75; }

/* Approved banner in page editor sidebar */
.approved-banner {
  margin-top: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
.approved-readonly  { background: #1a6b3a; color: #7de8a8; border: 1px solid #2a9b56; }
.approved-staff     { background: #3d2900; color: #f4a52f;  border: 1px solid #8b5a00; }

/* Login page */
body.login-page {
  display: flex; justify-content: center; align-items: center;
}
.login-box {
  background: #194e90; border: 1px solid #1e73be; border-radius: 8px;
  padding: 2rem; width: 320px;
}
.login-box h1 { margin-bottom: 1.5rem; text-align: center; }
.login-box form { display: flex; flex-direction: column; gap: 0.75rem; }
.login-box button { margin-top: 0.5rem; width: 100%; padding: 0.5rem; }
.error { color: #ff7070; font-size: 13px; }

/* Status bar */
#status-bar { padding: 0.5rem; font-size: 13px; min-height: 2rem; }
#status-bar.error { color: #ff7070; }

/* Unsaved changes modal (shared by editor and metadata pages) */
.unsaved-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.unsaved-overlay.open { display: flex; }
.unsaved-modal {
  background: #194e90;
  border: 1px solid #1e73be;
  border-radius: 8px;
  padding: 1.5rem;
  width: 340px;
  max-width: 90vw;
}
.unsaved-modal h3 { font-size: 1rem; color: #f4a52f; margin-bottom: 0.5rem; }
.unsaved-modal p  { font-size: 13px; color: #e0eaf4; margin-bottom: 1.25rem; line-height: 1.5; }
.unsaved-modal-btns { display: flex; flex-direction: column; gap: 0.5rem; }
.unsaved-modal-btns button { width: 100%; padding: 0.45rem; font-size: 13px; }
