/* Atlas admin console — Spectrum Science brand layer (Brand Book Dec 2025).
 * The locked stack is Vue + Vuetify + Tailwind (AAD3 Lock 1); a full Tailwind
 * build would replace this file. The utility classes below cover the few
 * spacing/typography needs the admin console actually uses today.
 */

/* ---- Poppins (self-hosted) — brand sans-serif. Three weights cover the
 * documented UI roles: regular for body, medium for some headings, bold for
 * titles. SF4 closure: vendor files are local under /static/vendor/fonts/;
 * no Google Fonts CDN call, the CSP font-src 'self' clause stays unchanged. */
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/vendor/fonts/poppins/poppins-400-latin.woff2")
    format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/vendor/fonts/poppins/poppins-500-latin.woff2")
    format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/vendor/fonts/poppins/poppins-700-latin.woff2")
    format("woff2");
}

/* ---- Spectrum Science brand palette (Brand Book p.18). Exposed as custom
 * properties so the rest of the file references the names, not the hexes. */
:root {
  --brand-teal: #00afaa; /* primary — Confident */
  --brand-sun: #fbaf00; /* primary — Energetic */
  --brand-onyx: #1e1e05; /* primary — Sophisticated */
  --brand-sandstone: #dbd6c1; /* primary — Optimistic */
  --brand-hot-pink: #e42d85; /* secondary — Creative (use minimally) */
  --brand-steel: #626262; /* tertiary — Strong (logo wordmark colour) */

  /* Derived working tones. The page background lifts Sandstone with white
   * so long form-pages don't sit on a saturated tan; banners and chips use
   * the full-strength brand tones. */
  --brand-page-bg: #f5f2e8; /* sandstone tinted toward white */
  --brand-teal-soft: #e0f5f4; /* teal mixed with white for active chip bg */
  --brand-sun-soft: #fff1cc; /* sun mixed with white for warning chip bg */
  /* Translucent teal wash for the tenant-scoped nav items (Accounts /
   * Contacts / Research Studies). Kept *translucent* (not the opaque
   * --brand-teal-soft) so the single token reads correctly over BOTH the
   * Onyx app bar and the white navigation drawer. No new hue — a derived
   * tone of the frozen brand Teal. See UXD3. */
  --nav-tenant-tint: color-mix(in srgb, var(--brand-teal) 18%, transparent);

  /* CMP3 (this run) — design-token mirror of CMP1 (src/theme/tokens.js) for
   * the raw-HTML edges Vuetify does not own (footer, login chrome, responsive
   * table). Role names match the token module so the two never drift. */
  --surface: #ffffff;
  --surface-muted: #faf8f1;
  --border-subtle: #e4e0d2;
  --text-primary: var(--brand-onyx);
  --text-body: var(--brand-steel);
  --text-muted: #8a8a82;
  --error-soft: #f8e0e0;

  /* Spacing + radius scale (CMP1 mirror). */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

body {
  /* Brand sans (Poppins) → Arial fallback (the brand book explicitly permits
   * Arial as the HTML substitution for Poppins). Then a final system fallback
   * for environments where neither has loaded yet. */
  font-family:
    "Poppins",
    Arial,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  margin: 0;
  background: var(--brand-page-bg);
  color: var(--brand-steel);
}

/* Headings lean on the Onyx primary so the page hierarchy reads strong; the
 * brand book pairs Onyx headings against Steel body. */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--brand-onyx);
  font-weight: 600;
}

.notice-banner {
  background: var(--brand-sun-soft);
  border-left: 4px solid var(--brand-sun);
  padding: 0.75rem 1rem;
  margin: 1rem;
  border-radius: 4px;
  font-size: 0.875rem;
  color: var(--brand-onyx);
}

