/* YOUNEET — authentication, account & admin-portal UI.
   Built on the design tokens and visual language of styles.css:
   surface cards, soft borders, 999px pills, the accent gradient,
   uppercase micro-labels, and the fade-up entrance motion. */

/* ---------- account (header) ---------- */
.header-actions { position: relative; }
.account { display: flex; align-items: center; gap: 8px; }
.account-signin { height: 36px; padding: 0 16px; font-size: 0.9rem; }

.account-chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-3) 0 4px;
  background: var(--surface);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-xs);
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
}
.account-chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}
.account-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-grad);
  color: var(--text-on-accent);
  font-size: 0.74rem;
  font-weight: 700;
  box-shadow: 0 2px 8px -2px rgba(139, 92, 246, 0.5);
}
.account-email {
  max-width: 150px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.sync-status { font-size: 0.72rem; color: var(--text-mute); white-space: nowrap; }
.sync-status:empty { display: none; }   /* idle state stays out of the way */
.sync-status[data-state="saving"] { color: var(--ml1); }
.sync-status[data-state="error"]  { color: var(--bad); }

.account-menu {
  position: absolute;
  top: 46px; right: 0;
  min-width: 240px;
  padding: var(--space-2);
  z-index: 60;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: fade-up var(--duration-fast) var(--ease-out) both;
}
.account-menu-meta {
  padding: 10px; margin-bottom: 4px;
  font-size: 0.76rem; color: var(--text-mute);
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}
.account-menu-email { color: var(--text); font-weight: 600; font-size: 0.84rem; }
.account-menu-plan {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px;
}
.account-menu-compare {
  margin-left: auto;
  font-size: 0.74rem;
  color: var(--accent-2);
  text-decoration: none;
}
.account-menu-compare:hover { text-decoration: underline; }
.account-menu button {
  display: block; width: 100%; text-align: left;
  padding: 9px var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-dim);
  font-size: var(--text-sm);
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
}
.account-menu button:hover { background: var(--surface-hover); color: var(--text); }

/* ─────────────────────────────────────────────────────────────────────
   Modals — backdrop, card, header, fields
   ───────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-6);
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  backdrop-filter: blur(10px) saturate(1.3);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  animation: modal-fade var(--duration) var(--ease-out) both;
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  position: relative;
  width: 100%; max-width: 440px;
  padding: var(--space-7);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  animation: fade-up var(--duration-slow) var(--ease-out) both;
}
.modal-wide { max-width: 580px; }

.modal-close {
  position: absolute; top: var(--space-4); right: var(--space-4);
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface);
  color: var(--text-mute);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}
.modal-close:hover {
  color: var(--text);
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.modal-card h2 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
  padding-right: 42px;
  letter-spacing: var(--tracking-tight);
}
.modal-card p {
  color: var(--text-dim);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-5);
}
.modal-card label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 600;
}

.field-input {
  width: 100%; height: 44px;
  padding: 0 var(--space-4);
  margin-bottom: var(--space-4);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-family: inherit;
  /* 16px keeps iOS Safari from zooming the viewport on focus */
  font-size: 16px;
  transition: border-color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}
.field-input::placeholder { color: var(--text-mute); }
.field-input:hover { border-color: var(--text-mute); }
.field-input:focus {
  outline: none;
  border-color: var(--accent-1);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-1) 24%, transparent);
}
/* Invalid-state input — red border + soft red glow. Set + cleared by JS
   via aria-invalid (mirrors the .field-error sibling visibility). */
.field-input[aria-invalid="true"] {
  border-color: var(--bad);
  background: color-mix(in srgb, var(--bad) 5%, var(--surface));
}
.field-input[aria-invalid="true"]:focus {
  border-color: var(--bad);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 24%, transparent);
}

/* Per-field error message slot. Sits directly under the input it belongs
   to so the user sees exactly which input is wrong without scanning a
   modal-level summary. The `field-input + field-error` rule pulls the
   slot up so its top edge touches the input's bottom edge (the input has
   margin-bottom for layout; cancel that when a sibling error is shown). */
