/*
 * app.css — served stylesheet for alb-portal (F1).
 *
 * Brand tokens come from the ALB proforma/branding (MOCKUP-REVIEW.md).
 * In production the Tailwind utility layer is compiled via the standalone CLI
 * (see README "Frontend assets"); this file additionally hosts the hand-authored
 * brand layer below. No CDN is used.
 */

:root {
  --alb-red: #e31e24;
  --alb-ink: #1a1a1a;
  --alb-tint: #fdecec;
  --alb-paper: #ffffff;
  --alb-muted: #6b7280;
  --alb-border: #e5e7eb;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

.alb-body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--alb-ink);
  background: var(--alb-paper);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header — wordmark and sub-label sit side by side with a divider, never
 * overlapping (MOCKUP-REVIEW finding #4). */
.alb-header {
  background: var(--alb-ink);
  color: var(--alb-paper);
  border-bottom: 4px solid var(--alb-red);
}

.alb-header__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.alb-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.alb-brand__mark {
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--alb-red);
}

.alb-brand__divider {
  width: 1px;
  height: 1.1rem;
  background: rgba(255, 255, 255, 0.35);
}

.alb-brand__sub {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--alb-paper);
  white-space: nowrap;
}

.alb-nav {
  display: inline-flex;
  gap: 1rem;
  font-size: 0.9rem;
}

