:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #667085;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --border: #e4e7ec;
  --danger: #d92d20;
  --ok-bg: #ecfdf3;
  --ok-ink: #027a48;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

header.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

header.topbar .brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
}

header.topbar nav a { margin-left: 16px; font-size: 0.95rem; color: var(--muted); }
header.topbar nav a:first-child { margin-left: 0; }

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

h1 { font-size: 1.5rem; margin: 0 0 6px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 0 0 8px; }
p.muted, span.muted { color: var(--muted); font-size: 0.92rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.book-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: #fbfbfd;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.book-card .title { font-weight: 600; }

.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: center;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn.small { padding: 5px 10px; font-size: 0.85rem; }

form.inline { display: inline; }

label { display: block; font-size: 0.88rem; color: var(--muted); margin-bottom: 4px; margin-top: 10px; }
input[type=text], input[type=password], input[type=file], select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.98rem;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 90px; font-family: inherit; }

table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
th { color: var(--muted); font-weight: 600; }

.alert {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.92rem;
}
.alert.error { background: #fef3f2; color: var(--danger); border: 1px solid #fda29b; }
.alert.success { background: var(--ok-bg); color: var(--ok-ink); border: 1px solid #6ce9a6; }

.login-wrap {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-card { max-width: 380px; width: 100%; }

.creds-box {
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px 14px;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  overflow-x: auto;
  white-space: pre;
}

.class-list a.class-link {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  color: var(--ink);
}
.class-list a.class-link:hover { border-color: var(--brand); text-decoration: none; }

.reader-frame {
  width: 100%;
  height: 82vh;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #525659;
}

.section-divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

footer.note { text-align: center; color: var(--muted); font-size: 0.82rem; margin-top: 24px; }
