/* =============================================================================
   Accounts — the signed-out screens, the header identity strip, and the user
   management console.

   Kept out of theme.css deliberately: theme.css is the brand (colours, bands,
   buttons, tiles) and is loaded by every feature. This file is the one area
   that is not a feature — signing in and administering who may sign in — and
   separating it keeps a change here from repainting the Workbook.

   Every colour comes from a theme.css token, except the two avatar tints,
   which are decorative and belong to that one component.
   ========================================================================== */

/* --- Shared form controls -------------------------------------------------
   Ported from the reference's Input and Label cvas: an h-8 field with an
   --input border on a transparent ground, a text-sm muted label 0.5rem above
   it, and a blue focus ring — which is deliberately not the brand orange
   there, so it reads as "focus" rather than as an accent. */

.var-field {
  margin-bottom: 1.25rem;
}

.var-field > label {
  display: block;
  color: var(--var-grey-muted);
  font-size: 0.875rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.var-input,
.var-select {
  width: 100%;
  height: 2rem;
  background-color: transparent;
  border: 1px solid var(--var-line-strong);
  color: var(--var-fg);
  padding: 0.25rem 0.75rem;
  font-family: var(--var-font);
  font-size: 0.875rem;
  border-radius: 0;
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.var-input::placeholder {
  color: var(--var-grey-muted);
}

.var-input:focus,
.var-select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2.5px rgba(59, 130, 246, 0.4);
}

.var-select {
  appearance: none;
  height: auto;
  min-height: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--var-grey-muted) 50%),
                    linear-gradient(135deg, var(--var-grey-muted) 50%, transparent 50%);
  background-position: right 1rem center, right 0.72rem center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

/* The open list drawn dark too: without this the browser draws it white,
   with the select's light text on it. */
.var-select { color-scheme: dark; }
.var-select option { background: #1c1c1c; color: var(--var-fg); }

.var-select:disabled,
.var-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.var-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Password fields carry a reveal button inside the box (pr-10, right-3). */
.var-field-reveal {
  position: relative;
}

.var-field-reveal .var-input {
  padding-right: 2.5rem;
}

.var-field-reveal button {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  padding: 0;
  color: var(--var-grey-muted);
  cursor: pointer;
  transition: color 0.15s;
}

.var-field-reveal button:hover {
  color: var(--var-fg);
}

.var-field-hint {
  color: var(--var-warn);
  font-size: 0.75rem;
  font-weight: 600;
  margin: 0.5rem 0 0;
}

.var-field-error {
  color: #ef4444;
  font-size: 0.75rem;
  font-weight: 500;
  margin: 0.5rem 0 0;
}

/* --- Signed-out shell ------------------------------------------------------
   The wordmark strips in the top-left corner under the team's orange glow,
   and a glint crossing now and then. Over it the form,
   on a card, and — from lg up — what the portal is. Along the bottom a strip
   of pit lane, where Chief rides one formula tyre (core/js/auth_chief.js),
   behind the card. */

.var-auth-body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse 60% 55% at 0% 0%, rgba(245, 87, 2, 0.13), transparent 70%),
    radial-gradient(ellipse 50% 45% at 100% 100%, rgba(245, 87, 2, 0.08), transparent 70%),
    linear-gradient(180deg, #232323, #181818);
  background-attachment: fixed;
  background-color: #1c1c1c;
  /* The pit lane's height. From lg up the content stands centred in what is
     above it, clear of the whole lane, so the card never reaches down into
     Chief's way — not even grown by an error message. */
  --auth-lane: clamp(160px, 25vh, 260px);
}

/* --- The ground: strips and glint ------------------------------------------ */

.var-auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* In the top-left corner, under the orange glow, the wordmark's letters as
   strips (the same tile as .home-hero-streaks: one V and one A, turned sixty
   degrees, drifting one tile per loop so there is no seam), gone well before
   the card. */