.alb-main {
  flex: 1 1 auto;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.alb-footer {
  border-top: 1px solid var(--alb-border);
  color: var(--alb-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 1.25rem;
}

/* Error pages */
.alb-error {
  text-align: center;
  padding: 3rem 1rem;
}

.alb-error__code {
  font-size: 3rem;
  font-weight: 800;
  color: var(--alb-red);
  margin: 0;
}

.alb-error__title {
  font-size: 1.25rem;
  margin: 0.5rem 0 1.5rem;
}

.alb-error__hint a {
  color: var(--alb-red);
}

/* Auth screens (login, activation) */
.alb-auth {
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}

.alb-auth__card {
  width: 100%;
  max-width: 420px;
  background: var(--alb-paper);
  border: 1px solid var(--alb-border);
  border-radius: 10px;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.alb-auth__title {
  font-size: 1.4rem;
  margin: 0 0 0.5rem;
}

.alb-auth__subtitle {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.5rem;
}

.alb-auth__hint {
  color: var(--alb-muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.alb-auth__error {
  background: var(--alb-tint);
  color: var(--alb-red);
  border: 1px solid var(--alb-red);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.alb-auth__form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.alb-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.alb-field__label {
  font-size: 0.85rem;
  font-weight: 600;
}

.alb-field__input {
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--alb-border);
  border-radius: 6px;
  font-size: 1rem;
}

.alb-field__input:focus {
  outline: 2px solid var(--alb-red);
  outline-offset: 1px;
}

.alb-btn {
  display: inline-block;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.alb-btn--primary {
  background: var(--alb-red);
  color: var(--alb-paper);
}

.alb-btn--ghost {
  background: transparent;
  color: var(--alb-paper);
  border-color: rgba(255, 255, 255, 0.4);
}

.alb-auth__qr {
  display: block;
  margin: 0 auto 0.75rem;
  border: 1px solid var(--alb-border);
  border-radius: 6px;
}

.alb-auth__secret {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.alb-auth__codes {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

.alb-nav__user {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
}

.alb-nav__logout {
  margin: 0;
}

.alb-link {
  color: var(--alb-red);
}

/* ----- Ops panel (internal) ------------------------------------------- */

.alb-nav__link {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-weight: 500;
}

.alb-nav__link:hover {
  color: var(--alb-paper);
}

.alb-ops__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--alb-muted);
  margin: 0 0 0.25rem;
}

.alb-ops__title {
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
}

.alb-ops__sub {
  color: var(--alb-muted);
  margin: 0 0 1.25rem;
}

.alb-ops__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.alb-ops__actions {
  margin-top: 0.5rem;
}

/* Filters */
.alb-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

/* Tables — dark header, per ALB brand (MOCKUP-REVIEW). */
.alb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  border: 1px solid var(--alb-border);
  border-radius: 8px;
  overflow: hidden;
}

.alb-table__head {
  background: var(--alb-ink);
  color: var(--alb-paper);
}

.alb-table__head th {
  text-align: left;
  padding: 0.65rem 0.8rem;
  font-weight: 600;
}

.alb-table td {
  padding: 0.6rem 0.8rem;
  border-top: 1px solid var(--alb-border);
}

.alb-table .num {
  text-align: right;
}

.alb-table__ref {
  font-weight: 600;
}

.alb-table__empty {
  text-align: center;
  color: var(--alb-muted);
  padding: 1.25rem;
}

.muted {
  color: var(--alb-muted);
}

/* Status badges — one tint, status name carried in the label. */
.alb-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--alb-tint);
  color: var(--alb-red);
  border: 1px solid var(--alb-red);
}

.alb-badge--closed {
  background: #eef2f7;
  color: var(--alb-muted);
  border-color: var(--alb-border);
}

/* Cards + detail grid */
.alb-card {
  border: 1px solid var(--alb-border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.alb-card__title {
  font-size: 1.05rem;
  margin: 0 0 0.9rem;
}

.alb-detail {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 720px) {
  .alb-detail {
    grid-template-columns: 1fr;
  }
}

.alb-facts {
  margin: 0;
}

.alb-facts__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--alb-border);
}

.alb-facts dt {
  color: var(--alb-muted);
  font-size: 0.85rem;
}

.alb-facts dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

/* Status panel + timeline */
.alb-status {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  align-items: flex-start;
}

.alb-status__terminal {
  color: var(--alb-muted);
  font-size: 0.9rem;
  margin: 0;
}

.alb-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.alb-timeline__empty {
  color: var(--alb-muted);
  font-size: 0.9rem;
  margin: 0;
}

.alb-event {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.45rem 0.6rem;
  border-left: 3px solid var(--alb-red);
  background: var(--alb-tint);
  border-radius: 0 6px 6px 0;
}

.alb-event__type {
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.alb-event__time {
  color: var(--alb-muted);
  font-size: 0.8rem;
}

.alb-event__note {
  font-size: 0.9rem;
}

/* Forms */
.alb-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.alb-form--inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.6rem;
  margin-top: 1rem;
}

.alb-form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.alb-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.alb-field__input--compact {
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
}

.alb-btn--muted {
  background: transparent;
  color: var(--alb-ink);
  border-color: var(--alb-border);
  text-decoration: none;
}

/* Modal */
.alb-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem;
  overflow-y: auto;
  z-index: 50;
}

.alb-modal__card {
  width: 100%;
  max-width: 640px;
  background: var(--alb-paper);
  border-radius: 10px;
  padding: 1.75rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.alb-modal__title {
  margin: 0 0 1rem;
  font-size: 1.2rem;
}

/* ----- Client portal (dashboard, list, detail) ------------------------ */

.alb-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--alb-muted);
  margin: 0 0 0.25rem;
}

.alb-page-title {
  font-size: 1.6rem;
  margin: 0 0 0.3rem;
}

.alb-page-sub {
  color: var(--alb-muted);
  margin: 0;
  font-size: 0.95rem;
}

.alb-portal__head {
  margin-bottom: 1.5rem;
}

.alb-portal__head--row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.alb-portal__title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.3rem;
}

.alb-portal__section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.5rem 0 0.75rem;
}

.alb-portal__section-head .alb-card__title {
  margin: 0;
}

.alb-field--grow {
  flex: 1 1 14rem;
}

/* KPI row */
.alb-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 720px) {
  .alb-kpis {
    grid-template-columns: 1fr;
  }
}

