/* =========================================================
   Back-office specifics

   Only what belongs to this application. Anything reusable lives in
   shared/css/platform-design.css, which is shared with the member site and
   must not acquire back-office-shaped rules.

   This file is NOT synced. Everything under wwwroot/shared is owned by
   frontend/shared-assets and will be overwritten and pruned; everything here
   belongs to this project.
   ========================================================= */

/* ------------------------------------------------------- blazor error bar */

/* #blazor-error-ui is always present in the DOM; the framework unhides it by
   setting display:block when a circuit fails. Without this rule it is visible on
   every page, permanently announcing an error that has not happened — which is
   exactly what it looked like after app.css was replaced and this rule was left
   behind with it. */
#blazor-error-ui {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0.85rem 1.25rem;
  background: var(--gold-soft);
  color: var(--ink-900);
  border-top: 2.5px solid var(--ink-900);
  font-family: var(--font-data);
  box-shadow: 0 -4px 0 rgba(42, 26, 10, 0.15);
}

#blazor-error-ui .reload { color: var(--hot-red-ink); text-decoration: underline wavy; }
#blazor-error-ui .dismiss { cursor: pointer; float: right; padding: 0 0.5rem; }

/* The error boundary fallback keeps the same voice rather than the template's
   default dark-red slab. */
.blazor-error-boundary {
  background: var(--hot-red-ink);
  color: var(--cream-50);
  padding: 1rem 1.25rem;
  border: 2.5px solid var(--ink-900);
  border-radius: 16px 20px 18px 22px / 20px 16px 22px 18px;
  font-family: var(--font-data);
}

.blazor-error-boundary::after { content: "An error has occurred."; }

/* ----------------------------------------------------------------- shell */

.backoffice-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.backoffice-shell__main {
  flex: 1;
  padding: clamp(1.5rem, 3vw, 2.5rem) 1.5rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* The session cluster in the header: creator picker, operator, sign out. */
.backoffice-shell__session {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.backoffice-shell__user {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--ink-700);
}

.backoffice-shell__signout {
  font-family: var(--font-marker);
  font-size: 0.95rem;
  color: var(--hot-red-ink);
  text-decoration: underline wavy;
}

/* Page heading block, matching the template's admin.html: a marker-font eyebrow
   above a large display heading, with the primary action opposite. */
.page-head {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 2rem;
}

.page-head__eyebrow {
  font-family: var(--font-marker);
  font-size: 1.15rem;
  color: var(--hot-red-ink);
  margin: 0 0 0.35rem;
  display: inline-block;
  transform: rotate(-2deg);
}

/* --------------------------------------------------------- creator picker */

.creator-picker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0;
}

.creator-picker__label {
  font-family: var(--font-marker);
  font-size: 0.9rem;
  color: var(--ink-700);
}

.creator-picker__select {
  font-family: var(--font-data);
  font-size: 1rem;
  color: var(--ink-900);
  background: var(--cream-50);
  border: 2.5px solid var(--ink-700);
  border-radius: 16px 20px 18px 22px / 20px 16px 22px 18px;
  padding: 0.4rem 0.65rem;
  min-height: 2.5rem;
  max-width: 15rem;
}

.creator-picker__single {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
}

.creator-picker__none {
  font-family: var(--font-data);
  font-size: 0.9rem;
  color: var(--ink-500);
}

/* ------------------------------------------------------------ auth screens */

.auth-page {
  min-height: calc(100vh - 5rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
}

.auth-card {
  max-width: 28rem;
  width: 100%;
  padding: clamp(1.5rem, 5vw, 2.5rem);
}

.auth-card__eyebrow {
  font-family: var(--font-marker);
  font-size: 1.05rem;
  color: var(--hot-red-ink);
  text-align: center;
  margin: 0 0 0.5rem;
}

.auth-card__intro {
  font-family: var(--font-hand);
  color: var(--ink-700);
  text-align: center;
  line-height: 1.5;
  margin: 0 0 1.5rem;
}

.auth-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
  justify-content: center;
}

/* Errors carry a text label as well as colour, so the message never depends on
   the red alone to say something went wrong. */
