:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-muted: #fafbfc;
  --border: #dde2e7;
  --border-strong: #c8d0d9;
  --text: #1f2933;
  --text-muted: #5b6875;

  /* Brand palette — sampled directly from static/brand/logo-light-transparent.png (CMYK hummingbird motif). */
  --primary: #0077ae;
  --primary-strong: #005e8c;
  --brand-cyan: #00a0e7;
  --accent-magenta: #df0378;
  --accent-magenta-strong: #b80261;
  --accent-yellow: #fee907;

  --success: #1f7a4d;
  --success-bg: #caffe2;
  --warning: #9a6700;
  --warning-bg: #ffeabd;
  --danger: #b42318;
  --danger-bg: #ffafa9;
  --info: #0b5cad;
  --info-bg: #eef6ff;
  --neutral-bg: #f1f3f5;
  --light-bg: #f4f9ff;

  --header-bg: #14151a;
  --header-bg-strong: #1c1e24;
  --header-text: #f4f5f7;
  --header-text-muted: #a9adb6;
  --header-border: #2a2c33;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.06);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  --max-width: 1200px;
}

/* ---------- Base / Reset ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

body.lightbox-open {
  overflow: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
}

/* ---------- App shell ---------- */

.app-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.app-session {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.app-session__user {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.app-session__form {
  margin: 0;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  color: var(--header-text);
  text-decoration: none;
}

.app-brand:hover {
  text-decoration: none;
}

.app-brand__mark {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  object-fit: contain;
}

.app-brand__mark--menu {
  width: 40px;
  height: 40px;
}

.app-brand__mark-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 7px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  flex: 0 0 auto;
}

.app-brand__mark-wrap .app-brand__mark {
  width: 100%;
  height: 100%;
}

.app-brand__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.app-brand__title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--header-text);
}

.app-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.app-nav__desktop {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.app-nav__desktop-only {
  display: inline-flex;
}

.app-nav__link {
  display: inline-flex;
  align-items: center;
  padding: 0.625rem 0.9rem;
  border-radius: 999px;
  color: var(--header-text);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.app-nav__link:hover {
  background: var(--header-bg-strong);
  border-color: var(--header-border);
  text-decoration: none;
}

.app-nav__link--primary {
  background: var(--accent-magenta);
  color: #fff;
}

.app-nav__link--primary:hover {
  background: var(--accent-magenta-strong);
  border-color: var(--accent-magenta-strong);
}

.app-menu {
  position: relative;
  flex: 0 0 auto;
}

.app-menu[open] {
  z-index: 40;
}

.app-menu__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  padding: 0.625rem 0.9rem;
  border: 1px solid var(--header-border);
  border-radius: 999px;
  background: var(--header-bg-strong);
  color: var(--header-text);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.app-menu__trigger::-webkit-details-marker {
  display: none;
}

.app-menu__trigger:hover {
  background: var(--header-border);
}

.app-menu__trigger-label {
  font-weight: 600;
  color: var(--header-text-muted);
}

.app-menu__trigger-icon {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 18px;
}

.app-menu__trigger-icon span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--header-text);
}

.app-menu__panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 260px;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* ---------- Header search ---------- */

.app-search {
  position: relative;
  flex: 0 0 auto;
}

.app-search[open] {
  z-index: 40;
}

.app-search__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  border: 1px solid var(--header-border);
  border-radius: 999px;
  background: var(--header-bg-strong);
  color: var(--header-text);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.app-search__trigger::-webkit-details-marker {
  display: none;
}

.app-search__trigger::marker {
  content: "";
  display: none;
}

.app-search__trigger:hover {
  background: var(--header-border);
}

.app-search__trigger-icon {
  font-size: 1rem;
  line-height: 1;
}

.app-search__panel {
  min-width: 320px;
}

.app-search__panel input[type="search"] {
  width: 100%;
}

.app-search__spinner {
  align-self: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.app-search__results-wrap:empty {
  display: none;
}

.app-search__results {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: min(360px, 60vh);
  overflow-y: auto;
  list-style: none;
  padding: 0;
  margin: 0;
}

.app-search__result {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  color: var(--text);
}

.app-search__result:hover {
  background: var(--surface-muted);
  text-decoration: none;
}

.app-search__result-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-search__result-title {
  font-weight: 600;
}

.app-search__result-subtitle {
  font-size: 0.85rem;
}

.app-search__hint {
  padding: 0.4rem 0.2rem;
  font-size: 0.9rem;
}

.app-search-inline {
  position: relative;
  flex: 1 1 220px;
  max-width: 300px;
  min-width: 160px;
}

input[type="search"].app-search-inline__input {
  width: 100%;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--header-border);
  background: var(--header-bg-strong);
  color: var(--header-text);
  padding: 0.5rem 1rem;
}

