/* ============================================================================
   Exam Reader admin panel
   Same palette as the public site (sampled from the application icon), but a
   denser, more utilitarian layout — this is a tool, not a shop window.
   ========================================================================== */

:root {
	--blue: #1e6eb5;
	--blue-700: #175c98;
	--blue-950: #071d31;
	--blue-50: #edf4fb;
	--yellow: #fce800;
	--ink: #16202b;
	--body: #5a6472;
	--muted: #78828f;
	--line: #dde4ec;
	--line-soft: #eaeff5;
	--surface: #fff;
	--surface-alt: #f6f8fb;
	--ok: #1c7a3e;
	--ok-bg: #e8f6ec;
	--warn: #8a5a00;
	--warn-bg: #fff5e0;
	--bad: #a3232a;
	--bad-bg: #fdecec;
	--radius: 10px;
	--font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--surface-alt);
	color: var(--body);
	font-family: var(--font);
	font-size: 15px;
	line-height: 1.55;
}

a { color: var(--blue-700); }
code {
	font-family: ui-monospace, Consolas, monospace;
	font-size: .92em;
	background: var(--surface-alt);
	border: 1px solid var(--line-soft);
	border-radius: 4px;
	padding: .1em .35em;
}

h1 { font-size: 1.6rem; color: var(--ink); margin: 0 0 .2em; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; color: var(--ink); margin: 0 0 .6em; }