.var-auth-streaks {
  position: absolute;
  inset: 0;
  -webkit-mask-image: radial-gradient(ellipse 42% 55% at 0% 0%, #000 15%, transparent 100%);
          mask-image: radial-gradient(ellipse 42% 55% at 0% 0%, #000 15%, transparent 100%);
}
.var-auth-streaks::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4200px;
  height: 4200px;
  margin: -2100px 0 0 -2100px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='66' height='52' viewBox='0 0 66 52'%3E%3Cg fill='none' stroke='%23f55702' stroke-opacity='0.16' stroke-width='1.3' stroke-linejoin='round' transform='translate(0 6)'%3E%3Cpath d='M0 0h12l11.1 19.2L34.2 0h12L23.1 40Z'/%3E%3Cpath d='M33 40h12l11.1-19.2L67.2 40h12L56.1 0Z'/%3E%3Cpath d='M-33 40h12l11.1-19.2L1.2 40h12L-9.9 0Z'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 66px 52px;
  transform: rotate(60deg);
  animation: var-auth-streaks 9s linear infinite;
}
@keyframes var-auth-streaks { to { background-position: -66px 0; } }

.var-auth-sweep {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 30%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.035), transparent);
  transform: skewX(-20deg);
  animation: var-auth-sweep 13s cubic-bezier(0.5, 0, 0.3, 1) 0.6s infinite;
}
@keyframes var-auth-sweep {
  0% { left: -40%; }
  16%, 100% { left: 140%; }
}

/* --- The pit lane and Chief -------------------------------------------------
   A darker strip of tarmac along the bottom, edged with a line of the team's
   orange. The walker is a box as tall as the lane, moved along it
   in script; his tyre stands 10% up from its bottom (chief3d's "full" frame). */
.var-auth-lane {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--auth-lane);
  z-index: 1;
  pointer-events: none;
}
.var-auth-lane::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 14%;
  background:
    linear-gradient(90deg, transparent, rgba(245, 87, 2, 0.45) 25%, rgba(245, 87, 2, 0.45) 75%, transparent) top / 100% 1px no-repeat,
    linear-gradient(180deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.45));
}

.var-auth-walker {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 100%;
  aspect-ratio: 3 / 4;
  will-change: transform;
  opacity: 0;
  transition: opacity 0.8s ease;
}
.var-auth-walker.is-here { opacity: 1; }

.var-auth-walker-stage {
  position: absolute;
  inset: 0;
}
.var-auth-walker.is-here .var-auth-walker-stage {
  pointer-events: auto;
  cursor: pointer;
}

/* His shadow, on the lane under his tyre. */
.var-auth-walker-shadow {
  position: absolute;
  left: 25%;
  right: 25%;
  bottom: 7%;
  height: 6%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.65), transparent);
}

/* What he says: a small white card above his head, with a tail. */
.var-auth-bubble {
  position: absolute;
  left: 56%;
  top: 2%;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  background: var(--var-white);
  color: #1a1a1a;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transform: translateY(-50%);
  animation: var-auth-pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.var-auth-bubble::after {
  content: "";
  position: absolute;
  left: 14px;
  bottom: -5px;
  width: 12px;
  height: 12px;
  background: inherit;
  transform: rotate(45deg);
  border-radius: 2px;
}
.var-auth-bubble.is-out {
  opacity: 0;
  transform: translateY(-20%);
  transition: opacity 0.25s, transform 0.25s;
}
@keyframes var-auth-pop {
  from { opacity: 0; transform: translateY(0) scale(0.85); }
  to { opacity: 1; transform: translateY(-50%) scale(1); }
}

/* --- The layout ------------------------------------------------------------- */

.var-auth {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 100vh;
  pointer-events: none; /* clicks fall through to Chief beside the card... */
}
.var-auth-card,
.var-auth-pitch-inner { pointer-events: auto; } /* ...but not through it */

.var-auth-form {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem 9rem;
}

@media (min-width: 640px) { .var-auth-form { padding: 3rem 1.5rem 10rem; } }
@media (min-width: 1024px) {
  .var-auth-form {
    width: 50%;
    padding: 1.5rem 3rem calc(var(--auth-lane) + 0.5rem) 5rem;
    justify-content: flex-end;
  }
}
@media (min-width: 1280px) {
  .var-auth-form { padding-left: 6rem; padding-right: 4rem; }
}

/* The card: the portal's panel (the greeting banner's border and corners),
   a little see-through, so the strips — and Chief riding behind — show
   through blurred. An orange edge across the top, fading out at its ends. */
.var-auth-card {
  position: relative;
  width: 100%;
  max-width: 27rem;
  padding: 2.5rem 2.25rem 2rem;
  border: 1px solid #2f2f2f;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(40, 40, 40, 0.8), rgba(28, 28, 28, 0.85));
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
          backdrop-filter: blur(14px) saturate(1.1);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 30px 80px -20px rgba(0, 0, 0, 0.7);
  animation: var-auth-rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 0.05s both;
}
.var-auth-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 12%;
  right: 12%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--var-orange), transparent);
}
@media (max-width: 479.98px) {
  .var-auth-card { padding: 2rem 1.25rem 1.5rem; }
}

