/* Alpha Academy colours: navy #232E4B, gold #C0A35A */
:root {
  --navy: #232e4b;
  --gold: #c0a35a;
  --gold-soft: #f6efdd;
  --bg: #f6f7fa;
  --card: #fff;
  --text: #1d2333;
  --muted: #6b7286;
  --line: #e3e6ee;
  --pos: #1f7a4d;
  --neg: #b3261e;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--navy); }
h1 { font-size: 1.6rem; margin: .2em 0 .4em; color: var(--navy); }
h2 { font-size: 1.15rem; margin: 1.8em 0 .6em; color: var(--navy); }
main { max-width: 1150px; margin: 0 auto; padding: 16px 16px 60px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* top bar */
.topbar {
  background: var(--navy); color: #fff; display: flex; align-items: center; gap: 16px;
  padding: 8px 16px; flex-wrap: wrap; position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 600; }
.brand img { width: 34px; height: 34px; background: #fff; border-radius: 8px; padding: 2px; }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.topbar nav a { color: #dfe3ee; text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.topbar nav a.active, .topbar nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.topbar nav a.active { box-shadow: inset 0 -2px 0 var(--gold); }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.flash { background: var(--gold-soft); border: 1px solid var(--gold); padding: 10px 14px; border-radius: var(--radius); margin: 8px 0 14px; }
.flash.error { background: #fdecea; border-color: var(--neg); }
.empty { color: var(--muted); background: var(--card); border: 1px dashed var(--line); padding: 18px; border-radius: var(--radius); }

/* stat cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 12px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; border-top: 3px solid var(--gold); }
.stat span { display: block; color: var(--muted); font-size: .85rem; }
.stat strong { display: block; font-size: 1.25rem; color: var(--navy); font-variant-numeric: tabular-nums; }
.stat.pos strong { color: var(--pos); }
.stat.neg strong { color: var(--neg); }
.stat small { color: var(--muted); }

/* tables */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #fafbfd; font-size: .82rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tfoot th { background: var(--gold-soft); color: var(--text); }
td:first-child { white-space: nowrap; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; margin: 10px 0; }
.form-grid .wide { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; }
input, select {
  font: inherit; color: var(--text); padding: 9px 10px; border: 1px solid #cfd4e0; border-radius: 8px; background: #fff; width: 100%;
}
input[type=checkbox] { width: auto; }
input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 0; }
legend { color: var(--muted); font-size: .88rem; padding: 0 4px; }
label.row { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; color: var(--text); margin: 4px 0; }
label.row input { max-width: 120px; }
button, .button {
  font: inherit; font-weight: 600; background: var(--navy); color: #fff; border: 0; border-radius: 8px;
  padding: 10px 16px; cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover, .button:hover { filter: brightness(1.15); }
button.secondary, .button.secondary { background: #fff; color: var(--navy); border: 1px solid var(--navy); }
button.link { background: none; color: var(--navy); padding: 0; font-weight: 400; text-decoration: underline; }
button.link.danger { color: var(--neg); }
form.inline { display: inline; }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--navy); font-weight: 600; padding: 6px 0; }

.range { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 8px 0; }
.range label { flex-direction: row; align-items: center; }
.range input { width: auto; }
.range .quick { align-self: center; display: flex; gap: 10px; font-size: .9rem; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.two-col h2 { margin-top: 1em; }

/* books */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.book-card {
  display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; text-decoration: none; color: var(--text);
}
.book-card:hover { border-color: var(--gold); }
.book-card img, .no-cover { width: 64px; height: 88px; object-fit: cover; border-radius: 4px; flex: none; }
.no-cover { background: var(--navy); color: var(--gold); display: grid; place-items: center; font-size: 1.8rem; font-weight: 700; }
.book-card strong, .book-card small { display: block; }
.book-head { display: flex; gap: 16px; align-items: center; }
.book-head .cover { width: 90px; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }

/* login */
.login { max-width: 380px; margin: 40px auto; text-align: center; }
.login-logo { width: 150px; }
.login form { text-align: left; display: grid; gap: 12px; }

@media (max-width: 760px) {
  .two-col { grid-template-columns: 1fr; }
  .topbar { position: static; }
  .topbar nav { margin-left: 0; width: 100%; }
  .stat strong { font-size: 1.05rem; }
  h1 { font-size: 1.35rem; }
}
