/* ============================================================
   Guadalupe County — Employee ID Portal
   Flat, minimal, dark. Inspiration: modern SaaS workspaces
   (near-black surfaces, hairline borders, compact controls,
   small radii, one accent used sparingly).
   Palette stays the county's: teal accent + gold from the seal.
   ============================================================ */

:root {
  /* ---- surfaces: flat, near-black, no gradients ---- */
  --bg:        #0E0F11;
  --surface:   #14161A;
  --surface-2: #101215;
  --raised:    #191C21;

  /* ---- hairlines instead of heavy borders ---- */
  --border:    rgba(255, 255, 255, 0.07);
  --border-2:  rgba(255, 255, 255, 0.12);
  --border-3:  rgba(255, 255, 255, 0.18);

  /* ---- type ---- */
  --text:      #F3F6F9;
  --muted:     rgba(255, 255, 255, 0.70);
  --faint:     rgba(255, 255, 255, 0.52);

  /* ---- accents ---- */
  --accent:    #3FE0D0;
  --accent-ink:#04211E;   /* text on the accent fill */
  --gold:      #C6A15B;
  --danger:    #FF7A88;
  --ok:        #55D6A0;

  /* ---- geometry ---- */
  --r-card:    14px;
  --r-control: 9px;
  --r-sm:      8px;

  /* ---- the logo, in one place so it is easy to tune ---- */
  --logo:      93px;   /* 80% of 116px */

  --mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans:    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", var(--sans);
}

* { box-sizing: border-box; }

/* The `hidden` attribute must win over our display:grid/flex rules below. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* one soft top glow — the only atmospheric element left */
.bg-glow {
  position: fixed; z-index: 0; pointer-events: none;
  top: -32vh; left: 50%; transform: translateX(-50%);
  width: 130vw; height: 72vh;
  background: radial-gradient(ellipse at 50% 0%, rgba(63, 224, 208, 0.09), transparent 62%);
}

/* ---------- header: a real bar, hairline-separated ---------- */
.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  flex: none;                     /* must never be compressed by the column body */
  min-height: calc(var(--logo) + 40px);
  padding: 20px clamp(18px, 4vw, 40px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.012);
}

/* The seal needs no ring or glow of its own — the artwork already has one,
   so wrapping it only made the emblem read smaller than it is. */
.brand { display: flex; align-items: center; gap: 20px; }
.brand__badge {
  display: grid; place-items: center;
  width: var(--logo); height: var(--logo);
  flex: 0 0 auto;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.5));
}
.brand__badge img {
  width: 100%; height: 100%; display: block;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.12; }
.brand__name {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  letter-spacing: -0.01em;
}
.brand__sub {
  font-family: var(--mono); font-size: 0.62rem;
  letter-spacing: 0.26em; color: var(--accent);
  margin-top: 7px;
}

/* ---------- header actions: pushed to the corners ----------
   top-right:    <email> [Sign out]
   bottom-right:         [Change password]                          */
.topbar__right {
  align-self: stretch;
  display: flex; flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}