.auth-banner {
  background: var(--brand-teal);
  color: white;
  margin-top: 3rem;
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-chip {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Active = Teal (brand primary, signals "go"). Suspended = Sun (warning).
 * Terminated stays in a high-contrast red-tinted Onyx so an irrecoverable
 * state reads correctly against the brand palette without recycling the
 * semantic error red. */
.status-Active {
  background: var(--brand-teal-soft);
  color: var(--brand-teal);
}
.status-Suspended {
  background: var(--brand-sun-soft);
  color: #b07900;
}
.status-Terminated {
  background: #f8e0e0;
  color: #b41c1c;
}

.error-box {
  background: #fbe7e7;
  color: #b41c1c;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin: 1rem 0;
  font-size: 0.875rem;
}

/* Validation summary anchored at the foot of a form, directly above the
 * submit button. Same colour scheme as .error-box; this class adjusts only
 * the spacing so the banner reads as belonging to the action row. */
.form-error-summary {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

/* ---- Brand footer. Onyx surface, white-KO Spectrum logo, brand-Teal links.
 * Three columns on desktop (brand / offices / contact) collapsing to a
 * single stacked column below 720 px. Office addresses are reproduced
 * verbatim from the Brand Book back-cover; the phone + email come from the
 * same page. LinkedIn is the only field the brand book does NOT supply —
 * the `href` is a `#` placeholder until the team's LinkedIn URL is wired. */
.brand-footer {
  background: var(--brand-onyx);
  color: rgba(255, 255, 255, 0.85);
  padding: 2.5rem 1.5rem 1.5rem;
  margin-top: 3rem;
}
.brand-footer__container {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr 1fr;
  gap: 2.5rem;
  max-width: 1280px;
  margin: 0 auto;
}
@media (max-width: 720px) {
  .brand-footer__container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}
.brand-footer__brand img {
  height: 36px;
  max-width: 100%;
  display: block;
}
.brand-footer__tagline {
  font-size: 0.9rem;
  margin: 1rem 0 0;
  color: rgba(255, 255, 255, 0.75);
  max-width: 28ch;
}
.brand-footer h4 {
  color: white;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.85rem;
}
.brand-footer__offices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.5rem;
  font-size: 0.85rem;
  line-height: 1.45;
}
.brand-footer__office strong {
  display: block;
  color: white;
  font-weight: 600;
  margin-bottom: 0.15rem;
}
.brand-footer__contact ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.9rem;
}
.brand-footer a {
  color: var(--brand-teal);
  text-decoration: none;
}
.brand-footer a:hover,
.brand-footer a:focus {
  text-decoration: underline;
}
.brand-footer__legal {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  margin: 2rem auto 0;
  padding-top: 1rem;
  max-width: 1280px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
}
.brand-footer__legal-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
}

/* App-bar title: wrap on word boundaries on narrow viewports instead of
 * ellipsizing. Vuetify's default (.v-toolbar-title__placeholder) sets
 * white-space:nowrap + text-overflow:ellipsis, which hides the second half
 * of "Atlas — Admin Console" on small screens. Wrap and tighten line-height
 * so two short lines still fit within the compact app-bar height. */
.v-toolbar-title__placeholder {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: break-word;
  line-height: 1.15;
}

/* Responsive list tables. Each list view's <v-table> opts in via the
 * `responsive-table` class on the wrapping element (the VCard the table
 * lives in, or a sibling wrapper). Above Vuetify's `sm` threshold (600px)
 * the table renders normally. Below it, the rows reflow as stacked cards
 * — one card per row, each cell prefixed with its column label drawn from
 * the cell's `data-label` attribute. Cells without `data-label` (typically
 * the "Actions" column) render unlabelled and right-aligned.
 *
 * Each list view's `<td>` therefore needs `data-label="…"` so the mobile
 * card view stays readable; the desktop table view ignores the attribute. */