.field-error {
  margin: -10px 0 var(--space-3);
  padding: 6px 10px;
  font-size: 0.78rem; line-height: 1.4;
  color: var(--bad);
  background: color-mix(in srgb, var(--bad) 8%, transparent);
  border-left: 2px solid var(--bad);
  border-radius: var(--radius-xs);
  animation: field-error-pop .14s ease-out;
}
.field-error[hidden] { display: none; }
@keyframes field-error-pop {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .field-error { animation: none; }
}
.field-input[readonly] {
  opacity: 0.7; cursor: not-allowed;
  background: var(--surface-strong);
}
.field-input[readonly]:hover { border-color: var(--border-strong); }
select.field-input { height: 44px; cursor: pointer; }

/* International phone field — country picker + formatted number on one row.
   The two controls carry .field-input so they inherit the standard input
   styling; the wrapper owns the bottom margin and the flex layout. */
.phone-field {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  align-items: stretch;
}
.phone-field .field-input { margin-bottom: 0; }
.phone-field .phone-country {
  /* phone.js measures and sets the exact width to fit "flag + dial code" for the
     selected country (a native <select> would otherwise reserve room for its
     widest option — the long names). This 7rem is just a pre-measurement
     fallback so the control doesn't briefly balloon before JS sizes it. */
  flex: 0 0 auto;
  width: 7rem;
  padding-left: var(--space-3);
  padding-right: var(--space-2);
}
.phone-field .phone-number {
  flex: 1 1 auto;
  min-width: 0;
}

/* ─────────────────────────────────────────────────────────────────────
   One-time-code input — six boxes (Stripe/Apple/GitHub pattern)
   ───────────────────────────────────────────────────────────────────── */
.otp-input {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.otp-box {
  flex: 1 1 0;
  min-width: 0;
  height: 56px;
  padding: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  font-feature-settings: 'tnum';
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  caret-color: var(--accent-1);
  transition: border-color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}
.otp-box:hover { border-color: var(--text-mute); }
.otp-box:focus {
  outline: none;
  border-color: var(--accent-1);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-1) 24%, transparent);
  transform: translateY(-1px);
}
/* Filled boxes are tagged via .is-filled by the JS so we can style them
   distinctly — pure-CSS detection of input value isn't reliable when the
   value is set programmatically (placeholder-shown / :valid both miss). */
.otp-box.is-filled:not(:focus) {
  border-color: color-mix(in srgb, var(--accent-1) 60%, var(--border-strong));
  background: color-mix(in srgb, var(--accent-1) 5%, var(--surface));
}
.otp-box[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Tiny phones — drop box height a touch so the modal stays compact */
@media (max-width: 380px) {
  .otp-box { height: 52px; font-size: 1.35rem; }
  .otp-input { gap: 6px; }
}

.modal-error {
  margin-bottom: 14px; padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--bad); font-size: 0.82rem;
  border: 1px solid color-mix(in srgb, var(--bad) 45%, transparent);
  background: color-mix(in srgb, var(--bad) 9%, transparent);
}
/* Non-alarming variant — used for "no account here yet, want to create
   one?" where the situation is recoverable and a red error reads as alarm. */