.topbar__row { display: flex; align-items: center; gap: 10px; }
.user-chip__mail {
  font-family: var(--mono); font-size: 0.7rem; color: var(--muted);
  max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- stage / cards ---------- */
.stage {
  position: relative; z-index: 2; flex: 1;
  display: grid; place-items: center;
  /* `minmax(0, 1fr)` and not the implicit `auto` track: an auto track is floored
     at the content's min-content width, so a nowrap line inside a card (the
     roster's metadata) silently widened the whole column past the viewport and
     produced a horizontal scrollbar on phones. */
  grid-template-columns: minmax(0, 1fr);
  padding: clamp(24px, 4vw, 52px) clamp(16px, 4vw, 40px);
}
.card {
  width: min(660px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: clamp(22px, 3vw, 34px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.42);
  animation: rise .38s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card--center { display: grid; place-items: center; gap: 16px; text-align: center; }
.card--notice { max-width: 560px; }
.card--wide { width: min(760px, 100%); }
.card__head { display: flex; gap: 24px; align-items: flex-start; justify-content: space-between; }
.card__title {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.35rem, 2.6vw, 1.6rem);
  letter-spacing: -0.015em; margin: 16px 0 8px;
}
.card__lede { color: var(--muted); font-size: 0.9rem; line-height: 1.62; margin: 0 0 4px; max-width: 48ch; }
.card--notice .card__title { margin-top: 12px; }

/* ---------- pills / labels ---------- */
.tag {
  display: inline-block;
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.16em;
  color: var(--accent);
  border: 1px solid rgba(63, 224, 208, 0.24);
  background: rgba(63, 224, 208, 0.09);
  padding: 4px 9px; border-radius: 999px;
}
.tag--warn { color: var(--gold); border-color: rgba(198, 161, 91, 0.3); background: rgba(198, 161, 91, 0.09); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
code {
  font-family: var(--mono); font-size: 0.85em;
  background: rgba(255, 255, 255, 0.06); color: var(--text);
  padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border);
}

/* ---------- forms ---------- */
.form { margin-top: 20px; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field__label {
  font-size: 0.66rem; letter-spacing: 0.14em; color: var(--faint);
  font-family: var(--mono);
}
.input {
  width: 100%; padding: 11px 13px; color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-2); border-radius: var(--r-control);
  font-size: 0.92rem; font-family: var(--sans);
  transition: border-color .16s, box-shadow .16s;
}
.input::placeholder { color: rgba(255, 255, 255, 0.55); }
.input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(63, 224, 208, 0.13);
}

/* ---------- sections ---------- */
.fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 15px; min-width: 0; }
.fieldset + .fieldset { margin-top: 4px; padding-top: 20px; border-top: 1px solid var(--border); }
.legend { padding: 0; margin-bottom: 1px; font-size: 0.66rem; letter-spacing: 0.16em; color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

.select-wrap { position: relative; display: block; }
.select { appearance: none; -webkit-appearance: none; -moz-appearance: none; padding-right: 40px; cursor: pointer; }
.select__chevron {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--faint); pointer-events: none;
}
.select option { background: #14161A; color: var(--text); }

/* ---------- buttons: compact by default ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: var(--r-control); cursor: pointer;
  font-family: var(--sans); font-weight: 600; font-size: 0.86rem;
  border: 1px solid transparent; background: transparent; color: var(--text);
  transition: background .16s, border-color .16s, color .16s, filter .16s;
  user-select: none;
  white-space: nowrap;   /* labels must never wrap inside a button */
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn--primary {
  /* Tinted glass rather than a solid slab. A full-strength --accent fill is a bright
     block against these near-black surfaces and reads as abrupt; the same hue at low
     alpha still reads as the primary action, and the hairline border gives the edge
     something to sit on so it doesn't look flat. */
  color: var(--accent);
  background: rgba(63, 224, 208, 0.11);
  border-color: rgba(63, 224, 208, 0.42);
  width: 100%;
}
.btn--primary:hover {
  background: rgba(63, 224, 208, 0.17);
  border-color: rgba(63, 224, 208, 0.62);
  color: #6BEBDE;
}
.btn--primary:active { background: rgba(63, 224, 208, 0.22); }
.btn--primary:disabled {
  opacity: .5; cursor: not-allowed;
  background: rgba(63, 224, 208, 0.06);
  border-color: rgba(63, 224, 208, 0.18);
  color: rgba(63, 224, 208, 0.55);
}

.btn--ghost {
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.74);
  background: transparent;
}
.btn--ghost:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.26);
}

/* the small variant used in the header */
.btn--sm {
  height: 30px; padding: 0 11px; gap: 6px;
  font-size: 0.75rem; font-weight: 500;
  border-radius: var(--r-sm);
}

.actions { display: flex; gap: 10px; }
.actions .btn--primary { flex: 1; }
.actions--stack { flex-direction: column; }
.actions--stack .btn { width: 100%; }
.actions--stack .btn--primary { flex: none; }