.alb-kpi {
  border: 1px solid var(--alb-border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  background: var(--alb-paper);
}

.alb-kpi--accent {
  border-color: var(--alb-red);
  background: var(--alb-tint);
}

.alb-kpi__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--alb-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.alb-kpi__value {
  font-size: 1.7rem;
  font-weight: 800;
  margin: 0.35rem 0 0.2rem;
  line-height: 1.1;
}

.alb-kpi__foot {
  font-size: 0.8rem;
  color: var(--alb-muted);
}

/* CTA + breadcrumb */
.alb-cta-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.alb-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.alb-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--alb-muted);
  margin-bottom: 1rem;
}

.alb-breadcrumb__sep {
  color: var(--alb-border);
}

/* Stack helper for detail columns */
.alb-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Facts grid (detail) */
.alb-factgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

@media (max-width: 720px) {
  .alb-factgrid {
    grid-template-columns: 1fr 1fr;
  }
}

.alb-fact {
  border: 1px solid var(--alb-border);
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
}

.alb-fact--accent {
  border-color: var(--alb-red);
  background: var(--alb-tint);
}

.alb-fact--accent .alb-fact__value {
  color: var(--alb-red);
}

.alb-fact__label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--alb-muted);
  font-weight: 600;
}

.alb-fact__value {
  font-weight: 700;
  margin-top: 0.2rem;
}

.alb-fact__sub {
  font-size: 0.8rem;
  color: var(--alb-muted);
  margin-top: 0.1rem;
}

.alb-fact__desc {
  margin: 0.9rem 0 0;
  color: var(--alb-ink);
  font-size: 0.9rem;
}

.cell-strong {
  font-weight: 700;
}

/* Placeholder block (photos & documents, filled in a later ticket) */
.alb-placeholder {
  border: 1px dashed var(--alb-border);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  color: var(--alb-muted);
  font-size: 0.9rem;
}

/* Upcoming-tasks list (dashboard) */
.alb-tasklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.alb-tasklist__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-top: 1px solid var(--alb-border);
}

.alb-tasklist__item:first-child {
  border-top: none;
}

.alb-tasklist__title {
  font-weight: 600;
}

.alb-tasklist__meta {
  font-size: 0.82rem;
  color: var(--alb-muted);
}

/* Lifecycle timeline ladder */
.alb-tl {
  list-style: none;
  margin: 0;
  padding: 0;
}

.alb-tl__item {
  display: grid;
  grid-template-columns: 1.6rem 1fr;
  gap: 0.6rem;
  padding-bottom: 1rem;
  position: relative;
}

.alb-tl__item::before {
  /* connecting rail */
  content: "";
  position: absolute;
  left: 0.75rem;
  top: 1.6rem;
  bottom: 0;
  width: 2px;
  background: var(--alb-border);
}

.alb-tl__item:last-child {
  padding-bottom: 0;
}

.alb-tl__item:last-child::before {
  display: none;
}

.alb-tl__node {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  border: 2px solid var(--alb-border);
  background: var(--alb-paper);
  color: var(--alb-muted);
  z-index: 1;
}

.alb-tl__item--done .alb-tl__node {
  background: var(--alb-ink);
  border-color: var(--alb-ink);
  color: var(--alb-paper);
}

.alb-tl__item--current .alb-tl__node {
  background: var(--alb-red);
  border-color: var(--alb-red);
  color: var(--alb-paper);
}

.alb-tl__title {
  font-weight: 600;
}

.alb-tl__item--pending .alb-tl__title,
.alb-tl__item--pending .alb-tl__meta {
  color: var(--alb-muted);
}

.alb-tl__meta {
  font-size: 0.8rem;
  color: var(--alb-muted);
}