/* The start lights: a gantry of five on the card's top edge, unseen until a
   form is sent (.is-starting, set by auth_base.html). Then the reds come on
   one by one, a beat apart, and all go out together — lights out. */
.var-auth-lights {
  position: absolute;
  top: -11px;
  left: 50%;
  display: flex;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid #333;
  border-radius: 999px;
  background: #121212;
  opacity: 0;
  transform: translate(-50%, -4px);
  transition: opacity 0.15s, transform 0.15s;
  pointer-events: none;
}
.var-auth-lights i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3a1410;
}
.var-auth-card.is-starting .var-auth-lights {
  opacity: 1;
  transform: translate(-50%, 0);
}
/* Each red stays on until the same moment, so they all go out at once. */
.var-auth-card.is-starting .var-auth-lights i {
  animation: var-auth-light calc(2500ms - var(--n) * 400ms) linear calc(var(--n) * 400ms) forwards;
}
@keyframes var-auth-light {
  0%, 99.9% { background: #ff2a1a; box-shadow: 0 0 10px 2px rgba(255, 42, 26, 0.65); }
  100% { background: #3a1410; box-shadow: none; }
}

/* Where this sign-in happens, in the desktop app: a small badge over the
   wordmark, green online, orange offline. */
.var-auth-place {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 0.4rem;
  margin: -1rem auto 1.1rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--var-line-strong);
  border-radius: 999px;
  color: var(--var-grey-muted);
  font-size: 0.7rem;
  font-weight: 600;
}
.var-auth-place::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--var-green);
}
.var-auth-place.is-offline {
  border-color: rgba(245, 87, 2, 0.4);
  color: var(--var-orange-alt);
}
.var-auth-place.is-offline::before { background: var(--var-orange); }

@keyframes var-auth-rise {
  from { opacity: 0; transform: translateY(14px); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: none; }
}

/* The brand as the header draws it — the wordmark beside "Portal" — scaled
   up, in the same proportion. */
.var-auth-brand {
  display: flex;
  justify-content: center;
  align-items: baseline; /* VAR's bottom on PORTAL's baseline (theme.css) */
  gap: 0.6rem;
  margin-bottom: 1.75rem;
  text-decoration: none;
}
.var-auth-brand img {
  height: 1.3rem;
  width: auto;
  display: block;
}
.var-auth-brand span {
  color: var(--var-orange-alt);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.025em;
  font-size: 1.8rem;
  line-height: 1;
}

.var-auth-card h1 {
  text-align: center;
  font-size: 1.75rem;
  line-height: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  text-transform: none;
  color: var(--var-white);
  margin: 0 0 0.4rem;
}

.var-auth-sub {
  text-align: center;
  color: var(--var-grey-muted);
  font-size: 0.95rem;
  font-weight: 400;
  margin: 0 0 1.75rem;
}

/* On the card the fields are a step taller and sit in a darker well, so the
   form reads as the thing to do on the page. */
