/* Mavis brand: docs/05_BRAND_AND_DESIGN.md */
:root {
  --red: #ED1C24;
  --red-dark: #B3141A;
  --red-tint: #FDECEC;
  --ink: #1A1A1A;
  --text-2: #4A4A4A;
  --text-3: #5E5E5E;
  --rule: #E2E2E2;
  --rule-2: #D6D6D6;
  --panel: #F6F6F6;
  --ok: #1E7B34;
  --warn: #9A6200;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; background: #fff; color: var(--ink);
  font-family: "Source Sans 3", system-ui, sans-serif; line-height: 1.5;
  border-top: 8px solid var(--red);
}
h1, h2, h3, .brand-name { font-family: "Archivo", system-ui, sans-serif; }
h1 { font-weight: 800; font-size: 1.75rem; margin: 0 0 .5rem; }
h2 { font-weight: 700; font-size: 1.25rem; }
a { color: var(--red-dark); }
.tagline { letter-spacing: .18em; text-transform: uppercase; font-size: .72rem; color: var(--text-3); }

/* Header */
.site-header { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  padding: .75rem 1.5rem; border-bottom: 1px solid var(--rule); }
.site-header img { height: 40px; width: auto; display: block; }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--ink); }
.brand-name { font-weight: 700; font-size: 1.05rem; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.nav a { text-decoration: none; color: var(--text-2); padding: .4rem .7rem; border-radius: 6px; font-weight: 600; }
.nav a:hover { background: var(--panel); }
.nav a.active { background: var(--red-tint); color: var(--red-dark); }
.user-box { display: flex; align-items: center; gap: .75rem; font-size: .9rem; color: var(--text-2); }
.chip { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700;
  background: var(--panel); border: 1px solid var(--rule-2); color: var(--text-2); }
.chip.role-superadmin { background: var(--red-tint); border-color: var(--red); color: var(--red-dark); }

/* Main */
main { width: 100%; margin: 0; padding: 1.5rem 2rem 3rem; }
.panel { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 1.25rem 1.5rem; }
.muted { color: var(--text-3); }
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: .6rem .9rem; border-radius: 8px; background: var(--panel); border-left: 4px solid var(--ok); }
.messages li.error { border-left-color: var(--red); }