.alb-tl__note {
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

/* Tonal consignment-status badges (status_badge macro emits a tone, not the raw
 * status). `active` keeps the brand-red accent; the rest are calm tints. */
.alb-badge--active {
  background: var(--alb-tint);
  color: var(--alb-red);
  border-color: var(--alb-red);
}

.alb-badge--info {
  background: #eef2f7;
  color: #334155;
  border-color: #cbd5e1;
}

.alb-badge--muted {
  background: #eef2f7;
  color: var(--alb-muted);
  border-color: var(--alb-border);
}

/* Tonal task-status badges (planned / in_progress / done / blocked) */
.alb-badge--planned {
  background: #eef2f7;
  color: var(--alb-muted);
  border-color: var(--alb-border);
}

.alb-badge--in_progress {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.alb-badge--done {
  background: #ecfdf5;
  color: #047857;
  border-color: #6ee7b7;
}

.alb-badge--blocked {
  background: var(--alb-tint);
  color: var(--alb-red);
  border-color: var(--alb-red);
}

/* on_hold reads as neutral on the client side ("Pending ALB review") — no
 * amber alarm, no reason surfaced. */
.alb-badge--on_hold {
  background: #eef2f7;
  color: var(--alb-muted);
  border-color: var(--alb-border);
}

/* -- Files (US-020) ------------------------------------------------------- */

/* Ops upload + management grid */
.alb-files__upload {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.alb-files__subhead {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--alb-muted);
  margin: 1rem 0 0.5rem;
}

.alb-files__empty {
  color: var(--alb-muted);
  font-size: 0.9rem;
  margin: 0;
}

.alb-filegrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.alb-file-card {
  border: 1px solid var(--alb-border);
  border-radius: 8px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.alb-file-card__thumb {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--alb-tint);
}

.alb-file-card__doc {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  border-radius: 6px;
  background: var(--alb-tint);
  color: var(--alb-red);
  font-weight: 700;
  text-decoration: none;
}

.alb-file-card__name {
  font-size: 0.8rem;
  word-break: break-all;
}

.alb-file-card__del {
  align-self: flex-start;
  padding: 0.15rem 0.5rem;
  font-size: 0.78rem;
}

/* Client gallery + documents */
.alb-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
}

.alb-gallery__item {
  position: relative;
  display: block;
  border-radius: 8px;
  overflow: hidden;
}

.alb-gallery__item img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
}

.alb-gallery__tag {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}

.alb-doclist {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}

.alb-doclist__item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--alb-border);
}

.alb-doclist__item:first-child {
  border-top: none;
}

.alb-doclist__link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.alb-doclist__icon {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--alb-red);
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
}

/* CSS-only :target lightbox (no script → CSP-safe) */
.alb-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.alb-lightbox:target {
  display: flex;
}

.alb-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
}

.alb-lightbox__img {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 6px;
}

.alb-lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2rem;
  line-height: 1;
  color: #fff;
  text-decoration: none;
}

/* -- Release requests (US-031) ------------------------------------------- */

/* Tonal release-request status badges. */
.alb-badge--submitted {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.alb-badge--in_preparation {
  background: #fffbeb;
  color: #b45309;
  border-color: #fcd34d;
}

.alb-badge--released {
  background: #ecfdf5;
  color: #047857;
  border-color: #6ee7b7;
}

.alb-badge--rejected {
  background: var(--alb-tint);
  color: var(--alb-red);
  border-color: var(--alb-red);
}

/* Inline notice panel (release modal info / rejection reason). */
.alb-notice {
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  margin: 0 0 1rem;
  font-size: 0.9rem;
  background: var(--alb-tint);
  border: 1px solid var(--alb-border);
}

.alb-notice--info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e3a8a;
}

/* Per-field validation message, shown under the input. */
.alb-field__error {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--alb-red);
}

.alb-field__hint {
  font-size: 0.8rem;
  color: var(--alb-muted);
  margin: 0.25rem 0 0.75rem;
}

/* Checkbox field (VAT exemption): horizontal label + box. */
.alb-field--check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

/* Ops release card action forms, stacked. */
.alb-rr-card__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}