.app-search-inline__input::placeholder {
  color: var(--header-text-muted);
}

.app-search-inline__spinner {
  position: absolute;
  top: 50%;
  right: 0.9rem;
  transform: translateY(-50%);
  color: var(--header-text-muted);
  font-size: 0.8rem;
}

.app-search-inline__results {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 320px;
  max-width: min(380px, calc(100vw - 2rem));
}

.app-search-inline__results:empty {
  display: none;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 0.4rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--accent-magenta);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 18px;
}

.app-menu__panel-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.25rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.app-menu__panel-user {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.app-menu__panel-user strong {
  font-size: 0.95rem;
}

.app-menu__panel-user span {
  color: var(--text-muted);
  font-size: 0.84rem;
}

.app-menu__section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.app-menu__section-title {
  padding: 0.25rem 0.35rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.app-menu__link,
.app-menu__button {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.app-menu__link:hover,
.app-menu__button:hover {
  background: var(--neutral-bg);
  text-decoration: none;
}

.app-menu__button--danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.app-menu__form {
  margin: 0;
}

.app-menu__mobile-only {
  display: none;
}

.page-shell {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-8);
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  color: var(--text-muted);
  font-size: 0.92rem;
}

.breadcrumbs span {
  color: var(--text-muted);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
}

.page-header__title h1 {
  margin: 0;
  font-size: 1.8rem;
  line-height: 1.15;
}

.page-header__title p {
  margin: var(--space-2) 0 0;
  color: var(--text-muted);
}

.page-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* ---------- Login hero ---------- */

.login-hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-6);
  align-items: stretch;
  min-height: 60vh;
  padding-top: var(--space-4);
}

.login-hero__panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-6);
}

.login-hero__mark {
  position: relative;
  width: 240px;
  height: 240px;
  max-width: 100%;
}

.login-hero__mark .brand-loader--ambient {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.login-hero__logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 110px;
  height: 110px;
  object-fit: contain;
  z-index: 1;
}

@media (min-width: 900px) {
  .login-hero__mark {
    width: 340px;
    height: 340px;
  }

  .login-hero__logo {
    width: 160px;
    height: 160px;
  }
}

.login-hero__eyebrow {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.login-hero__form {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 420px;
}

.login-card__title {
  margin: 0 0 var(--space-5);
  font-size: 1.5rem;
}

#login-submit-btn .login-submit__loader {
  display: none;
}

#login-submit-btn.is-submitting .login-submit__label {
  display: none;
}

#login-submit-btn.is-submitting .login-submit__loader {
  display: inline-block;
}

@media (max-width: 900px) {
  .login-hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }
}

/* ---------- Buttons ---------- */

.button,
button,
input[type="submit"] {
  appearance: none;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.button:hover,
button:hover,
input[type="submit"]:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  text-decoration: none;
}

.button--secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.button--secondary:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
}

.button--danger {
  background: var(--danger);
  border-color: var(--danger);
}

.button--danger:hover {
  background: #8f1c13;
  border-color: #8f1c13;
}

.button--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.button--ghost:hover {
  background: var(--neutral-bg);
  border-color: var(--border-strong);
}

.button--delete {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  background: transparent;
  color: var(--text);
  border-color: var(--danger);
}

.button--delete:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
}

.toggle-link {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.toggle-link:hover {
  background: none;
  border: none;
  color: var(--primary-strong);
  text-decoration: underline;
}

/* ---------- Cards / layout ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.card--secondary {
  background: var(--surface-muted);
}

.card--info {
  background: var(--info-bg);
}

.card + .card {
  margin-top: var(--space-4);
}

.card__header {
  margin: -1.25rem -1.25rem 1rem;
  padding: 0.9rem 1.25rem;
  background: var(--light-bg);
  border-bottom: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
}

.section-title {
  margin: var(--space-1) 0;
  font-size: 1.05rem;
  font-weight: 700;
}

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

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.grid {
  display: grid;
  gap: var(--space-4);
}

.grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stats-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: var(--space-5);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.stat-card__label {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: var(--space-2);
}

.dashboard-card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  align-items: stretch;
}

.dashboard-card {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 240px;
  min-width: 200px;
  margin-bottom: 0;
  padding-top: calc(var(--space-5) + 4px);
  border-top: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* .card + .card adds margin-top for stacked cards elsewhere; it also matches
   dashboard cards (they carry both classes) and breaks flex stretch in a row. */
.dashboard-card-grid .card.dashboard-card {
  margin-top: 0;
}

.dashboard-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--primary);
}