.modal-error.modal-soft {
  color: var(--text-dim);
  border-color: var(--border-strong);
  background: var(--surface-2);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
/* Inline link inside a paragraph or soft error — looks like a link, not the
   usual block-level modal-link. Underlines on hover so it's discoverable. */
.modal-link-inline {
  background: none; border: 0; padding: 0;
  color: var(--accent-2); font: inherit; font-weight: 600;
  cursor: pointer;
}
.modal-link-inline:hover { text-decoration: underline; }

.modal-actions {
  display: flex; gap: 12px; justify-content: flex-end; margin-top: 8px;
}
.modal-actions-split { justify-content: space-between; align-items: center; }

.modal-link {
  background: none; border: 0; padding: 8px 0;
  color: var(--text-mute); font-size: 0.84rem;
  transition: color .15s;
}
.modal-link:hover { color: var(--text-dim); }
.auth-switch { text-align: center; margin-top: 16px; }
.auth-switch .modal-link { color: var(--accent-2); }
.auth-switch .modal-link:hover { text-decoration: underline; }
#clerk-captcha { margin: 6px 0; }

/* ─────────────────────────────────────────────────────────────────────
   Admin portal — section cards + tables
   ───────────────────────────────────────────────────────────────────── */
.admin-card {
  margin-bottom: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.admin-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
}
.admin-card-head h2 { font-size: var(--text-md); }
.admin-card-body { padding: 4px var(--space-2) var(--space-2); overflow-x: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.admin-table th {
  text-align: left;
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-mute);
  font-weight: 600;
}
.admin-table td {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-dim);
}
.admin-table td strong { color: var(--text); font-weight: 600; }
.admin-table tbody tr { transition: background var(--duration-fast) var(--ease-out); }
.admin-table tbody tr:hover td { background: var(--surface-hover); }
.admin-empty {
  text-align: center;
  color: var(--text-mute);
  padding: var(--space-7) var(--space-4);
}
/* Keep this a real table cell (do NOT use display:flex here): a flex td
   shrinks to its buttons, so on taller rows — e.g. an auditor's two-line
   Status/Access cell — the row-hover background stops at the button height and
   leaves the bottom-right of the row unhighlighted. As a table cell its
   background fills the full row height. Buttons lay out inline, right-aligned. */
.admin-actions { text-align: right; white-space: nowrap; }
.admin-actions > .btn-mini { vertical-align: middle; }
.admin-actions > .btn-mini + .btn-mini { margin-left: var(--space-1); }

/* ─ Small table-action button ─ */
.btn-mini {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 5px var(--space-3);
  min-height: 30px;
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}
.btn-mini:hover {
  color: var(--text);
  background: var(--surface-hover);
  border-color: var(--text-mute);
}
.btn-mini.danger:hover {
  color: var(--bad);
  border-color: var(--bad-border);
  background: var(--bad-soft);
}

/* ─ Danger button — same family as .btn-primary, red glow ─ */
.btn-danger {
  background: var(--bad);
  color: var(--text-on-accent);
  border: 1px solid transparent;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 8px 22px -8px rgba(239, 68, 68, 0.55);
}
.btn-danger:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

/* ─ Pills — role / status / plan ─ */
.role-pill, .status-pill, .plan-pill {
  display: inline-flex; align-items: center;
  padding: 3px var(--space-2);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  white-space: nowrap;
}
.role-pill[data-role="admin"] {
  color: var(--ml2);
  border-color: color-mix(in srgb, var(--ml2) 40%, transparent);
  background: color-mix(in srgb, var(--ml2) 8%, transparent);
}
.role-pill[data-role="auditor"] {
  color: var(--accent-2);
  border-color: color-mix(in srgb, var(--accent-2) 40%, transparent);
  background: color-mix(in srgb, var(--accent-2) 8%, transparent);
}
/* Auditing-firm marker on the Global-Admin org list — sits inline after the
   org name, so it carries its own left margin. */
.role-pill[data-role="firm"] {
  margin-left: 8px;
  color: var(--accent-1);
  border-color: color-mix(in srgb, var(--accent-1) 42%, transparent);
  background: color-mix(in srgb, var(--accent-1) 8%, transparent);
}
.status-pill[data-status="pending"] {
  color: var(--warn);
  border-color: var(--warn-border);
  background: var(--warn-soft);
}
.status-pill[data-status="blocked"] {
  color: var(--bad);
  border-color: var(--bad-border, color-mix(in srgb, var(--bad) 40%, transparent));
  background: var(--bad-soft);
}
.plan-pill[data-plan="paid"] {
  color: var(--accent-2);
  border-color: color-mix(in srgb, var(--accent-2) 42%, transparent);
  background: color-mix(in srgb, var(--accent-2) 8%, transparent);
}
/* Auditing firm that hasn't subscribed yet — awaiting payment. */
.plan-pill[data-plan="unsubscribed"] {
  color: var(--warn);
  border-color: var(--warn-border);
  background: var(--warn-soft);
}