/* Forms and buttons */
.btn { display: inline-block; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  padding: .55rem 1.1rem; border-radius: 8px; border: 1px solid var(--red); background: var(--red); color: #fff; }
.btn:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn.secondary { background: #fff; color: var(--red-dark); }
.btn.small { padding: 4px 10px; font-size: .85em; }
.btn.danger { background: #fff; color: #1A1A1A; border-color: #1A1A1A; }
.btn.danger:hover { background: #1A1A1A; color: #fff; }
.btn.link { background: none; border: none; color: var(--red-dark); padding: 0; font-weight: 600; text-decoration: underline; }
form p { margin: 0 0 1rem; }
label { display: block; font-weight: 600; margin-bottom: .25rem; }
input[type=text], input[type=password], input[type=email] {
  width: 100%; font: inherit; padding: .55rem .7rem; border: 1px solid var(--rule-2); border-radius: 8px; }
input:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.errorlist { color: var(--red-dark); list-style: none; padding: 0; margin: .25rem 0; font-size: .9rem; }
.helptext, .form-help { font-size: .85rem; color: var(--text-3); }

/* Login */
.auth { max-width: 420px; margin: 3rem auto; }
.auth .logo { height: 56px; margin-bottom: 1rem; }

/* Placeholder pages */
.badge-version { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--red-dark); background: var(--red-tint); padding: .15rem .5rem; border-radius: 4px; }
.qr svg { width: 220px; height: 220px; background: #fff; padding: 8px; border: 1px solid var(--rule); }
code.secret { font-size: 1.05rem; letter-spacing: .05em; background: #fff; padding: .2rem .4rem; border: 1px solid var(--rule); border-radius: 4px; }

footer { border-top: 1px solid var(--rule); padding: 1rem 1.5rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }

@media (max-width: 640px) {
  .site-header { padding: .6rem 1rem; gap: .75rem; }
  main { padding: 1.25rem 1rem 2rem; }
  .brand-name { display: none; }
}

/* Home: levels and subjects */
.levels { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 1.25rem; }
.level h2 { margin-top: 0; }
.grades { font-size: .85rem; font-weight: 400; font-family: "Source Sans 3", system-ui, sans-serif; }
.subjects { list-style: none; padding: 0; margin: 0; }
.subjects li { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; padding: .45rem 0; border-top: 1px solid var(--rule); }
.subjects li:first-child { border-top: none; }
.subject-name { font-weight: 700; }
.subjects .chip { margin-left: auto; }
.chip.status-active { background: #E8F5EC; border-color: var(--ok); color: var(--ok); }
.topics { columns: 2; column-gap: 2rem; padding-left: 1.5rem; }
@media (max-width: 640px) { .topics { columns: 1; } }

/* Questions */
.bank-layout { display: grid; grid-template-columns: 280px 1fr; gap: 1.25rem; align-items: start; }
.filters p { margin: 0 0 .7rem; }
.filters select, .filters input[type=text] { width: 100%; font: inherit; padding: .4rem .5rem; border: 1px solid var(--rule-2); border-radius: 6px; background: #fff; }
.filters .check { display: flex; gap: .4rem; align-items: center; }
.filters .check label { display: inline; margin: 0; font-weight: 600; }
.qtable { width: 100%; border-collapse: collapse; font-size: .95rem; }
.qtable th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); border-bottom: 2px solid var(--rule-2); padding: .4rem; }
.qtable td { border-bottom: 1px solid var(--rule); padding: .55rem .4rem; vertical-align: top; }
.qtable .thumb { width: 170px; }
.qtable .thumb img { width: 160px; height: auto; border: 1px solid var(--rule); background: #fff; }
.qtable td:nth-child(2) { width: 50%; }
.qtable td:nth-child(3) { white-space: nowrap; }
.qid { font-weight: 700; }
.small { font-size: .85rem; }
.qtext { margin-top: .2rem; }
.pager { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }
.chip.st-verified { background: #E8F5EC; border-color: var(--ok); color: var(--ok); }
.chip.st-needs-review { background: #FFF4E0; border-color: var(--warn); color: var(--warn); }
.chip.st-excluded, .chip.st-extracted { background: var(--panel); color: var(--text-3); }
.warn { color: var(--warn); }
.detail-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.detail-layout .panel { margin-bottom: 1rem; }
.label { font-family: "Archivo", system-ui, sans-serif; font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--red-dark); margin: 0 0 .4rem; }
.qimg { max-width: 100%; height: auto; border: 1px solid var(--rule); background: #fff; margin: .5rem 0; }
.qtext-full { font-size: 1.05rem; }
.options { padding-left: 1.25rem; }
.facts dt { font-weight: 700; font-size: .85rem; color: var(--text-2); margin-top: .5rem; }
.facts dd { margin: 0; }
.review-card { margin-bottom: .75rem; }
@media (max-width: 900px) { .bank-layout, .detail-layout { grid-template-columns: 1fr; } .qtable .thumb { display: none; } }

/* Editor and history */
.actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.edit-form .field { margin-bottom: 1rem; }
.edit-form textarea, .edit-form select, .edit-form input[type=number] { width: 100%; font: inherit; padding: .5rem .6rem; border: 1px solid var(--rule-2); border-radius: 8px; background: #fff; }
.outcome-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--rule-2); border-radius: 8px; padding: .5rem; background: #fff; }
.outcome-list label { font-weight: 400; display: block; margin: 0 0 .25rem; }
.outcome-list ul, .outcome-list div { list-style: none; padding: 0; margin: 0; }
.history-row { margin-bottom: .75rem; }
.changes td:first-child { white-space: nowrap; font-weight: 600; }
.results-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }

/* Version 2 */
.inline-form { display: flex; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.inline-form select { font: inherit; padding: .4rem .5rem; border: 1px solid var(--rule-2); border-radius: 6px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: .75rem; }
.stat { display: flex; flex-direction: column; gap: .2rem; }
.stat-n { font-family: "Archivo", system-ui, sans-serif; font-weight: 800; font-size: 1.6rem; color: var(--red-dark); }
.topic-row { margin-bottom: .6rem; }
.topic-row summary { cursor: pointer; }
.cov tr.thin td:nth-child(2) { color: var(--warn); font-weight: 700; }
.prompt { width: 100%; font: .85rem/1.4 ui-monospace, Menlo, monospace; border: 1px solid var(--rule-2); border-radius: 8px; padding: .5rem; margin-bottom: .5rem; }
.basket td.row-actions { white-space: nowrap; }
.row-actions button { font: inherit; font-size: .8rem; padding: .15rem .45rem; border: 1px solid var(--rule-2); border-radius: 5px; background: #fff; cursor: pointer; }
.row-actions button:hover { border-color: var(--red); color: var(--red-dark); }
.add-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .6rem .8rem; margin-bottom: .6rem; }
.add-bar select { font: inherit; padding: .35rem .5rem; border: 1px solid var(--rule-2); border-radius: 6px; }
.qtable td.pick { width: 28px; }
.dtable { border-collapse: collapse; margin: .4rem 0 .6rem; font-size: .95rem; }
.dtable th, .dtable td { border: 1px solid var(--rule-2); padding: .2rem .6rem; text-align: center; }
.dtable th { text-align: left; font-weight: 600; background: var(--panel); white-space: nowrap; }

/* Header switch: the subject and year every list page shows */
.scope-switch { display: flex; align-items: center; gap: .5rem; margin: 0 1rem; }
.scope-switch label { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #6b6b6b; }
.scope-switch select { font: 700 1rem "Archivo", sans-serif; color: #fff; background: #ED1C24; border: 0; border-radius: 999px;
  padding: .4rem 2rem .4rem .9rem; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, #fff 50%), linear-gradient(135deg, #fff 50%, transparent 50%);
  background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.scope-switch select option, .scope-switch select optgroup { color: #1a1a1a; background: #fff; }
@media (max-width: 800px) { .scope-switch { margin: .5rem 0; width: 100%; } .scope-switch select { flex: 1; } }
