/*
 * Stylesheet of the admin panel (/admin). Separate from the public site's CSS on purpose: the blog parts and the
 * site build do not depend on it. The colours and radii repeat the site's design tokens (frontend/src/styles/tokens.css)
 * so the panel looks like BluWebMedia. System fonts only: the Content-Security-Policy allows nothing from other hosts.
 */

/* Tokens (same values as the site's brand tokens). */
:root {
  --brand-blue: #2457d6;
  --brand-orange: #f7902a;
  --brand-orange-hover: #e27b14;
  --brand-navy: #0a2342;
  --surface: #ffffff;
  --page: #f3f6fb;
  --text: #0b1730;
  --muted: #4a5a73;
  --border: #c9d4e5;
  --danger: #a31515;
  --radius: 10px;
  --space: 16px;
}

/* Page frame. */
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 1100px; margin: 0 auto; padding: var(--space); }

/* Top bar. */
.bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space); padding: 12px var(--space); background: var(--brand-navy); color: #fff; }
.brand { color: #fff; font-weight: 700; text-decoration: none; }
.bar-user { display: flex; align-items: center; gap: var(--space); margin: 0; }

/* Cards and headings. */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: calc(var(--space) * 1.5); margin-top: var(--space); }
.narrow { max-width: 420px; margin-left: auto; margin-right: auto; }
h1 { margin: 0 0 var(--space); font-size: 1.5rem; }
h2 { margin: calc(var(--space) * 1.5) 0 8px; font-size: 1.1rem; }

/* Forms: labels above fields, 44px touch targets. */
label { display: block; margin: var(--space) 0 4px; font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="date"], select, textarea { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--brand-blue); outline-offset: 2px; }
.button { display: inline-block; min-height: 44px; margin-top: var(--space); padding: 10px 20px; border: 0; border-radius: var(--radius); background: var(--brand-orange); color: var(--text); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.button:hover { background: var(--brand-orange-hover); }
.button-quiet { margin-top: 0; padding: 6px 14px; background: transparent; color: #fff; border: 1px solid #fff; }
.button-quiet:hover { background: rgba(255, 255, 255, 0.15); }

/* Messages, QR code and backup codes. */
.error { color: var(--danger); font-weight: 600; }
.qr { width: 220px; max-width: 100%; }
.qr svg { width: 100%; height: auto; }
code { padding: 2px 6px; background: var(--page); border-radius: 4px; word-break: break-all; }
.codes { columns: 2; padding-left: var(--space); }

/* Header menu. */
.nav { display: flex; gap: var(--space); margin: 0; padding: 0; list-style: none; }
.nav a { color: #fff; text-decoration: none; padding: 10px 4px; display: inline-block; }
.nav a:hover { text-decoration: underline; }
textarea { width: 100%; font: inherit; }
.muted { color: var(--muted); font-size: 0.9rem; }
/* Link back to the common sign-in page (/login): a 44px touch target. */
.back-link { margin: 8px 0 0; font-size: 0.9rem; }
.back-link a { display: inline-flex; align-items: center; min-height: 44px; }
.button-secondary { background: var(--surface); border: 2px solid var(--brand-blue); color: var(--brand-blue); }
.button-secondary:hover { background: var(--page); }

/* List filters: a responsive grid of labelled fields. */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 var(--space); align-items: end; }
.filter-buttons { display: flex; align-items: center; gap: var(--space); }
.count { margin: var(--space) 0 8px; font-weight: 600; }

/* Record lists: a table on a desktop (cards on a phone, see the media query below). */
.records { width: 100%; border-collapse: collapse; }
.records th, .records td { padding: 10px 8px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--page); border: 1px solid var(--border); font-size: 0.85rem; }
.status-new { border-color: var(--brand-orange); }
.status-replied, .status-hired, .status-shortlisted { border-color: var(--brand-blue); }
.pager { display: flex; align-items: center; gap: var(--space); margin-top: var(--space); }
.export { margin-top: 8px; }

/* Detail pages. */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--space); }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; word-break: break-word; }
.message-text { white-space: normal; word-break: break-word; background: var(--page); padding: var(--space); border-radius: var(--radius); }
.notes { padding-left: var(--space); }
.inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space); }
.inline-form label { margin-top: 0; }

/* Downloads page: the notice box, the totals and the SVG bar chart (drawn in the page, no script). */
.notice-box { padding: var(--space); border: 1px solid var(--brand-orange); border-radius: var(--radius); background: var(--page); }
.totals { grid-template-columns: max-content max-content; }
.totals dd { font-weight: 700; font-size: 1.25rem; }
.chart { display: block; width: 100%; max-width: 640px; height: auto; background: var(--page); border-radius: var(--radius); }
.bar { fill: var(--brand-blue); }
.plain { max-width: 520px; }

/* Dashboard cards, the log box, the users list, the second chart colour. */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space); }
.dash-card h2 { margin-top: 0; }
.bar-orange { fill: var(--brand-orange); }
.log { max-height: 360px; overflow: auto; padding: var(--space); background: var(--page); border-radius: var(--radius); font-size: 0.85rem; white-space: pre-wrap; word-break: break-all; }
.person { border-top: 1px solid var(--border); padding: 8px 0; }
.person summary { cursor: pointer; min-height: 44px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.check { display: inline-flex; align-items: center; gap: 6px; margin-right: var(--space); font-weight: 400; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); margin-top: var(--space); }

/* Phones: the bar and its menu wrap (11 links do not fit in one row), a list row becomes a card with a label before each value, and the facts stack. */
@media (max-width: 600px) {
  .bar { flex-wrap: wrap; }
  .bar nav { width: 100%; }
  .nav { flex-wrap: wrap; gap: 0 var(--space); }
  .nav a { padding: 12px 4px; }
  .card { padding: var(--space); }
  .records thead { position: absolute; left: -9999px; }
  .records, .records tbody, .records tr, .records td { display: block; width: 100%; }
  .records tr { margin-bottom: var(--space); padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); }
  .records td { border: 0; padding: 4px 0; }
  .records td::before { content: attr(data-label) ": "; font-weight: 600; }
  .facts { grid-template-columns: 1fr; }
}

/* The Re-check button of the payments list stays on one line (the Action column is narrow). */
.records .button-small { white-space: nowrap; }

/* A payment in review: the row stands out (a person must look at it). */
.row-alert { background: var(--page); outline: 2px solid var(--danger); outline-offset: -2px; }

/* The invoice as the admin panel shows it: the same class rules the stored invoice HTML carries (the strict policy blocks inline style). */
.invoice-doc { font-family: "DejaVu Sans", Arial, sans-serif; font-size: 12px; color: #1b1b1b; }
.invoice-doc h1 { font-size: 22px; margin: 0 0 4px; }
.invoice-doc table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.invoice-doc th, .invoice-doc td { border-bottom: 1px solid #cccccc; padding: 6px 4px; text-align: left; vertical-align: top; }
.invoice-doc th.n, .invoice-doc td.n { text-align: right; }
.invoice-doc table.cols td { border: 0; padding: 0 12px 0 0; width: 50%; }
.invoice-doc .muted { color: #555555; }
.invoice-doc table.totals td { border: 0; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