@media (max-width: 599px) {
  .responsive-table .v-table > .v-table__wrapper > table,
  .responsive-table .v-table > .v-table__wrapper > table > thead,
  .responsive-table .v-table > .v-table__wrapper > table > tbody,
  .responsive-table .v-table > .v-table__wrapper > table > tbody > tr,
  .responsive-table .v-table > .v-table__wrapper > table > tbody > tr > td {
    display: block;
    width: 100%;
  }
  .responsive-table .v-table > .v-table__wrapper > table > thead {
    /* Visually hide column headers — each <td> shows its label inline. */
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  .responsive-table .v-table > .v-table__wrapper > table > tbody > tr {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #fff;
  }
  .responsive-table .v-table > .v-table__wrapper > table > tbody > tr > td {
    border: none;
    padding: 0.35rem 0;
    min-height: auto;
    height: auto;
    text-align: left;
    display: grid;
    grid-template-columns: 40% 1fr;
    gap: 0.5rem;
    align-items: baseline;
  }
  .responsive-table
    .v-table
    > .v-table__wrapper
    > table
    > tbody
    > tr
    > td::before {
    content: attr(data-label);
    font-weight: 600;
    color: rgba(0, 0, 0, 0.7);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  .responsive-table
    .v-table
    > .v-table__wrapper
    > table
    > tbody
    > tr
    > td:not([data-label])::before {
    content: "";
    display: none;
  }
  .responsive-table
    .v-table
    > .v-table__wrapper
    > table
    > tbody
    > tr
    > td:not([data-label]) {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding-top: 0.5rem;
  }
}

/* ====================================================================
 * Shared presentation layer (this run — UI/UX overhaul).
 * Token-driven chrome polish for the surfaces Vuetify does not fully own.
 * No behavioural change; presentation only.
 * ================================================================== */

/* Page-level rhythm: keep the main content column from butting against the
 * viewport edges and give the sandstone page a calm max-width gutter. */
.v-main {
  background: var(--brand-page-bg);
}

/* Tenant-data nav grouping (UXD3). Accounts / Contacts / Research Studies act
 * on the data *inside* the active tenant; Tenants / Platform admins are
 * fleet-level. A translucent teal wash on the tenant-scoped items groups them
 * as a set and ties them to the teal active-tenant chip that affirms context
 * (UXP3/UXD2), a standing cue beyond the tenant-gating disabled state
 * (UXG1/UXP7). Applies in both layouts — app-bar button (wide) and drawer
 * list item (compact). Vuetify's own hover/active overlays still stack on top.
 * Presentation only; the scope tag and routes (catalogs.js DD4) are unchanged. */
.nav-item--tenant.v-btn,
.nav-item--tenant.v-list-item {
  background-color: var(--nav-tenant-tint);
}
.nav-item--tenant.v-btn {
  margin-inline: 2px;
}

/* ADR8 / UXP9 / FR55 — visible keyboard focus on every interactive control.
 * Vuetify renders most focus rings, but raw <a>/<button> in the footer,
 * login chrome, and table cells need an explicit, high-contrast ring so
 * keyboard users always see where focus is. :focus-visible only — pointer
 * focus stays clean. */
a:focus-visible,
button:focus-visible,
.v-btn:focus-visible,
.v-chip:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--brand-teal);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* UXP4 loading — list skeleton rows. A subtle sandstone→white shimmer so a
 * loading list keeps the table's shape (no layout shift) without a spinner.
 * Honors prefers-reduced-motion. */
.skeleton-line {
  display: block;
  height: 0.9rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    var(--surface-muted) 25%,
    #efebdf 37%,
    var(--surface-muted) 63%
  );
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
}
@keyframes skeleton-shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton-line {
    animation: none;
  }
}

/* Login chrome — center the sign-in card on a calm sandstone field that
 * fills the viewport height so the form never floats against a bare edge. */
.login-shell {
  min-height: calc(100vh - 96px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-xl) var(--space-md);
}

/* Definition-list detail layout (CMP6) — label/value rows that read as a
 * scannable record rather than a dense Vuetify list. */
.detail-grid {
  display: grid;
  grid-template-columns: minmax(160px, 240px) 1fr;
  gap: var(--space-xs) var(--space-lg);
  align-items: baseline;
}
.detail-grid__label {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 0.2rem;
}
.detail-grid__value {
  color: var(--text-primary);
  word-break: break-word;
}
@media (max-width: 599px) {
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 0.1rem var(--space-md);
  }
  .detail-grid__label {
    padding-top: var(--space-sm);
  }
}