.var-auth-card .var-input,
.var-auth-card .var-select {
  height: 2.5rem;
  background-color: rgba(0, 0, 0, 0.22);
  border-radius: 4px;
}
.var-auth-card .var-input:hover { border-color: rgba(255, 255, 255, 0.25); }

/* A field the browser filled in keeps the card's look: Chrome paints
   autofilled fields pale blue-white with dark text, which no background
   rule can override — only an inset shadow over it, and the text colour set
   through its own property. */
.var-auth-card .var-input:-webkit-autofill,
.var-auth-card .var-input:-webkit-autofill:hover,
.var-auth-card .var-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--var-fg);
  caret-color: var(--var-fg);
  -webkit-box-shadow: 0 0 0 100px #1d1d1d inset;
          box-shadow: 0 0 0 100px #1d1d1d inset;
  transition: background-color 9999s ease-out 0s;
}
.var-auth-card .var-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 2.5px rgba(59, 130, 246, 0.4), 0 0 0 100px #1d1d1d inset;
          box-shadow: 0 0 0 2.5px rgba(59, 130, 246, 0.4), 0 0 0 100px #1d1d1d inset;
}
.var-auth-card .var-input:focus { border-color: #2563eb; }

.var-auth-aside {
  display: flex;
  justify-content: flex-end;
  margin: -0.5rem 0 1.25rem;
  font-size: 0.75rem;
}

.var-auth-aside a {
  color: var(--var-grey-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.var-auth-aside a:hover {
  color: var(--var-orange-alt);
}

/* The button: the brand's orange, a glint across it under the pointer. */
.var-auth-submit {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 2.75rem;
  background-color: var(--var-orange);
  border: 0;
  border-radius: 4px;
  color: var(--var-white);
  font-family: var(--var-font);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0 1rem;
  cursor: pointer;
  box-shadow: 0 8px 24px -8px rgba(245, 87, 2, 0.6);
  transition: background-color 0.1s ease-in-out, box-shadow 0.2s;
}
.var-auth-submit::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: skewX(-20deg);
}
.var-auth-submit:hover::after { animation: var-auth-glint 0.7s ease-out; }
@keyframes var-auth-glint { to { left: 130%; } }

.var-auth-submit:hover {
  background-color: #e04e00;
  color: var(--var-white);
  box-shadow: 0 10px 28px -8px rgba(245, 87, 2, 0.75);
}

.var-auth-submit:active {
  transform: scale(0.98);
}

.var-auth-foot {
  text-align: center;
  color: var(--var-grey-muted);
  font-size: 0.875rem;
  margin: 1.75rem 0 0;
}

.var-auth-foot a {
  color: var(--var-orange-alt);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s;
}

.var-auth-foot a:hover {
  color: var(--var-orange);
}

.var-auth-alert {
  border-left: 3px solid var(--var-orange);
  background: rgba(245, 87, 2, 0.08);
  border-radius: 0 4px 4px 0;
  padding: 0.7rem 0.9rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
}

.var-auth-alert p:last-child {
  margin-bottom: 0;
}

.var-auth-note {
  color: var(--var-grey-muted);
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* --- What the portal is (lg and up) --------------------------------------- */
.var-auth-pitch {
  display: none;
}

@media (min-width: 1024px) {
  .var-auth-pitch {
    display: flex;
    width: 50%;
    align-items: center;
    padding: 1.5rem 5rem calc(var(--auth-lane) + 0.5rem) 3rem;
  }
}

.var-auth-pitch-inner {
  max-width: 34rem;
  animation: var-auth-rise 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s both;
}

/* A small line of capitals over the headline, ruled off in orange. */
.var-auth-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1.1rem;
  color: var(--var-orange-alt);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.var-auth-eyebrow::before {
  content: "";
  width: 2rem;
  height: 2px;
  background: var(--var-orange);
}

.var-auth-pitch h2 {
  color: var(--var-white);
  font-size: clamp(2.2rem, 3.4vw, 3.1rem);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.035em;
  text-transform: none;
  margin: 0 0 2.25rem;
}
.var-auth-pitch h2 > span { display: block; }

/* "One platform." catches the light once as the page opens, as the name in
   the homepage's greeting does (theme.css, home-shine), and keeps the orange. */
.var-auth-shine {
  background: linear-gradient(100deg, var(--var-orange) 0 40%, #ffd2b3 50%, #fff 60% 100%) 0 0 / 260% 100% no-repeat;
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  animation: home-shine 1.4s ease-in-out 0.8s both;
}

.var-auth-pitch ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.var-auth-pitch li {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.05rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.var-auth-pitch li:last-child {
  margin-bottom: 0;
}

/* Each point's icon in an orange-tinted square. */
.var-auth-pitch-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 8px;
  border: 1px solid rgba(245, 87, 2, 0.3);
  background: rgba(245, 87, 2, 0.1);
  color: var(--var-orange);
}

/* The series the team races in: their marks, quiet in grey until pointed at. */
.var-auth-series {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.75rem;
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--var-line);
}
.var-auth-series img {
  height: 1.6rem;
  width: auto;
  filter: grayscale(1) brightness(1.6);
  opacity: 0.5;
  transition: filter 0.25s, opacity 0.25s;
}
.var-auth-series img:hover {
  filter: none;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .var-auth-streaks::before,
  .var-auth-sweep,
  .var-auth-card,
  .var-auth-pitch-inner,
  .var-auth-shine,
  .var-auth-submit::after { animation: none; }
}

/* --- Header identity strip ------------------------------------------------- */

.var-topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem;
}

.var-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* --- The bell -------------------------------------------------------------
   Ported from the reference's NotificationBell: a ghost icon button (h-8 w-8
   holding a size-4 bell) with the count pinned to its top-right corner, over
   a w-80 popover that scrolls at max-h-80. */

.var-bell-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: none;
  border: 0;
  color: var(--var-fg);
  cursor: pointer;
  transition: all 0.1s ease-in-out;
}