/* ---------- dropzone ---------- */
.drop {
  position: relative; display: block; cursor: pointer;
  border: 1px dashed var(--border-3);
  border-radius: 12px;
  background: var(--surface-2);
  transition: border-color .16s, background .16s;
  overflow: hidden;
}
.drop:hover, .drop.is-drag {
  border-color: var(--accent);
  background: rgba(63, 224, 208, 0.05);
}
.drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop__inner {
  display: grid; place-items: center; gap: 9px; text-align: center;
  padding: clamp(26px, 4.4vw, 40px) 22px;
}
.drop__icon { width: 30px; height: 30px; color: var(--accent); }
.drop__title { margin: 2px 0 0; font-weight: 600; font-size: 0.95rem; }
.drop__title .muted { font-weight: 400; font-size: 0.85rem; }
.drop__hint { margin: 0; font-size: 0.62rem; letter-spacing: 0.08em; color: var(--faint); }
.drop__preview { position: relative; display: grid; place-items: center; padding: 16px; }
.drop__preview img {
  width: min(220px, 56vw); aspect-ratio: 1/1; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--border-2);
}
.drop__replace { margin-top: 11px; font-size: 0.58rem; letter-spacing: 0.16em; color: var(--faint); }

/* ---------- current photo / placeholder ---------- */
.thumb { margin: 0; display: grid; gap: 9px; justify-items: center; flex: 0 0 auto; }
.thumb__frame {
  position: relative;
  width: clamp(128px, 22vw, 176px);
  aspect-ratio: 1 / 1;
  display: grid; place-items: center;
  border-radius: 12px; overflow: hidden;
  border: 1px dashed rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.02);
  transition: border-color .18s, background .18s;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* faded generic profile graphic — scales with the frame, deliberately quiet */
.thumb__ph { width: 42%; height: 42%; color: rgba(255, 255, 255, 0.15); }
.thumb figcaption {
  font-size: 0.55rem; letter-spacing: 0.2em;
  color: var(--faint); font-family: var(--mono);
}
/* once a photo exists, the placeholder chrome gives way to the photo */
.thumb--filled .thumb__frame {
  border-style: solid; border-color: var(--border-2); background: transparent;
}
.thumb--filled figcaption { color: var(--gold); }