.wrap { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 24px; }
.main { padding-block: 28px 60px; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.right { text-align: right; }
.big { font-size: 1.3rem; color: var(--ink); margin: 0 0 .2em; font-weight: 600; }
.req { color: var(--bad); }
.inline { display: inline; }
.crumb { margin: 0 0 .3em; font-size: .85rem; color: var(--muted); }

/* --- top bar --------------------------------------------------------------- */
.topbar {
	background: var(--blue-950);
	color: #c3d2e0;
	position: sticky;
	top: 0;
	z-index: 20;
}
.topbar__inner { display: flex; align-items: center; gap: 28px; min-height: 58px; }
.brand { color: #fff; text-decoration: none; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.brand__sub { color: var(--yellow); font-weight: 600; }
.brand__mark {
	width: 20px; height: 20px; border-radius: 5px;
	background: var(--blue);
	box-shadow: inset 0 0 0 2px var(--yellow);
	display: inline-block;
}
.topnav { display: flex; gap: 4px; margin-right: auto; }
.topnav a {
	color: #a9bdd0; text-decoration: none; padding: 7px 13px;
	border-radius: 7px; font-weight: 600; font-size: .93rem;
}
.topnav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.topnav a.is-active { background: rgba(255,255,255,.13); color: #fff; }
.topbar__user { display: flex; align-items: center; gap: 12px; font-size: .9rem; }

/* --- page head ------------------------------------------------------------- */
.page-head {
	display: flex; align-items: flex-start; justify-content: space-between;
	gap: 20px; margin-bottom: 22px; flex-wrap: wrap;
}

/* --- stats ----------------------------------------------------------------- */
.stats {
	display: grid; gap: 14px; margin-bottom: 26px;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.stat {
	background: var(--surface); border: 1px solid var(--line);
	border-radius: var(--radius); padding: 16px 18px;
}
.stat b { display: block; font-size: 1.7rem; color: var(--blue-700); line-height: 1.1; }
.stat span { font-size: .85rem; color: var(--muted); }
.stat--warn b { color: var(--warn); }

/* --- panels ---------------------------------------------------------------- */
.panel {
	background: var(--surface); border: 1px solid var(--line);
	border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px;
}
.panel--highlight { border-color: var(--yellow); border-width: 2px; background: #fffdf0; }

.cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.cols__side .panel { margin-bottom: 16px; }
@media (max-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr); } }

/* --- key display ----------------------------------------------------------- */
.keybox {
	font-family: ui-monospace, Consolas, monospace;
	font-size: 1.35rem; font-weight: 700; letter-spacing: .06em;
	color: var(--ink); background: #fff;
	border: 2px dashed var(--yellow); border-radius: var(--radius);
	padding: 16px 18px; margin: 0 0 12px;
	user-select: all; /* one click selects the whole key */
	word-break: break-all;
}

/* --- tables ---------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.table tr:last-child td { border-bottom: 0; }
.table--compact th, .table--compact td { padding: 7px 10px; }
.table .is-muted { opacity: .5; }

/* --- pills ----------------------------------------------------------------- */
.pill {
	display: inline-block; padding: 2px 9px; border-radius: 99px;
	font-size: .76rem; font-weight: 700; letter-spacing: .02em;
}
.pill--ok { background: var(--ok-bg); color: var(--ok); }
.pill--warn { background: var(--warn-bg); color: var(--warn); }
.pill--bad { background: var(--bad-bg); color: var(--bad); }
.pill--muted { background: var(--surface-alt); color: var(--muted); }

/* --- forms ----------------------------------------------------------------- */
.form { display: block; }
.form--wide { max-width: 780px; }
.field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: .85rem; font-weight: 700; color: var(--ink); }
.field small { color: var(--muted); font-size: .82rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], select, textarea {
	width: 100%; padding: 9px 11px; font: inherit; color: var(--ink);
	background: #fff; border: 1.5px solid var(--line); border-radius: 7px;
}
input:focus, select:focus, textarea:focus {
	outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30,110,181,.15);
}
textarea { resize: vertical; }

.filters { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filters input[type=search] { flex: 1; min-width: 220px; }
.filters select { width: auto; }

/* Compact in-row forms (voice credits: adjust allowance, re-issue secret).
   Inputs are narrow on purpose so a table row does not wrap on a laptop. */
.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form + .inline-form { margin-top: 6px; }
.inline-form input[type=number] { width: 110px; }
.inline-form input[type=text] { width: 140px; }

/* A balance under 10% of its allowance — the school is about to run out
   mid-exam-week, which is exactly when nobody is watching this page. */
.warn { color: var(--warn); font-weight: 600; }

.actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.stack { margin-top: 10px; }
.stack + .stack { margin-top: 8px; }

/* --- buttons --------------------------------------------------------------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center;
	padding: 9px 16px; border: 1.5px solid transparent; border-radius: 7px;
	font: inherit; font-weight: 700; font-size: .92rem;
	text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn--sm { padding: 5px 11px; font-size: .84rem; }
.btn--block { width: 100%; }
.btn--primary { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }
.btn--primary:hover { background: #ffef3d; }
.btn--solid { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn--solid:hover { background: var(--blue-700); }
.btn--outline { background: #fff; border-color: var(--line); color: var(--ink); }
.btn--outline:hover { border-color: var(--blue); color: var(--blue-700); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--body); }
.btn--ghost:hover { border-color: var(--blue); color: var(--blue-700); }
.btn--danger { background: #fff; border-color: #e6b3b6; color: var(--bad); }
.btn--danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.topbar .btn--ghost { border-color: rgba(255,255,255,.25); color: #c3d2e0; }
.topbar .btn--ghost:hover { border-color: #fff; color: #fff; }

/* --- notices --------------------------------------------------------------- */
.notice { padding: 11px 16px; border-radius: 8px; margin-bottom: 18px; font-size: .93rem; }
.notice--ok { background: var(--ok-bg); border: 1px solid #b6dfc2; color: var(--ok); }
.notice--error { background: var(--bad-bg); border: 1px solid #f0c2c4; color: var(--bad); }

/* --- meta list ------------------------------------------------------------- */
.meta { margin: 0; font-size: .88rem; }
.meta dt { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; margin-top: 10px; }
.meta dt:first-child { margin-top: 0; }
.meta dd { margin: 2px 0 0; color: var(--ink); }

/* --- bare pages (login, password change) ----------------------------------- */
body.bare {
	display: flex; align-items: center; justify-content: center;
	min-height: 100vh; background: var(--blue-950); padding: 24px;
}
.bare__box {
	width: 100%; max-width: 400px; background: #fff;
	border-radius: 14px; padding: 32px; box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.bare__brand {
	display: flex; align-items: center; gap: 9px;
	font-weight: 700; color: var(--ink); margin-bottom: 20px;
}
.bare__box h1 { font-size: 1.25rem; margin-bottom: 18px; }
.bare__box .btn { margin-top: 6px; }
.bare__box .muted { margin-top: 18px; margin-bottom: 0; }

/* --- footer ---------------------------------------------------------------- */
.foot { padding: 20px 0 34px; font-size: .82rem; color: var(--muted); }