.var-bell-button:hover,
.var-bell-button[aria-expanded="true"] {
  background-color: var(--var-orange-alt);
  color: var(--var-white);
}

.var-bell-button:active {
  transform: scale(0.98);
}

.var-bell-count {
  position: absolute;
  top: -0.125rem;
  right: -0.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 1rem;
  min-width: 1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background-color: var(--var-orange);
  color: var(--var-white);
  font-size: 0.625rem;
  font-weight: 500;
  line-height: 1;
  /* The bar's own colour, so the ring is invisible at rest and only appears
     when the button fills with orange underneath and the count would
     otherwise vanish into it. */
  box-shadow: 0 0 0 2px var(--var-black);
}

/* Bootstrap's dropdown does the opening, the outside click and the Escape;
   everything it draws is overridden back to the reference's popover. */
.var-bell-menu.dropdown-menu {
  width: 20rem;
  padding: 0;
  background-color: var(--var-surface);
  border: 1px solid var(--var-line);
  border-radius: 0;
  color: var(--var-fg);
}

.var-bell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--var-line);
}

.var-bell-head h3 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.var-bell-list {
  max-height: 20rem;
  overflow-y: auto;
}

/* Every notification the portal has is unread by definition — it is a job
   waiting to be done — so the item always carries the reference's unread
   tint, and clicking it goes to the only place it can be cleared. */
.var-bell-item {
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  border-bottom: 1px solid var(--var-line);
  background-color: rgba(245, 87, 2, 0.05);
  text-decoration: none;
  transition: background-color 0.1s ease-in-out;
}

.var-bell-item:last-child {
  border-bottom: 0;
}

.var-bell-item:hover {
  background-color: rgba(245, 87, 2, 0.1);
  text-decoration: none;
}

.var-bell-title {
  font-size: 0.875rem;
  line-height: 1.25;
  font-weight: 500;
  color: var(--var-fg);
}

.var-bell-message {
  margin-top: 0.125rem;
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--var-grey-muted);
}

.var-bell-time {
  margin-top: 0.25rem;
  font-size: 0.6875rem;
  line-height: 1rem;
  color: rgba(163, 163, 163, 0.6);
}