.dashboard-card:nth-of-type(3n+2)::before {
  background: var(--accent-magenta);
}

.dashboard-card:nth-of-type(3n)::before {
  background: var(--brand-cyan);
}

.dashboard-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.dashboard-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-3);
}

.dashboard-card__body .page-actions {
  margin-top: auto;
}

.stat-card__value {
  font-size: 1.5rem;
  font-weight: 700;
}

.meta-list {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.meta-item dt {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: var(--space-1);
}

.meta-item dd {
  margin: 0;
  font-weight: 600;
}

/* ---------- Table ---------- */

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  width: 100%;
  max-width: 100%;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.table th,
.table td {
  text-align: left;
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table th {
  background: #fbfcfd;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.table tr:last-child td {
  border-bottom: none;
}

.table-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* ---------- Chips / messages ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.chip--success {
  background: var(--success-bg);
  color: var(--success);
  border-color: #cde9d8;
}

.chip--warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: #f0d9a9;
}

.chip--danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #f5c3be;
}

.chip--info {
  background: var(--info-bg);
  color: var(--info);
  border-color: #c6def8;
}

.chip--neutral {
  background: var(--neutral-bg);
  color: var(--text-muted);
  border-color: var(--border);
}

.message-list {
  position: fixed;
  top: 1rem;
  left: max(1rem, calc((100vw - var(--max-width)) / 2 + 1rem));
  z-index: 80;
  width: min(420px, calc(100vw - 2rem));
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.message {
  --message-accent: var(--border-strong);
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0.9rem 1rem 0.9rem 1.1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  pointer-events: auto;
  text-align: left;
  animation: toast-in 0.18s ease;
}

.message::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--message-accent);
}

.message__body {
  min-width: 0;
}

.message__close {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
}

.message__close:hover {
  background: rgba(15, 23, 42, 0.06);
}

.message.success {
  --message-accent: #16603b;
  background: var(--success-bg);
  border-color: #cde9d8;
  color: var(--success);
}

.message.warning {
  --message-accent: #7a4f00;
  background: var(--warning-bg);
  border-color: #f0d9a9;
  color: var(--warning);
}

.message.error {
  --message-accent: #8f1c13;
  background: var(--danger-bg);
  border-color: #f5c3be;
  color: var(--danger);
}

.message.info {
  --message-accent: #084b8a;
  background: var(--info-bg);
  border-color: #c6def8;
  color: var(--info);
}

.message--closing {
  animation: toast-out 0.16s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

/* ---------- Brand loader (CMYK dots) ---------- */

.brand-loader {
  position: relative;
  display: inline-block;
}

.js-export-link .brand-loader {
  display: none;
  margin-left: 0.5rem;
}

.js-export-link.is-loading .brand-loader {
  display: inline-block;
}

.brand-loader__dot {
  position: absolute;
  border-radius: 999px;
}

.brand-loader--spinner {
  width: 44px;
  height: 14px;
  vertical-align: middle;
}

.brand-loader--spinner .brand-loader__dot {
  top: 0;
  width: 10px;
  height: 10px;
  animation: brand-loader-bounce 0.9s ease-in-out infinite;
}

.brand-loader--spinner .brand-loader__dot--cyan {
  left: 0;
  background: var(--brand-cyan);
  animation-delay: 0s;
}

.brand-loader--spinner .brand-loader__dot--magenta {
  left: 17px;
  background: var(--accent-magenta);
  animation-delay: 0.15s;
}

.brand-loader--spinner .brand-loader__dot--yellow {
  left: 34px;
  background: var(--accent-yellow);
  animation-delay: 0.3s;
}

@keyframes brand-loader-bounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.6;
  }
  40% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

.brand-loader--ambient {
  width: 240px;
  height: 240px;
  max-width: 100%;
}

.brand-loader--ambient .brand-loader__dot {
  animation: brand-loader-float 6s ease-in-out infinite;
}

.brand-loader--ambient .brand-loader__dot--cyan {
  top: 10%;
  left: 66%;
  width: 13px;
  height: 13px;
  background: var(--brand-cyan);
  animation-delay: 0s;
}