/* ---------- progress + status ---------- */
.progress { height: 3px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.progress__bar {
  height: 100%; width: 40%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 200% 100%;
  animation: slide 1.1s linear infinite;
}
@keyframes slide { from { background-position: 200% 0; } to { background-position: 0 0; } }

.status { min-height: 1.2em; margin: 0; font-size: 0.82rem; color: var(--muted); }
.status.is-ok { color: var(--ok); }
.status.is-err { color: var(--danger); }

.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.12);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- view tabs (staff only) ---------- */
.stage__col {
  display: flex; flex-direction: column; align-items: center;
  gap: 18px; width: 100%;
  min-width: 0;   /* let the column shrink; without this its min-content wins */
}
.tabs {
  display: inline-flex; gap: 4px; padding: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border); border-radius: 10px;
}
.tab {
  border: 0; background: transparent; cursor: pointer;
  padding: 7px 14px; border-radius: 7px;
  font-family: var(--sans); font-size: 0.8rem; font-weight: 500;
  color: var(--muted);
  transition: background .16s, color .16s;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.tab.is-active { color: var(--text); background: rgba(255, 255, 255, 0.09); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- roster ---------- */
.roster { display: flex; flex-direction: column; gap: 8px; }
.person {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2);
}
.person__pic {
  width: 42px; height: 42px; flex: 0 0 auto;
  border-radius: 9px; overflow: hidden;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  font-family: var(--mono); font-size: 0.7rem; color: rgba(255, 255, 255, 0.35);
}
.person__pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.person__main { flex: 1 1 auto; min-width: 0; }
.person__name {
  font-weight: 600; font-size: 0.9rem;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.person__meta {
  font-family: var(--mono); font-size: 0.68rem; color: var(--muted);
  margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.person__actions { display: flex; gap: 6px; flex: 0 0 auto; }
.role {
  font-family: var(--mono); font-size: 0.55rem; letter-spacing: 0.14em;
  padding: 3px 7px; border-radius: 999px; border: 1px solid;
  text-transform: uppercase; white-space: nowrap;
}
.role--admin { color: var(--gold); border-color: rgba(198,161,91,.42); background: rgba(198,161,91,.10); }
.role--agent { color: var(--accent); border-color: rgba(63,224,208,.35); background: rgba(63,224,208,.09); }
.role--user  { color: var(--muted); border-color: var(--border-2); background: rgba(255,255,255,.03); }
.role--pending { color: var(--faint); border-color: var(--border); border-style: dashed; background: transparent; }

@media (max-width: 620px) {
  .person { flex-wrap: wrap; }
  /* wrap, not overflow: Edit + Reset password + Delete are wider than the card
     on the narrowest phones, and a non-wrapping row pushed the page sideways */
  .person__actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
}

/* ---------- modal (password set / change) ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(6, 7, 8, 0.72);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: fade .2s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal__panel {
  position: relative;
  width: min(480px, 100%);
  max-height: 92vh; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-card);
  padding: clamp(20px, 3vw, 28px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: rise .26s cubic-bezier(.2,.8,.2,1) both;
}
.modal__title { font-family: var(--display); font-size: 1.3rem; margin: 14px 0 8px; letter-spacing: -0.015em; }
.modal__lede { color: var(--muted); font-size: 0.88rem; line-height: 1.6; margin: 0; }
.modal__close {
  position: absolute; top: 12px; right: 12px;
  width: 28px; height: 28px; border-radius: var(--r-sm);
  display: grid; place-items: center;
  font-size: 1.05rem; line-height: 1; color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: color .16s, background .16s, border-color .16s;
}
.modal__close:hover { color: var(--text); background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.24); }
.modal__close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- footer ---------- */
.footer {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 22px 18px 26px;
  color: var(--faint); font-size: 0.63rem; letter-spacing: 0.14em;
}
.footer__lines { display: flex; flex-direction: column; gap: 5px; text-align: center; }
/* line 1 reads brighter than the credit line beneath it */
.footer__brand { color: rgba(255, 255, 255, 0.78); }

/* ---------- responsive ---------- */
@media (max-width: 620px) {
  .grid2 { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  :root { --logo: 54px; }   /* 80% of 68px */

  /* Header stacks and centres: side by side there is not room — the wordmark and
     the button labels all wrapped, and the actions sat flush to the screen edge. */
  .topbar {
    flex-direction: column; align-items: center;
    gap: 14px; padding: 16px 18px;
    text-align: center;
  }
  .brand { flex-direction: column; align-items: center; gap: 10px; }
  .brand__text { align-items: center; text-align: center; }
  .brand__name { font-size: 1.2rem; white-space: nowrap; }
  .brand__sub { white-space: nowrap; }
  .topbar__right {
    align-self: stretch;
    flex-direction: row; flex-wrap: wrap;
    align-items: center; justify-content: center;
    gap: 10px;
  }
  /* `display: contents` dissolves the inner wrapper so the address and the two
     buttons share one wrapping row — the email takes a full-width line, the
     buttons sit together on the next. */
  .topbar__row { display: contents; }
  .user-chip__mail {
    flex: 0 0 100%; order: 1;
    max-width: none; padding-right: 0;
    text-align: center;
  }
  .topbar__right .btn { order: 2; }

  /* reclaim horizontal room lost to the double gutter */
  .stage { padding: 18px 14px 26px; }
  .card { padding: 20px 18px; }
  .card__head { flex-direction: column; }
  .thumb { align-self: center; }
  .thumb__frame { width: clamp(170px, 56vw, 220px); }

  /* 16px stops iOS zooming the page when a field takes focus */
  .input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