/* ─ Paid-feature badge on the Audit nav tab ─ Now carries a lock icon
   alongside the PRO chip so free users see the gating at a glance, not
   just as a colour-coded badge. */
.nav-pro {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: var(--space-2);
  padding: 2px 6px 2px 4px;
  border-radius: 5px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--accent-grad);
  color: var(--text-on-accent);
  vertical-align: middle;
  text-transform: uppercase;
}
.nav-pro-lock { font-size: 0.78rem; line-height: 1; }
.nav-pro-text { font-size: 0.58rem; line-height: 1; }
/* Subtle muted treatment for the parent nav link when it's locked — keeps
   it discoverable but reads as "not yet available" rather than equivalent
   to the free tabs. */
.site-nav a.nav-locked { opacity: 0.75; }
.site-nav a.nav-locked:hover { opacity: 0.92; }

.role-select {
  height: 34px; padding: 0 10px; font-family: inherit; font-size: 0.82rem;
  background: var(--surface); color: var(--text); cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .15s;
}
.role-select:hover { border-color: var(--text-mute); }

.you-tag {
  margin-left: 7px; padding: 2px 8px; border-radius: 999px;
  font-size: 0.68rem; font-weight: 600;
  background: var(--surface-strong); color: var(--text-mute);
}

.admin-sublist { margin-bottom: 14px; }

/* Inline checkbox row used by formModal (e.g. the "auditing firm" toggle). */
.field-check-row {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 4px 0 2px; cursor: pointer; font-weight: 500;
}
.field-check-row .field-check {
  width: auto; margin: 2px 0 0; flex: 0 0 auto; cursor: pointer;
}

/* Sign-up organisation-type chooser — two selectable cards. */
.orgtype-chooser {
  /* Single column — tiles stack full-width so they always fit the modal with
     no horizontal overflow, regardless of title/badge length. */
  display: flex; flex-direction: column; gap: 10px;
  margin: 4px 0 var(--space-4);
  width: 100%;
}
.orgtype-option {
  /* Reset the native button so the tile inherits the form's typography
     instead of the browser's default button font (which read as "unformatted"). */
  appearance: none; -webkit-appearance: none;
  font: inherit; color: var(--text);
  box-sizing: border-box; width: 100%; min-width: 0;
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
  text-align: left; padding: 14px 16px; cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  transition: border-color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}
.orgtype-option:hover { border-color: var(--text-mute); background: var(--surface-hover); }
.orgtype-option:focus-visible {
  outline: none; border-color: var(--accent-1);
  box-shadow: 0 0 0 3px var(--accent-1-soft);
}
.orgtype-option[aria-checked="true"] {
  border-color: var(--accent-1);
  background: color-mix(in srgb, var(--accent-1) 8%, transparent);
  box-shadow: 0 0 0 1px var(--accent-1) inset;
}
.orgtype-option-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-width: 0;
}
.orgtype-title {
  font-weight: 600; font-size: var(--text-sm); color: var(--text);
  letter-spacing: var(--tracking-tight); line-height: 1.2;
  min-width: 0; overflow-wrap: anywhere;
}
.orgtype-badge {
  flex: 0 0 auto;
  padding: 2px 8px; border-radius: var(--radius-full);
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; white-space: nowrap;
  border: 1px solid var(--border-strong); color: var(--text-mute);
  background: var(--surface-2, var(--surface));
}
.orgtype-badge[data-kind="firm"] {
  color: var(--accent-1);
  border-color: color-mix(in srgb, var(--accent-1) 42%, transparent);
  background: color-mix(in srgb, var(--accent-1) 10%, transparent);
}
.orgtype-desc {
  font-size: 0.78rem; color: var(--text-dim); line-height: 1.4;
}

/* notice — mirrors the app's .callout */
.admin-notice {
  padding: 14px 16px; margin-bottom: 16px;
  border-radius: 12px; font-size: 0.9rem;
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-dim);
}
.admin-notice.error {
  color: var(--text);
  border-color: color-mix(in srgb, var(--bad) 50%, transparent);
  background: color-mix(in srgb, var(--bad) 9%, transparent);
}