.auth-alert {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border: 2.5px solid var(--hot-red);
  border-radius: 16px 20px 18px 22px / 20px 16px 22px 18px;
  box-shadow: 3px 3px 0 var(--hot-red);
  background: var(--cream-50);
  color: var(--ink-900);
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
}

.auth-alert strong { font-family: var(--font-display); font-size: 1.2rem; color: var(--hot-red-ink); }
.auth-alert span { font-family: var(--font-data); font-size: 0.95rem; }

.field { margin-bottom: 1.25rem; }

/* A checkbox reads as one thing with its label, so the whole row is the hit
   target and the box is grown well past the browser default — 14px is below
   any sane touch minimum. */
.field--checkbox {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  min-height: 2.75rem;
}

.field--checkbox input[type="checkbox"] {
  inline-size: 1.35rem;
  block-size: 1.35rem;
  accent-color: var(--hot-red-ink);
  flex: none;
}

.field--checkbox label {
  font-family: var(--font-data);
  font-size: 0.95rem;
  cursor: pointer;
}

/* Monospaced and letter-spaced: a six-digit code and a recovery code are read
   character by character, and proportional digits invite transposition. */
.field__input--code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.15em;
}

/* -------------------------------------------------------------- enrolment */

.qr {
  display: flex;
  justify-content: center;
  padding: 1rem;
  margin-bottom: 1rem;
  background: #ffffff;
  border: 2.5px solid var(--ink-700);
  border-radius: 16px 20px 18px 22px / 20px 16px 22px 18px;
}

/* White, not cream, and no tilt: a QR code needs quiet-zone contrast and square
   modules. Prettier here would mean a code that will not scan. */
.qr svg { width: 100%; max-width: 13rem; height: auto; }

.manual-key { margin-bottom: 1.5rem; font-family: var(--font-data); }
.manual-key summary { cursor: pointer; padding: 0.25rem 0; font-family: var(--font-display); font-size: 1.15rem; }
.manual-key__value {
  display: block;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: 0.5rem;
  background: var(--cream-100);
  border-radius: 10px;
}

.recovery-codes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.5rem;
  list-style: none;
  padding: 1rem;
  margin: 0;
  background: var(--cream-100);
  border: 2px dashed var(--ink-700);
  border-radius: 16px 20px 18px 22px / 20px 16px 22px 18px;
}

.recovery-codes code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- dashboard */

/* Figure cards. A number wants to be read before it is explained, so the value
   leads and the label follows it — the reverse of a form field. */
.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
}

.figure {
  background: var(--cream-50);
  border: 2px solid var(--ink-700);
  border-radius: 18px 22px 16px 20px / 22px 18px 20px 16px;
  padding: 1rem 1.25rem;
}

.figure__value {
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1.1;
  color: var(--ink-900);
  /* Tabular figures so a column of numbers lines up and a changing value does
     not shuffle the ones beside it. */
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.figure__value--negative { color: var(--hot-red-ink); }

.figure__label {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--ink-500);
}

.figure__note {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-500);
}

/* A plain table, for the figures a chart cannot state exactly. Every back-office
   grid is a DxGrid; these two are not, because they are small, fixed and read
   rather than sorted, and a real table needs no JavaScript to be legible. */
.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.dash-table caption {
  text-align: left;
  padding-bottom: 0.5rem;
  color: var(--ink-500);
}

.dash-table th,
.dash-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--ink-300);
  text-align: left;
}

.dash-table th[scope="col"] {
  border-bottom: 2px solid var(--ink-700);
  white-space: nowrap;
}

.dash-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* The range control reads as one group of choices, not three loose buttons. */
.range-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.range-picker__legend {
  font-size: 0.9rem;
  color: var(--ink-500);
  margin-right: 0.25rem;
}

/* The chart is given a height in rem rather than a percentage: it sits in a grid
   cell with no intrinsic height, and a percentage of nothing is nothing. */
.dash-chart { height: 20rem; }

@media (max-width: 768px) {
  .dash-chart { height: 15rem; }
}