.brand-loader--ambient .brand-loader__dot--magenta {
  top: 22%;
  left: 80%;
  width: 9px;
  height: 9px;
  background: var(--accent-magenta);
  animation-delay: 0.8s;
}

.brand-loader--ambient .brand-loader__dot--yellow {
  top: 5%;
  left: 46%;
  width: 10px;
  height: 10px;
  background: var(--accent-yellow);
  animation-delay: 1.6s;
}

.brand-loader--ambient .brand-loader__dot--cyan.brand-loader__dot--2 {
  top: 80%;
  left: 14%;
  width: 8px;
  height: 8px;
  animation-delay: 2.4s;
}

.brand-loader--ambient .brand-loader__dot--magenta.brand-loader__dot--2 {
  top: 90%;
  left: 32%;
  width: 11px;
  height: 11px;
  animation-delay: 3.2s;
}

.brand-loader--ambient .brand-loader__dot--yellow.brand-loader__dot--2 {
  top: 68%;
  left: 4%;
  width: 7px;
  height: 7px;
  animation-delay: 4s;
}

@keyframes brand-loader-float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.55;
  }
  50% {
    transform: translate(-6px, -10px) scale(1.15);
    opacity: 0.9;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand-loader__dot {
    animation: none !important;
  }
}

.empty-state {
  padding: var(--space-6);
  text-align: center;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
}

/* ---------- Forms ---------- */

.form-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field--full {
  grid-column: 1 / -1;
}

label {
  font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 0.72rem 0.85rem;
  font: inherit;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.help-text {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.error-text {
  color: var(--danger);
  font-size: 0.88rem;
}

.field-label__required {
  color: var(--danger);
  font-weight: 700;
}

.field-label__optional {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.9em;
}

select:disabled,
input:disabled,
textarea:disabled,
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.inline-field-action {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-2);
  align-items: start;
}

.inline-field-action__field {
  min-width: 0;
}

.inline-field-action .button {
  align-self: end;
}

.readonly-value {
  display: block;
  padding: 0.72rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--text);
}

/* ---------- HTMX ---------- */

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-flex;
}

.spec-loading {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---------- Wizard ---------- */

.wizard {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface);
}

.wizard-step--active {
  border-color: #c6def8;
  background: var(--info-bg);
  color: var(--info);
}

.wizard-step--done {
  border-color: #cde9d8;
  background: var(--success-bg);
  color: var(--success);
}

.wizard-step--previous {
  border-color: var(--border);
  background: var(--neutral-bg);
  color: var(--text-muted);
}

/* ---------- Selector / manual panels ---------- */

.selector-details {
  margin-top: 0.75rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.selector-details[disabled] {
  opacity: 0.6;
  pointer-events: none;
}

.selector-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary);
}

.selector-search {
  margin-top: 0.75rem;
}

.selector-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: 0.75rem;
}

.selector-list__item {
  margin-right: 0;
}

.manual-panel {
  margin-top: 0.9rem;
  padding: var(--space-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.repeater {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.repeater-row {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  background: var(--surface-muted);
}

.repeater-row__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}

.repeater-row__title {
  font-weight: 700;
  color: var(--text);
}

/* ---------- Inventory ---------- */

.inventory-layout,
.inventory-card-stack,
.inventory-layout > *,
.inventory-layout .card,
.inventory-table-card,
.inventory-table-card .table-wrap {
  min-width: 0;
}

.inventory-table-card {
  overflow: hidden;
}

.inventory-action-grid > * {
  min-width: 0;
}

.inventory-layout {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  align-items: start;
}

.inventory-card-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.inventory-helper {
  padding: 0.95rem 1rem;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--surface-muted);
  color: var(--text);
}

.inventory-helper strong {
  display: block;
  margin-bottom: 0.35rem;
}

.inventory-action-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.inventory-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.inventory-list__item {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  align-items: flex-start;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted);
}

.inventory-list__item-main {
  min-width: 0;
}

.inventory-list__title {
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.inventory-list__meta {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.inventory-list__value {
  font-weight: 700;
  white-space: nowrap;
}

.inventory-inline-stats {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.inventory-inline-stat {
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted);
}

.inventory-inline-stat__label {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 0.25rem;
}

.inventory-inline-stat__value {
  font-weight: 700;
  font-size: 1.05rem;
}

.inventory-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.inventory-order-meta {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 1rem;
}

.inventory-order-meta__item {
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted);
}

.inventory-order-meta__label {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 0.25rem;
}

.inventory-order-meta__value {
  font-weight: 700;
}

.inventory-table-card .table-wrap {
  border: 0;
  box-shadow: none;
  border-radius: 0;
}

.inventory-report-block + .inventory-report-block {
  margin-top: 1rem;
}

.field--checkbox {
  justify-content: center;
}

.field--checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 0.25rem;
}