.var-bell-empty {
  padding: 1.5rem;
  text-align: center;
}

.var-bell-empty-icon {
  display: block;
  width: 2rem;
  height: 2rem;
  margin: 0 auto 0.5rem;
  color: rgba(163, 163, 163, 0.3);
}

.var-bell-empty p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--var-grey-muted);
}

/* Everything in the bar is text-xs; it was reading a size and a half too big. */
.var-clocks {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--var-grey-muted);
  font-size: 0.75rem;
  line-height: 1rem;
  white-space: nowrap;
}

.var-clock b {
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

/* The reference's LiveClock: the label carries an mr-1 and nothing else. */
.var-clock-label {
  margin-right: 0.25rem;
}

/* One bar, between the two clocks — the reference draws no others. */
.var-clock-sep {
  color: var(--var-line);
}

@media (max-width: 767.98px) {
  .var-clocks { display: none; }
}

@media (max-width: 575.98px) {
  .var-header .var-version { display: none; }
}

/* The account menu's button: the name as the bar has always shown it, a caret
   to say it opens, and the person mark that stands in for the name on a
   narrow bar. A button reset to look like the text it was. */
.var-whoami {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0;
  background: none;
  border: 0;
  color: var(--var-grey-muted);
  font: inherit;
  font-size: 0.75rem;
  line-height: 1rem;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.var-whoami:hover,
.var-whoami[aria-expanded="true"] {
  color: var(--var-white);
}

.var-whoami-mark { display: none; font-size: 1rem; line-height: 1; }
.var-whoami-caret { font-size: 0.6rem; opacity: 0.7; }

/* The menu: the bell's panel (.var-bell-menu), narrower — the whole account
   at its head, then what can be done with it, one row each. */
.var-account-menu.dropdown-menu { width: 16rem; }

.var-account-head {
  padding: 0.75rem;
  border-bottom: 1px solid var(--var-line);
}

.var-account-name {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  color: var(--var-fg);
}

.var-account-line,
.var-account-email {
  margin-top: 0.15rem;
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--var-grey-muted);
}

.var-account-email { overflow: hidden; text-overflow: ellipsis; }
.var-account-sep { margin: 0 0.4em; opacity: 0.6; }

/* A row: a link or a form's button, drawn alike. */
.var-account-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: none;
  border: 0;
  color: var(--var-fg);
  font: inherit;
  font-size: 0.8125rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.var-account-item:hover,
.var-account-item:focus-visible {
  background-color: rgba(245, 87, 2, 0.1);
  color: var(--var-white);
  text-decoration: none;
}

.var-account-item i,
.var-account-item .var-icon { color: var(--var-orange); }

.var-verified {
  color: var(--var-green);
  font-size: 0.8rem;
  vertical-align: middle;
}

/* The reference's Button, variant="outline" size="sm":
   an --input border over --background — a shade lighter than the bar it sits
   on, which is what makes it read as a control — filling with --accent on
   hover and pressing to 98%. */
.var-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--var-dark);
  border: 1px solid var(--var-line-strong);
  color: var(--var-fg);
  height: 2rem;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 0 1rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.1s ease-in-out;
}

/* The mark carries an mr-1.5 of its own, on top of the button's gap-2 — so
   14px between it and the word, not 8. */
.var-logout .var-icon {
  margin-right: 0.375rem;
}

.var-logout:hover,
.var-logout:focus {
  background-color: var(--var-orange-alt);
  border-color: var(--var-orange-alt);
  color: var(--var-white);
  text-decoration: none;
}

.var-logout:active {
  transform: scale(0.98);
}

/* The reference hides the identity at lg, not sm: below 1024px the clocks and
   the version still fit, but the name does not. The menu stays — Log out is
   in it — behind a person mark instead. */
@media (max-width: 1023.98px) {
  .var-whoami-name,
  .var-whoami .var-verified { display: none; }
  .var-whoami-mark { display: inline-block; }
}