/* OSCAL releases panel (Phase 5 admin surface) */
.oscal-release-list { display: flex; flex-direction: column; gap: 8px; }
.oscal-release-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "meta summary toggle" "detail detail detail";
  gap: 10px 16px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface);
}
.oscal-release-meta { grid-area: meta; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.oscal-release-meta .mono { font-weight: 600; }
.oscal-release-summary { grid-area: summary; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.oscal-release-row .btn-mini { grid-area: toggle; }
.oscal-release-detail {
  grid-area: detail;
  padding-top: 10px; border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.oscal-diff-col h4 {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-mute); margin-bottom: 6px; font-weight: 600;
}
.oscal-diff-chips { display: flex; flex-wrap: wrap; gap: 4px; max-height: 220px; overflow-y: auto; }
.oscal-diff-chip {
  font-family: var(--font-mono); font-size: 0.7rem;
  padding: 2px 8px; border-radius: var(--radius-full);
  border: 1px solid transparent;
}
.oscal-diff-chip.diff-added   { background: color-mix(in srgb, var(--ok, #16a34a) 14%, transparent); color: #16a34a; }
.oscal-diff-chip.diff-removed { background: color-mix(in srgb, var(--bad, #dc2626) 14%, transparent); color: #dc2626; }
.oscal-diff-chip.diff-changed { background: color-mix(in srgb, var(--accent, #2563eb) 14%, transparent); color: #2563eb; }
.diff-badge {
  font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600;
  padding: 2px 8px; border-radius: var(--radius-full);
}
.diff-badge.diff-added   { background: color-mix(in srgb, var(--ok, #16a34a) 14%, transparent); color: #16a34a; }
.diff-badge.diff-removed { background: color-mix(in srgb, var(--bad, #dc2626) 14%, transparent); color: #dc2626; }
.diff-badge.diff-changed { background: color-mix(in srgb, var(--accent, #2563eb) 14%, transparent); color: #2563eb; }
@media (max-width: 720px) {
  .oscal-release-row { grid-template-columns: 1fr; grid-template-areas: "meta" "summary" "toggle" "detail"; }
  .oscal-release-detail { grid-template-columns: 1fr; }
}

/* ─ Toasts — non-blocking action feedback ─ */
.toast-stack {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 200;
  display: flex; flex-direction: column; gap: var(--space-2);
  max-width: calc(100vw - 40px);
  pointer-events: none;
}
.toast {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  max-width: 360px;
  pointer-events: auto;
  animation: fade-up var(--duration) var(--ease-out) both;
  transition: opacity var(--duration-slow), transform var(--duration-slow);
}
.toast-ok    { border-left: 3px solid var(--ok); }
.toast-error { border-left: 3px solid var(--bad); }
.toast-out   { opacity: 0; transform: translateY(-6px); }

/* ---- checkout activating banner ---- */
.checkout-banner {
  position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
  z-index: 200;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: 999px;
  background: var(--accent-grad); color: #fff;
  font-weight: 600; font-size: 0.88rem;
  box-shadow: var(--shadow);
  animation: fade-up .25s ease both;
}
.checkout-banner::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
  animation: checkout-spin 0.8s linear infinite;
}
.checkout-banner-stalled { background: #b45309; }
.checkout-banner-stalled::before { display: none; }
.checkout-banner-stalled .modal-link { color: #fff; text-decoration: underline; background: transparent; border: 0; cursor: pointer; padding: 0; font: inherit; }
/* Anchored expectation — Doherty threshold: a vague "Activating..." feels
   broken at 5s; a concrete "5–15s" doesn't. Slightly faded so it reads as
   secondary metadata, not equal weight to the primary action. */
.checkout-banner-text { font-weight: 600; }
.checkout-banner-eta {
  opacity: 0.72; font-weight: 500;
  font-size: 0.82em;
  padding-left: 4px;
  border-left: 1px solid rgba(255,255,255,0.35);
  margin-left: 4px;
}
@keyframes checkout-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .modal-backdrop, .modal-card, .account-menu,
  .toast, .checkout-banner { animation: none; }
  .checkout-banner::before { animation: none; }
}

/* ====================================================================
   Mobile / touch refinements
   ==================================================================== */

/* Phone — compact account chip, full-bleed modals, stacked admin tables. */
@media (max-width: 720px) {
  /* Compact account chip — drop the email and just show the avatar so the
     header doesn't blow out on narrow screens. */
  .account-chip { padding: 0 6px; height: 36px; gap: 0; }
  .account-email { display: none; }
  .sync-status { display: none; }
  .account-signin {
    padding: 0 12px; font-size: 0.85rem; min-height: 36px;
  }

  /* Position the account menu so it never overflows the viewport */
  .account-menu {
    position: fixed;
    top: 60px;
    right: max(10px, env(safe-area-inset-right));
    left: auto;
    min-width: 0;
    width: min(280px, calc(100vw - 20px));
  }

  /* Modals — full-bleed-ish, easier to read on phones. */
  .modal-backdrop {
    padding: 12px;
    align-items: flex-end;          /* slide-up sheet feel */
  }
  .modal-card {
    padding: 20px;
    max-width: 100%;
    max-height: calc(100dvh - 24px);
    border-radius: 18px;
  }
  .modal-card h2 { font-size: 1.15rem; padding-right: 36px; }
  .modal-card p { font-size: 0.9rem; margin-bottom: 14px; }
  .modal-card label { margin-bottom: 4px; }
  .field-input { margin-bottom: 12px; }

  .modal-actions {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
  }
  .modal-actions .btn { width: 100%; }
  /* Split actions (Decline | Accept) — keep side-by-side, equal width */
  .modal-actions-split { flex-direction: row; }
  .modal-actions-split .btn { flex: 1; }
  .modal-actions-split .modal-link { flex: none; }

  /* Toasts — bottom on mobile so they don't overlap the header */
  .toast-stack {
    top: auto;
    bottom: calc(14px + env(safe-area-inset-bottom));
    left: 14px;
    right: 14px;
    max-width: none;
    align-items: stretch;
  }
  .toast { min-width: 0; max-width: none; }

  /* Checkout banner — keep below the header, narrower */
  .checkout-banner {
    top: 70px;
    width: calc(100vw - 32px);
    max-width: 360px;
    text-align: center; justify-content: center;
    padding: 10px 16px;
    font-size: 0.85rem;
  }

  /* Admin tables → stacked cards. Each row becomes its own card, and the
     column header text is repeated inline via the data-label attribute. */
  .admin-card-head {
    padding: 14px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .admin-card-head h2 { font-size: 1rem; }
  .admin-card-head > div:first-child { min-width: 0; }
  .admin-card-head .btn { width: 100%; }
  .admin-card-body { padding: 6px 8px 10px; overflow-x: visible; }

  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td {
    display: block;
    width: 100%;
  }
  .admin-table thead { display: none; }                 /* labels move inline */
  .admin-table tr {
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
  }
  .admin-table tbody tr:hover td { background: transparent; }
  .admin-table td {
    border-top: 0;
    padding: 6px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
  }
  /* First cell is the headline (org name / email) — emphasise it */
  .admin-table td:first-child {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    padding-top: 2px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
    flex-wrap: wrap;
  }
  .admin-table td:first-child::before { display: none; }
  /* Label before each value, pulled from data-label */
  .admin-table td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 96px;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-mute);
    font-weight: 600;
  }
  .admin-table td.admin-actions {
    text-align: left;            /* stacked card: actions sit left, can wrap */
    white-space: normal;
    padding-top: 8px;
    margin-top: 4px;
    border-top: 1px solid var(--border);
  }
  .admin-table td.admin-actions::before { display: none; }
  .admin-empty { padding: 18px 12px; }

  .role-select { width: 100%; min-height: 36px; }
}

/* Tiny phones */
@media (max-width: 380px) {
  .modal-card { padding: 16px; }
  .modal-card h2 { font-size: 1.05rem; }
  .account-menu { width: calc(100vw - 20px); }
}