.inventory-summary-card {
  margin-bottom: 1rem;
}

.inventory-report-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ---------- Task / workboard ---------- */

.task-row {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1.5fr 1fr 1fr auto;
  align-items: center;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}

.task-row:last-child {
  border-bottom: none;
}

.task-row__title {
  font-weight: 700;
  margin-bottom: var(--space-1);
}

.task-row__subtitle {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.task-row__actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.task-row--focus {
  border: 1px solid var(--border-strong);
  background: var(--info-bg);
  border-radius: 12px;
  padding: 0.9rem;
}

.work-log-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  background: var(--surface-muted);
}

.workboard-item {
  padding: var(--space-4);
}

.workboard-summary-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.workboard-summary-top__main {
  min-width: 0;
  flex: 1 1 340px;
}

.workboard-summary-top__actions {
  display: flex;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.workboard-summary-bottom {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1.1fr 0.7fr 0.8fr 1.2fr;
  align-items: start;
  margin-top: 0.75rem;
}

.workboard-summary-block {
  min-width: 0;
}

.workboard-summary-block--stage {
  min-width: 180px;
}

.workboard-summary-block--quantities {
  min-width: 220px;
}

.workboard-summary__title {
  font-size: 1.08rem;
  font-weight: 700;
  margin-bottom: var(--space-1);
}

.workboard-summary__meta {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
}

.workboard-summary__label {
  display: block;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.workboard-value {
  font-weight: 600;
  color: var(--text);
}

.workboard-subvalue {
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.workboard-quantities {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
}

.workboard-toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: var(--space-3);
  color: var(--text-muted);
  user-select: none;
}

.workboard-toggle-arrow {
  width: 0.7rem;
  height: 0.7rem;
  display: inline-block;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.18s ease;
  margin-top: -0.15rem;
}

details.workboard-card[open] .workboard-toggle-arrow {
  transform: rotate(225deg);
  margin-top: 0.1rem;
}

.workboard-toggle-hint {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.workboard-flow {
  margin-top: var(--space-4);
  padding: var(--space-4);
  border: 1px solid #d9e2ea;
  border-radius: var(--radius-md);
  background: #f8fafc;
  scroll-margin-top: 6.5rem;
}

.workboard-flow__title {
  margin: 0 0 var(--space-4);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

details.workboard-card[open] {
  background: #fcfdff;
}

details.workboard-card summary {
  list-style: none;
  cursor: pointer;
}

details.workboard-card summary::-webkit-details-marker {
  display: none;
}

.workboard-card summary:hover .workboard-summary__title {
  color: var(--primary);
}

.workboard-card summary:focus-visible {
  outline: 2px solid rgba(47, 91, 138, 0.22);
  outline-offset: 4px;
  border-radius: 14px;
}

.workboard-card.is-recently-opened .workboard-flow {
  animation: workboard-reveal 0.26s ease;
  box-shadow: inset 0 0 0 2px rgba(47, 91, 138, 0.08);
}

@keyframes workboard-reveal {
  from {
    opacity: 0.65;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.workboard-filters summary {
  list-style: none;
  cursor: pointer;
}

.workboard-filters summary::-webkit-details-marker {
  display: none;
}

.workboard-filters__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.workboard-filters__meta {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 0.2rem;
}

.workboard-results__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.workboard-results__page {
  white-space: nowrap;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.pagination__actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.pagination__status {
  color: var(--text-muted);
  font-size: 0.92rem;
}

#workboard-results {
  min-height: 8rem;
}

/* ---------- Evidence / lightbox ---------- */

.stage-evidence {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: 0.5rem;
}

.stage-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  box-shadow: var(--shadow-sm);
}

.stage-thumb--large {
  width: 180px;
  height: 180px;
}

.stage-evidence-preview {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.stage-thumb-button {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  cursor: zoom-in;
}

.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.75);
}

.lightbox__dialog {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 1100px);
  max-height: 92vh;
  margin: 4vh auto;
  padding: var(--space-4);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.lightbox__image {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  margin: 0 auto;
  border-radius: var(--radius-md);
}

.lightbox__close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox__nav--prev {
  left: 1rem;
}

.lightbox__nav--next {
  right: 1rem;
}

.lightbox__counter {
  margin-top: 0.75rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.attachment-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.attachment-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  background: var(--surface-muted);
}

.attachment-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  min-width: 0;
}

.attachment-card__actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* ---------- Search / picker ---------- */

.select-filter__input {
  margin-bottom: var(--space-2);
}

.project-picker {
  position: relative;
}

.project-picker__native {
  display: block;
}

.project-picker.is-enhanced .project-picker__native {
  display: none;
}

.project-picker__input {
  width: 100%;
}

.project-picker__results[hidden],
.project-picker__selected[hidden] {
  display: none;
}

.project-picker__results {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 280px;
  overflow: auto;
  padding: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.project-picker__option {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
}

.project-picker__option:hover {
  border-color: var(--primary);
  background: #f7fbff;
}

.project-picker__selected {
  margin-top: 0.6rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: var(--success-bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.94rem;
}

.project-picker__empty {
  padding: 0.75rem 0.85rem;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.copy-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.copy-row--inline {
  flex-wrap: nowrap;
}

.copy-row__value {
  flex: 1 1 auto;
  min-width: 0;
}

.readonly-value--scroll {
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.copy-icon-button {
  flex: 0 0 auto;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.copy-icon {
  width: 1.1rem;
  height: 1.1rem;
}

.copy-feedback {
  color: var(--success);
}

.copy-feedback--error {
  color: var(--danger);
}

/* ---------- Customer portal ---------- */

.portal-task {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.portal-task__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-4);
  align-items: start;
}

.portal-task__title-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.portal-evidence {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: flex-end;
}

.portal-evidence__grid {
  display: grid;
  grid-template-columns: repeat(2, 96px);
  gap: 0.5rem;
}

.portal-evidence__image {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  box-shadow: var(--shadow-sm);
}

.portal-progress {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.portal-progress__track {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 0.6rem;
}

.portal-progress__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.portal-progress__step-number {
  width: 100%;
  min-height: 26px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--neutral-bg);
  color: var(--text-muted);
}

.portal-progress__step--done .portal-progress__step-number {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.portal-progress__step--current .portal-progress__step-number {
  background: var(--info);
  border-color: var(--info);
  color: #fff;
}

.portal-progress__step--upcoming .portal-progress__step-number {
  background: var(--neutral-bg);
  border-color: var(--border);
  color: var(--text-muted);
}

.portal-progress__step-label {
  text-align: center;
  font-size: 0.84rem;
  line-height: 1.3;
  color: var(--text-muted);
  word-break: break-word;
}

.portal-progress__step--done .portal-progress__step-label {
  color: var(--success);
  font-weight: 600;
}

.portal-progress__step--current .portal-progress__step-label {
  color: var(--info);
  font-weight: 600;
}

/* ---------- Evidence tiles ---------- */

.help-list {
  margin: 0.6rem 0 0;
  padding-left: 1.1rem;
  color: var(--text);
}

.help-list li + li {
  margin-top: 0.35rem;
}

.gallery-item-hidden {
  display: none !important;
}

.evidence-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-3);
}

.evidence-tile {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-muted);
}

.evidence-tile__image {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.evidence-tile__actions,
.evidence-tile__delete {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
}

.icon-button {
  appearance: none;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.icon-button--danger {
  color: var(--danger);
  border-color: #f2b8b2;
}

.stage-evidence__stack {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.hidden-form {
  display: none;
}

.inline-link {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--primary);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.inline-link:hover {
  color: var(--surface);
}

.stage-evidence--panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3);
  align-items: start;
}

.stage-evidence__grid {
  display: grid;
  gap: 0.4rem;
}

.stage-evidence__grid--internal {
  grid-template-columns: repeat(2, 72px);
}

.stage-thumb-grid {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  box-shadow: var(--shadow-sm);
}

/* ---------- Delivery / release ---------- */

.signature-pad {
  width: 100%;
  max-width: 100%;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: #fff;
  touch-action: none;
}

.release-preview {
  white-space: pre-wrap;
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted);
  font: inherit;
}

.release-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  padding: 1rem 1.1rem;
}

.release-card__header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.release-card__eyebrow {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.release-card__title {
  margin: 0;
  font-size: 1.1rem;
}

.release-card__meta {
  display: grid;
  gap: 0.25rem;
  min-width: 260px;
}

.release-card__section {
  margin-top: 1rem;
}

.release-card__media {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.release-card__media-box {
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  min-height: 150px;
  padding: 0.75rem;
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}


/* ---------- Dashboard shell ---------- */

.launch-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.launch-card {
  display: flex;
  flex-direction: column;
  min-height: 220px;
  height: 100%;
  margin-bottom: 0;
}

.launch-card__body {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  flex: 1 1 auto;
  min-width: 0;
}

.admin-shell {
  position: relative;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}

.admin-shell__mobile-trigger {
  display: none;
}

.admin-shell__overlay {
  display: none;
}

.admin-shell__sidebar {
  padding: 0;
  margin-bottom: 0;
  overflow: hidden;
  position: sticky;
  top: calc(72px + var(--space-4));
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.9rem;
}

.admin-nav__link {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}

.admin-nav__link:hover {
  background: var(--neutral-bg);
  border-color: var(--border);
  text-decoration: none;
}

.admin-nav__link.is-active {
  background: var(--info-bg);
  border-color: #c6def8;
  color: var(--info);
}

.admin-nav__label {
  display: block;
}

.admin-panel {
  min-width: 0;
}

.admin-panel__bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.admin-panel__menu-button {
  display: none;
}

.admin-panel__title {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.2;
}

.admin-panel__scroll {
  max-height: calc(100dvh - 12rem);
  overflow-y: auto;
  padding-right: var(--space-2);
}

.admin-panel__scroll::-webkit-scrollbar {
  width: 10px;
}

.admin-panel__scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

.admin-section-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.admin-section-card {
  margin-bottom: 0;
}

.admin-action-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.button--nav {
  background: var(--info-bg);
  color: var(--info);
  border-color: #c6def8;
}

.button--nav:hover {
  background: #dcecff;
  color: #084b8a;
  border-color: #b8d8fb;
}

.admin-shell__mobile-trigger {
  display: none;
  width: auto;
  align-self: flex-start;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: var(--space-3);
}

.admin-shell__mobile-trigger-icon {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 16px;
  flex: 0 0 auto;
}

.admin-shell__mobile-trigger-icon span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.admin-shell__sidebar .card__header {
  margin: 0;
  padding: 1rem 1.1rem;
  border-radius: 0;
}

.admin-shell__sidebar .section-title {
  margin: 0;
}

.admin-panel__menu-button {
  display: none !important;
}

/* ---------- Setup / compatibility ---------- */

.setup-step-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.setup-step-card {
  display: flex;
  flex-direction: column;
  min-height: 220px;
}

.compatibility-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.compatibility-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted);
  cursor: pointer;
}

.compatibility-item:hover {
  border-color: var(--border-strong);
  background: #fbfcfd;
}

.compatibility-item__check {
  padding-top: 0.15rem;
}

.compatibility-item__body {
  min-width: 0;
}

.compatibility-item__title-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.compatibility-item__meta {
  color: var(--text-muted);
  font-size: 0.92rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}


/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .grid--2,
  .grid--3,
  .form-grid,
  .task-row,
  .workboard-summary-bottom,
  .inline-field-action {
    grid-template-columns: 1fr;
  }

  .task-row__actions {
    justify-content: flex-start;
  }

  .page-shell {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .portal-task__top {
    grid-template-columns: 1fr;
  }

  .portal-evidence {
    align-items: flex-start;
  }

  .portal-evidence__grid {
    grid-template-columns: 96px;
  }

  .portal-evidence__item--secondary {
    display: none;
  }

  .portal-progress__track {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .portal-progress__step-label {
    display: none;
  }

  .portal-progress__step-number {
    min-height: 22px;
    font-size: 0.74rem;
  }

  .stage-evidence--panel {
    grid-template-columns: 1fr;
  }

  .lightbox__nav {
    width: 40px;
    height: 40px;
  }

  .lightbox__nav--prev {
    left: 0.5rem;
  }

  .lightbox__nav--next {
    right: 0.5rem;
  }

  .attachment-card {
    align-items: flex-start;
  }

  .attachment-card__meta {
    flex: 1 1 260px;
    min-width: 0;
  }

  .attachment-card__meta strong {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .attachment-card__actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 0 0 auto;
  }

  .app-header__inner {
    padding: 0.85rem var(--space-4);
    align-items: center;
    gap: 0.75rem;
  }

  .app-brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .app-brand__text {
    display: none;
  }

  .app-brand__mark {
    width: 42px;
    height: 42px;
  }

  .app-nav {
    width: auto;
    margin-left: auto;
  }

  .app-nav__desktop {
    display: none;
  }

  .app-nav__desktop-only {
    display: none;
  }

  .app-menu {
    width: auto;
  }

  .app-menu__trigger {
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    justify-content: center;
    border-radius: 12px;
  }

  .app-menu__trigger-label {
    display: none;
  }

  .app-menu__panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    left: auto;
    width: min(320px, calc(100vw - 2rem));
    min-width: 0;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
  }

  .app-menu__mobile-only {
    display: flex;
  }

  .app-menu__desktop-only-link {
    display: none;
  }

  .task-row {
    gap: 0.9rem;
  }

  .task-row__actions {
    width: 100%;
  }

  .task-row__actions .button {
    flex: 1 1 auto;
  }

  .release-card {
    padding: 0.85rem 0.9rem;
  }

  .release-card__header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .release-card__meta {
    min-width: 0;
  }

  .release-card__media-box {
    min-height: 120px;
  }

  .release-preview {
    padding: 0.85rem;
    font-size: 0.98rem;
  }

  .meta-list {
    grid-template-columns: 1fr;
  }

  .delivery-form-layout {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  .delivery-form-layout > .card {
    margin-top: 0;
  }

  .release-preview-panel {
    scroll-margin-top: 7rem;
  }

  .release-card__section .table-wrap {
    overflow-x: auto;
  }

  .help-panel summary {
    list-style: none;
    cursor: pointer;
  }

  .help-panel summary::-webkit-details-marker {
    display: none;
  }

  .help-panel__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
  }

  .help-panel__summary-text {
    color: var(--text-muted);
    font-size: 0.9rem;
  }

  .release-card__media {
    grid-template-columns: 1fr;
  }

  .workboard-summary-top {
    flex-direction: column;
    align-items: stretch;
  }

  .workboard-summary-top__actions {
    justify-content: flex-start;
  }

  .workboard-quantities {
    grid-template-columns: 1fr 1fr;
  }

  .message-list {
    left: 1rem;
    right: 1rem;
    width: auto;
  }

  .workboard-item {
    padding: var(--space-4) var(--space-3);
  }

  .workboard-summary-top__main {
    min-width: 0;
    flex: 0 1 auto;
  }

  .workboard-summary-top__actions {
    margin-top: 0.15rem;
  }

  .workboard-toggle-row {
    margin-top: 0.75rem;
  }

  .workboard-summary__title {
    font-size: 1rem;
  }

  .workboard-summary__meta {
    font-size: 0.92rem;
  }

  .workboard-summary-bottom {
    gap: 0.9rem;
    margin-top: 0.5rem;
  }

  .workboard-summary-block--quantities {
    min-width: 0;
  }

  .workboard-quantities {
    gap: 0.35rem 0.75rem;
    font-size: 0.92rem;
  }

  .workboard-results__header {
    align-items: flex-start;
  }

  .pagination {
    align-items: flex-start;
  }

  .repeater-row__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .inventory-action-grid,
  .inventory-inline-stats,
  .inventory-order-meta {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .inventory-layout > *,
  .inventory-card-stack,
  .inventory-layout .card {
    min-width: 0;
  }

  .inventory-layout {
    grid-template-columns: 1fr;
  }

  .inventory-list__item {
    flex-direction: column;
    gap: var(--space-2);
  }

  .inventory-list__value {
    white-space: normal;
  }

  .launch-grid {
    grid-template-columns: 1fr;
  }

  .launch-card {
    min-height: 180px;
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-shell__mobile-trigger {
    display: inline-flex;
  }

  .admin-shell__sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(82vw, 320px);
    max-width: 320px;
    border-radius: 0 18px 18px 0;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 70;
    padding-top: calc(64px + var(--space-4));
    box-shadow: var(--shadow-md);
  }

  .admin-shell__overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(15, 23, 42, 0.42);
    border: 0;
    padding: 0;
    margin: 0;
  }

  .admin-shell.is-drawer-open .admin-shell__sidebar {
    transform: translateX(0);
  }

  .admin-shell.is-drawer-open .admin-shell__overlay {
    display: block;
  }

  .admin-panel__bar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 0.2rem 0 0.75rem;
    background: var(--bg);
  }

  .admin-panel__scroll {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .admin-shell__overlay[hidden] {
    display: none !important;
  }

  .setup-step-grid {
    grid-template-columns: 1fr;
  }
}