/* --- Admin page head, search and table ----------------------------------------
   Once the user console's, now the Database page's (core/schema.html); the
   console itself is drawn in the Garage's materials (core/css/users.css) and
   keeps only the search box from here. A text-2xl/500 title that is NOT
   uppercased, and the shadcn Table's own metrics. */

.var-users-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.var-users-head h1 {
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  text-transform: none;
  color: var(--var-fg);
  margin: 0;
}

.var-users-count {
  display: flex;
  align-items: center;
  height: 1.25rem;
  margin: 0.25rem 0 0;
  color: var(--var-grey-muted);
  font-size: 0.875rem;
}

/* Button variant="outline" size="icon", size-8. */
.var-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  border: 1px solid var(--var-line-strong);
  background: var(--var-dark);
  color: var(--var-fg);
  text-decoration: none;
  transition: all 0.1s ease-in-out;
}

.var-icon-btn:hover {
  background: var(--var-orange-alt);
  border-color: var(--var-orange-alt);
  color: var(--var-white);
}

.var-search {
  position: relative;
  flex: 1 1 auto;
}

.var-search .var-icon {
  position: absolute;
  left: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0.875rem;
  height: 0.875rem;
  color: var(--var-grey-muted);
  pointer-events: none;
}

.var-search input {
  width: 100%;
  height: 2rem;
  background-color: transparent;
  border: 1px solid var(--var-line-strong);
  color: var(--var-fg);
  padding: 0.25rem 0.75rem 0.25rem 2rem;
  font-family: var(--var-font);
  font-size: 0.875rem;
}

.var-search input::placeholder { color: var(--var-grey-muted); }

.var-search input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2.5px rgba(59, 130, 246, 0.4);
}

/* --- The table ------------------------------------------------------------- */

.var-users-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.875rem;
  margin-top: 1rem;
}

.var-users-table th {
  height: 3rem;
  padding: 0 1rem;
  text-align: left;
  vertical-align: middle;
  font-weight: 500;
  color: var(--var-grey-muted);
  border-bottom: 1px solid var(--var-line);
}

.var-users-table td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--var-line);
}

.var-users-table tbody tr:last-child td { border-bottom: 0; }

/* --- Switch ----------------------------------------------------------------
   Used by the User Management console (core/css/users.css tints it orange
   there, where it grants something). */

/* A checkbox drawn as the reference Switch: h-6 w-11, a 5-unit thumb on
   --background, --input when off. Still a checkbox to the keyboard. */
.var-switch {
  appearance: none;
  flex: 0 0 auto;
  width: 2.75rem;
  height: 1.5rem;
  background: var(--var-line-strong);
  border: 2px solid transparent;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease;
  margin: 0;
}

.var-switch::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: var(--var-dark);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease;
}

.var-switch:checked { background: #10b981; }

.var-switch:checked::after { transform: translateX(1.25rem); }

.var-switch:focus-visible {
  outline: 2px solid var(--var-orange-alt);
  outline-offset: 2px;
}

.var-switch:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Database (core/schema.html) --------------------------------------------
   The users console's head and table, on a wider column: the tables listed
   down the left by app, the chosen one filling the right. */

.var-schema {
  max-width: 80rem;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2rem 1rem 6rem;
}

@media (min-width: 640px) { .var-schema { padding-left: 1.5rem; padding-right: 1.5rem; } }
@media (min-width: 1024px) { .var-schema { padding-left: 2rem; padding-right: 2rem; } }

.var-schema-body {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

@media (max-width: 767.98px) { .var-schema-body { grid-template-columns: minmax(0, 1fr); } }

.var-schema-list {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--var-surface-2) transparent;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (max-width: 767.98px) { .var-schema-list { position: static; max-height: 18rem; } }

.var-schema-app ul { list-style: none; margin: 0.25rem 0 0; padding: 0; }

.var-schema-link {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.3rem 0.6rem;
  border-left: 2px solid transparent;
  color: var(--var-fg);
  font-size: 0.875rem;
  text-decoration: none;
}

.var-schema-link small { color: var(--var-grey-muted); font-variant-numeric: tabular-nums; }
.var-schema-link small.is-empty { opacity: 0.5; }
.var-schema-link:hover { background: rgba(46, 46, 46, 0.5); }
.var-schema-link.is-on { border-left-color: var(--var-orange-alt); background: var(--var-surface-2); }

.var-schema-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1rem; }

.var-schema-title h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 500;
  text-transform: none;
  color: var(--var-fg);
}

.var-schema-meta { display: flex; flex-wrap: wrap; gap: 0.75rem; color: var(--var-grey-muted); font-size: 0.8rem; }

.var-schema-doc {
  margin: 0.75rem 0 0;
  max-width: 65ch;
  color: var(--var-grey-muted);
  font-size: 0.875rem;
  white-space: pre-line;
}

.var-schema-table code { color: inherit; font-size: 0.8rem; }
.var-schema-name { color: var(--var-fg) !important; }
.var-schema-table a { color: var(--var-orange-alt); text-decoration: none; }
.var-schema-table a:hover { text-decoration: underline; }

/* Field tables scroll on their own on a phone rather than widening the page. */
.var-schema-fields { table-layout: auto; display: block; overflow-x: auto; }
.var-schema-fields th { height: 2.25rem; padding: 0 0.75rem; white-space: nowrap; }
.var-schema-fields td { padding: 0.5rem 0.75rem; vertical-align: top; }
.var-schema-fields td:nth-child(-n+4) { white-space: nowrap; }

.var-schema-notes { color: var(--var-grey-muted); font-size: 0.8rem; min-width: 16rem; }
.var-schema-choices { display: block; margin-top: 0.15rem; color: var(--var-fg); opacity: 0.75; }

.var-schema-tag {
  display: inline-block;
  padding: 0 0.3rem;
  border: 1px solid var(--var-line-strong);
  color: var(--var-grey-muted);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 0.1em;
}

.var-schema-base { margin: 0.75rem 0 0; color: var(--var-grey-muted); font-size: 0.8rem; }

.var-schema-rels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.var-schema-rels p { margin: 0.35rem 0 0; font-size: 0.875rem; }
.var-schema-rels small { color: var(--var-grey-muted); margin-left: 0.35rem; }
.var-schema-none { color: var(--var-grey-muted); }

/* Flags: orange is a warning, grey a note — the findings over the fields,
   the badges on the fields themselves; the dot in the list is warnings only. */
/* The count line is a flex row, which drops the space before this. */
.var-schema-warned { color: var(--var-orange-alt); margin-left: 0.3em; }

#var-schema-level { width: 100%; height: 2rem; font-size: 0.875rem; }

.var-schema-dot {
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  margin-left: 0.3rem;
  border-radius: 50%;
  vertical-align: 0.15em;
  background: var(--var-orange-alt);
}

.var-schema-flags {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.var-schema-flags li { padding: 0.4rem 0.6rem; border-left: 2px solid var(--var-line-strong); background: rgba(46, 46, 46, 0.35); color: var(--var-grey-muted); }
.var-schema-flags li.is-warn { border-left-color: var(--var-orange-alt); color: var(--var-fg); }

.var-schema-tag.is-warn { border-color: var(--var-orange-alt); color: var(--var-orange-alt); }

.var-schema-filled { color: var(--var-grey-muted); font-variant-numeric: tabular-nums; }

/* Passkeys on the sign-in pages (apps/core/passkeys.py). */
.var-passkey { margin-top: 1.25rem; }
.var-passkey-or {
  display: flex; align-items: center; gap: 0.75rem;
  color: var(--var-grey-muted); font-size: 0.8rem; margin-bottom: 1rem;
}
.var-passkey-or::before, .var-passkey-or::after { content: ""; flex: 1; height: 1px; background: var(--var-line-strong); }
.var-passkey-btn {
  width: 100%; padding: 0.7rem 1rem; border: 1px solid var(--var-line-strong);
  background: transparent; color: var(--var-fg); font-weight: 600; cursor: pointer;
}
.var-passkey-btn:hover { border-color: var(--var-orange); }
.var-passkey-btn:disabled { opacity: 0.5; cursor: default; }
