/* ═══════════════════════════════════════════════════════════════════════════
   ArcBig Portal — Light design system (single source of truth)
   60-30-10: 60% --n-50 bg · 30% white surfaces · 10% --blue-500 accent
   Marketing pages: light layout in main.css (index, business-model, auth)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Breakpoint scale — use ONLY these going forward:
   mobile  → @media (max-width: 640px)
   tablet  → @media (max-width: 900px)
   desktop → default (> 900px); min-width queries use 901px if needed */
:root {
  /* Brand accents */
  --blue-50: #eef3ff;
  --blue-100: #dbe6ff;
  --blue-200: #b9ccff;
  --blue-400: #5b8bff;
  --blue-500: #1e5eff;
  --blue-600: #1a4fd6;
  --blue-700: #163f9e;
  --navy: #0B2645;

  /* Neutrals */
  --n-50: #f7f9fc;
  --n-100: #eef1f6;
  --n-200: #e3e8ef;
  --n-300: #cbd3df;
  --n-400: #9aa5b1;
  --n-500: #6b7280;
  --ink: #1a1a1a;
  /* White card/panel surface — was hardcoded #fff in 42 places. */
  --surface: #ffffff;

  /* Semantic */
  --success: #128a3a;
  --success-bg: #ecfdf3;
  --success-border: #b8e6c8;
  --warning: #b8860b;
  --warning-bg: #fffbeb;
  --warning-border: #f0d78c;
  --error: #c0392b;
  --error-bg: #fef2f2;
  --error-border: #f5c6c2;

  /* Spacing — strict 8px increments */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --space-7: 64px;

  /* Radii */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-full: 999px;

  /* Shadows — soft, blue-tinted */
  --shadow-sm: 0 1px 2px rgba(11, 37, 69, 0.05), 0 1px 3px rgba(30, 94, 255, 0.04);
  --shadow-md: 0 4px 12px rgba(11, 37, 69, 0.07), 0 2px 6px rgba(30, 94, 255, 0.05);
  --shadow-lg: 0 12px 32px rgba(11, 37, 69, 0.1), 0 4px 12px rgba(30, 94, 255, 0.06);

  /* Motion */
  --transition-fast: 150ms ease;
  --transition: 150ms ease;

  /* Typography — one brand family, weights 400 / 600 / 700 / 800.
     --font-brand is the ONLY place a family name is declared. Swap a licensed
     Degular or Satoshi in here (plus arcbig/css/fonts.css) with no other edits. */
  --font-brand: "Inter";
  --font-fallback: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-family: var(--font-brand), var(--font-fallback);
  --font-display: var(--font-family);
  --font-body: var(--font-family);
  /* Tabular figures for job codes, timers, IDs and currency columns. */
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  --text-display: 52px;
  --text-h1: 36px;
  --text-h2: 28px;
  --text-h3: 20px;
  --text-body: 16px;
  --text-caption: 13px;
  --text-micro: 11px;
  --text-sm: 14px;
  --text-table: 15px;
  --fw-display: 800;
  --fw-h1: 700;
  --fw-h2: 600;
  --fw-h3: 600;
  --fw-body: 400;
  --fw-caption: 500;
  --lh-body: 1.6;
  --lh-heading: 1.2;
  --lh-display: 1.1;
  --label-spacing: 0.06em;
  --measure: 65ch;

  /* Breakpoint scale — @media cannot read custom properties, so these are the
     canonical reference values. Use ONLY these four widths in media queries:
     640 (phone) · 900 (tablet) · 1100 (laptop) · 1440 (wide). */
  --bp-sm: 640px;
  --bp-md: 900px;
  --bp-lg: 1100px;
  --bp-xl: 1440px;

  /* Unified header rhythm — eyebrow → title → subtitle */
  --header-eyebrow-gap: var(--space-2);
  --header-title-gap: 10px;
  --header-subtitle-gap: var(--space-2);
  --header-title-tracking: -0.01em;
  --header-block-max: var(--measure);
  --header-center-max: 720px;
  --header-subtitle-max: 60ch;

  /* Surfaces (60-30-10) */
  --surface-bg: var(--n-50);
  --surface-card: #ffffff;
  --text-color: var(--ink);
  --text-muted: var(--n-500);

  /* —— Compatibility aliases (existing markup) —— */
  --arc-blue-50: var(--blue-50);
  --arc-blue-100: var(--blue-100);
  --arc-blue-400: var(--blue-400);
  --arc-blue-500: var(--blue-500);
  --arc-blue-600: var(--blue-600);
  --arc-blue-700: var(--blue-700);
  --arc-blue-800: #123580;
  --arc-blue-900: var(--navy);
  --arc-blue: var(--blue-500);
  --arc-blue-hover: var(--blue-600);
  --gray-50: var(--n-50);
  --gray-100: var(--n-100);
  --gray-200: var(--n-200);
  --gray-300: var(--n-300);
  --gray-400: var(--n-400);
  --gray-500: var(--n-500);
  --gray-600: #4b5563;
  --gray-700: #374151;
  --navy-core: var(--navy);
  --deep-blue: var(--navy);
  --white: #ffffff;
  --cream-bg: var(--n-50);
  --off-white: var(--n-50);
  --border: var(--n-200);
  --border-subtle: var(--n-200);
  --border-strong: var(--n-300);
  --success-green: var(--success);
  --warning-amber: var(--warning);
  --progress-blue: var(--blue-500);
  --progress-blue-soft: var(--blue-50);
  --piki-blue: var(--blue-500);
  --piki-blue-hover: var(--blue-600);
  --piki-soft: var(--blue-50);
  --malaga-red: var(--error);
  --coral-soft: var(--error-bg);
  --mediterranean: #17d1c8;
  --teal-soft: rgba(23, 209, 200, 0.12);
  --wa: #25d366;
  --sidebar-w: 260px;
  --radius-glass: var(--radius-lg);

  /* Legacy aliases — solid surfaces only (no blur in portal) */
  --glass-light-bg: var(--surface-card);
  --glass-light-border: var(--n-200);
  --glass-light-shadow: var(--shadow-sm);
  --modal-scrim: rgba(11, 37, 69, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  /* `clip`, not `hidden`: html already hides x-overflow, and `hidden` would turn
     body into a scroll container that never scrolls — which silently breaks every
     position: sticky element inside the portal. */
  overflow-x: clip;
  max-width: 100vw;
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: var(--fw-body);
  background-color: var(--n-50);
  color: var(--ink);
  line-height: var(--lh-body);
  text-align: left;
  letter-spacing: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.app-portal {
  background-color: var(--n-50);
  background-image: none;
}

p, li, td, label, input, select, textarea, .text-body {
  color: var(--ink);
  text-align: left;
}

a { color: var(--blue-500); text-decoration: none; transition: color var(--transition-fast); }
a:hover { text-decoration: none; color: var(--blue-600); }
a:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 2px; border-radius: 2px; }

.app-portal .sidebar a:hover {
  color: inherit;
}

img,
video,
canvas,
picture {
  max-width: 100%;
  height: auto;
}

img { display: block; }

.hidden { display: none !important; }

/* Typography — Brand Style Guide scale */
.display, .font-display {
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: var(--fw-display);
  line-height: var(--lh-display);
  color: var(--navy);
  max-width: var(--measure);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--navy);
  line-height: var(--lh-heading);
  max-width: var(--measure);
}

h1 {
  font-size: var(--text-h1);
  font-weight: var(--fw-h1);
}

h2 {
  font-size: var(--text-h2);
  font-weight: var(--fw-h2);
}

h3 {
  font-size: var(--text-h3);
  font-weight: var(--fw-h3);
}

h4, .caption, .form-label, label:not(.btn):not(.oc-toggle) {
  font-size: var(--text-caption);
  font-weight: var(--fw-caption);
  text-transform: uppercase;
  letter-spacing: var(--label-spacing);
  color: var(--n-500);
}

.text-muted { color: var(--n-500); }
.text-caption { font-size: var(--text-caption); font-weight: var(--fw-caption); line-height: var(--lh-body); }
.text-sm { font-size: var(--text-sm); font-weight: 500; line-height: var(--lh-body); }
.text-xs { font-size: 12px; line-height: 1.5; } /* minimum scale */

.brand { font-weight: var(--fw-h1); letter-spacing: -0.02em; font-family: var(--font-display); }
.brand span { color: var(--blue-500); }

.prose, .auth-subtitle {
  max-width: var(--measure);
}

/* Logo */
.logo-link {
  display: block;
  width: 100%;
  text-decoration: none;
  line-height: 0;
}

.logo-link:hover { text-decoration: none; }

.logo {
  display: block;
  width: auto;
  height: auto;
}

.logo-sidebar {
  display: block;
  height: 56px;
  width: 100%;
  max-width: 104px;
  object-fit: contain;
  object-position: left center;
  mix-blend-mode: lighten;
}

.logo-auth {
  display: block;
  width: 45%;
  height: auto;
  margin: 0 auto;
  padding: 0;
  object-fit: contain;
  object-position: center;
}

.auth-logo {
  margin: 0;
  padding: 20px 0;
  line-height: 0;
  text-align: center;
  height: auto;
}

.auth-box:has(.auth-logo) {
  padding: 36px;
}

/* Buttons */
[hidden] {
  display: none !important;
}

/* Role-scoped workflow controls (job detail, etc.) */
body[data-portal-role="admin"] .employee-only {
  display: none !important;
}

body[data-portal-role="employee-portal"] .admin-only {
  display: none !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 10px var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-body);
  letter-spacing: 0;
  cursor: pointer;
  text-decoration: none;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast),
    opacity var(--transition-fast);
}
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
/* Disabled reads as disabled: a neutral fill, never a translucent primary. */
.btn:disabled,
.btn[disabled],
.btn[aria-disabled="true"] {
  background: var(--n-100);
  border-color: var(--n-200);
  color: var(--n-400);
  box-shadow: none;
  opacity: 1;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-primary {
  background: var(--blue-500);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) {
  background: var(--blue-600);
  box-shadow: var(--shadow-md);
}
.btn-primary:active:not(:disabled) {
  background: var(--blue-700);
}
.btn-secondary {
  background: var(--white);
  color: var(--navy);
  border-color: var(--n-300);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--n-50);
  border-color: var(--n-400);
}
.btn-secondary:active:not(:disabled) {
  background: var(--n-100);
}
.btn-ghost {
  background: transparent;
  color: var(--blue-500);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--blue-50);
  color: var(--blue-700);
}
.btn-ghost:active:not(:disabled) { background: var(--blue-100); }
.btn-danger {
  background: var(--error);
  color: var(--white);
}
.btn-danger:hover:not(:disabled) {
  background: #a93226;
}
.btn-danger:active:not(:disabled) {
  background: #922b21;
}
/* Legacy variant kept as an alias so existing markup keeps working; it now
   renders as the documented primary. New markup should use .btn-primary. */
.btn-deep { background: var(--blue-500); color: var(--surface); }
.btn-deep:hover:not(:disabled) { background: var(--blue-600); }
.btn:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--blue-100);
}
/* Alias -> primary. Teal is not in the ArcBig palette. */
.btn-teal { background: var(--blue-500); color: var(--surface); }
.btn-teal:hover:not(:disabled) { background: var(--blue-600); }
/* Alias -> danger. Coral is not in the ArcBig palette. */
.btn-coral { background: var(--error); color: var(--surface); }
.btn-coral:hover:not(:disabled) { filter: brightness(0.92); }
/* Sign out is deliberately quiet: see the component layer at the end of this
   file. It should never out-rank paying or submitting a request. */
.btn-signout { margin-top: var(--space-3); }
.btn-wa { background: var(--wa); color: var(--white); }
.btn-sm { min-height: 32px; padding: 6px var(--space-3); font-size: var(--text-caption); }
.btn-block { width: 100%; }

/* Anchor buttons — global a:hover would turn label blue on blue backgrounds */
a.btn:hover {
  text-decoration: none;
}

a.btn-primary,
a.btn-primary:hover:not(:disabled),
a.btn-primary:active:not(:disabled) {
  color: var(--white);
}

a.btn-secondary,
a.btn-secondary:hover:not(:disabled),
a.btn-secondary:active:not(:disabled) {
  color: var(--navy);
}

a.btn-ghost,
a.btn-ghost:active:not(:disabled) {
  color: var(--n-500);
}

a.btn-ghost:hover:not(:disabled) {
  color: var(--navy);
}

a.btn-danger,
a.btn-danger:hover:not(:disabled),
a.btn-danger:active:not(:disabled) {
  color: var(--white);
}

a.btn-deep,
a.btn-deep:hover:not(:disabled),
a.btn-deep:active:not(:disabled) {
  color: var(--white);
}

a.btn-coral,
a.btn-coral:hover:not(:disabled) {
  color: var(--white);
}

a.btn-wa,
a.btn-wa:hover:not(:disabled) {
  color: var(--white);
}

a.btn-teal,
a.btn-teal:hover:not(:disabled) {
  color: var(--arc-blue-900);
}

a.btn-signout,
a.btn-signout:hover:not(:disabled),
a.btn-signout:active:not(:disabled) {
  color: var(--white);
}

/* Forms — labels above fields, uppercase captions */
label:not(.toggle-row label):not(.option-btn):not(.btn):not(.oc-toggle) {
  display: block;
  font-size: var(--text-caption);
  font-weight: var(--fw-caption);
  font-family: var(--font-body);
  letter-spacing: var(--label-spacing);
  text-transform: uppercase;
  color: var(--n-500);
  margin-bottom: var(--space-2);
}

input, select, textarea {
  width: 100%;
  min-height: 42px;
  background: var(--white);
  border: 1px solid var(--n-300);
  border-radius: var(--radius-sm);
  padding: 10px var(--space-3);
  color: var(--ink);
  font-size: var(--text-body);
  font-weight: var(--fw-body);
  font-family: var(--font-body);
  margin-bottom: var(--space-3);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  accent-color: var(--ui-blue, #0071e3);
  flex-shrink: 0;
}

input::placeholder,
textarea::placeholder {
  color: var(--n-400);
}

input:hover:not(:disabled):not(:focus):not([type="checkbox"]):not([type="radio"]),
select:hover:not(:disabled):not(:focus),
textarea:hover:not(:disabled):not(:focus) {
  border-color: var(--n-400);
}

input:focus:not([type="checkbox"]):not([type="radio"]),
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px var(--blue-100);
}

input:disabled, select:disabled, textarea:disabled {
  background: var(--n-100);
  color: var(--n-400);
  cursor: not-allowed;
}

input.is-error, select.is-error, textarea.is-error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px var(--error-bg);
}

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

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

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

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 20px;
}

/* Cards — white surface, 1px n-200 border, 24px padding */
.card, .panel {
  background: var(--white);
  border: 1px solid var(--n-200);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.panel-flush { padding: 0; overflow-x: auto; overflow-y: visible; -webkit-overflow-scrolling: touch; }

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

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

.stat-card .num {
  font-size: var(--text-h1);
  font-weight: var(--fw-h1);
  font-family: var(--font-display);
  color: var(--navy);
  line-height: var(--lh-heading);
}

.stat-card .lbl {
  font-size: var(--text-caption);
  color: var(--n-500);
  margin-top: var(--space-2);
}

.price-card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.price-card.featured {
  border-color: var(--arc-blue);
  border-width: 2px;
}

.price-card .plan-badge {
  position: absolute;
  top: 18px;
  right: 18px;
  display: inline-block;
  font-size: var(--text-caption);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--arc-blue);
  background: var(--piki-soft);
  border: 1px solid rgba(58, 119, 232, 0.3);
  border-radius: 999px;
  padding: 4px 10px;
}

.plan-intro {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--navy-core);
  margin: 4px 0 8px;
}

.price-card .inr {
  font-size: 28px;
  font-weight: 800;
  color: var(--navy-core);
  margin: 10px 0;
}

.price-card .inr small {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
}

.price-card ul {
  list-style: none;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.9;
}

.price-card ul li::before {
  content: "✓ ";
  color: var(--mediterranean);
  font-weight: 700;
}

/* Status pills */
.status,
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-caption);
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  border: 1px solid transparent;
}

.status-submitted,
.status-pill--submitted,
.status-pill--pending,
.status-pending {
  background: var(--n-100);
  color: var(--n-500);
  border-color: var(--n-200);
}

.status-in_design,
.status-pill--progress,
.status-scheduled {
  background: var(--blue-50);
  color: var(--blue-700);
  border-color: var(--blue-100);
}

.status-ready,
.status-sent_whatsapp,
.status-pill--ready,
.status-pill--whatsapp,
.status-approved,
.status-published,
.status-pill--published,
.status-posted,
.status-pill--posted {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

.status-failed,
.status-pill--failed {
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error-border);
}

.status-pill--accepted {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

/* Alias -> primary. Green is reserved for status/success, never for an action:
   using it as a CTA gave the product two different primary colours and removed
   green's ability to mean "succeeded". */
.btn-success {
  background: var(--blue-500);
  color: var(--surface);
  border: none;
}

.btn-success:hover:not(:disabled) {
  background: var(--blue-600);
}

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: var(--text-table); line-height: 1.5; }

th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: var(--space-3);
  font-size: var(--text-caption);
  font-weight: 600;
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: var(--label-spacing);
  color: var(--n-500);
  border-bottom: 1px solid var(--n-200);
  background: var(--n-50);
}

td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--n-100);
  vertical-align: middle;
  color: var(--ink);
  min-height: 48px;
}

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

.app-shell tbody tr:nth-child(even) {
  background: var(--n-50);
}

.app-shell tbody tr:hover {
  background: var(--blue-50);
}

.app-shell tbody tr:focus-within {
  outline: 2px solid var(--blue-500);
  outline-offset: -2px;
}

td.num, th.num,
td[data-align="right"],
th[data-align="right"] {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.impersonation-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 20px;
  background: var(--piki-soft);
  border: 1px solid rgba(47, 91, 255, 0.25);
  border-radius: 10px;
  font-size: 14px;
}
.btn-download-pending {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

/* Callouts */
.callout {
  padding: 16px 24px;
  border-radius: var(--radius-glass);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--arc-blue);
  background: var(--white);
  margin: 16px 0;
}

.callout-warn { border-left-color: var(--malaga-red); background: var(--coral-soft); }
.callout-teal { border-left-color: var(--mediterranean); background: var(--teal-soft); }

/* Tags */
.tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: var(--text-caption);
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* Toast */
.toast {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  background: var(--navy);
  color: var(--white);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--text-caption);
  z-index: 9999;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Marketing header */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header nav { display: flex; gap: 24px; align-items: center; }
.site-header nav a { color: var(--deep-blue); font-size: 14px; font-weight: 500; text-decoration: none; }
.site-header nav a:hover { color: var(--piki-blue); }

.site-footer {
  background: var(--deep-blue);
  color: rgba(255,255,255,0.7);
  padding: 48px 24px 32px;
  margin-top: 80px;
}

.site-footer a { color: var(--mediterranean); }
.site-footer .brand { color: var(--white); }
.site-footer .brand span { color: var(--mediterranean); }

/* Hero */
.hero {
  padding: 72px 24px 80px;
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.hero-badge {
  display: inline-block;
  background: var(--teal-soft);
  color: #0a8a84;
  font-size: var(--text-caption);
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.hero p.lead {
  font-size: 18px;
  color: var(--text-muted);
  margin: 16px 0 28px;
  max-width: 480px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-visual {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.workflow-step {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.workflow-step:last-child { border-bottom: none; }

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--piki-blue);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 64px 24px;
}

.section-header { margin-bottom: 32px; }

/* ═══ Portal page headers — left-aligned, shared left edge ═══ */
.app-portal .page-header {
  text-align: left;
  margin-left: 0;
  margin-right: 0;
  padding-left: 0;
  padding-right: 0;
  max-width: var(--header-block-max);
}

.app-portal .page-header > :is(h1, h2, h3, p) {
  margin-left: 0;
  margin-right: 0;
  padding-left: 0;
  padding-right: 0;
  text-indent: 0;
  text-align: left;
  max-width: none;
}

.app-portal .page-header > h1,
.app-portal .page-header > h2 {
  margin-top: 0;
  margin-bottom: var(--header-title-gap);
  letter-spacing: var(--header-title-tracking);
}

.app-portal .page-header > p {
  margin-top: 0;
  margin-bottom: 0;
  color: var(--text-muted);
  max-width: var(--header-subtitle-max);
}

/* ═══ Public / marketing headers — centered on one axis ═══ */
:is(
  .section-header,
  .text-header,
  .auth-hero-panel__inner
) {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  padding-left: 0;
  padding-right: 0;
  max-width: var(--header-center-max);
}

.auth-box > h1,
.auth-box > .auth-subtitle {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  padding-left: 0;
  padding-right: 0;
  text-indent: 0;
  letter-spacing: var(--header-title-tracking);
}

.auth-box > h1 {
  margin-top: 0;
  margin-bottom: var(--header-title-gap);
}

.auth-box > .auth-subtitle {
  margin-top: 0;
  margin-bottom: var(--space-4);
  max-width: var(--header-subtitle-max);
  color: var(--text-muted);
}

:is(
  .section-header,
  .text-header,
  .auth-hero-panel__inner
) > :is(
  .kicker,
  .eyebrow,
  .blog-kicker,
  .cta-band__kicker,
  .lead-form-kicker,
  h1,
  h2,
  h3,
  .auth-subtitle,
  .blog-lead
) {
  margin-left: auto;
  margin-right: auto;
  padding-left: 0;
  padding-right: 0;
  text-indent: 0;
  text-align: center;
  max-width: 100%;
}

:is(
  .section-header,
  .text-header,
  .auth-hero-panel__inner
) > :is(p, .auth-subtitle, .blog-lead) {
  max-width: var(--header-subtitle-max);
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

:is(.kicker, .eyebrow, .blog-kicker, .cta-band__kicker, .lead-form-kicker) {
  display: block;
  margin-top: 0;
  margin-bottom: var(--header-eyebrow-gap);
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: var(--label-spacing);
  text-transform: uppercase;
  color: var(--text-muted);
}

:is(
  .section-header,
  .text-header,
  .auth-hero-panel__inner
) > :is(h1, h2, h3) {
  margin-top: 0;
  margin-bottom: var(--header-title-gap);
  letter-spacing: var(--header-title-tracking);
}

:is(
  .section-header,
  .text-header,
  .auth-hero-panel__inner
) > p,
:is(
  .section-header,
  .text-header,
  .auth-hero-panel__inner
) > .auth-subtitle,
:is(
  .section-header,
  .text-header,
  .auth-hero-panel__inner
) > .blog-lead {
  margin-top: 0;
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: var(--text-body);
  font-weight: var(--fw-body);
  line-height: var(--lh-body);
}

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

/* App shell (client + admin) */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.sidebar-brand span { color: var(--mediterranean); }

.sidebar-close {
  display: none;
}

.sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  padding: var(--space-3) 0 var(--space-4);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-group-block {
  display: flex;
  flex-direction: column;
}

.nav-section-title {
  padding: var(--space-2) var(--space-4) var(--space-3);
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: var(--label-spacing);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}

.nav-group-block--spaced {
  margin-top: var(--space-4);
}

.nav-subgroup {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-subgroup + .nav-subgroup {
  margin-top: var(--space-2);
}

.nav-logout-wrap {
  margin-top: var(--space-5);
  padding: 0 0 var(--space-2);
}

.nav-link:focus-visible {
  outline: 2px solid var(--arc-blue);
  outline-offset: -2px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-group.is-open .nav-sub {
  display: flex;
}

.nav-sub {
  display: none;
  flex-direction: column;
  gap: var(--space-1);
  margin: var(--space-1) 0 0 var(--space-4);
  padding-left: var(--space-3);
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-4);
  margin: 0 var(--space-2);
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.72);
  font-size: var(--text-caption);
  font-weight: 500;
  font-family: var(--font-body);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition);
}

.nav-link__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.45);
  transition: color 0.2s ease, transform 0.2s ease;
}

.nav-link__icon svg {
  width: 18px;
  height: 18px;
}

.nav-link__label {
  flex: 1;
  min-width: 0;
}

.nav-link:hover:not(.active) {
  color: var(--white);
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
}

.nav-link:hover:not(.active) .nav-link__icon {
  color: rgba(255, 255, 255, 0.9);
}

.nav-link.active {
  color: var(--white);
  font-weight: 600;
  background: rgba(30, 94, 255, 0.18);
  border-left-color: var(--blue-500);
}

.nav-link.active .nav-link__icon {
  color: var(--blue-400);
}

.nav-link-sub {
  padding: 8px var(--space-3) 8px var(--space-3);
  font-size: var(--text-caption);
  font-weight: 500;
}

.nav-link-sub.active {
  font-weight: 600;
  background: rgba(30, 94, 255, 0.14);
}

.nav-link-parent.active {
  background: rgba(30, 94, 255, 0.1);
}

.nav-link-logout {
  width: calc(100% - var(--space-4));
  margin: var(--space-2) var(--space-2) 0;
  padding: var(--space-3) var(--space-4);
  border-top: none;
  border-left: 3px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  font-size: var(--text-caption);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
  transition:
    background var(--transition),
    color var(--transition);
}

.nav-link-logout .nav-link__icon {
  color: rgba(255, 255, 255, 0.45);
  transition: color 0.2s ease, transform 0.2s ease;
}

.nav-link-logout:hover {
  color: #fca5a5;
  background: rgba(220, 38, 38, 0.12);
}

.nav-link-logout:hover .nav-link__icon {
  color: #fca5a5;
}

@media (prefers-reduced-motion: reduce) {
  .nav-link,
  .nav-link-logout,
  .nav-link__icon {
    transition: background var(--transition-fast), color var(--transition-fast), border-left-color var(--transition-fast);
  }
}

.account-form {
  max-width: 640px;
}

.account-form .form-section {
  margin-bottom: 18px;
}

.account-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

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

.toggle-row label {
  font-size: 14px;
  font-weight: 600;
  color: var(--deep-blue);
}

.toggle-row span {
  display: block;
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 4px;
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.sidebar-footer .user-name {
  font-size: var(--text-caption);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}

.sidebar-footer .user-meta {
  margin-top: var(--space-2);
  line-height: 1.4;
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.5);
}

.plan-badge {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid rgba(30, 94, 255, 0.35);
  border-radius: var(--radius-full);
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: var(--label-spacing);
  text-transform: uppercase;
  color: var(--arc-blue-200);
  background: rgba(30, 94, 255, 0.15);
}

.nav-shell-error {
  padding: 16px 22px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.7);
}

.nav-shell-error a {
  color: var(--arc-blue);
  font-weight: 600;
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: var(--space-5);
  padding-bottom: max(var(--space-5), env(safe-area-inset-bottom));
  min-height: 100vh;
  background: var(--n-50);
  width: calc(100% - var(--sidebar-w));
  box-sizing: border-box;
}

/* Mobile sticky top bar — injected by layout.js; hidden on desktop */
.mobile-topbar {
  display: none;
}

.page-header {
  margin-bottom: var(--space-5);
}

.page-header h1 {
  font-size: var(--text-h1);
  font-weight: var(--fw-h1);
  line-height: var(--lh-heading);
  color: var(--navy);
}

.page-header p {
  color: var(--n-500);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.workflow-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-card);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  font-size: var(--text-caption);
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}

.workflow-bar strong { color: var(--arc-blue-900); }

/* Login page */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: var(--n-50);
}

.auth-box {
  width: 100%;
  max-width: 440px;
  padding: var(--space-6) var(--space-5);
  overflow: visible;
  position: relative;
  background: var(--white);
  border: 1px solid var(--n-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.auth-box::before {
  display: none;
}

.auth-box > * {
  position: relative;
  z-index: 1;
}

#client-auth {
  overflow: visible;
}

.auth-box h1 {
  font-size: var(--text-h2);
  color: var(--navy);
}

.password-field {
  position: relative;
  margin-bottom: var(--space-3);
}

.password-field input {
  margin-bottom: 0;
  padding-right: 44px;
}

.password-field__toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--n-500);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.password-field__toggle:hover {
  color: var(--navy);
  background: var(--n-100);
}

.password-field__toggle:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}

.password-field__icon {
  display: inline-flex;
  line-height: 0;
}

.password-field__icon--hide {
  display: none;
}

.password-field__toggle.is-visible .password-field__icon--show {
  display: none;
}

.password-field__toggle.is-visible .password-field__icon--hide {
  display: inline-flex;
}

/* ── Modern login (client) ── */
.auth-page.auth-page--login {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-height: 100vh;
  padding: 0;
  background: #f4f5f9;
}

.auth-page--login .auth-page__brand {
  flex: 0 0 auto;
  width: 100%;
  padding: 28px 40px;
}

.auth-page--login .auth-page__logo-link {
  display: inline-block;
  line-height: 0;
  text-decoration: none;
}

.auth-page--login .logo-auth-page,
.auth-page--login .auth-page__brand img {
  display: block;
  height: 32px;
  width: auto;
  max-width: 160px;
  max-height: 32px;
  object-fit: contain;
  object-position: left center;
}

.auth-page--login .auth-page__main {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px 48px;
}

.auth-page--login .auth-box--login {
  width: 100%;
  max-width: 420px;
  padding: 36px 40px 32px;
  border-radius: 16px;
  border: none;
  box-shadow: 0 4px 24px rgba(11, 37, 69, 0.08);
}

.auth-page--login .auth-box--login > h1 {
  font-size: 28px;
  font-weight: 700;
  color: #1d1549;
  text-align: center;
  margin: 0 0 24px;
  letter-spacing: -0.02em;
}

.auth-page--login .auth-form--login label,
.auth-page--login .auth-box--login label {
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--n-500);
  margin-bottom: 8px;
}

.auth-box--login input[type="email"],
.auth-box--login input[type="password"],
.auth-box--login .password-field input {
  min-height: 48px;
  border-radius: 10px;
  border-color: var(--n-200);
  margin-bottom: 0;
}

.auth-box--login input[type="email"] {
  margin-bottom: var(--space-4);
}

.auth-box--login .password-field {
  margin-bottom: 8px;
}

.auth-box--login .password-field__toggle {
  color: var(--n-500);
}

.social-auth--buttons {
  align-items: stretch;
  margin-bottom: 0;
}

.social-auth--buttons .social-auth__label {
  display: none;
}

.social-auth--buttons .social-auth__row {
  display: flex;
  gap: 16px;
  width: 100%;
}

.social-auth--buttons .social-btn {
  flex: 1;
  min-width: 0;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid #dadce0;
  background: var(--white);
  text-decoration: none;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.social-btn:hover {
  text-decoration: none;
  border-color: #c6c9cd;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.social-btn:active {
  transform: none;
}

.social-btn:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}

.social-btn svg {
  display: block;
  width: 24px;
  height: 24px;
}

.social-btn--google {
  background: var(--white);
  border-color: #dadce0;
}

.social-btn--facebook {
  background: #1877f2;
  border-color: #1877f2;
}

.social-btn--facebook:hover {
  background: #166fe0;
  border-color: #166fe0;
}

.social-btn--unconfigured {
  opacity: 0.72;
  cursor: not-allowed;
}

.social-btn--unconfigured:hover {
  box-shadow: none;
  border-color: #dadce0;
}

.social-btn--facebook.social-btn--unconfigured:hover {
  background: #1877f2;
  border-color: #1877f2;
}

@media (max-width: 640px) {
  .auth-page--login .auth-page__brand {
    padding: 20px 20px;
  }

  .auth-page--login .auth-box--login {
    padding: 28px 24px 24px;
  }
}

.auth-divider--compact {
  margin: 28px 0 24px;
  font-size: var(--text-sm);
  color: var(--n-400);
}

.auth-form--login .auth-form__forgot {
  margin: 4px 0 20px;
  text-align: left;
}

.auth-form--login .auth-form__forgot a {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--blue-500);
  text-decoration: none;
}

.auth-form--login .auth-form__forgot a:hover {
  text-decoration: underline;
}

.auth-form__submit {
  min-height: 50px;
  font-size: var(--text-body);
  font-weight: 600;
  border-radius: 10px;
}

.auth-form__help {
  margin: 20px 0 0;
  text-align: center;
}

.auth-form__help a {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--blue-500);
  text-decoration: none;
}

.auth-form__help a:hover {
  text-decoration: underline;
}

.auth-form__signup {
  margin: 16px 0 0;
  text-align: center;
  color: var(--n-500);
}

.auth-form__signup a {
  font-weight: 700;
  color: var(--blue-500);
  text-decoration: none;
}

.auth-form__signup a:hover {
  text-decoration: underline;
}

.auth-form__meta {
  margin: 20px 0 0;
  text-align: center;
  font-size: var(--text-caption);
}

.auth-form__meta a {
  color: var(--n-500);
}

.role-tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding: var(--space-1);
  background: var(--n-100);
  border-radius: var(--radius);
}

.role-tab {
  flex: 1;
  min-width: 0;
  padding: 10px var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: var(--text-caption);
  font-weight: var(--fw-caption);
  font-family: var(--font-body);
  cursor: pointer;
  color: var(--n-500);
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

.role-tab:hover:not(.active) {
  color: var(--navy);
  background: var(--white);
}

.role-tab.active {
  background: var(--white);
  color: var(--blue-500);
  border-color: var(--n-200);
  box-shadow: var(--shadow-sm);
}

.role-tab:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--blue-100);
}

.demo-box {
  margin-top: var(--space-4);
  padding: var(--space-3);
  background: var(--arc-blue-50);
  border: 1px solid var(--arc-blue-100);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.7;
}

.demo-box code {
  background: var(--white);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: var(--text-caption);
  color: var(--arc-blue-900);
}

.social-auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: 24px;
  overflow: visible;
}

.social-auth__label {
  margin: 0 0 16px;
  width: 100%;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.social-auth__icons {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 28px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 4px 8px;
  overflow: visible;
}

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  border: 1px solid var(--gray-200);
  background: var(--white);
  text-decoration: none;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast);
}

.social-icon:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--arc-blue-200);
}

.social-icon:focus-visible {
  outline: 2px solid var(--arc-blue);
  outline-offset: 2px;
}

.social-icon svg {
  display: block;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.social-icon--disabled {
  cursor: not-allowed;
}

.social-icon--disabled:hover {
  transform: none;
  box-shadow: none;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 20px;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.auth-divider span {
  white-space: nowrap;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  color: var(--text-muted);
}

.empty-state p { margin-bottom: var(--space-3); }

.empty-state-card {
  padding: var(--space-6);
  text-align: center;
  background: var(--surface-card);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.empty-state-card__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-4);
  color: var(--arc-blue-400);
}

.empty-state-card__icon svg {
  width: 56px;
  height: 56px;
}

.empty-state-card h2 {
  font-size: var(--text-h3);
  font-weight: 600;
  color: var(--arc-blue-900);
  margin-bottom: var(--space-2);
}

.empty-state-card p {
  font-size: var(--text-body);
  color: var(--text-muted);
  max-width: 420px;
  margin: 0 auto var(--space-4);
  line-height: var(--lh-body);
}

.panel-heading {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-heading h2,
.panel-heading h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy-core);
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy-core);
  margin: 32px 0 16px;
}

/* ——— New request form: glass + button UI ——— */
.app-main-form {
  background: transparent;
}

.request-form {
  max-width: 720px;
  padding: 32px;
}

.form-section {
  margin-bottom: 28px;
}

.form-section:last-of-type {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-caption);
  font-weight: var(--fw-caption);
  letter-spacing: var(--label-spacing);
  text-transform: uppercase;
  color: var(--n-500);
  margin-bottom: var(--space-2);
}

.form-hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 8px;
  letter-spacing: -0.02em;
}

.option-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}

.option-btn-category {
  justify-content: center;
  min-height: 44px;
  text-align: center;
}

.sub-options-section {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--n-200);
  background: var(--n-50);
}

.sub-options-section[hidden] {
  display: none;
}

.option-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1px solid var(--n-300);
  background: var(--white);
  color: var(--navy);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}

.option-btn:hover {
  border-color: var(--blue-400);
  background: var(--blue-50);
}

.option-btn:active {
  transform: scale(0.98);
}

.option-btn.active {
  background: var(--piki-blue);
  border-color: var(--piki-blue);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(51, 102, 238, 0.28);
}

.option-btn .option-icon {
  font-size: 15px;
  line-height: 1;
  opacity: 0.85;
}

.glass-field {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--n-300);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--ink);
  font-size: var(--text-body);
  font-family: inherit;
  margin-bottom: 0;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.glass-field:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px var(--blue-50);
}

.glass-field::placeholder {
  color: var(--n-400);
}

.request-form textarea.glass-field {
  min-height: 120px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row .form-section {
  margin-bottom: 0;
}

.form-actions {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(34, 36, 74, 0.08);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.form-actions .btn-primary {
  padding: 14px 28px;
  border-radius: 10px;
  font-size: 15px;
}

.form-actions-hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 20px 16px;
  border-radius: 12px;
  border: 1px dashed var(--n-300);
  background: var(--n-50);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
}

.upload-zone:hover {
  border-color: var(--blue-500);
  background: var(--blue-50);
}

.upload-zone.has-file {
  border-style: solid;
  border-color: rgba(51, 102, 238, 0.35);
  background: rgba(51, 102, 238, 0.06);
}

.upload-zone-title {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--deep-blue);
  letter-spacing: -0.02em;
}

.upload-zone-hint {
  font-size: var(--text-caption);
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.upload-preview {
  width: 100%;
  margin-top: 12px;
}

.upload-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  margin-top: 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(34, 36, 74, 0.08);
  font-size: var(--text-sm);
  color: var(--deep-blue);
  text-align: left;
}

.upload-file-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-remove {
  flex-shrink: 0;
  padding: 2px 8px;
  border: none;
  border-radius: 6px;
  background: var(--coral-soft);
  color: #c44a38;
  font-size: var(--text-caption);
  font-weight: 700;
  cursor: pointer;
  font-family: "Inter", sans-serif;
}

.upload-logo-thumb {
  max-height: 48px;
  max-width: 100%;
  margin-top: 10px;
  object-fit: contain;
  border-radius: 6px;
}

.attach-badge {
  display: inline-block;
  font-size: var(--text-caption);
  color: var(--piki-blue);
  font-weight: 600;
  margin-top: 4px;
}

.addon-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.addon-search {
  flex: 1;
  min-width: 220px;
  margin: 0;
}

.addon-count {
  font-size: var(--text-sm);
  color: var(--text-muted);
  white-space: nowrap;
}

.addon-table td.addon-price {
  color: var(--navy-core);
  font-weight: 700;
  white-space: nowrap;
}

.addon-table th:last-child,
.addon-table td:last-child {
  width: 100px;
  text-align: right;
}

.addon-price-inline {
  color: var(--navy-core);
  font-weight: 600;
}

.addon-banner {
  margin-bottom: 20px;
}

.addon-change-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--piki-blue);
  text-decoration: none;
}

.addon-change-link:hover {
  color: var(--arc-blue-hover);
  opacity: 0.9;
}

.job-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.job-panel {
  padding: 22px 24px;
}

.job-panel h3 {
  margin-bottom: 16px;
}

.job-dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px 16px;
  font-size: 14px;
}

.job-dl dt {
  color: var(--text-muted);
  font-weight: 600;
}

.job-dl dd {
  margin: 0;
  color: var(--deep-blue);
}

.job-brief {
  white-space: pre-wrap;
  line-height: 1.6;
  color: var(--deep-blue);
  font-size: 14px;
}

.job-logo-preview {
  max-height: 120px;
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--off-white);
  padding: 8px;
}

.deliver-block {
  padding: 16px;
  border-radius: var(--radius);
  border: 1px dashed var(--n-300);
  background: var(--n-50);
}

/* ——— Solid card alias (portal — no glass) ——— */
.glass-light {
  background: var(--glass-light-bg);
  border: 1px solid var(--glass-light-border);
  border-radius: var(--radius-glass);
  box-shadow: var(--glass-light-shadow);
}

@keyframes portal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes portal-rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .app-portal .stat-card:hover,
  .app-portal .empty-state-card:hover,
  .app-portal .callout:hover,
  .app-portal .card:hover,
  .app-portal .price-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--gray-300);
  }

  .app-portal .portal-enter,
  .app-portal .stat-card,
  .app-portal .stat-strip,
  .app-portal .empty-state-card,
  .app-portal .pipeline-stepper,
  .app-portal .panel,
  .app-portal .card,
  .app-portal .callout,
  .app-portal .dashboard-panel,
  .app-portal .request-form,
  .app-portal .price-card {
    animation: portal-rise-in 300ms ease-out both;
  }

  .app-portal .auth-box {
    animation: portal-fade-in 300ms ease-out both;
  }

  .stats-row .stat-card:nth-child(1),
  .stats-layout--active .stat-card:nth-child(1) { animation-delay: 0ms; }
  .stats-row .stat-card:nth-child(2),
  .stats-layout--active .stat-card:nth-child(2) { animation-delay: 60ms; }
  .stats-row .stat-card:nth-child(3),
  .stats-layout--active .stat-card:nth-child(3) { animation-delay: 120ms; }
  .stats-row .stat-card:nth-child(4),
  .stats-layout--active .stat-card:nth-child(4) { animation-delay: 180ms; }

  .stats-layout--empty .stat-strip { animation-delay: 0ms; }
  .stats-layout--empty .stat-card--quota { animation-delay: 60ms; }

  .pipeline-stepper { animation-delay: 0ms; }
  .dashboard-ctas { animation: portal-rise-in 300ms ease-out 120ms both; }
  .empty-state-card { animation-delay: 180ms; }
  .dashboard-panel { animation-delay: 240ms; }
}

@media (prefers-reduced-motion: reduce) {
  .app-portal .stat-card:hover,
  .app-portal .empty-state-card:hover,
  .app-portal .callout:hover,
  .app-portal .card:hover,
  .app-portal .price-card:hover {
    box-shadow: var(--shadow-sm);
  }

  .app-portal .portal-enter,
  .app-portal .stat-card,
  .app-portal .stat-strip,
  .app-portal .empty-state-card,
  .app-portal .pipeline-stepper,
  .app-portal .panel,
  .app-portal .card,
  .app-portal .callout,
  .app-portal .dashboard-panel,
  .app-portal .auth-box,
  .app-portal .request-form,
  .app-portal .price-card,
  .app-portal .dashboard-ctas,
  .pipeline-step--active {
    animation: none !important;
  }
}

/* Portal surfaces — 60-30-10 */
.app-portal .stat-card,
.app-portal .stat-strip,
.app-portal .empty-state-card,
.app-portal .panel,
.app-portal .card,
.app-portal .callout,
.app-portal .dashboard-panel,
.app-portal .auth-box,
.app-portal .request-form,
.app-portal .price-card,
.app-portal .workflow-bar,
.app-portal .pipeline-stepper {
  background: var(--white);
  border: 1px solid var(--n-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.app-portal .auth-box {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.app-portal .btn-secondary {
  background: var(--white);
  border: 1px solid var(--n-300);
  color: var(--navy);
  box-shadow: var(--shadow-sm);
}

.app-portal .btn-secondary:hover:not(:disabled) {
  background: var(--n-50);
  border-color: var(--n-400);
  color: var(--blue-600);
}

/* Table: container glass only, opaque rows inside */
.app-portal .panel.panel-flush,
.app-portal .dashboard-panel {
  padding: 0;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

.app-portal .panel.panel-flush table,
.app-portal .dashboard-panel:not(.ab-card) table {
  min-width: 880px;
}

.app-portal .panel.panel-flush th,
.app-portal .panel.panel-flush td,
.app-portal .dashboard-panel th,
.app-portal .dashboard-panel td {
  padding: 14px 16px;
  vertical-align: top;
}

.app-portal .panel.panel-flush td:nth-child(2),
.app-portal .dashboard-panel td:nth-child(2) {
  white-space: normal;
  word-break: break-word;
  min-width: 160px;
  max-width: 220px;
}

.app-portal .panel.panel-flush td:last-child,
.app-portal .dashboard-panel td:last-child {
  white-space: nowrap;
}

.app-portal .panel.panel-flush thead th,
.app-portal .dashboard-panel:not(.ab-card) thead th,
.app-portal .dashboard-panel:not(.ab-card) h2,
.app-portal .panel-heading {
  background: var(--n-50);
  border-bottom: 1px solid var(--n-200);
}

.app-portal .panel.panel-flush tbody tr,
.app-portal .dashboard-panel:not(.ab-card) tbody tr {
  background: var(--white);
}

.app-portal .panel.panel-flush tbody tr:nth-child(even),
.app-portal .dashboard-panel:not(.ab-card) tbody tr:nth-child(even) {
  background: var(--n-50);
}

.app-portal .panel.panel-flush tbody tr:hover,
.app-portal .dashboard-panel tbody tr:hover {
  background: var(--blue-50);
  cursor: pointer;
}

.app-portal .panel.panel-flush tbody tr:nth-child(even):hover,
.app-portal .dashboard-panel tbody tr:nth-child(even):hover {
  background: var(--blue-50);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--modal-scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal-overlay[hidden] {
  display: none !important;
}

body.modal-open {
  overflow: hidden;
}

.add-job-modal {
  max-width: 560px;
}

.add-job-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.add-job-modal__head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.add-job-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ui-muted, #6e6e73);
  cursor: pointer;
}

.add-job-modal__close:hover {
  background: var(--ui-fill, #f2f2f7);
  color: var(--ui-ink, #1d1d1f);
}

.add-job-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.add-job-form label {
  margin-top: 8px;
}

.add-job-form label:first-of-type {
  margin-top: 0;
}

.add-job-form input,
.add-job-form select,
.add-job-form textarea {
  width: 100%;
}

.add-job-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.add-job-form__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.add-job-form__spacer {
  flex: 1 1 auto;
}

.page-header__action {
  flex-shrink: 0;
  margin-left: auto;
}

.page-header__copy {
  min-width: 0;
  flex: 1 1 auto;
}

@media (max-width: 640px) {
  .add-job-form__row {
    grid-template-columns: 1fr;
  }

  .add-job-form__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .add-job-form__spacer {
    display: none;
  }
}

.modal-panel {
  width: 100%;
  max-width: 520px;
  padding: var(--space-5);
  max-height: calc(100vh - var(--space-6));
  overflow-y: auto;
  background: var(--surface-card);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.modal-panel.glass-light,
.modal-panel.glass-dark {
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Pipeline stepper */
.pipeline-stepper {
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  padding: var(--space-2);
  background: var(--surface-card);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.pipeline-step {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--gray-500);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  text-align: center;
  min-height: 48px;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.pipeline-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  font-size: var(--text-caption);
  font-weight: 600;
  flex-shrink: 0;
  background: var(--gray-200);
  color: var(--gray-600);
}

.pipeline-step--completed {
  color: var(--arc-blue-900);
  border-color: var(--gray-200);
  background: var(--white);
}

.pipeline-step--completed .pipeline-step__num {
  background: var(--success-bg);
  color: var(--success);
  font-size: 14px;
}

.pipeline-step--active {
  background: var(--blue-500);
  border-color: var(--blue-500);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.pipeline-step--active .pipeline-step__num {
  background: rgba(255, 255, 255, 0.2);
  color: var(--white);
}

/* Dashboard stats layouts */
.stats-layout--empty {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 280px);
  gap: 16px;
  margin-bottom: 24px;
  align-items: stretch;
}

.stat-strip {
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

.stat-strip-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px 24px;
  min-height: 72px;
}

.stat-strip-item + .stat-strip-item {
  border-left: 1px solid rgba(255, 255, 255, 0.35);
}

.stat-strip-item .num {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy-core);
  line-height: 1;
}

.stat-strip-item .lbl {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
}

.stat-card--quota {
  border-left: 4px solid var(--arc-blue);
}

.stats-layout--active {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stats-layout--active .stat-card {
  padding: 24px;
}

.stats-layout--active .stat-card .num {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-indicator {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.stat-indicator--amber,
.stat-indicator--blue { background: var(--arc-blue); }
.stat-indicator--green { background: var(--success-green); }

.dashboard-ctas {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.dashboard-panel:not(.ab-card) h2 {
  font-size: var(--text-h3);
  font-weight: var(--fw-h3);
  color: var(--navy-core);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--n-200);
}

/* Icon action buttons */
.icon-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--navy-core);
  cursor: pointer;
  text-decoration: none;
  padding: 0;
}

.icon-btn:hover:not(:disabled) {
  background: rgba(245, 240, 230, 0.8);
  border-color: var(--navy-core);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--arc-blue);
  outline-offset: 2px;
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 900px) {
  .stats-layout--empty { grid-template-columns: 1fr; }
  .stats-layout--active { grid-template-columns: repeat(2, 1fr); }
  .pipeline-stepper { flex-direction: column; }
}

@media (max-width: 900px) {
  .upload-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .request-form { padding: 24px 20px; }
  .account-form .form-row { grid-template-columns: 1fr; }
  .job-dl { grid-template-columns: 1fr; }
}

/* Responsive */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 80;
    box-shadow: none;
    will-change: transform;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.28);
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(20, 36, 60, 0.45);
    transition: opacity 0.28s ease;
  }
  .sidebar-backdrop[hidden] {
    display: none !important;
  }
  body.sidebar-open {
    overflow: hidden;
  }
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    position: sticky;
    top: 0;
    z-index: 65;
    margin: calc(-1 * var(--space-3)) calc(-1 * var(--space-3)) var(--space-3);
    padding:
      max(var(--space-2), env(safe-area-inset-top))
      max(var(--space-3), env(safe-area-inset-right))
      var(--space-2)
      max(var(--space-3), env(safe-area-inset-left));
    background: var(--n-50);
    border-bottom: 1px solid var(--n-200);
  }
  .mobile-topbar__menu {
    flex-shrink: 0;
    position: static;
    top: auto;
    left: auto;
    bottom: auto;
    right: auto;
    display: inline-flex;
    box-shadow: var(--shadow-sm);
  }
  .mobile-topbar__title {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--navy);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mobile-topbar__brand {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
  }

  .mobile-topbar__install {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--n-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--navy);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
  }

  .mobile-topbar__install:hover {
    background: var(--n-100);
  }

  .mobile-topbar__install:focus-visible {
    outline: 2px solid var(--blue-500);
    outline-offset: 2px;
  }

  .mobile-topbar__install[hidden] {
    display: none !important;
  }
  .logo-mobile {
    display: block;
    max-height: 28px;
    width: auto;
    max-width: 100%;
  }
  .app-shell > .mobile-menu-btn,
  .app-shell > #mobile-menu:not(.mobile-topbar__menu) {
    display: none !important;
  }
  .page-header > h1,
  .page-header .page-header__copy > h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .page-header--row .page-header__copy p {
    display: none;
  }
  .page-header.page-header--row {
    margin-bottom: 12px;
    justify-content: flex-end;
  }
  .app-main {
    margin-left: 0;
    width: 100%;
    padding: var(--space-3);
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
  body.sidebar-open .mobile-topbar__menu {
    z-index: 90;
  }
  .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .page-header h1 { font-size: 26px; }
  .job-card-grid {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }
  .job-card {
    width: 100%;
    min-height: 0;
  }
  .job-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .job-filters select,
  .job-filters input[type="search"] {
    width: 100%;
    min-width: 0;
  }
  .sidebar-footer {
    padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
  }
  .sidebar-footer .btn-signout {
    min-height: 44px;
  }
}

@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar-backdrop,
  .burger-icon span {
    transition: none;
  }
}

.mobile-menu-btn {
  display: none;
  position: fixed;
  z-index: 75;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--navy);
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: background var(--transition-fast);
}

.mobile-topbar .mobile-menu-btn {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
  overflow: hidden;
}

@media (max-width: 900px) {
  .mobile-topbar .mobile-topbar__menu.mobile-menu-btn {
    display: inline-flex;
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: 1;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    margin: 0;
  }
}

.mobile-menu-btn:hover {
  background: var(--blue-700);
}

.mobile-menu-btn:focus-visible {
  outline: 2px solid var(--arc-blue);
  outline-offset: 2px;
}

.burger-icon {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 20px;
  height: 16px;
}

.burger-icon span {
  display: block;
  height: 2px;
  width: 100%;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

body.sidebar-open .burger-icon span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

body.sidebar-open .burger-icon span:nth-child(2) {
  opacity: 0;
}

body.sidebar-open .burger-icon span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ——— Team module ——— */
.role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: var(--text-caption);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
}

.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--error);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--arc-blue-900);
}

.nav-link {
  position: relative;
}

.nav-link .nav-badge {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.team-quick-add {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  margin-bottom: 24px;
}

.team-quick-add input,
.team-quick-add select,
.team-quick-add textarea {
  flex: 1 1 160px;
  min-width: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.75);
  font-family: inherit;
}

.team-quick-add textarea {
  flex: 1 1 100%;
  min-height: 72px;
  resize: vertical;
  line-height: 1.5;
}

.team-quick-add input[type="date"] {
  flex: 0 1 150px;
}

.team-quick-add .btn {
  flex: 0 0 auto;
}

.team-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.team-column__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.team-task-card {
  padding: 16px;
  margin-bottom: 12px;
}

.team-task-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.team-task-card__title {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.4;
}

.team-task-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.client-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: var(--text-caption);
  font-weight: 600;
  background: rgba(51, 102, 238, 0.1);
  color: var(--arc-blue);
}

.overdue-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: var(--text-caption);
  font-weight: 600;
  background: rgba(229, 57, 53, 0.12);
  color: #c62828;
}

.revision-review-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: var(--text-caption);
  font-weight: 600;
  background: rgba(255, 125, 106, 0.12);
  color: var(--malaga-red);
}

.team-task-note {
  width: 100%;
  margin-top: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.7);
  resize: vertical;
  min-height: 36px;
}

.team-status-btn {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.team-status-btn:focus-visible {
  outline: 2px solid var(--arc-blue);
  outline-offset: 2px;
  border-radius: 999px;
}

.team-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin: 20px 0 12px;
  border: 1px solid var(--glass-light-border);
  border-radius: var(--radius-glass);
  background: rgba(255, 255, 255, 0.45);
  font-weight: 600;
  cursor: pointer;
}

.team-section-toggle[aria-expanded="false"] + .team-section-body {
  display: none;
}

.team-warnings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.team-warning {
  padding: 12px 16px;
  border-radius: var(--radius);
  background: rgba(229, 57, 53, 0.08);
  border: 1px solid rgba(229, 57, 53, 0.2);
  color: #b71c1c;
  font-size: 14px;
}

.attendance-clock-card {
  margin-bottom: 20px;
}

.attendance-clock-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.attendance-clock-card__title {
  font-size: 18px;
  margin: 0 0 4px;
}

.attendance-clock-card__state {
  margin: 0;
  font-size: 14px;
  color: var(--n-600, #64748b);
}

.attendance-clock-card__metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.attendance-clock-metric__label {
  display: block;
  font-size: 12px;
  color: var(--n-600, #64748b);
  margin-bottom: 6px;
}

.attendance-clock-metric__value {
  font-size: 32px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.attendance-clock-metric__value--sm {
  font-size: 24px;
}

.attendance-clock-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.attendance-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.attendance-history-table th,
.attendance-history-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--n-200, #e5e7eb);
}

.attendance-history-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--n-600, #64748b);
}

.attendance-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.attendance-status--present {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
}

.attendance-status--half {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.attendance-status--absent {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.team-section {
  margin-bottom: 8px;
}

.attendance-report-filters {
  margin-bottom: 16px;
}

.attendance-live-board {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.attendance-live-chip {
  min-width: 180px;
  padding: 14px 16px;
  border-radius: var(--radius, 10px);
  border: 1px solid var(--n-200, #e5e7eb);
  background: var(--surface-card, #fff);
}

.attendance-live-chip__name {
  font-weight: 600;
  margin-bottom: 4px;
}

.attendance-live-chip__meta {
  font-size: 14px;
  margin-bottom: 2px;
}

.attendance-live-chip__sub {
  font-size: 12px;
  color: var(--n-600, #64748b);
}

.attendance-live-chip--production {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
}

.attendance-live-chip--break {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.12);
}

.attendance-live-chip--out {
  border-color: var(--n-200, #e5e7eb);
  background: var(--n-50, #f8fafc);
  opacity: 0.92;
}

.emp-cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.emp-cal-month-label {
  margin: 0;
  font-size: 20px;
  min-width: 180px;
  text-align: center;
}

.emp-cal-panel {
  padding: 16px;
}

.emp-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--n-600, #64748b);
  text-align: center;
}

.emp-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.emp-cal-day {
  min-height: 88px;
  border-radius: 10px;
  border: 1px solid var(--n-200, #e5e7eb);
  background: var(--surface-card, #fff);
  padding: 8px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.emp-cal-day--empty {
  border: none;
  background: transparent;
  cursor: default;
  min-height: 0;
  padding: 0;
}

.emp-cal-day__num {
  font-weight: 700;
  font-size: 15px;
}

.emp-cal-day__meta {
  font-size: 11px;
  color: var(--n-600, #64748b);
}

.emp-cal-day--holiday {
  background: var(--n-100, #f1f5f9);
  border-color: var(--n-300, #cbd5e1);
  color: var(--n-600, #64748b);
}

.emp-cal-day--present {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.35);
}

.emp-cal-day--half {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.4);
}

.emp-cal-day--absent {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
}

.emp-cal-day--neutral {
  background: var(--surface-card, #fff);
}

.emp-cal-day-modal {
  max-width: 920px;
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.emp-cal-day-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.emp-cal-day-modal__body {
  display: grid;
  gap: 20px;
}

.emp-cal-report-block h4 {
  margin: 0 0 12px;
}

.emp-cal-report-block h5 {
  margin: 16px 0 8px;
  font-size: 14px;
}

.emp-cal-report-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.emp-cal-report-stats div {
  padding: 10px 12px;
  border: 1px solid var(--n-200, #e5e7eb);
  border-radius: 8px;
  background: var(--n-50, #f8fafc);
}

.emp-cal-report-stats span {
  display: block;
  font-size: 11px;
  color: var(--n-600, #64748b);
  margin-bottom: 4px;
}

.emp-cal-break-list {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
}

.emp-cal-jobs-table {
  margin-top: 12px;
}

.team-overview-table tbody tr.inactive-row {
  opacity: 0.65;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  min-width: 0;
  min-height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(107, 114, 128, 0.35);
  border-radius: 999px;
  transition: background 0.2s;
}

.toggle-slider:before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--success-green);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.reassignment-note {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 6px;
  font-style: italic;
}

@media (max-width: 900px) {
  .team-quick-add {
    flex-direction: column;
    align-items: stretch;
  }

  .team-quick-add input,
  .team-quick-add select,
  .team-quick-add textarea,
  .team-quick-add input[type="date"] {
    flex: 1 1 auto;
    width: 100%;
  }
}

/* ——— Job card grid & shared content lane ——— */
.app-portal .app-main > .team-quick-add,
.app-portal .app-main > .job-filters,
.app-portal .app-main > .stats-row,
.app-portal .app-main > .team-warning,
.app-portal .app-main > .jobs-board,
.app-portal .app-main > #job-grid-wrap,
.app-portal .app-main > #active-tasks,
.app-portal .app-main > #history-list,
.app-portal .app-main > #completed-wrap,
.app-portal .app-main > .jobs-toolbar,
.app-portal .app-main > .dashboard-ctas,
.app-portal .app-main > h2,
.job-grid-host,
#job-grid-wrap,
#active-tasks,
#completed-tasks,
#completed-wrap,
#history-list,
.job-grid-empty {
  width: 100%;
  max-width: min(1280px, 100%);
  margin-inline: auto;
}

.app-portal .app-main > p.text-sm.text-muted {
  max-width: min(1280px, 100%);
  margin-inline: auto;
  width: 100%;
}

.job-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  justify-content: stretch;
  gap: 20px;
  align-items: stretch;
}

.job-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}

.job-card--unassigned {
  border-left: 4px solid var(--arc-blue);
}

.job-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.job-card__code {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.job-card__title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
}

.job-card__type {
  margin: 0;
}

.job-card__due {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.job-card__assign {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  font-size: var(--text-sm);
  min-height: 32px;
}

.job-card__assign-label {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  height: 32px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0;
  white-space: nowrap;
  line-height: 1;
}

.needs-assignment {
  flex: 1 1 100%;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--arc-blue);
  line-height: 1.2;
  margin: 0;
}

.job-card__assign .job-assign-select {
  flex: 1 1 0;
  min-width: 120px;
  margin: 0;
}

.job-assign-select,
.job-emp-status-select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.75);
  height: 32px;
  box-sizing: border-box;
  margin: 0;
}

.assignee-pill {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
}

.job-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}

.job-card__actions .actions {
  flex: 1 1 auto;
}

.job-card__upload {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(34, 36, 74, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.job-card__upload-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: rgba(34, 36, 74, 0.65);
  margin: 0;
}

.job-card__upload input[type="file"] {
  font-size: var(--text-sm);
  max-width: 100%;
}

.job-card__upload-name {
  margin: 0;
  word-break: break-all;
}

.job-card__upload-files {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--text-muted, #64748b);
  font-size: 0.875rem;
}

.job-card__upload-files li + li {
  margin-top: 4px;
}

.job-card__upload-hint {
  margin: 4px 0 8px;
}

.employee-deliverables__list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.employee-deliverables__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
}

.employee-deliverables__item span {
  word-break: break-word;
  flex: 1;
  min-width: 0;
}

.employee-deliverables__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.employee-deliverables__note {
  margin: 0 0 10px;
}

.job-card--revision {
  border-left: 4px solid var(--malaga-red);
}

.job-card__revision {
  background: rgba(255, 125, 106, 0.1);
  border: 1px solid rgba(255, 125, 106, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.job-card__revision-label {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--malaga-red);
}

.job-card__revision-comment {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.client-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.client-review-panel {
  margin-top: 20px;
}

.client-review-panel h3 {
  margin-bottom: 8px;
}

.client-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.client-review-no-file {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle, rgba(0, 0, 0, 0.03));
}

.design-preview-wrap {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--border-subtle);
  text-align: center;
}

.design-preview-wrap--file {
  text-align: left;
}

.design-preview {
  display: block;
  max-width: 100%;
  max-height: min(70vh, 720px);
  margin: 0 auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(34, 36, 74, 0.08);
}

.client-revision-limit {
  margin-top: 12px;
}

.client-revision-form .revision-modal__comment {
  margin-bottom: 12px;
}

.client-revision-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Design proof viewer */
.proof-viewer {
  margin-top: 0;
}

.proof-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 12px;
}

.proof-stage-grid {
  display: grid;
  gap: 16px;
}

.proof-stage-grid.proof-compare-grid {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 900px) {
  .proof-stage-grid.proof-compare-grid {
    grid-template-columns: 1fr;
  }
}

.proof-pane-label {
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #64748b);
  margin-bottom: 8px;
}

.proof-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: min(70vh, 640px);
  background: #0f172a08;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.proof-canvas-inner {
  position: relative;
  width: 100%;
  height: 100%;
}

.proof-image,
.proof-pdf-canvas,
.proof-pdf-embed {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.proof-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  z-index: 2;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.proof-pin-dot {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--piki-blue, #2563eb);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.45);
  border: 2px solid #fff;
}

.proof-pin--resolved .proof-pin-dot {
  background: #94a3b8;
  box-shadow: none;
}

.proof-pin--active .proof-pin-dot {
  transform: scale(1.15);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.25);
}

.proof-thread {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface-subtle, rgba(0, 0, 0, 0.03));
}

.proof-thread-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.proof-thread-body {
  margin: 0 0 10px;
  white-space: pre-wrap;
}

.proof-reply {
  font-size: 13px;
  padding: 8px 0;
  border-top: 1px solid var(--border-subtle);
}

.proof-reply-compose {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.proof-checklist {
  margin-bottom: 12px;
}

.proof-checklist ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.proof-hint {
  margin-top: 10px;
}

.proof-pin-summary {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
}

.proof-pin-summary li {
  margin-bottom: 4px;
}

.job-card__revision-pins {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.15);
}

.billing-banner {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.billing-banner--past-due {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
}

.billing-banner--suspended {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.35);
}

.billing-status-dl {
  margin-top: 12px;
}

.client-revision-sent {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--border-subtle);
}

.revision-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--modal-scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.revision-modal {
  width: min(480px, 100%);
  max-height: 90vh;
  overflow-y: auto;
}

.revision-modal__comment {
  width: 100%;
  margin-bottom: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

.revision-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.revision-urgency-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(11, 37, 69, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.revision-urgency-backdrop.is-visible {
  opacity: 1;
}

.revision-urgency-backdrop--nudge .revision-urgency-modal {
  animation: revision-urgency-nudge 0.45s ease;
}

@keyframes revision-urgency-nudge {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px);
  }
  40% {
    transform: translateX(8px);
  }
  60% {
    transform: translateX(-6px);
  }
  80% {
    transform: translateX(6px);
  }
}

.revision-urgency-modal {
  position: relative;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  border: 2px solid rgba(220, 38, 38, 0.35);
  box-shadow: 0 20px 60px rgba(220, 38, 38, 0.2);
}

.revision-urgency-pulse {
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid rgba(220, 38, 38, 0.45);
  animation: revision-urgency-pulse 1.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes revision-urgency-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
}

.revision-urgency-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #dc2626;
}

.revision-urgency-comment {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(220, 38, 38, 0.06);
  border: 1px solid rgba(220, 38, 38, 0.18);
}

.revision-urgency-comment p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.55;
}

.revision-urgency-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.revision-urgency-note {
  margin: 14px 0 0;
}

@media (prefers-reduced-motion: reduce) {
  .revision-urgency-pulse,
  .revision-urgency-backdrop--nudge .revision-urgency-modal {
    animation: none !important;
  }
}

.clients-table-panel {
  width: 100%;
}

.clients-table td.clients-table__email {
  font-size: inherit;
}

.job-card-submit-btn {
  background: var(--arc-blue);
  color: var(--white);
  align-self: stretch;
  font-weight: 600;
}

.job-card-submit-btn:hover:not(:disabled) {
  background: var(--arc-blue-hover);
}

.job-card__emp-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.job-grid-empty {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  min-height: min(280px, 42vh);
  padding: 32px 0 48px;
  box-sizing: border-box;
}

.job-grid-empty .empty-state-card,
.job-grid-empty .empty-state-quiet {
  width: 100%;
  max-width: none;
  margin: 0;
  text-align: left;
}

.job-grid-empty .empty-state-card h2,
.job-grid-empty .empty-state-card p,
.job-grid-empty .empty-state-quiet h2,
.job-grid-empty .empty-state-quiet p {
  text-align: left;
  margin-left: 0;
  margin-right: 0;
}

/* Coming soon — centered panel when a feature is gated off */
.coming-soon-panel {
  width: 100%;
  max-width: 560px;
  margin: var(--space-6) auto;
  text-align: center;
}

.coming-soon-panel .page-header {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

.coming-soon-panel .page-header > :is(h1, h2, h3, p) {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

.coming-soon-panel .empty-state-card {
  margin-top: var(--space-5);
  text-align: center;
}

.coming-soon-panel .empty-state-card p {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

.coming-soon-panel__cta {
  margin-top: var(--space-3);
  margin-bottom: 0;
}

.coming-soon-panel__cta .btn {
  display: inline-flex;
}

.job-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.job-filters select,
.job-filters input[type="search"] {
  width: auto;
  min-width: 160px;
  margin: 0;
}

.job-filters input[type="search"] {
  flex: 1;
  min-width: 200px;
}

.jobs-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.job-card--unassigned {
  border-left: 4px solid var(--arc-blue);
}

.job-card--accepted {
  border-left: 4px solid var(--success-green);
}

.job-card--just-accepted {
  animation: job-accept-flash 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes job-accept-flash {
  0% {
    transform: scale(0.98);
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.45);
  }
  45% {
    transform: scale(1.015);
    box-shadow: 0 0 0 10px rgba(22, 163, 74, 0.12);
  }
  100% {
    transform: scale(1);
    box-shadow: var(--shadow-sm);
  }
}

@media (prefers-reduced-motion: reduce) {
  .job-card--just-accepted,
  .job-panel--just-accepted {
    animation: none;
  }
}

.job-panel--just-accepted {
  animation: job-accept-flash 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.job-card--completed {
  opacity: 0.55;
  animation: job-fade-complete 0.6s ease-out both;
}

@keyframes job-fade-complete {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0.55;
    transform: scale(0.99);
  }
}

.job-card__time {
  font-size: var(--text-sm);
  font-weight: 600;
  margin: 0;
}

.job-card__time--live {
  color: var(--arc-blue);
}

.job-card__time--overdue {
  color: var(--malaga-red);
}

.job-card__time--live .job-timer {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.job-card__time--done {
  color: var(--success-green);
}

.job-card__time-label {
  font-weight: 600;
}

/* Brand kit — designer job views */
.brand-kit-panel {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(34, 36, 74, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.65);
  text-align: left;
}
.brand-kit-panel--compact {
  font-size: var(--text-sm);
  max-height: 280px;
  overflow: auto;
}
.brand-kit-panel__head {
  margin-bottom: 8px;
}
.brand-kit-warning {
  margin: 8px 0 12px;
}
.brand-kit-warning-label {
  font-size: var(--text-caption);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 8px 0 4px;
  color: #991b1b;
}
.brand-kit-logos {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.brand-kit-logo {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 140px;
}
.brand-kit-logo img {
  width: 100%;
  max-height: 72px;
  object-fit: contain;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid rgba(34, 36, 74, 0.08);
}
.brand-kit-logo-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--text-caption);
}
.brand-kit-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.brand-kit-swatch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(34, 36, 74, 0.12);
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: var(--text-sm);
}
.brand-kit-swatch-chip {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--swatch, #ccc);
  border: 1px solid rgba(0, 0, 0, 0.12);
}
.brand-kit-meta {
  margin: 6px 0;
  font-size: var(--text-sm);
}
.brand-kit-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 8px 0;
}
.brand-kit-col-label {
  font-size: var(--text-caption);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 4px;
  color: rgba(34, 36, 74, 0.55);
}
.brand-kit-list {
  margin: 0;
  padding-left: 1.1em;
  font-size: var(--text-sm);
}
.brand-kit-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}
.brand-kit-chips-label {
  font-size: var(--text-caption);
  font-weight: 700;
  color: rgba(34, 36, 74, 0.55);
  margin-right: 4px;
}
.brand-kit-chip {
  border: 1px solid rgba(34, 36, 74, 0.12);
  background: #f1f5f9;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: var(--text-caption);
  cursor: pointer;
}
.brand-kit-guardrail {
  border: 1px solid #f59e0b;
  background: #fffbeb;
  border-radius: 10px;
  padding: 12px 14px;
}
.brand-kit-guardrail-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 8px 0;
  font-size: 13px;
  cursor: pointer;
}
.brand-kit-guard-kind {
  font-weight: 700;
  color: #b45309;
  white-space: nowrap;
}
.brand-kit-from {
  margin-top: 4px;
}
.brand-kit-from-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.brand-kit-from-item {
  width: 96px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--text-caption);
}
.brand-kit-from-item img,
.brand-kit-from-ph {
  width: 96px;
  height: 64px;
  object-fit: contain;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid rgba(34, 36, 74, 0.08);
}

.client-instructions {
  margin-top: 12px;
  padding: 16px 18px;
  border: 2px solid var(--piki-blue, #3b5bdb);
  border-radius: 12px;
  background: var(--n-50, #f8fafc);
  text-align: left;
}
.client-instructions--compact {
  font-size: var(--text-sm);
  padding: 12px 14px;
}
.client-instructions-panel {
  margin-bottom: 20px;
}
.client-instructions-panel > .client-instructions {
  margin-top: 0;
  padding: 0;
  border: none;
  background: transparent;
}
.client-instructions__title {
  margin: 4px 0 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--deep-blue);
  line-height: 1.35;
}
.client-instructions--compact .client-instructions__title {
  font-size: 16px;
}
.client-instructions__brief {
  margin: 0;
}
.client-instructions__attachments {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border, #e2e8f0);
}
.client-instructions__attachments .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

/* Portal messaging */
.msg-widget {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.65);
  margin-top: 16px;
}
.msg-widget-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.msg-list {
  max-height: 320px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  padding-right: 4px;
}
.msg-bubble {
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.msg-bubble.msg-role-client { background: #eff6ff; border-color: #bfdbfe; }
.msg-bubble.msg-role-employee,
.msg-bubble.msg-role-admin { background: #f0fdf4; border-color: #bbf7d0; }
.msg-meta { margin-bottom: 4px; }
.msg-body { white-space: pre-wrap; font-size: 14px; line-height: 1.45; }
.msg-attachments { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.msg-attach-link {
  font-size: var(--text-sm);
  padding: 4px 8px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
}
.msg-compose-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.msg-attach-preview { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.msg-attach-chip {
  font-size: var(--text-caption);
  padding: 4px 8px;
  border-radius: 999px;
  background: #ede9fe;
  color: #5b21b6;
}
.msg-inbox-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}
@media (max-width: 900px) {
  .msg-inbox-layout { grid-template-columns: 1fr; }
}
.msg-inbox-panel { padding: 16px; display: flex; flex-direction: column; }
.msg-inbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.msg-inbox-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.msg-inbox-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
}
.msg-inbox-count.has-unread { background: #6366f1; color: #fff; }
.msg-inbox-count[hidden] { display: none; }
.msg-inbox-search { margin-bottom: 12px; }
.msg-inbox-search input { width: 100%; }
.msg-inbox-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: 62vh;
  padding-right: 2px;
}
.msg-inbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.msg-inbox-row:hover { background: #f1f5f9; }
.msg-inbox-row.active { border-color: #c7d2fe; background: #eef2ff; }
.msg-inbox-avatar {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #4338ca;
  background: linear-gradient(135deg, #e0e7ff, #ede9fe);
}
.msg-inbox-row-main { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.msg-inbox-row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.msg-inbox-title {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-inbox-time { flex: 0 0 auto; font-size: 11px; color: #94a3b8; }
.msg-inbox-preview {
  font-size: 12.5px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-inbox-row.unread .msg-inbox-title { color: #4338ca; }
.msg-inbox-row.unread .msg-inbox-preview { color: #334155; font-weight: 500; }
.msg-inbox-badge { flex: 0 0 auto; align-self: center; }
.msg-inbox-empty {
  padding: 28px 12px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}
.msg-inbox-error { color: #b91c1c; }
.msg-inbox-detail {
  padding: 16px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
}
.msg-inbox-detail .empty-state-card {
  margin: auto;
  border: none;
  box-shadow: none;
  background: transparent;
}
.msg-detail-loading { padding: 8px; }

/* Header row with action button */
.page-header--row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* System / activity lines inside a thread */
.msg-system {
  align-self: center;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  background: #f1f5f9;
  border-radius: 999px;
  padding: 4px 12px;
  margin: 2px auto;
  max-width: 90%;
}

/* Participants bar */
.msg-participants {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 0 12px;
  margin-bottom: 8px;
  border-bottom: 0.5px solid var(--border, #e2e8f0);
}
.msg-part-label { font-size: 12px; color: #94a3b8; margin-right: 2px; }
.msg-part-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
}
.msg-part-chip.msg-part-client { background: #eff6ff; color: #1e40af; }
.msg-part-chip.msg-part-admin { background: #f0fdf4; color: #166534; }
.msg-part-role { font-size: 10.5px; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.02em; }
.msg-part-rm {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 0 0 2px;
  opacity: 0.6;
}
.msg-part-rm:hover { opacity: 1; }

/* Picker modal */
.msg-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.msg-modal {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(2, 6, 23, 0.3);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}
.msg-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.msg-modal-head strong { font-size: 16px; }
.msg-modal-close {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #94a3b8;
}
.msg-modal-close:hover { color: #0f172a; }
.msg-modal-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.msg-modal-tab {
  flex: 1;
  padding: 7px 10px;
  border: 0.5px solid var(--border, #e2e8f0);
  background: #f8fafc;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: #475569;
}
.msg-modal-tab.active { background: #eef2ff; border-color: #c7d2fe; color: #4338ca; }
.msg-modal-search { width: 100%; margin-bottom: 10px; }
.msg-modal-list { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.msg-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
}
.msg-picker-row:hover { background: #f1f5f9; }
.msg-picker-main { display: flex; flex-direction: column; min-width: 0; }
.msg-picker-name { font-size: 14px; font-weight: 500; color: #0f172a; }
.msg-picker-sub {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* CRM */
.crm-health {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: var(--text-sm);
}
.crm-health--healthy { background: #d1fae5; color: #065f46; }
.crm-health--watch { background: #fef3c7; color: #92400e; }
.crm-health--risk { background: #fee2e2; color: #991b1b; }
.crm-stage {
  display: inline-block;
  font-size: var(--text-caption);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
}
.crm-stage--at_risk { background: #fee2e2; color: #991b1b; }
.crm-stage--churned { background: #f1f5f9; color: #64748b; }
.crm-stage--lead { background: #ede9fe; color: #5b21b6; }
.crm-tag {
  display: inline-block;
  font-size: var(--text-caption);
  padding: 2px 8px;
  margin: 2px 4px 2px 0;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
}
.crm-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 12px;
}
.crm-tab {
  border: 1px solid var(--gray-200);
  background: var(--white);
  border-radius: var(--radius-full);
  padding: 8px 14px;
  font-size: var(--text-caption);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.crm-tab:hover:not(.active) {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

.crm-tab.active {
  background: var(--arc-blue-50);
  border-color: var(--arc-blue-200);
  color: var(--arc-blue-700);
}
.crm-profile-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.crm-quick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crm-profile-panel { padding: 18px; }
.crm-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.crm-stat-card {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.6);
}
.crm-stat-label { display: block; font-size: var(--text-caption); color: #64748b; margin-bottom: 6px; }
.crm-note-list { margin: 0; padding-left: 18px; }
.crm-note {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: rgba(255,255,255,0.65);
}
.crm-note--pinned { border-color: #6366f1; background: #eef2ff; }
.crm-note-head { margin-bottom: 6px; }
.crm-note-compose { margin-bottom: 16px; }

@media (prefers-reduced-motion: reduce) {
  .btn-signout:hover:not(:disabled),
  .btn-signout:active:not(:disabled) {
    transform: none;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Portal premium polish — light SaaS motion & components
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --motion-fast: 150ms;
  --motion-normal: 200ms;
  --motion-slow: 250ms;
  --shadow-xs: 0 1px 2px rgba(11, 37, 69, 0.04);
  --shadow-hover: 0 6px 20px rgba(11, 37, 69, 0.08), 0 2px 6px rgba(30, 94, 255, 0.06);
  --shadow-focus: 0 0 0 3px var(--blue-50);
  --frosted-surface: rgba(255, 255, 255, 0.94);
  --hairline: 1px solid var(--n-200);
}

/* —— Buttons: press + lift —— */
.app-portal .btn {
  position: relative;
  isolation: isolate;
}

@media (prefers-reduced-motion: no-preference) {
  .app-portal .btn:hover:not(:disabled) {
    transform: translateY(-1px);
  }

  .app-portal .btn:active:not(:disabled) {
    transform: scale(0.98) translateY(0);
    transition-duration: 80ms;
  }

  .app-portal .btn-primary {
    background-image: linear-gradient(180deg, #2f6fff 0%, var(--blue-500) 100%);
  }

  .app-portal .btn-primary:hover:not(:disabled) {
    background-image: linear-gradient(180deg, #3d7aff 0%, var(--blue-600) 100%);
    box-shadow: var(--shadow-hover);
  }
}

.app-portal .btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus), var(--shadow-sm);
}

/* —— Inputs: animated focus ring —— */
.app-portal input:not([type="checkbox"]):not([type="radio"]),
.app-portal select,
.app-portal textarea,
.app-portal .glass-field {
  transition:
    border-color var(--motion-fast) var(--ease-out),
    box-shadow var(--motion-fast) var(--ease-out),
    background var(--motion-fast) var(--ease-out);
}

.app-portal input:focus-visible,
.app-portal select:focus-visible,
.app-portal textarea:focus-visible,
.app-portal .glass-field:focus-visible {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: var(--shadow-focus);
}

/* —— Cards & interactive rows —— */
.app-portal .card,
.app-portal .stat-card,
.app-portal .price-card,
.app-portal .panel:not(.panel-flush),
.app-portal .job-panel {
  transition:
    box-shadow var(--motion-normal) var(--ease-out),
    border-color var(--motion-normal) var(--ease-out),
    transform var(--motion-normal) var(--ease-out);
}

@media (prefers-reduced-motion: no-preference) {
  .app-portal .card:hover,
  .app-portal .stat-card:hover,
  .app-portal .price-card:hover,
  .app-portal .job-panel:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--n-300);
  }

  .app-portal tbody tr {
    transition: background var(--motion-fast) var(--ease-out);
  }
}

.app-portal tbody tr[role="button"],
.app-portal tbody tr.is-clickable,
.app-portal .panel tbody tr {
  cursor: default;
}

.app-portal .panel tbody tr:hover {
  background: var(--blue-50);
}

.app-portal table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--white);
  box-shadow: 0 1px 0 var(--n-200);
}

.app-portal .th-sortable {
  cursor: pointer;
  user-select: none;
}

.app-portal .th-sortable::after {
  content: "↕";
  margin-left: 6px;
  font-size: 12px;
  color: var(--n-400);
  opacity: 0.6;
}

/* —— Content reveal —— */
@keyframes portal-content-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: no-preference) {
  .app-portal.portal-ready .portal-reveal {
    animation: portal-content-in var(--motion-slow) var(--ease-out) both;
    animation-delay: calc(var(--reveal-i, 0) * 40ms);
  }

  .app-portal.portal-ready .portal-reveal-root > .page-header {
    --reveal-i: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-portal .portal-reveal {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
}

/* —— Nav active + badges —— */
.app-portal .nav-link {
  transition:
    background var(--motion-fast) var(--ease-out),
    color var(--motion-fast) var(--ease-out),
    padding-left var(--motion-normal) var(--ease-out);
}

.app-portal .nav-link.active {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 3px 0 0 var(--blue-400);
}

.app-portal .nav-badge {
  transition: transform var(--motion-fast) var(--ease-out);
}

@media (prefers-reduced-motion: no-preference) {
  .app-portal .nav-link.active .nav-badge {
    animation: nav-badge-pop 400ms var(--ease-out);
  }
}

@keyframes nav-badge-pop {
  0% { transform: scale(0.85); }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* —— Tabs: animated underline —— */
.app-portal .role-tabs,
.app-portal .crm-tabs {
  position: relative;
}

.app-portal .role-tab,
.app-portal .crm-tab {
  transition:
    color var(--motion-fast) var(--ease-out),
    background var(--motion-fast) var(--ease-out),
    box-shadow var(--motion-fast) var(--ease-out);
}

.app-portal .role-tab.active,
.app-portal .crm-tab.active {
  box-shadow: inset 0 -2px 0 var(--blue-500);
}

/* —— Modals —— */
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes modal-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: no-preference) {
  .modal-overlay {
    animation: modal-backdrop-in var(--motion-normal) var(--ease-out);
  }

  .modal-panel,
  .revision-modal {
    animation: modal-in var(--motion-slow) var(--ease-out);
  }

  .sidebar.open {
    transition: transform var(--motion-slow) var(--ease-out);
  }
}

/* —— Toast —— */
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(12px);
  opacity: 0;
  transition:
    transform var(--motion-normal) var(--ease-out),
    opacity var(--motion-normal) var(--ease-out);
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.toast--success {
  background: var(--success);
  border-color: rgba(255, 255, 255, 0.15);
}

.toast__icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.toast__icon svg {
  width: 18px;
  height: 18px;
}

/* —— Skeletons —— */
.skeleton-zone {
  padding: 4px 0;
}

.skeleton {
  display: block;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    var(--n-100) 0%,
    var(--n-50) 40%,
    var(--n-100) 80%
  );
  background-size: 200% 100%;
  min-height: 14px;
}

@media (prefers-reduced-motion: no-preference) {
  .skeleton {
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
  }
}

@keyframes skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.skeleton-text { height: 14px; margin: 6px 0; }
.skeleton-text--sm { height: 10px; }
.skeleton-pill { width: 72px; height: 22px; border-radius: 999px; }
.skeleton-block { width: 100%; border-radius: var(--radius); }
.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-bottom: 12px;
}
.skeleton-avatar--sm { width: 32px; height: 32px; margin: 0; }
.skeleton-avatar--lg { width: 64px; height: 64px; }

.skeleton-card {
  padding: 16px;
  border: var(--hairline);
  border-radius: var(--radius);
  background: var(--white);
}

.skeleton-zone--cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.skeleton-zone--media {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.skeleton-media-tile {
  aspect-ratio: 1;
  border-radius: var(--radius);
}

.skeleton-zone--calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.skeleton-cal-cell {
  aspect-ratio: 1.1;
  border-radius: var(--radius-sm);
}

.skeleton-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.skeleton-row td {
  padding: 14px 16px;
}

/* —— Avatars —— */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  background: var(--blue-100);
  border: var(--hairline);
  flex-shrink: 0;
}

.avatar--sm { width: 28px; height: 28px; font-size: 12px; }
.avatar--lg { width: 48px; height: 48px; font-size: 16px; }

.avatar[data-hue="1"] { background: #dbe6ff; color: #163f9e; }
.avatar[data-hue="2"] { background: #ecfdf3; color: #128a3a; }
.avatar[data-hue="3"] { background: #fffbeb; color: #b8860b; }
.avatar[data-hue="4"] { background: #fef2f2; color: #c0392b; }

/* —— Chips, toggles, progress —— */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--text-caption);
  font-weight: 600;
  border: var(--hairline);
  background: var(--white);
  color: var(--n-500);
}

.chip--blue { background: var(--blue-50); border-color: var(--blue-100); color: var(--blue-700); }
.chip--success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: var(--n-300);
  border: none;
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-out);
}

.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: var(--shadow-xs);
  transition: transform var(--motion-fast) var(--ease-out);
}

.toggle[aria-checked="true"] {
  background: var(--blue-500);
}

.toggle[aria-checked="true"]::after {
  transform: translateX(20px);
}

.progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--n-100);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue-400), var(--blue-500));
  transition: width var(--motion-slow) var(--ease-out);
}

/* —— Tooltips —— */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--white);
  background: var(--navy);
  border-radius: var(--radius-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-fast), transform var(--motion-fast);
  z-index: 100;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* —— Segmented control —— */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--n-100);
  border-radius: var(--radius);
  border: var(--hairline);
}

.segmented__btn {
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--n-500);
  cursor: pointer;
  transition: background var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast);
}

.segmented__btn[aria-selected="true"] {
  background: var(--white);
  color: var(--navy);
  box-shadow: var(--shadow-xs);
}

/* —— Frosted overlay (light, legible) —— */
.surface-frosted {
  background: var(--frosted-surface);
  border-bottom: var(--hairline);
}

@supports (backdrop-filter: blur(8px)) {
  .surface-frosted--blur {
    backdrop-filter: blur(8px) saturate(140%);
    -webkit-backdrop-filter: blur(8px) saturate(140%);
  }
}

/* —— Celebration burst —— */
.celebrate-burst {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.celebrate-burst span {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue-400);
  animation: celebrate-pop 700ms var(--ease-out) forwards;
}

.celebrate-burst span:nth-child(1) { --a: 0deg; background: var(--blue-500); }
.celebrate-burst span:nth-child(2) { --a: 60deg; background: #17d1c8; }
.celebrate-burst span:nth-child(3) { --a: 120deg; }
.celebrate-burst span:nth-child(4) { --a: 180deg; background: var(--success); }
.celebrate-burst span:nth-child(5) { --a: 240deg; }
.celebrate-burst span:nth-child(6) { --a: 300deg; background: #17d1c8; }

@keyframes celebrate-pop {
  0% { transform: rotate(var(--a)) translateY(0) scale(1); opacity: 1; }
  100% { transform: rotate(var(--a)) translateY(-48px) scale(0); opacity: 0; }
}

/* —— Command palette —— */
.cmd-palette-root {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
}

.cmd-palette-root[hidden] { display: none !important; }

.cmd-palette-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 37, 69, 0.4);
}

.cmd-palette {
  position: relative;
  width: min(560px, 100%);
  background: var(--white);
  border: var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  opacity: 0;
  transform: scale(0.98) translateY(-8px);
  transition: opacity var(--motion-normal) var(--ease-out), transform var(--motion-normal) var(--ease-out);
}

.cmd-palette-root.is-open .cmd-palette {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.cmd-palette__search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: var(--hairline);
}

.cmd-palette__search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 16px;
  color: var(--ink);
  margin: 0;
  padding: 0;
  min-height: 28px;
}

.cmd-palette__search input:focus {
  outline: none;
  box-shadow: none;
}

.cmd-palette__icon {
  display: inline-flex;
  color: var(--n-400);
  width: 20px;
  height: 20px;
}

.cmd-palette__icon svg { width: 20px; height: 20px; }

.cmd-palette__kbd {
  font-size: var(--text-caption);
  padding: 3px 7px;
  border-radius: 6px;
  border: var(--hairline);
  color: var(--n-500);
  background: var(--n-50);
  text-transform: uppercase;
}

.cmd-palette__list {
  list-style: none;
  margin: 0;
  padding: 8px;
  max-height: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.cmd-palette__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: background var(--motion-fast);
}

.cmd-palette__item:hover,
.cmd-palette__item.is-active {
  background: var(--blue-50);
  color: var(--navy);
}

.cmd-palette__item-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  color: var(--blue-500);
}

.cmd-palette__item-icon svg { width: 18px; height: 18px; }

.cmd-palette__foot {
  display: flex;
  gap: 16px;
  padding: 10px 16px;
  border-top: var(--hairline);
  font-size: var(--text-caption);
  color: var(--n-500);
}

.cmd-palette__foot kbd {
  font-size: var(--text-sm);
  padding: 2px 5px;
  border-radius: 4px;
  border: var(--hairline);
  background: var(--n-50);
  margin: 0 2px;
}

body.cmd-palette-open { overflow: hidden; }

/* —— Empty states —— */
.empty-state-card {
  transition: box-shadow var(--motion-normal) var(--ease-out);
}

.empty-state-card .btn {
  margin-top: var(--space-2);
}

/* —— Touch & tablet/mobile (≤900px) —— */
@media (max-width: 900px) {
  /* Toolbars & filters — full-width stack, no horizontal page overflow */
  .cal-toolbar,
  .cal-toolbar-left,
  .cal-toolbar-right,
  .cal-filters,
  .biz-filters,
  .crm-filters,
  .leads-toolbar,
  .blog-admin-toolbar,
  .category-form,
  .emp-cal-toolbar {
    width: 100%;
    max-width: 100%;
  }

  .cal-toolbar-left,
  .cal-toolbar-right {
    flex: 1 1 100%;
  }

  .cal-toolbar-right .btn,
  .cal-toolbar-right a.btn,
  .cal-toolbar-right select {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }

  .cal-filters select,
  .crm-filters select,
  .crm-filters input[type="search"],
  .leads-toolbar select,
  .biz-filters select,
  .biz-filters input {
    width: 100%;
    min-width: 0 !important;
    max-width: 100%;
  }

  .cal-filters label {
    min-height: 44px;
    padding: 4px 0;
  }

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

  .chart-grid {
    grid-template-columns: 1fr !important;
  }

  .leads-board {
    grid-template-columns: 1fr !important;
  }

  .capacity-row {
    grid-template-columns: 1fr !important;
  }

  .app-portal .panel.panel-flush,
  .app-portal .dashboard-panel {
    max-width: 100%;
  }

  .fc .fc-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .fc .fc-toolbar-chunk {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }

  .fc .fc-button {
    min-height: 44px;
    min-width: 44px;
  }

  #needs-approval-chip {
    min-height: 44px;
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
  }

  .app-portal table .btn,
  .app-portal table .btn-sm,
  .app-portal table a.btn {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 12px;
  }

  .msg-inbox-layout {
    min-height: 0;
  }

  .auth-page .auth-box a,
  .auth-page p.text-sm a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 6px;
  }

  .auth-page .social-auth__icons {
    gap: 12px;
  }

  .btn,
  .btn-sm {
    min-height: 44px;
  }

  .nav-link {
    min-height: 44px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .icon-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
  }

  input[type="checkbox"],
  input[type="radio"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
  }

  .app-portal .app-main {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  .toast {
    bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
    right: max(var(--space-4), env(safe-area-inset-right));
    left: auto;
    max-width: min(360px, calc(100vw - var(--space-4) - env(safe-area-inset-right) - env(safe-area-inset-left)));
  }
}

/* —— Mobile base (≤640px) —— */
@media (max-width: 640px) {
  input,
  select,
  textarea {
    font-size: 16px;
  }

  .analytics-cards {
    grid-template-columns: 1fr !important;
  }

  .cal-toolbar-right .btn,
  .cal-toolbar-right a.btn {
    flex: 1 1 100%;
  }

  .health-pillars {
    grid-column: span 1;
  }
}

.pipeline-step__num .pipeline-check-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  color: var(--white);
}

.pipeline-step__num .pipeline-check-icon svg {
  width: 16px;
  height: 16px;
}

@media (prefers-reduced-motion: reduce) {
  .celebrate-burst { display: none; }
  .cmd-palette { transition: none; }
  .toast { transition: none; opacity: 1; transform: none; }
  .modal-overlay,
  .modal-panel,
  .revision-modal { animation: none !important; }
  .app-portal .btn:hover:not(:disabled),
  .app-portal .btn:active:not(:disabled) { transform: none; }
}

/* —— PWA standalone / installed app polish —— */
@media (display-mode: standalone) {
  html,
  body.app-portal {
    overscroll-behavior-y: none;
  }

  .app-main {
    padding-top: max(var(--space-3), env(safe-area-inset-top));
    padding-left: max(var(--space-3), env(safe-area-inset-left));
    padding-right: max(var(--space-3), env(safe-area-inset-right));
    padding-bottom: max(var(--space-5), env(safe-area-inset-bottom));
  }

  .mobile-topbar {
    margin-top: 0;
    padding-top: max(var(--space-2), env(safe-area-inset-top));
  }

  .sidebar {
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
  }

  .toast {
    bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
    right: max(var(--space-4), env(safe-area-inset-right));
  }
}

@supports (-webkit-touch-callout: none) {
  @media (display-mode: standalone) {
    body.app-portal {
      -webkit-overflow-scrolling: touch;
    }
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Portal — industry-standard visual system (Linear / Apple HIG)
   One accent. Neutral surfaces. Symmetric cards. No mixed button colors.
   ═══════════════════════════════════════════════════════════════════════════ */
body.app-portal {
  /* Legacy --ui-* palette, now carrying the ArcBig brand VALUES.
     It used to hold its own (#0071e3 blue, #1d1d1f ink, #f5f5f7 bg), so the
     portal shipped two different blues and two neutral ramps side by side.
     These must stay literal: the rules below alias the n-, ink and navy tokens back to
     these names, so a var() pointing the other way would be circular.
     New code should reference the brand tokens in :root instead. */
  --ui-bg: #f7f9fc;
  --ui-surface: #ffffff;
  --ui-ink: #1a1a1a;
  --ui-nav: #0b2545;
  --ui-secondary: #374151;
  --ui-muted: #6b7280;
  --ui-line: #e3e8ef;
  --ui-fill: #eef1f6;
  --ui-blue: #1e5eff;
  --ui-blue-hover: #1a4fd6;
  --ui-blue-pressed: #163f9e;
  --ui-blue-soft: #eef3ff;
  --ui-green: #128a3a;
  --ui-green-soft: #ecfdf3;
  --ui-red: #c0392b;
  --ui-red-soft: #fdecee;
  --ui-orange: #c93400;
  --ui-radius: 16px;
  --ui-radius-sm: 10px;
  --ui-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ui-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 6px 20px rgba(15, 23, 42, 0.06);
  --ui-shadow-hover: 0 10px 18px rgba(15, 23, 42, 0.08), 0 24px 48px rgba(15, 23, 42, 0.12);
  --blue-500: var(--ui-blue);
  --blue-600: var(--ui-blue-hover);
  --blue-700: var(--ui-blue-pressed);
  --arc-blue: var(--ui-blue);
  --arc-blue-hover: var(--ui-blue-hover);
  --navy: var(--ui-ink);
  --ink: var(--ui-ink);
  --text-muted: var(--ui-muted);
  --n-50: var(--ui-bg);
  --n-100: var(--ui-fill);
  --n-200: var(--ui-line);
  --n-300: #cbd3df;
  --white: var(--ui-surface);
  -webkit-font-smoothing: antialiased;
  background: var(--ui-bg);
  color: var(--ui-ink);
}

body.app-portal .app-main {
  background: var(--ui-bg);
}

/* Compact titles on every portal role. Nav already names the page. */
body.app-portal .page-header {
  max-width: min(1280px, 100%);
  width: 100%;
  margin-bottom: 20px;
}

body.app-portal .page-header h1 {
  margin-bottom: 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--ui-ink);
}

body.app-portal .page-header p {
  display: none;
}

body.app-portal .page-header #today-date,
body.app-portal .page-header #inbox-sub,
body.app-portal .coming-soon-panel .page-header p {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ui-muted);
}

body.app-portal .page-header #inbox-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.app-portal .jobs-page-head {
  max-width: min(1280px, 100%);
  width: 100%;
  margin-bottom: 8px;
}

body.app-portal .jobs-page-head > h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.app-portal .jobs-chrome {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

body.app-portal .jobs-chrome__bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

body.app-portal .jobs-chrome__bar .job-assignment-switch {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 280px;
  padding: 2px;
  border: none;
  background: rgba(118, 118, 128, 0.12);
  border-radius: 9px;
}

body.app-portal .jobs-chrome__bar .segmented__btn {
  flex: 1 1 0;
  min-height: 28px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border-radius: 7px;
}

body.app-portal .jobs-chrome__bar .segmented__btn[aria-selected="true"] {
  background: #fff;
  color: var(--ui-ink);
  box-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.06);
}

body.app-portal .jobs-chrome__bar #open-add-job {
  margin-left: auto;
  flex: 0 0 auto;
  min-height: 32px;
  padding: 6px 14px;
}

body.app-portal .jobs-chrome__tools {
  display: flex;
  align-items: center;
  gap: 4px 12px;
  flex-wrap: wrap;
}

body.app-portal .jobs-chrome .jobs-search,
body.app-portal .jobs-chrome input[type="search"]:not(.ab-field__control) {
  flex: 1 1 180px;
  width: auto;
  min-width: 0;
  height: 36px;
  min-height: 36px;
  margin: 0;
  padding: 0 12px 0 34px;
  border: none;
  border-radius: 10px;
  background-color: rgba(118, 118, 128, 0.12);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238e8e93' stroke-width='1.8' stroke-linecap='round'><circle cx='7' cy='7' r='5.2'/><path d='M11 11.2L14 14'/></svg>");
  background-repeat: no-repeat;
  background-position: 10px 50%;
  background-size: 16px;
  color: var(--ui-ink);
  font-size: 15px;
  font-weight: 400;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}

body.app-portal .jobs-chrome .jobs-search::placeholder,
body.app-portal .jobs-chrome input[type="search"]::placeholder {
  color: #8e8e93;
}

body.app-portal .jobs-chrome .jobs-search:focus-visible,
body.app-portal .jobs-chrome input[type="search"]:focus-visible {
  border: none;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
  outline: none;
}

body.app-portal .jobs-chrome .jobs-menu,
body.app-portal .jobs-chrome select:not(.ab-select__control) {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  max-width: 46vw;
  height: 32px;
  min-height: 32px;
  margin: 0;
  padding: 0 22px 0 0;
  border: none;
  border-radius: 0;
  background-color: transparent;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%230071e3' d='M1 1l4 4 4-4'/></svg>");
  background-repeat: no-repeat;
  background-position: right 2px center;
  color: var(--ui-blue);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

body.app-portal .jobs-chrome .jobs-menu:focus-visible,
body.app-portal .jobs-chrome select:not(.ab-select__control):focus-visible {
  border: none;
  box-shadow: none;
  outline: 2px solid rgba(0, 113, 227, 0.35);
  outline-offset: 3px;
}

body.app-portal .jobs-chrome select[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  body.app-portal .jobs-page-head {
    margin-bottom: 4px;
  }

  body.app-portal .jobs-chrome__bar .job-assignment-switch {
    max-width: none;
  }

  body.app-portal .jobs-chrome .jobs-search,
  body.app-portal .jobs-chrome input[type="search"] {
    flex: 1 1 100%;
  }
}

.empty-state-quiet {
  text-align: left;
  padding: 8px 0 48px;
  background: none;
  border: none;
  box-shadow: none;
}

.empty-state-quiet .empty-state-card__icon {
  width: 36px;
  height: 36px;
  margin: 0 0 12px;
  color: #c7c7cc;
}

.empty-state-quiet .empty-state-card__icon svg {
  width: 36px;
  height: 36px;
  stroke-width: 1.7;
}

.empty-state-quiet h2 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.022em;
  color: var(--ui-ink, #1d1d1f);
}

body.app-portal .empty-state-quiet h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.022em;
}

.empty-state-quiet p {
  margin: 0;
  max-width: none;
  font-size: 15px;
  line-height: 1.35;
  color: var(--ui-muted, #6e6e73);
}

.empty-state-quiet .btn {
  margin-top: 16px;
}

.job-grid-empty .empty-state-quiet {
  width: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  .app-portal .empty-state-quiet:hover {
    box-shadow: none;
    transform: none;
    border-color: transparent;
  }
}

body.app-portal .empty-state,
body.app-portal .empty-state-card,
body.app-portal .empty-state-quiet {
  text-align: left;
}

body.app-portal .empty-state-card__icon,
body.app-portal .empty-state-quiet .empty-state-card__icon {
  margin-left: 0;
  margin-right: 0;
}

body.app-portal .empty-state-card h2,
body.app-portal .empty-state-card p,
body.app-portal .empty-state p,
body.app-portal .empty-state-quiet h2,
body.app-portal .empty-state-quiet p {
  text-align: left;
  margin-left: 0;
  margin-right: 0;
  max-width: none;
}

body.app-portal .coming-soon-panel,
body.app-portal .coming-soon-panel .page-header,
body.app-portal .coming-soon-panel .page-header > :is(h1, h2, h3, p),
body.app-portal .coming-soon-panel .empty-state-card,
body.app-portal .coming-soon-panel .empty-state-card h2,
body.app-portal .coming-soon-panel .empty-state-card p {
  text-align: center;
}

body.app-portal .coming-soon-panel .empty-state-card__icon {
  margin-left: auto;
  margin-right: auto;
}

body.app-portal .add-job-modal {
  background: #fff;
  border: 1px solid var(--ui-line);
  border-radius: 20px;
  box-shadow: var(--ui-shadow-hover);
}

/* Sidebar */
body.app-portal .sidebar {
  background: var(--ui-nav, #0B2645);
  border-right: none;
}

body.app-portal .nav-link,
body.app-portal .nav-link-logout {
  border-left: none;
  border-radius: var(--ui-radius-sm);
  margin: 0 12px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
}

body.app-portal .nav-link.active,
body.app-portal .nav-link-sub.active {
  background: var(--ui-blue);
  color: #fff;
  font-weight: 600;
  box-shadow: none;
}

body.app-portal .nav-link.active .nav-link__icon,
body.app-portal .nav-link-sub.active .nav-link__icon {
  color: #fff;
}

body.app-portal .nav-link:hover:not(.active) {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

body.app-portal .nav-link-parent.active {
  background: rgba(255, 255, 255, 0.08);
}

/* Surfaces */
body.app-portal .card,
body.app-portal .panel,
body.app-portal .stat-card,
body.app-portal .stat-strip,
body.app-portal .empty-state-card,
body.app-portal .callout,
body.app-portal .dashboard-panel,
body.app-portal .request-form,
body.app-portal .price-card,
body.app-portal .workflow-bar,
body.app-portal .pipeline-stepper,
body.app-portal .glass-light {
  background: var(--ui-surface);
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow);
  transition:
    box-shadow 280ms var(--ui-ease),
    transform 280ms var(--ui-ease),
    border-color 280ms var(--ui-ease);
}

body.app-portal .stat-card {
  padding: 20px;
}

body.app-portal .stat-card .num {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--ui-ink);
}

body.app-portal .stat-card .lbl {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ui-muted);
  text-transform: none;
  letter-spacing: 0;
}

/* Buttons — one system: fill / outline / quiet / danger / success */
body.app-portal .btn {
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 980px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: none;
  transform: none;
}

body.app-portal .btn-sm {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 13px;
}

body.app-portal .btn-primary,
body.app-portal .btn-deep,
body.app-portal .btn-teal,
body.app-portal a.btn-primary,
body.app-portal a.btn-deep,
body.app-portal a.btn-teal {
  background: var(--ui-blue);
  background-image: none;
  border-color: transparent;
  color: #fff;
}

body.app-portal .btn-primary:hover:not(:disabled),
body.app-portal .btn-deep:hover:not(:disabled),
body.app-portal .btn-teal:hover:not(:disabled),
body.app-portal a.btn-primary:hover:not(:disabled),
body.app-portal a.btn-deep:hover:not(:disabled),
body.app-portal a.btn-teal:hover:not(:disabled) {
  background: var(--ui-blue-hover);
  background-image: none;
  color: #fff;
  box-shadow: none;
}

body.app-portal .btn-secondary,
body.app-portal a.btn-secondary,
body.app-portal a.btn-secondary:hover:not(:disabled) {
  background: var(--ui-surface);
  border-color: var(--ui-line);
  color: var(--ui-ink);
  box-shadow: none;
}

body.app-portal .btn-secondary:hover:not(:disabled) {
  background: var(--ui-fill);
  border-color: #c7c7cc;
  color: var(--ui-ink);
}

body.app-portal .btn-ghost,
body.app-portal a.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ui-blue);
}

body.app-portal .btn-ghost:hover:not(:disabled),
body.app-portal a.btn-ghost:hover:not(:disabled) {
  background: var(--ui-blue-soft);
  color: var(--ui-blue);
}

body.app-portal .btn-success {
  background: var(--blue-500);
  border-color: transparent;
  color: var(--surface);
}

body.app-portal .btn-success:hover:not(:disabled) {
  background: var(--blue-600);
  color: var(--surface);
}

body.app-portal .btn-coral,
body.app-portal .btn-danger,
body.app-portal a.btn-coral,
body.app-portal a.btn-danger {
  background: var(--ui-red);
  border-color: transparent;
  color: #fff;
}

body.app-portal .btn-coral:hover:not(:disabled),
body.app-portal .btn-danger:hover:not(:disabled),
body.app-portal a.btn-coral:hover:not(:disabled),
body.app-portal a.btn-danger:hover:not(:disabled) {
  background: #c10012;
  color: #fff;
}

body.app-portal .btn:active:not(:disabled) {
  transform: none;
}

/* Job cards — Apple list-card rhythm */
body.app-portal .job-card-grid {
  gap: 16px;
  justify-content: stretch;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}

body.app-portal .job-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--ui-surface);
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow);
  border-left-width: 1px;
  transform: translateY(0);
  transition:
    box-shadow 280ms var(--ui-ease),
    transform 280ms var(--ui-ease),
    border-color 280ms var(--ui-ease);
}

body.app-portal .job-card--unassigned,
body.app-portal .job-card--accepted,
body.app-portal .job-card--revision,
body.app-portal .job-card--overdue {
  border-left-width: 1px;
  border-left-color: var(--ui-line);
}

body.app-portal .job-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
}

body.app-portal .job-card__code {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ui-muted);
  font-variant-numeric: tabular-nums;
}

body.app-portal .job-card__pills {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

body.app-portal .job-card .status-pill,
body.app-portal .job-card .overdue-tag,
body.app-portal .job-card .revision-review-tag {
  margin: 0;
  height: 22px;
  padding: 0 8px;
  border-radius: 980px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  line-height: 22px;
}

body.app-portal .job-card .status-pill--submitted,
body.app-portal .job-card .status-pill--pending {
  background: var(--ui-fill);
  color: var(--ui-secondary);
}

body.app-portal .job-card .status-pill--progress {
  background: var(--ui-blue-soft);
  color: var(--ui-blue);
}

body.app-portal .job-card .status-pill--ready,
body.app-portal .job-card .status-pill--whatsapp {
  background: #fff4e5;
  color: var(--ui-orange);
}

body.app-portal .job-card .status-pill--posted,
body.app-portal .job-card .status-pill--accepted {
  background: var(--ui-green-soft);
  color: var(--ui-green);
}

body.app-portal .job-card__body {
  margin-top: 12px;
}

body.app-portal .job-card__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--ui-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.app-portal .job-card__type {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--ui-muted);
}

body.app-portal .job-card__assign {
  margin-top: 12px;
  min-height: 0;
}

body.app-portal .job-card__assign-label {
  height: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--ui-muted);
}

body.app-portal .job-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--ui-fill);
}

body.app-portal .job-card__due,
body.app-portal .job-card__time {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--ui-muted);
  line-height: 1.3;
}

body.app-portal .job-card__time-label {
  font-weight: 500;
  color: var(--ui-muted);
}

body.app-portal .job-card .overdue-tag {
  margin-top: 10px;
  align-self: flex-start;
  background: var(--ui-red-soft);
  color: var(--ui-red);
}

body.app-portal .job-card__upload,
body.app-portal .job-card__revision {
  margin-top: 12px;
  border-radius: var(--ui-radius-sm);
}

body.app-portal .job-card__actions {
  margin-top: auto;
  padding-top: 14px;
}

body.app-portal .job-card__actions .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

body.app-portal .job-card__actions .btn {
  flex: 1 1 calc(50% - 4px);
  width: auto;
  min-width: 8.5rem;
  justify-content: center;
}

body.app-portal .pipeline-stepper {
  padding: 6px;
  gap: 6px;
}

body.app-portal .pipeline-step {
  border: none;
  background: var(--ui-fill);
  color: var(--ui-muted);
  border-radius: 980px;
}

body.app-portal .pipeline-step--active {
  background: var(--ui-blue);
  color: #fff;
  box-shadow: none;
}

body.app-portal .pipeline-step--completed {
  background: var(--ui-blue-soft);
  color: var(--ui-blue);
}

body.app-portal input:not([type="checkbox"]):not([type="radio"]),
body.app-portal select,
body.app-portal textarea {
  border-radius: var(--ui-radius-sm);
  border-color: var(--ui-line);
  background: var(--ui-surface);
  box-shadow: none;
}

body.app-portal input:focus-visible,
body.app-portal select:focus-visible,
body.app-portal textarea:focus-visible {
  border-color: var(--ui-blue);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.16);
}

body.app-portal label:not(.toggle-row label):not(.option-btn):not(.btn):not(.oc-toggle) {
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--ui-muted);
}

body.app-portal .job-filters,
body.app-portal .jobs-toolbar,
body.app-portal .team-quick-add {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin-bottom: 16px;
}

body.app-portal a.stat-card {
  text-decoration: none;
  color: inherit;
  display: block;
}

body.app-portal a.stat-card:hover {
  border-color: var(--ui-line);
}

body.app-portal .segmented {
  background: var(--ui-fill);
  border: 1px solid var(--ui-line);
  border-radius: 12px;
}

body.app-portal .segmented__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 16px;
  color: var(--ui-muted);
  text-decoration: none;
  background: transparent;
}

body.app-portal .segmented__btn[aria-selected="true"],
body.app-portal .segmented__btn.is-active {
  background: #fff;
  color: var(--ui-ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

body.app-portal .job-filters select[hidden] {
  display: none !important;
}

body.app-portal .job-assignment-switch {
  flex: 0 0 auto;
}

body.app-portal .panel.panel-flush thead th,
body.app-portal .dashboard-panel thead th,
body.app-portal .dashboard-panel h2,
body.app-portal .panel-heading {
  background: var(--ui-fill);
  border-bottom: 1px solid var(--ui-line);
  color: var(--ui-muted);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

body.app-portal .panel.panel-flush tbody tr:nth-child(even),
body.app-portal .dashboard-panel tbody tr:nth-child(even) {
  background: var(--ui-surface);
}

body.app-portal .panel.panel-flush tbody tr:hover,
body.app-portal .dashboard-panel tbody tr:hover,
body.app-portal .panel tbody tr:hover {
  background: var(--ui-fill);
}

@media (prefers-reduced-motion: no-preference) {
  body.app-portal .btn:hover:not(:disabled) {
    transform: none;
  }

  body.app-portal .btn-primary:hover:not(:disabled) {
    background-image: none;
  }

  @keyframes ui-card-enter {
    from {
      opacity: 0;
      transform: translateY(12px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  body.app-portal .job-card-grid > .job-card {
    animation: ui-card-enter 480ms var(--ui-ease) both;
  }

  body.app-portal .job-card-grid > .job-card:nth-child(1) { animation-delay: 0ms; }
  body.app-portal .job-card-grid > .job-card:nth-child(2) { animation-delay: 40ms; }
  body.app-portal .job-card-grid > .job-card:nth-child(3) { animation-delay: 80ms; }
  body.app-portal .job-card-grid > .job-card:nth-child(4) { animation-delay: 120ms; }
  body.app-portal .job-card-grid > .job-card:nth-child(5) { animation-delay: 160ms; }
  body.app-portal .job-card-grid > .job-card:nth-child(6) { animation-delay: 200ms; }
  body.app-portal .job-card-grid > .job-card:nth-child(7) { animation-delay: 240ms; }
  body.app-portal .job-card-grid > .job-card:nth-child(8) { animation-delay: 280ms; }
  body.app-portal .job-card-grid > .job-card:nth-child(9) { animation-delay: 320ms; }
  body.app-portal .job-card-grid > .job-card:nth-child(10) { animation-delay: 360ms; }
  body.app-portal .job-card-grid > .job-card:nth-child(11) { animation-delay: 400ms; }
  body.app-portal .job-card-grid > .job-card:nth-child(12) { animation-delay: 440ms; }

  body.app-portal .job-card:hover,
  body.app-portal .card:hover,
  body.app-portal .stat-card:hover,
  body.app-portal .price-card:hover,
  body.app-portal .empty-state-card:hover,
  body.app-portal .callout:hover,
  body.app-portal .panel:hover,
  body.app-portal .dashboard-panel:hover {
    transform: translateY(-4px);
    box-shadow: var(--ui-shadow-hover);
    border-color: rgba(0, 0, 0, 0.06);
  }

  body.app-portal .job-card:active,
  body.app-portal .card:active,
  body.app-portal .stat-card:active {
    transform: translateY(-1px);
    box-shadow: var(--ui-shadow);
    transition-duration: 120ms;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.app-portal .job-card,
  body.app-portal .card,
  body.app-portal .stat-card,
  body.app-portal .price-card,
  body.app-portal .empty-state-card,
  body.app-portal .callout,
  body.app-portal .glass-light {
    animation: none;
    transition: none;
    transform: none;
  }
}

body.app-portal h1,
body.app-portal h2,
body.app-portal h3,
body.app-portal h4 {
  color: var(--ui-ink);
  letter-spacing: -0.02em;
}

/* Jobs board — ops rail */
.jobs-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
  width: 100%;
  max-width: min(1280px, 100%);
  margin-inline: auto;
}

.jobs-ops {
  position: sticky;
  top: 24px;
}

.jobs-ops__card {
  background: var(--ui-surface, #fff);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  box-shadow: var(--ui-shadow, 0 6px 20px rgba(15, 23, 42, 0.06));
  padding: 18px 16px 16px;
}

.jobs-ops__title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.jobs-ops__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.jobs-ops__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 10px 10px 9px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  background: #f5f5f7;
  text-align: left;
  cursor: default;
  font: inherit;
  color: inherit;
}

button.jobs-ops__stat {
  cursor: pointer;
}

button.jobs-ops__stat:hover {
  background: #ececf1;
}

.jobs-ops__stat:last-child {
  grid-column: 1 / -1;
}

.jobs-ops__stat--alert {
  background: #fdecee;
  border-color: rgba(215, 0, 21, 0.12);
}

.jobs-ops__stat-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.jobs-ops__stat-label {
  font-size: 11px;
  font-weight: 500;
  color: #6e6e73;
}

.jobs-ops__heading {
  margin: 18px 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: #6e6e73;
  letter-spacing: 0.02em;
}

.jobs-ops__list,
.jobs-ops__team {
  list-style: none;
  margin: 0;
  padding: 0;
}

.jobs-ops__list li + li,
.jobs-ops__team li + li {
  margin-top: 4px;
}

.jobs-ops__link,
.jobs-ops__person {
  display: grid;
  width: 100%;
  gap: 2px;
  padding: 8px;
  border: none;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  text-decoration: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.jobs-ops__link:hover,
.jobs-ops__person:hover {
  background: #f5f5f7;
  color: inherit;
}

.jobs-ops__code {
  font-size: 11px;
  font-weight: 600;
  color: #6e6e73;
}

.jobs-ops__job-title,
.jobs-ops__person-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jobs-ops__person-count {
  font-size: 11px;
  color: #6e6e73;
}

.jobs-ops__bar {
  display: block;
  height: 4px;
  margin-top: 6px;
  border-radius: 99px;
  background: #ececf1;
  overflow: hidden;
}

.jobs-ops__bar span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: #0071e3;
}

.jobs-ops__empty,
.jobs-ops__more {
  margin: 0;
  font-size: 13px;
  color: #6e6e73;
}

.jobs-ops__more {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 6px 8px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-weight: 600;
  color: #0071e3;
}

@media (max-width: 1100px) {
  .jobs-board {
    grid-template-columns: 1fr;
  }

  .jobs-ops {
    display: block;
    position: static;
    order: -1;
  }
}

/* Mobile portal chrome — dark Apple bar, visible menu, fluid job cards */
@media (max-width: 900px) {
  body.app-portal .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--ui-nav, #0B2645);
    border-bottom: none;
    color: #fff;
    z-index: 90;
    overflow: visible;
  }

  body.app-portal .mobile-topbar__title {
    color: #fff;
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -0.03em;
    text-align: left;
    padding-left: 0;
    position: relative;
    z-index: 0;
    pointer-events: none;
  }

  body.app-portal .mobile-topbar .mobile-topbar__menu.mobile-menu-btn {
    display: inline-flex;
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: 2;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    margin: 0;
    overflow: visible;
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border: none;
    box-shadow: none;
  }

  body.app-portal .mobile-topbar .burger-icon {
    width: 18px;
    height: 12px;
    gap: 3px;
  }

  body.app-portal .mobile-topbar .burger-icon span {
    height: 1.5px;
    background: #fff;
  }

  body.app-portal .mobile-topbar__brand {
    background: transparent;
    width: auto;
    min-width: 44px;
    padding: 0 4px;
  }

  body.app-portal .logo-mobile {
    max-height: 22px;
    width: auto;
    max-width: 88px;
  }

  body.app-portal .mobile-topbar__install {
    background: rgba(255, 255, 255, 0.12);
    border-color: transparent;
    color: #fff;
  }

  body.app-portal .sidebar {
    width: min(320px, calc(100vw - 48px));
  }

  body.app-portal .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  body.app-portal .stat-card {
    padding: 16px;
  }

  body.app-portal .stat-card .num {
    font-size: 24px;
  }

  body.app-portal .jobs-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  body.app-portal .jobs-toolbar .btn {
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
  }

  body.app-portal .job-card-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  body.app-portal .job-card {
    width: 100%;
    max-width: 100%;
  }

  body.app-portal .job-card__assign .job-assign-select {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
  }

  body.app-portal .page-header p {
    color: var(--ui-muted);
  }

  body.sidebar-open .mobile-topbar {
    visibility: hidden;
    pointer-events: none;
  }

  body.app-portal .sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: max(16px, env(safe-area-inset-top));
  }

  body.app-portal .sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
  }

  body.app-portal .sidebar-close svg {
    display: block;
  }
}

/* Publish Studio */
.studio-thread { margin-top: 16px; }
.studio { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.studio-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 0;
}
.studio-lang { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-full); overflow: hidden; background: var(--white); }
.studio-lang button {
  border: 0;
  background: transparent;
  color: var(--navy);
  padding: 6px 12px;
  font-weight: 650;
  cursor: pointer;
}
.studio-lang button[aria-pressed="true"] { background: var(--blue-500); color: var(--surface); }
/* Segmented control (caption mode, preview feed/grid). */
.studio-switch {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  margin: var(--space-3) 0 var(--space-2);
  border-radius: var(--radius-full);
  background: var(--n-100);
}
.studio-switch button {
  border: 0;
  background: transparent;
  color: var(--n-500);
  border-radius: var(--radius-full);
  min-height: 32px;
  padding: 0 var(--space-3);
  font: inherit;
  font-size: var(--text-caption);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out);
}
.studio-switch button:hover { color: var(--navy); }
.studio-switch button[aria-pressed="true"] { background: var(--white); color: var(--navy); box-shadow: var(--shadow-sm); }
.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  column-gap: var(--space-4);
  row-gap: 0;
  align-items: start;
}
.studio-col {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
  min-width: 0;
}
.studio-col h2 { margin: 0 0 12px; font-size: 15px; color: var(--navy); }
/* Composer (accounts + content) and "format & when" read as one card in column 1;
   the preview keeps pace in column 2. */
.studio-col[data-col="compose"] {
  grid-column: 1;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: 0;
}
.studio-col[data-col="when"] {
  grid-column: 1;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: 1px solid var(--n-100);
}
.studio-col[data-col="preview"] {
  grid-column: 2;
  grid-row: 1 / span 2;
  position: sticky;
  top: var(--space-3);
}
.studio.is-collapsed .studio-grid { grid-template-columns: minmax(0, 1fr); }
.studio-step[data-step="2"],
.studio-sec-head--when {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--n-100);
}
.studio-sec-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: var(--space-3); }
.studio-eyebrow {
  font-size: var(--text-micro);
  font-weight: 600;
  letter-spacing: var(--label-spacing);
  text-transform: uppercase;
  color: var(--n-500);
}
.studio-col .studio-sec-title {
  margin: 0;
  font-size: var(--text-h3);
  font-weight: 600;
  line-height: var(--lh-heading);
  color: var(--navy);
}
.studio-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.studio-chip, .studio-format, .studio-tab {
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--navy);
  border-radius: var(--radius-full);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
}
.studio-chip { display: inline-flex; align-items: center; gap: 6px; }
.studio-chips .studio-chip[data-chip] {
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-1);
  border-color: var(--blue-100);
  background: var(--blue-50);
  text-align: left;
}
.studio-chips .studio-chip[data-chip]:hover { border-color: var(--blue-500); }
.studio-chips .studio-chip[data-chip] .ab-avatar__badge { border-color: var(--blue-50); }
.studio-chip__text { display: flex; flex-direction: column; line-height: 1.25; }
.studio-chip__text strong { font-size: var(--text-sm); font-weight: 600; color: var(--navy); }
.studio-chip__text small { font-size: var(--text-micro); color: var(--n-500); }
.studio-chip__x { display: inline-flex; color: var(--n-500); margin-left: var(--space-1); }
.studio-chip__x svg { width: 14px; height: 14px; }
.studio-chips .studio-chip[data-chip]:hover .studio-chip__x { color: var(--navy); }
.studio-chip.is-on { box-shadow: 0 0 0 2px var(--success); }
.studio-chip.is-warn { box-shadow: 0 0 0 2px var(--warning); }
.studio-chip.is-error { box-shadow: 0 0 0 2px var(--error); }
.studio-plus { border-radius: var(--radius-full); }
.studio-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.studio-tab { position: relative; }
.studio-tab[aria-selected="true"] { background: var(--blue-50); border-color: var(--blue-500); }
.studio-tab .studio-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--blue-500); display: inline-block; margin-left: 4px;
}
.studio-formats { display: flex; flex-wrap: wrap; gap: 8px; }
/* Per-account options: two columns on wide screens, heading spans both. */
#studio-options .studio-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 var(--space-4);
  margin-top: var(--space-3);
}
#studio-options .studio-group > h3 { grid-column: 1 / -1; }
#label-campaign { margin-top: var(--space-4); }
.studio-empty {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--n-50);
}
.studio-empty p,
.studio-empty-copy p { margin: 0; color: var(--navy); }
.studio-empty-copy { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.studio-primary-wrap { display: inline-flex; }
.studio-format { display: inline-flex; align-items: center; gap: 6px; }
.studio-format[aria-pressed="true"] { background: var(--blue-500); color: var(--surface); border-color: var(--blue-500); }
.studio-soon {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--warning-bg);
  color: var(--warning);
  border-radius: var(--radius-full);
  padding: 1px 6px;
}
.studio-format[aria-pressed="true"] .studio-soon { background: var(--surface); color: var(--warning); }
.studio-counter { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.studio-counter.is-over { color: var(--error); font-weight: 650; }
.studio-media { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.studio-media-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  background: var(--n-50);
}
.studio-media-item img, .studio-media-item video {
  width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); background: var(--n-100);
}
.studio-popover, .studio-picker {
  position: absolute;
  z-index: 20;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 10px;
  min-width: 220px;
  max-height: 320px;
  overflow: auto;
}
.studio-anchor { position: relative; }
.studio-ai {
  margin-top: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--blue-50);
}
.studio-ai__row { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-2); }
.studio-ai__row select { flex: 1 1 140px; }
.studio-ai__note { margin: var(--space-2) 0 0; font-size: var(--text-caption); color: var(--text-muted); }
.studio-ai__results { display: grid; gap: var(--space-2); margin-top: var(--space-2); }
.studio-ai__item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
}
.studio-ai__item p { margin: 0 0 var(--space-2); white-space: normal; line-height: var(--lh-body); }
.studio-picker { width: min(360px, 80vw); }
.studio-group { margin-top: 8px; }
.studio-group h3 { margin: 8px 0 4px; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.studio-option { margin-bottom: 10px; display: block; }
.studio-option .ab-avatar { margin: 0 var(--space-1); }
.studio-banner {
  border: 1px solid var(--error-border);
  background: var(--error-bg);
  color: var(--navy);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 10px;
}
.studio-banner.is-warn {
  border-color: var(--warning-border);
  background: var(--warning-bg);
}
.studio-hash-list, .studio-best-box, .studio-queue-box { display: grid; gap: 6px; margin-top: 8px; }
.studio-hash, .studio-best {
  text-align: left;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
}
.studio-best { display: grid; gap: 2px; }
.publishing-grid { display: grid; gap: 16px; }
.publishing-card { padding: 16px 18px; }
.slot-row, .hash-row, .missed-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.slot-row:last-child, .hash-row:last-child, .missed-row:last-child { border-bottom: 0; }
.status-chip.missed_paused, .status-missed { background: var(--warning-bg); color: var(--warning); }
.posts-hub { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; align-items: start; }
.posts-hub:has(#posts-drawer:not([hidden])) { grid-template-columns: 200px minmax(0, 1fr) minmax(260px, 340px); }
.posts-subnav { display: grid; gap: 4px; }
.posts-subnav-views { display: grid; gap: 4px; }
.posts-nav-btn {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; text-align: left; border: 0; background: transparent;
  padding: 8px 10px; border-radius: var(--radius); color: var(--navy); cursor: pointer;
  font-weight: 500;
}
.posts-nav-btn:hover:not(.is-active) { background: var(--n-50); }
.posts-nav-btn.is-active,
.posts-nav-btn[aria-current="page"] {
  background: var(--ui-blue);
  color: #fff;
  font-weight: 600;
}
.posts-nav-btn.is-active .posts-count,
.posts-nav-btn[aria-current="page"] .posts-count { color: rgba(255, 255, 255, 0.8); }
.posts-count { font-size: 12px; color: var(--text-muted); }
.posts-subnav-links {
  display: grid; gap: 2px;
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--border);
}
.posts-jump {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 10px;
  color: var(--ui-blue);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  background: none;
  border: 0;
}
.posts-jump:hover { text-decoration: underline; }
.posts-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  margin-bottom: 14px;
}
.posts-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.posts-toolbar-menus { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.posts-menu-btn {
  display: inline-flex; align-items: center; gap: 4px;
  height: 32px; padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  color: var(--navy);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.posts-menu-btn.is-on { border-color: var(--navy); background: var(--n-50); }
.posts-menu-btn[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--ui-blue-soft, #e8f1fc); }
.posts-menu-pop { min-width: 180px; padding: 6px; }
.posts-menu-item {
  display: block; width: 100%; text-align: left;
  border: 0; background: transparent;
  padding: 8px 10px; border-radius: 6px;
  color: var(--navy); cursor: pointer; font-size: 13px;
}
.posts-menu-item:hover { background: var(--n-50); }
.posts-menu-item[aria-checked="true"] { background: var(--ui-blue-soft, #e8f1fc); font-weight: 650; }
.posts-range-custom { display: grid; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.posts-range-custom[hidden] { display: none; }
.posts-range-field { display: grid; gap: 4px; font-size: 12px; color: var(--text-muted); }
.posts-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border);
}
.posts-row.is-open { background: var(--ui-blue-soft, #e8f1fc); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: var(--radius); }
.posts-row-main {
  display: grid; grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px; align-items: center; cursor: pointer; min-width: 0;
}
.posts-row-main:focus-visible { outline: 2px solid var(--ui-blue); outline-offset: 2px; }
.posts-thumb img, .posts-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); background: var(--n-100); }
.posts-fmt { font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; height: 64px; }
.posts-caption { margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.posts-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.posts-avatars { display: flex; gap: 4px; margin-top: 6px; }
.posts-avatar { position: relative; width: 22px; height: 22px; border-radius: 50%; background: var(--navy); color: var(--white); font-size: 9px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; text-transform: uppercase; }
.status-dot { position: absolute; right: -2px; bottom: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--n-300); }
.status-dot.status-published { background: var(--success, #16a34a); }
.status-dot.status-scheduled, .status-dot.status-planned { background: var(--blue-500); }
.status-dot.status-failed { background: var(--error); }
.status-dot.status-missed_paused { background: var(--warning); }
.posts-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.posts-drawer { position: sticky; top: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--white); padding: 14px; }
.posts-drawer[hidden] { display: none; }
.posts-drawer-head { display: flex; justify-content: space-between; align-items: center; }
.posts-drawer-media { width: 100%; border-radius: var(--radius-sm); margin: 8px 0; }
.posts-history { padding-left: 18px; }
.posts-pager { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
@media (max-width: 900px) {
  .posts-hub { grid-template-columns: 1fr; }
  .posts-hub:has(#posts-drawer:not([hidden])) { grid-template-columns: 1fr; }
  .posts-subnav { display: grid; }
  .posts-row { grid-template-columns: 1fr; }
  .posts-row-main { grid-template-columns: 56px minmax(0, 1fr); }
  .posts-metrics, .posts-actions { grid-column: 1 / -1; }
}
.studio-preview-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.studio-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--n-100);
  color: var(--navy);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.studio-preview-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
  background: var(--n-50);
}
.studio-preview-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.studio-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--navy); color: var(--white);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.studio-crop { width: 100%; object-fit: cover; border-radius: var(--radius-sm); background: var(--n-100); display: block; }
.studio-crop.ratio-feed { aspect-ratio: 1.91 / 1; }
.studio-crop.ratio-ig { aspect-ratio: 4 / 5; }
.studio-crop.ratio-grid { aspect-ratio: 1 / 1; }
.studio-crop.ratio-gbp { aspect-ratio: 4 / 3; }
.studio-more {
  background: none;
  border: 0;
  color: var(--blue-500);
  cursor: pointer;
  padding: 2px var(--space-1);
  border-radius: var(--radius-sm);
  font-weight: 650;
}
.studio-more:hover { background: var(--blue-50); }
.studio-dots { display: flex; gap: 4px; justify-content: center; margin-top: 6px; }
.studio-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--n-300); display: block; }
.studio-dots i.is-on { background: var(--blue-500); }
.studio-foot-status { flex: 1; min-width: 200px; }
.studio-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--frosted-surface);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  bottom: var(--space-3);
  z-index: 6;
  margin-top: var(--space-3);
}
.studio-ready-btn {
  background: none;
  border: 0;
  color: var(--navy);
  font-weight: 650;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}
.studio-ready-btn:hover { background: var(--n-100); }
.studio-issues { width: 100%; display: grid; gap: 8px; }
.studio-issue {
  border: 1px solid var(--error-border);
  background: var(--error-bg);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
}
.studio-issue.is-warn { border-color: var(--warning-border); background: var(--warning-bg); }
.studio-issue-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.studio-tabs-mobile { display: none; gap: 8px; }
.studio.is-collapsed .studio-col[data-col="preview"] { display: none; }
.studio-col-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.studio button:focus-visible,
.studio input:focus-visible,
.studio textarea:focus-visible,
.studio select:focus-visible,
.studio a:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}
@media (max-width: 1024px) {
  .studio-grid { grid-template-columns: minmax(0, 1fr); }
  .studio-col[data-col="compose"],
  .studio-col[data-col="when"] { grid-column: 1; }
  .studio-tabs-mobile { display: flex; }
  .studio-col[data-col="preview"] { display: none; grid-column: 1; grid-row: auto; position: static; }
  .studio.is-preview .studio-col[data-col="compose"],
  .studio.is-preview .studio-col[data-col="when"] { display: none; }
  .studio.is-preview .studio-col[data-col="preview"] { display: block; }
  .studio.is-preview .studio-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .studio-grid { grid-template-columns: 1fr; }
  .studio-foot { position: sticky; bottom: 0; z-index: 6; }
}

.cal-tz {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
}
.cal-filters { margin-bottom: 14px; }
.cal-filters-compact {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  min-width: 0;
  overflow-x: auto;
}
.cal-ch-chips {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  flex: 1 1 auto;
}
.cal-ch-chip {
  flex-shrink: 0;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.cal-ch-chip[aria-pressed="true"] {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.cal-filter-menus {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.cal-menu { position: relative; }
.cal-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 32px;
  width: 160px;
  max-width: 160px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  color: var(--navy);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.cal-menu-display .cal-menu-btn { width: 132px; max-width: 132px; }
.cal-menu-btn.is-on { border-color: var(--navy); background: var(--n-50); }
.cal-menu-btn[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--ui-blue-soft, #e8f1fc); }
.cal-menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  padding: 6px;
  z-index: 24;
}
.cal-menu-pop[hidden] { display: none; }
.cal-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--navy);
  cursor: pointer;
  font-size: 13px;
}
.cal-menu-item:hover { background: var(--n-50); }
.cal-menu-item[aria-selected="true"] { background: var(--ui-blue-soft, #e8f1fc); font-weight: 650; }
.cal-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--navy);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.cal-toggle:hover { background: var(--n-50); }
.cal-switch {
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: var(--n-200, #e2e8f0);
  position: relative;
  flex-shrink: 0;
}
.cal-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
  transition: transform 0.15s ease;
}
.cal-toggle.is-on .cal-switch,
.cal-toggle[aria-pressed="true"] .cal-switch { background: var(--navy); }
.cal-toggle.is-on .cal-switch::after,
.cal-toggle[aria-pressed="true"] .cal-switch::after { transform: translateX(14px); }
@media (max-width: 900px) {
  .cal-filters.cal-filters-compact,
  .cal-filters.cal-filters-compact select {
    width: auto !important;
    max-width: none;
  }
  .cal-filters.cal-filters-compact label { min-height: 0; padding: 0; }
}
.cal-plus { position: relative; }
.cal-plus-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 140px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  padding: 6px;
  z-index: 20;
}
.cal-plus-menu[hidden] { display: none; }
.cal-plus-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  color: var(--navy);
}
.cal-plus-menu button:hover { background: var(--n-50); }
.cal-post-drawer {
  position: fixed;
  top: 16px;
  right: 16px;
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  z-index: 55;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
}
.cal-item-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 56;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.cal-item-modal[hidden] { display: none; }
#festivals-view { display: grid; gap: 10px; }
#festivals-view[hidden] { display: none; }
.fest-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--white);
}
.fest-card.is-soon { border-color: var(--warning); background: #fffbeb; }
.fest-card.is-past { opacity: 0.72; }
.fest-date { margin: 4px 0 0; font-size: 13px; }
.fest-hint { margin: 4px 0 0; font-size: 12px; font-weight: 650; color: var(--navy); }
.fest-past { margin-top: 8px; }
.fest-past summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--text-muted);
  padding: 8px 0;
}
.fest-past .fest-card { margin-top: 8px; }
.cal-item-card .cal-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.cal-item-card .cal-item-head h3 { margin: 0; }
.cal-item-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.cal-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.cal-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.cal-swatch.is-on { box-shadow: 0 0 0 2px var(--navy); }
.cal-vis-toggle {
  display: flex;
  gap: 6px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  width: fit-content;
}
.cal-vis-btn {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
}
.cal-vis-btn.is-on,
.cal-vis-btn[aria-pressed="true"] { background: var(--navy); color: #fff; }
.fc .fc-daygrid-event { overflow: hidden; max-width: 100%; }
.fc-chip-compact {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.fc-chip-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fc-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--n-300, #cbd5e1);
}
.fc-status-dot.status-published { background: var(--success, #16a34a); }
.fc-status-dot.status-scheduled { background: var(--blue-500, #2563eb); }
.fc-status-dot.status-needs_approval { background: var(--warning, #d97706); }
.fc-status-dot.status-draft { background: var(--n-400, #94a3b8); }
.fc-status-dot.status-failed { background: var(--error, #dc2626); }
.fc-status-dot.status-missed_paused { background: var(--warning, #d97706); }
.fc-day-actions {
  position: absolute;
  bottom: 4px;
  right: 4px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  z-index: 2;
}
.fc-empty-day .fc-fill-day,
.fc-empty-day .fc-suggest-day { position: static; }
.fc-event.fc-festival-marker,
.fc-event.fc-festival-marker .fc-event-main,
.fc-event.fc-festival-marker .fc-chip,
.fc-event.fc-festival-marker .fc-chip-title {
  color: var(--text-primary, var(--ink, #1a1a1a)) !important;
}
.fc-item-navy { border-color: var(--navy) !important; background: var(--n-100) !important; }
.fc-item-blue { border-color: var(--blue-500, #2563eb) !important; background: var(--ui-blue-soft, #e8f1fc) !important; }
.fc-item-success { border-color: var(--success) !important; background: var(--success-bg, #d1fae5) !important; }
.fc-item-warning { border-color: var(--warning) !important; background: var(--warning-bg, #fef3c7) !important; }
.fc-item-error { border-color: var(--error) !important; background: var(--error-bg, #fee2e2) !important; }
.fc-item-teal { border-color: #0d9488 !important; background: #ccfbf1 !important; }
.fc-item-purple { border-color: #7c3aed !important; background: #ede9fe !important; }
@media (max-width: 720px) {
  .fest-card { flex-direction: column; align-items: flex-start; }
  .cal-menu-btn { width: 140px; max-width: 140px; }
}

/* Reports v2 + Home channel health */
.rpt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.rpt-chips, .rpt-presets, .rpt-interval, .rpt-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rpt-chip {
  border: 1px solid var(--border, #e5e7eb);
  background: var(--surface, #fff);
  color: var(--text-primary, #1a1a1a);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
}
.rpt-chip.is-active {
  border-color: var(--navy, #22244a);
  background: var(--n-100, #eef0f7);
  font-weight: 600;
}
.rpt-more { position: relative; margin-left: auto; }
.rpt-more-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: var(--text-primary, #1a1a1a);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.rpt-more-btn:hover { background: var(--n-100, #eef0f7); }
.rpt-chart-empty {
  border: 1px dashed var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  margin: 12px 0 24px;
  color: var(--text-muted, #666);
}
.rpt-chart-empty p { margin: 0 0 12px; }
.rpt-row-muted td { color: var(--text-muted, #666); }
.rpt-menu {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 8;
  min-width: 180px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.rpt-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 6px;
}
.rpt-menu button:hover { background: var(--n-100, #eef0f7); }
.rpt-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}
.rpt-kpi {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 12px 14px;
}
.rpt-kpi__label { color: var(--text-muted, #666); font-size: 12px; margin-bottom: 4px; }
.rpt-kpi__value { font-size: 22px; font-weight: 700; color: var(--text-primary, #1a1a1a); }
.rpt-delta { font-size: 12px; font-weight: 600; }
.rpt-delta--up { color: var(--success); }
.rpt-delta--down { color: var(--error); }
.rpt-delta--muted, .rpt-delta--new { color: var(--text-muted, #666); }
.rpt-na { cursor: help; color: var(--text-muted, #666); }
.rpt-chart-wrap { height: 260px; margin: 12px 0 24px; }
.rpt-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }
.rpt-table td { vertical-align: middle; }
.rpt-dialog { border: 0; border-radius: 12px; padding: 0; width: min(440px, 94vw); }
.rpt-form { padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.rpt-sched-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dash-health-root { margin-top: 28px; }
.dash-health-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
}
.dash-need-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.dash-need-card ul { margin: 0; padding-left: 18px; }
.dash-need-card a { color: inherit; }
.rpt-spark { color: var(--navy, #22244a); display: block; }
@media (max-width: 900px) {
  .rpt-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-health-grid { grid-template-columns: 1fr; }
}

.inbox-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  min-width: 0;
  overflow-x: auto;
}
.inbox-toolbar .form-label {
  margin: 0;
  white-space: nowrap;
  flex: 0 0 auto;
}
.inbox-toolbar .inbox-filters {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  flex: 0 0 auto;
}
.inbox-toolbar select,
.inbox-toolbar .glass-field {
  width: auto;
  min-width: 0;
  max-width: none;
  flex: 0 0 auto;
  height: 32px;
  min-height: 32px;
  padding: 0 28px 0 10px;
  font-size: 13px;
}
.inbox-empty, .inbox-fatal {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  color: var(--text-muted, #666);
  border: 1px dashed var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 28px 16px;
}
.inbox-empty p, .inbox-fatal p { margin: 0; }
.inbox-panes {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(200px, 260px);
  gap: 12px;
  min-height: 560px;
}
.inbox-list-pane, .inbox-thread-pane, .inbox-card-pane {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 12px;
  min-width: 0;
}
.inbox-filters { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; }
.inbox-list { display: flex; flex-direction: column; gap: 4px; }
.inbox-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 8px;
  border-radius: 8px;
  cursor: pointer;
  color: inherit;
}
.inbox-row:hover, .inbox-row.is-active { background: var(--n-100, #eef0f7); }
.inbox-row.is-muted { opacity: 0.65; }
.inbox-row__ch { font-size: 11px; color: var(--text-muted, #666); text-transform: uppercase; }
.inbox-row__who { font-weight: 600; font-size: 13px; }
.inbox-row__snip { font-size: 12px; color: var(--text-muted, #666); }
.inbox-flag { font-size: 11px; color: var(--accent, #c45c26); }
.inbox-items { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.inbox-item { padding: 10px 12px; border-radius: 10px; background: var(--n-50, #f6f7fb); }
.inbox-item--outbound { background: #eef4ff; }
.inbox-item.is-failed { outline: 1px solid #c45c26; }
.inbox-item__meta { font-size: 12px; color: var(--text-muted, #666); margin-bottom: 4px; }
.inbox-item p { margin: 0; white-space: pre-wrap; }
.inbox-hint { font-size: 12px; color: var(--text-muted, #666); margin: 6px 0; }
.inbox-reconnect { background: #fff4e8; padding: 8px 10px; border-radius: 8px; }
.inbox-reply textarea, .inbox-reply select { width: 100%; }
.inbox-reply-bar { display: flex; gap: 8px; margin-top: 8px; }
@media (max-width: 960px) {
  .inbox-panes { grid-template-columns: 1fr; }
}



/* Publish Studio: video thumbnail + player */
.studio-thumb-play {
  position: relative;
  width: 64px; height: 64px;
  padding: 0; border: 0; background: none;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
}
.studio-thumb-play img, .studio-thumb-play video {
  width: 64px; height: 64px; object-fit: cover; display: block; background: var(--n-100);
  pointer-events: none;
}
.studio-play-icon {
  position: absolute; inset: 0; margin: auto;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(11, 37, 69, 0.72);
}
.studio-play-icon::after {
  content: ""; position: absolute; left: 11px; top: 8px;
  border-style: solid; border-width: 6px 0 6px 9px;
  border-color: transparent transparent transparent var(--white);
}
.studio-thumb-play:hover .studio-play-icon,
.studio-thumb-play:focus-visible .studio-play-icon { background: var(--blue-500); }
.studio-player {
  padding: 0; border: 0; border-radius: var(--radius-lg);
  background: var(--navy); max-width: min(90vw, 960px);
}
.studio-player::backdrop { background: rgba(11, 37, 69, 0.6); }
.studio-player video { display: block; width: 100%; max-height: 80vh; }
.studio-player-close {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, 0.9); color: var(--navy); font-size: 20px; cursor: pointer;
}

/* ============================================================================
   ARCBIG COMPONENT LAYER
   Shared primitives, tokens only. Follows docs/brand-style-guide.html:
   4 button variants, 8px spacing scale, radius 6/10/16/999, 3 elevation roles,
   blue as the 10% accent, semantic colours for status only.
   Behaviour lives in arcbig/js/components.js.
   ============================================================================ */

/* --- Focus ring: one definition for every interactive primitive ----------- */
.ab-focusable:focus-visible,
.ab-btn:focus-visible,
.ab-field__control:focus-visible,
.ab-select__control:focus-visible,
.ab-tab:focus-visible,
.ab-dropzone:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}

/* --- Skip to content ------------------------------------------------------ */
.ab-skip-link {
  position: absolute;
  left: var(--space-3);
  top: calc(-1 * var(--space-7));
  z-index: 2000;
  padding: var(--space-2) var(--space-3);
  background: var(--blue-500);
  color: var(--surface);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--fw-h2);
  text-decoration: none;
  transition: top var(--transition-fast);
}
.ab-skip-link:focus {
  top: var(--space-3);
}

/* --- Buttons: 4 variants x 3 sizes --------------------------------------- */
.ab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--fw-h2);
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition-fast), border-color var(--transition-fast),
    color var(--transition-fast), box-shadow var(--transition-fast);
}
.ab-btn--sm { height: 32px; padding: 0 var(--space-2); font-size: var(--text-caption); }
.ab-btn--lg { height: 48px; padding: 0 var(--space-4); font-size: var(--text-body); }
.ab-btn--block { width: 100%; }
.ab-btn__icon { display: inline-flex; width: 16px; height: 16px; flex: none; }
.ab-btn__icon svg { width: 100%; height: 100%; }

.ab-btn--primary { background: var(--blue-500); color: var(--surface); }
.ab-btn--primary:hover { background: var(--blue-600); }
.ab-btn--primary:active { background: var(--blue-700); }

.ab-btn--secondary { background: var(--surface); border-color: var(--n-200); color: var(--ink); }
.ab-btn--secondary:hover { background: var(--n-50); border-color: var(--n-300); }
.ab-btn--secondary:active { background: var(--n-100); }

.ab-btn--ghost { background: transparent; color: var(--blue-500); }
.ab-btn--ghost:hover { background: var(--blue-50); }
.ab-btn--ghost:active { background: var(--blue-100); }

/* Danger: for confirm dialogs and explicit destructive confirmation only. */
.ab-btn--danger { background: var(--error); color: var(--surface); }
.ab-btn--danger:hover { filter: brightness(0.92); }

/* Disabled reads as disabled — never a translucent primary. */
.ab-btn:disabled,
.ab-btn[disabled],
.ab-btn[aria-disabled="true"],
.ab-btn--disabled {
  background: var(--n-100);
  border-color: var(--n-200);
  color: var(--n-400);
  cursor: not-allowed;
  pointer-events: none;
  filter: none;
}
.ab-btn--loading { position: relative; color: transparent; pointer-events: none; }
.ab-btn--loading::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: var(--radius-full);
  color: var(--surface);
  animation: ab-spin 600ms linear infinite;
}
.ab-btn--secondary.ab-btn--loading::after { color: var(--n-500); }
@keyframes ab-spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .ab-btn { height: 44px; }
  .ab-btn--sm { height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .ab-btn { transition: none; }
  .ab-btn--loading::after { animation: none; }
}

/* --- Form field: label / control / hint / error --------------------------- */
.ab-field { display: block; margin-bottom: var(--space-3); }
.ab-field__label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-caption);
  font-weight: var(--fw-caption);
  letter-spacing: var(--label-spacing);
  text-transform: uppercase;
  color: var(--n-500);
}
.ab-field__required { color: var(--error); margin-left: 2px; }
.ab-field__control {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--n-200);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--font-body);
  font-size: var(--text-body);
  color: var(--ink);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.ab-field__control::placeholder { color: var(--n-400); }
.ab-field__control:hover:not(:disabled) { border-color: var(--n-300); }
.ab-field__control:disabled { background: var(--n-100); color: var(--n-400); cursor: not-allowed; }
textarea.ab-field__control { min-height: 96px; resize: vertical; line-height: var(--lh-body); }
.ab-field__hint {
  margin-top: var(--space-2);
  font-size: var(--text-caption);
  color: var(--n-500);
  line-height: 1.45;
}
.ab-field__error {
  display: none;
  margin-top: var(--space-2);
  font-size: var(--text-caption);
  color: var(--error);
  line-height: 1.45;
}
.ab-field--invalid .ab-field__control { border-color: var(--error); }
.ab-field--invalid .ab-field__control:focus-visible { outline-color: var(--error); }
.ab-field--invalid .ab-field__error { display: block; }
.ab-field--invalid .ab-field__hint { display: none; }

/* --- Select (styled, replaces native chrome) ----------------------------- */
.ab-select { position: relative; display: block; }
.ab-select__control {
  width: 100%;
  min-height: 40px;
  padding: var(--space-2) var(--space-6) var(--space-2) var(--space-3);
  border: 1px solid var(--n-200);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--font-body);
  font-size: var(--text-body);
  color: var(--ink);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--transition-fast);
}
.ab-select__control:hover:not(:disabled) { border-color: var(--n-300); }
.ab-select__control:disabled { background: var(--n-100); color: var(--n-400); cursor: not-allowed; }
.ab-select__chevron {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  pointer-events: none;
  color: var(--n-500);
}
.ab-select__chevron svg { width: 100%; height: 100%; }

/* --- File dropzone -------------------------------------------------------- */
.ab-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px dashed var(--n-300);
  border-radius: var(--radius);
  background: var(--n-50);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.ab-dropzone:hover, .ab-dropzone--over { border-color: var(--blue-500); background: var(--blue-50); }
.ab-dropzone__icon { width: 24px; height: 24px; color: var(--n-400); }
.ab-dropzone__icon svg { width: 100%; height: 100%; }
.ab-dropzone__title { font-size: var(--text-sm); font-weight: var(--fw-h2); color: var(--ink); }
.ab-dropzone__hint { font-size: var(--text-caption); color: var(--n-500); }
.ab-dropzone__input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ab-filelist { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; gap: var(--space-2); }
.ab-filelist__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  border: 1px solid var(--n-200);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--text-caption);
}
.ab-filelist__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.ab-filelist__size { color: var(--n-500); font-family: var(--font-mono); font-size: var(--text-micro); }
.ab-filelist__remove {
  flex: none; width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--n-500);
  border-radius: var(--radius-sm); cursor: pointer;
}
.ab-filelist__remove:hover { background: var(--error-bg); color: var(--error); }
.ab-filelist__remove svg { width: 14px; height: 14px; }

/* --- Card ----------------------------------------------------------------- */
.ab-card {
  background: var(--surface);
  border: 1px solid var(--n-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.ab-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--n-200);
}
.ab-card__title { margin: 0; font-size: var(--text-h3); font-weight: var(--fw-h3); color: var(--ink); }
.ab-card__body { padding: var(--space-4); }
.ab-card__body--flush { padding: 0; }
.ab-card__footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--n-200);
  display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2);
}

/* --- Page header: eyebrow / title / subtitle / actions ------------------- */
.ab-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.ab-page-header__text { min-width: 0; }
.ab-page-header__eyebrow {
  display: block;
  margin-bottom: var(--space-1);
  font-size: var(--text-caption);
  font-weight: var(--fw-caption);
  letter-spacing: var(--label-spacing);
  text-transform: uppercase;
  color: var(--n-500);
}
.ab-page-header__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-h1);
  font-weight: var(--fw-h1);
  line-height: var(--lh-heading);
  letter-spacing: -0.02em;
  color: var(--ink);
}
.ab-page-header__subtitle {
  display: block;
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
  color: var(--n-500);
  line-height: 1.5;
}
.ab-page-header__actions { display: flex; align-items: center; gap: var(--space-2); flex: none; }
@media (max-width: 640px) {
  .ab-page-header { flex-direction: column; align-items: stretch; }
  .ab-page-header__title { font-size: var(--text-h2); }
}

/* --- Section heading (title + meta on their own lines) ------------------- */
.ab-section-head { margin-bottom: var(--space-3); }
.ab-section-head__title { margin: 0; font-size: var(--text-h2); font-weight: var(--fw-h2); color: var(--ink); }
.ab-section-head__meta { display: block; margin-top: var(--space-1); font-size: var(--text-caption); color: var(--n-500); }

/* --- Badge / status ------------------------------------------------------- */
/* ── Avatar ──────────────────────────────────────────────────────────────── */
.ab-avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
  font-size: var(--text-caption);
  vertical-align: middle;
}
.ab-avatar--sm { width: 24px; height: 24px; font-size: var(--text-micro); }
.ab-avatar--lg { width: 48px; height: 48px; font-size: var(--text-body); }
.ab-avatar__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.ab-avatar__badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--white);
  background: var(--navy);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.ab-avatar--sm .ab-avatar__badge { width: 12px; height: 12px; border-width: 1px; }
.ab-avatar__badge svg { width: 9px; height: 9px; }
.ab-avatar--sm .ab-avatar__badge svg { width: 7px; height: 7px; }
.ab-avatar__badge--facebook { background: var(--blue-500); }
.ab-avatar__badge--instagram { background: var(--error); }
.ab-avatar__badge--gbp { background: var(--success); }

.ab-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-caption);
  font-weight: var(--fw-caption);
  line-height: 1.3;
  white-space: nowrap;
}
.ab-badge--neutral { background: var(--n-100); color: var(--n-500); }
.ab-badge--info    { background: var(--blue-50); color: var(--blue-700); }
.ab-badge--success { background: var(--success-bg); color: var(--success); }
.ab-badge--warning { background: var(--warning-bg); color: var(--warning); }
.ab-badge--error   { background: var(--error-bg); color: var(--error); }
.ab-badge--accent  { background: var(--blue-100); color: var(--navy); }

/* --- Alert / banner ------------------------------------------------------- */
.ab-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  line-height: 1.5;
}
.ab-alert__icon { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.ab-alert__icon svg { width: 100%; height: 100%; }
.ab-alert__body { flex: 1; min-width: 0; }
.ab-alert__title { display: block; font-weight: var(--fw-h2); margin-bottom: 2px; }
.ab-alert__actions { margin-top: var(--space-2); display: flex; gap: var(--space-2); }
.ab-alert__dismiss {
  flex: none; width: 24px; height: 24px; border: 0; background: transparent;
  color: inherit; opacity: 0.6; cursor: pointer; border-radius: var(--radius-sm);
}
.ab-alert__dismiss:hover { opacity: 1; }
.ab-alert__dismiss svg { width: 14px; height: 14px; }
.ab-alert--info    { background: var(--blue-50); border-color: var(--blue-200); color: var(--blue-700); }
.ab-alert--success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.ab-alert--warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.ab-alert--error   { background: var(--error-bg); border-color: var(--error-border); color: var(--error); }

/* --- Tabs ----------------------------------------------------------------- */
.ab-tabs { border-bottom: 1px solid var(--n-200); margin-bottom: var(--space-4); }
.ab-tabs__list { display: flex; gap: var(--space-4); overflow-x: auto; scrollbar-width: none; }
.ab-tabs__list::-webkit-scrollbar { display: none; }
.ab-tab {
  position: relative;
  padding: var(--space-2) 0 var(--space-3);
  border: 0;
  background: transparent;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--fw-h2);
  color: var(--n-500);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast);
}
.ab-tab:hover { color: var(--ink); }
.ab-tab[aria-selected="true"] { color: var(--blue-500); }
.ab-tab[aria-selected="true"]::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--blue-500); border-radius: 2px 2px 0 0;
}
.ab-tab__count {
  margin-left: var(--space-1);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--n-100);
  color: var(--n-500);
  font-size: var(--text-micro);
}
.ab-tab[aria-selected="true"] .ab-tab__count { background: var(--blue-50); color: var(--blue-700); }

/* --- Modal ---------------------------------------------------------------- */
.ab-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
}
.ab-modal[hidden] { display: none; }
.ab-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 37, 69, 0.5);
}
.ab-modal__panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - var(--space-6));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.ab-modal__panel--sm { max-width: 400px; }
.ab-modal__panel--lg { max-width: 720px; }
.ab-modal__header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-3);
}
.ab-modal__title { margin: 0; font-size: var(--text-h3); font-weight: var(--fw-h3); color: var(--ink); }
.ab-modal__close {
  flex: none; width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--n-500);
  border-radius: var(--radius-sm); cursor: pointer;
}
.ab-modal__close:hover { background: var(--n-100); color: var(--ink); }
.ab-modal__close svg { width: 16px; height: 16px; }
.ab-modal__body {
  padding: 0 var(--space-4) var(--space-4);
  overflow-y: auto;
  font-size: var(--text-sm);
  line-height: var(--lh-body);
  color: var(--n-500);
}
.ab-modal__body strong, .ab-modal__body b { color: var(--ink); }
.ab-modal__footer {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--n-200);
  background: var(--n-50);
}
.ab-modal__consequences {
  list-style: none; margin: var(--space-3) 0 0; padding: var(--space-3);
  background: var(--error-bg); border: 1px solid var(--error-border);
  border-radius: var(--radius-sm);
  display: grid; gap: var(--space-1);
  font-size: var(--text-caption); color: var(--error);
}
@media (max-width: 640px) {
  .ab-modal { align-items: flex-end; padding: 0; }
  .ab-modal__panel { max-width: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .ab-modal__footer { flex-direction: column-reverse; align-items: stretch; }
}

/* --- Table ---------------------------------------------------------------- */
.ab-table-wrap { width: 100%; overflow-x: auto; }
.ab-table { width: 100%; border-collapse: collapse; font-size: var(--text-table); }
.ab-table th, .ab-table td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  vertical-align: middle;
}
.ab-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--n-50);
  border-bottom: 1px solid var(--n-200);
  font-size: var(--text-caption);
  font-weight: var(--fw-caption);
  letter-spacing: var(--label-spacing);
  text-transform: uppercase;
  color: var(--n-500);
  white-space: nowrap;
}
.ab-table tbody tr { border-bottom: 1px solid var(--n-200); }
.ab-table tbody tr:last-child { border-bottom: 0; }
.ab-table tbody tr:hover { background: var(--n-50); }
.ab-table td { color: var(--ink); }
.ab-table .ab-num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.ab-table .ab-code { font-family: var(--font-mono); font-size: var(--text-caption); color: var(--n-500); }
.ab-table--compact th, .ab-table--compact td { padding: var(--space-1) var(--space-2); }
.ab-table__actions { text-align: right; white-space: nowrap; }

/* Below 900px each row becomes a card, headers become inline labels. */
@media (max-width: 900px) {
  .ab-table--cards thead { display: none; }
  .ab-table--cards, .ab-table--cards tbody { display: block; }
  .ab-table--cards tr {
    display: grid;
    gap: var(--space-1);
    padding: var(--space-3);
    margin-bottom: var(--space-2);
    border: 1px solid var(--n-200);
    border-radius: var(--radius);
    background: var(--surface);
  }
  .ab-table--cards tr:hover { background: var(--surface); }
  .ab-table--cards td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 0;
    border: 0;
  }
  .ab-table--cards td::before {
    content: attr(data-label);
    flex: none;
    font-size: var(--text-caption);
    font-weight: var(--fw-caption);
    letter-spacing: var(--label-spacing);
    text-transform: uppercase;
    color: var(--n-500);
  }
  .ab-table--cards td:not([data-label])::before { content: none; }
  .ab-table--cards td[data-primary] {
    display: block;
    font-size: var(--text-body);
    font-weight: var(--fw-h2);
    margin-bottom: var(--space-1);
  }
  .ab-table--cards td[data-primary]::before { content: none; }
  .ab-table--cards .ab-num { text-align: right; }
  .ab-table--cards .ab-table__actions { justify-content: flex-end; margin-top: var(--space-2); }
  .ab-table-wrap { overflow-x: visible; }
}

/* --- Empty / loading / error states -------------------------------------- */
.ab-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-4);
}
.ab-state__icon { width: 48px; height: 48px; color: var(--n-400); }
.ab-state__icon svg { width: 100%; height: 100%; }
.ab-state--error .ab-state__icon { color: var(--error); }
.ab-state__title { margin: 0; font-size: var(--text-h3); font-weight: var(--fw-h3); color: var(--ink); }
.ab-state__body { margin: 0; max-width: 46ch; font-size: var(--text-sm); color: var(--n-500); line-height: 1.55; }
.ab-state__actions { margin-top: var(--space-2); display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: center; }

/* --- Stat tile ------------------------------------------------------------ */
.ab-stat {
  background: var(--surface);
  border: 1px solid var(--n-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--space-3);
}
.ab-stat__value {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-h2);
  font-weight: var(--fw-h2);
  line-height: 1.15;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ab-stat__value .ab-stat__total { color: var(--n-400); font-weight: var(--fw-body); }
.ab-stat__label {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-caption);
  color: var(--n-500);
}
.ab-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); }
@media (max-width: 900px) { .ab-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* --- Meter (always carries a maximum) ------------------------------------ */
.ab-meter { display: block; }
.ab-meter__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2);
  margin-bottom: var(--space-1);
}
.ab-meter__label { font-size: var(--text-sm); font-weight: var(--fw-h2); color: var(--ink); }
.ab-meter__value { font-size: var(--text-caption); color: var(--n-500); font-variant-numeric: tabular-nums; }
.ab-meter__track {
  position: relative;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--n-100);
  overflow: hidden;
}
.ab-meter__fill { height: 100%; border-radius: var(--radius-full); background: var(--blue-500); }
.ab-meter--warning .ab-meter__fill { background: var(--warning); }
.ab-meter--over .ab-meter__fill { background: var(--error); }
.ab-meter__caption { display: block; margin-top: var(--space-1); font-size: var(--text-micro); color: var(--n-500); }

/* --- Progress steps (reads as progress, not tabs) ------------------------ */
.ab-steps { display: flex; align-items: flex-start; gap: 0; }
.ab-step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); position: relative; text-align: center; }
.ab-step::before,
.ab-step::after {
  content: "";
  position: absolute; top: 13px; height: 2px; background: var(--n-200);
}
.ab-step::before { left: 0; right: 50%; }
.ab-step::after { left: 50%; right: 0; }
.ab-step:first-child::before,
.ab-step:last-child::after { content: none; }
.ab-step__marker {
  position: relative; z-index: 1;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full);
  border: 2px solid var(--n-200);
  background: var(--surface);
  font-size: var(--text-caption);
  font-weight: var(--fw-h2);
  color: var(--n-400);
}
.ab-step__marker svg { width: 14px; height: 14px; }
.ab-step__label { font-size: var(--text-caption); color: var(--n-500); }
.ab-step--done .ab-step__marker { background: var(--success); border-color: var(--success); color: var(--surface); }
.ab-step--done::before, .ab-step--done::after { background: var(--success); }
.ab-step--current .ab-step__marker { border-color: var(--blue-500); color: var(--blue-500); box-shadow: 0 0 0 4px var(--blue-50); }
.ab-step--current .ab-step__label { color: var(--ink); font-weight: var(--fw-h2); }
.ab-step--current::before { background: var(--success); }
@media (max-width: 640px) {
  .ab-step__label { font-size: var(--text-micro); }
}

/* --- Visually hidden ------------------------------------------------------ */
.ab-sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Chevron for dropdown-style buttons — replaces the raw ▾ character, which no
   brand font reliably carries and which screen readers announce as a symbol. */
[data-ab-chevron] {
  width: 14px;
  height: 14px;
  display: inline-block;
  flex: none;
  background: currentColor;
  -webkit-mask: no-repeat center / 14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  mask: no-repeat center / 14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  opacity: 0.7;
}

/* Destructive row action: quiet by default, red only on intent. The danger
   styling lives in the confirm dialog, so Delete never competes with the
   primary action beside it. */
.job-card__delete { color: var(--n-500); }
.job-card__delete:hover:not(:disabled) {
  background: var(--error-bg);
  border-color: var(--error-border);
  color: var(--error);
}

/* Billing: the payment action is the page's primary, so it reads as the thing
   to do. Sign-out is a ghost control in the sidebar, not a competing CTA. */
.billing-pay { margin-top: var(--space-4); }
.billing-pay__body { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.billing-pay__plan { margin: 0; flex: 1; min-width: 200px; font-size: var(--text-sm); color: var(--n-500); }
.billing-section { margin-top: var(--space-4); }
.billing-section [data-ab-state-slot]:empty { display: none; }

/* Sign out: a quiet control. It should never out-rank paying or submitting. */
body.app-portal .btn-signout,
body.app-portal a.btn-signout,
.btn-signout {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.82);
  box-shadow: none;
}
body.app-portal .btn-signout:hover:not(:disabled),
.btn-signout:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}
.btn-signout:active:not(:disabled) { background: rgba(255, 255, 255, 0.16); }

/* Admin Jobs: filter row reads as one group of controls at one height. */
.jobs-select { min-width: 160px; }
.jobs-select .ab-select__control { min-height: 40px; }
.jobs-search { max-width: 360px; }
.job-card__assign { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.job-card__assign-label {
  font-size: var(--text-caption);
  font-weight: var(--fw-caption);
  letter-spacing: var(--label-spacing);
  text-transform: uppercase;
  color: var(--n-500);
}
.job-card__assign-select { flex: 1; min-width: 180px; }
@media (max-width: 640px) {
  .jobs-search, .jobs-select { max-width: none; width: 100%; }
}

/* Team load: the scale is stated once above the bars. */
.jobs-ops__scale {
  margin: 0 0 var(--space-2);
  font-size: var(--text-micro);
  color: var(--n-500);
}
.jobs-ops__person-count { font-variant-numeric: tabular-nums; }

/* Job card upload: the dropzone replaces the raw browser file control. */
.job-card__dropzone { position: relative; margin-top: var(--space-2); }
.employee-deliverables__empty { margin: 0 0 var(--space-2); }

/* Publish Studio: why the primary action is unavailable, stated on the page. */
.studio-blocker { margin-top: var(--space-2); }
.studio-blocker .ab-alert { font-size: var(--text-caption); }

/* The page header stays in the body on every width, so the title and its
   subtitle are never separated. The mobile top bar names the section instead. */
@media (max-width: 900px) {
  .ab-page-header { display: flex; }
  .ab-page-header__title { display: block; }
}

/* Disabled must win over every themed variant. The portal theme re-declares
   .btn-primary / .btn-teal / .btn-deep backgrounds at higher specificity, which
   left disabled buttons rendering as solid primaries you could not click. */
body.app-portal .btn:disabled,
body.app-portal .btn[disabled],
body.app-portal .btn[aria-disabled="true"],
body.app-portal a.btn:disabled,
body.app-portal a.btn[aria-disabled="true"],
.btn:disabled,
.btn[disabled],
.btn[aria-disabled="true"] {
  background: var(--n-100);
  background-image: none;
  border-color: var(--n-200);
  color: var(--n-400);
  box-shadow: none;
  opacity: 1;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

/* Previously referenced in markup but never defined, so they rendered as
   unstyled elements: modal scrim (3 admin pages) and blog pagination. */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(11, 37, 69, 0.5);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  list-style: none;
  padding: 0;
}
.pagination a,
.pagination button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 var(--space-2);
  border: 1px solid var(--n-200);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--text-caption);
  text-decoration: none;
  cursor: pointer;
}
.pagination a:hover,
.pagination button:hover:not(:disabled) {
  background: var(--n-50);
  border-color: var(--n-300);
}
.pagination [aria-current="page"] {
  background: var(--blue-500);
  border-color: var(--blue-500);
  color: var(--surface);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Portal motion pass 2 — page transitions, modal enter/exit
   Progressive enhancement: browsers without view transitions navigate as
   before. Everything here is transform/opacity only and switches off under
   prefers-reduced-motion.
   ═══════════════════════════════════════════════════════════════════════════ */

/* —— Cross-document page transitions (Chrome 126+, Safari 18.2+) ——
   Both pages share this stylesheet, so every same-origin navigation opts in.
   The shell (sidebar) stays still; only the page content crossfades, and the
   active nav highlight slides to its new position. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}

.app-portal .sidebar { view-transition-name: sidebar; }
.app-portal .app-main { view-transition-name: main; }
/* One active link per page (Layout.renderNavItems); PortalUI guards duplicates. */
.app-portal .sidebar .nav-link.active { view-transition-name: nav-active; }

@keyframes vt-fade-out {
  to { opacity: 0; }
}

@keyframes vt-rise-in {
  from { opacity: 0; transform: translateY(8px); }
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: var(--motion-normal);
}

/* Shell: show the new sidebar immediately, no crossfade flicker. */
::view-transition-old(sidebar),
::view-transition-new(sidebar) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-old(main) {
  animation: vt-fade-out var(--motion-fast) var(--ease-in-out) both;
}

::view-transition-new(main) {
  animation: vt-rise-in var(--motion-slow) var(--ease-out) both;
}

::view-transition-group(nav-active) {
  animation-duration: var(--motion-slow);
  animation-timing-function: var(--ease-out);
}

/* —— Shared modal (Components.modal): enter + exit —— */
@keyframes ab-backdrop-in {
  from { opacity: 0; }
}

@keyframes ab-backdrop-out {
  to { opacity: 0; }
}

@keyframes ab-panel-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
}

@keyframes ab-panel-out {
  to { opacity: 0; transform: translateY(8px) scale(0.98); }
}

@keyframes ab-sheet-in {
  from { opacity: 0; transform: translateY(24px); }
}

@keyframes ab-sheet-out {
  to { opacity: 0; transform: translateY(24px); }
}

.ab-modal.is-closing {
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .ab-modal__backdrop {
    animation: ab-backdrop-in var(--motion-normal) var(--ease-out) both;
  }

  .ab-modal__panel {
    animation: ab-panel-in var(--motion-slow) var(--ease-out) both;
  }

  .ab-modal.is-closing .ab-modal__backdrop {
    animation: ab-backdrop-out var(--motion-fast) var(--ease-in-out) both;
  }

  .ab-modal.is-closing .ab-modal__panel {
    animation: ab-panel-out var(--motion-fast) var(--ease-in-out) both;
  }
}

/* Phones: the panel is a bottom sheet, so it slides instead of scaling. */
@media (prefers-reduced-motion: no-preference) and (max-width: 640px) {
  .ab-modal__panel {
    animation-name: ab-sheet-in;
  }

  .ab-modal.is-closing .ab-modal__panel {
    animation-name: ab-sheet-out;
  }
}


/* ═══════════════════════════════════════════════════════════════════════════
   Phone shell — bottom tab bar, bottom sheets, thumb-zone action bar
   Flag: mobileShell. ≤640px only; the sidebar shell stays above that.
   ═══════════════════════════════════════════════════════════════════════════ */
body.has-tabbar {
  --tabbar-h: 64px;
  --tabbar-safe: env(safe-area-inset-bottom, 0px);
}

.tabbar {
  display: none;
}

/* —— Bottom sheet (AB.sheet) —— */
.ab-sheet {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.ab-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 37, 69, 0.5);
}
.ab-sheet__panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - var(--space-6));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  touch-action: none;
}
.ab-sheet--full .ab-sheet__panel {
  height: calc(100vh - var(--space-6));
}
.ab-sheet__grip {
  display: flex;
  justify-content: center;
  padding: var(--space-2) 0 var(--space-1);
  cursor: grab;
}
.ab-sheet__handle {
  width: 40px;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--n-300);
}
.ab-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3) var(--space-2);
}
.ab-sheet__title {
  margin: 0;
  font-size: var(--text-h3);
  font-weight: var(--fw-h3);
  color: var(--ink);
}
.ab-sheet__close {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 0;
  background: var(--n-100);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.ab-sheet__close svg { width: 18px; height: 18px; }
.ab-sheet__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--space-3) var(--space-3);
  touch-action: pan-y;
}
.ab-sheet__footer {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3) var(--space-3);
  border-top: 1px solid var(--n-200);
  background: var(--surface);
}
.ab-sheet__footer .btn { flex: 1 1 auto; min-height: 48px; }
.ab-sheet.is-closing { pointer-events: none; }

@keyframes ab-sheet-panel-in {
  from { transform: translateY(100%); }
}
@keyframes ab-sheet-panel-out {
  to { transform: translateY(100%); }
}

@media (prefers-reduced-motion: no-preference) {
  .ab-sheet__backdrop { animation: ab-backdrop-in var(--motion-normal) var(--ease-out) both; }
  .ab-sheet__panel { animation: ab-sheet-panel-in var(--motion-slow) var(--ease-out) both; }
  .ab-sheet.is-closing .ab-sheet__backdrop { animation: ab-backdrop-out var(--motion-fast) var(--ease-in-out) both; }
  .ab-sheet.is-closing .ab-sheet__panel { animation: ab-sheet-panel-out var(--motion-normal) var(--ease-in-out) both; }
}

/* Wide screens: the same sheet sits centred like a modal. */
@media (min-width: 641px) {
  .ab-sheet { align-items: center; padding: var(--space-3); }
  .ab-sheet__panel { border-radius: var(--radius-lg); max-height: calc(100vh - var(--space-7)); }
  .ab-sheet--full .ab-sheet__panel { height: auto; }
  .ab-sheet__grip { display: none; }
  .ab-sheet__header { padding-top: var(--space-3); }
}

/* —— "More" sheet: full navigation, light theme ——
   body.app-portal prefix: the sidebar's link colours are set at that specificity. */
.more-sheet__user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) 0 var(--space-3);
  border-bottom: 1px solid var(--n-200);
  margin-bottom: var(--space-2);
}
.more-sheet__name { font-weight: 600; color: var(--ink); }
body.app-portal .more-sheet__nav .nav-group-title,
body.app-portal .more-sheet__nav .nav-section-title {
  color: var(--n-500);
}
body.app-portal .more-sheet__nav .nav-link,
body.app-portal .more-sheet__nav .nav-link-sub {
  color: var(--ink);
  min-height: 48px;
  margin: 0;
  border-radius: var(--radius);
  font-size: var(--text-table);
}
body.app-portal .more-sheet__nav .nav-link:hover:not(.active),
body.app-portal .more-sheet__nav .nav-link-sub:hover:not(.active) {
  background: var(--n-100);
  color: var(--ink);
}
body.app-portal .more-sheet__nav .nav-link.active,
body.app-portal .more-sheet__nav .nav-link-sub.active {
  background: var(--blue-50);
  color: var(--blue-700);
  box-shadow: inset 3px 0 0 var(--blue-500);
}
body.app-portal .more-sheet__nav .nav-link__icon { color: var(--n-500); }
body.app-portal .more-sheet__nav .nav-link.active .nav-link__icon { color: var(--blue-600); }
body.app-portal .more-sheet__nav .nav-sub { display: block; }
body.app-portal .more-sheet__nav .nav-link-logout { display: none; }

/* —— Thumb-zone action bar (pages opt in with .ab-actionbar) —— */
.ab-actionbar {
  position: sticky;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  background: var(--frosted-surface);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--n-200);
}
.ab-actionbar .btn { min-height: 48px; }
.ab-actionbar .btn-primary { flex: 1 1 auto; }

@media (max-width: 640px) {
  body.has-tabbar .tabbar {
    display: grid;
    grid-template-columns: repeat(var(--tabbar-count, 5), minmax(0, 1fr));
    align-items: end;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    height: calc(var(--tabbar-h) + var(--tabbar-safe));
    padding: 0 var(--space-1) var(--tabbar-safe);
    background: var(--frosted-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--n-200);
    view-transition-name: tabbar;
  }
  .tabbar__link {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: var(--tabbar-h);
    min-width: 44px;
    border: 0;
    background: transparent;
    color: var(--n-500);
    font-family: inherit;
    font-size: var(--text-micro);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color var(--motion-fast) var(--ease-out);
  }
  .tabbar__link:active { color: var(--blue-600); }
  .tabbar__link.is-active { color: var(--blue-600); }
  .tabbar__icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .tabbar__icon svg { width: 24px; height: 24px; }
  .tabbar__link--primary .tabbar__icon {
    width: 48px;
    height: 48px;
    margin-top: calc(-1 * (var(--space-3) + var(--space-1)));
    border-radius: var(--radius-full);
    background: var(--blue-500);
    color: var(--surface);
    box-shadow: 0 6px 20px rgba(30, 94, 255, 0.3);
  }
  .tabbar__link--primary .tabbar__icon svg { width: 22px; height: 22px; }
  .tabbar__link--primary.is-active .tabbar__icon { background: var(--blue-600); }
  .tabbar__link .nav-badge {
    position: absolute;
    top: var(--space-1);
    left: 50%;
    margin-left: var(--space-1);
    min-width: 18px;
    height: 18px;
    padding: 0 var(--space-1);
    border-radius: var(--radius-full);
    background: var(--error);
    color: var(--surface);
    font-size: var(--text-micro);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .tabbar__link--primary .nav-badge { top: calc(-1 * var(--space-2)); }

  /* Page content clears the bar; the burger goes (More replaces it). */
  body.has-tabbar .app-main {
    padding-bottom: calc(var(--tabbar-h) + var(--tabbar-safe) + var(--space-3));
  }
  body.has-tabbar .mobile-topbar .mobile-topbar__menu.mobile-menu-btn { display: none; }
  body.has-tabbar .toast {
    bottom: calc(var(--tabbar-h) + var(--tabbar-safe) + var(--space-2));
  }
  body.has-tabbar .ab-actionbar {
    bottom: calc(var(--tabbar-h) + var(--tabbar-safe));
  }
  body.has-tabbar .ab-sheet__panel {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ab-sheet__backdrop, .ab-sheet__panel { animation: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Publish Studio — phone flow (≤640px, flag mobileShell): 4 steps, one screen each
   ═══════════════════════════════════════════════════════════════════════════ */
.studio-camera { display: none; }
.studio-steps { display: none; }
.studio-stepnav { display: none; }
.studio-foot-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .studio.is-stepper .studio-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    margin-bottom: var(--space-3);
  }
  .studio-steps__bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-1);
    margin-bottom: var(--space-2);
  }
  .studio-steps__seg {
    height: 4px;
    border-radius: var(--radius-full);
    background: var(--n-200);
    transition: background var(--motion-normal) var(--ease-out);
  }
  .studio-steps__seg.is-done { background: var(--blue-500); }
  .studio-steps__eyebrow {
    font-size: var(--text-micro);
    font-weight: 600;
    letter-spacing: var(--label-spacing);
    text-transform: uppercase;
    color: var(--n-500);
  }
  .studio-steps__title {
    margin: 0;
    font-size: var(--text-h3);
    line-height: var(--lh-heading);
    font-weight: var(--fw-h1);
    letter-spacing: -0.02em;
    color: var(--navy);
  }

  /* Compact page header: the step title carries the page on phones. */
  .studio.is-stepper .studio-top { margin-bottom: var(--space-2); }
  .studio.is-stepper .studio-top h1 { font-size: var(--text-h3); }
  .studio.is-stepper .studio-top #studio-sub { display: none; }

  /* One step at a time; the column headings repeat the step title, so hide them. */
  .studio.is-stepper .studio-tabs-mobile { display: none; }
  .studio.is-stepper .studio-grid { display: block; }
  .studio.is-stepper .studio-col { border: 0; box-shadow: none; padding: 0; background: transparent; }
  .studio.is-stepper .studio-col-head { display: none; }
  .studio.is-stepper .studio-col { border-radius: 0; }
  .studio.is-stepper .studio-step[data-step="2"] { margin-top: 0; padding-top: 0; border-top: 0; }
  /* Steps 1–2: the step strip carries the question, so drop the in-card head.
     Step 3 keeps its two section labels ("Format", "When") as small eyebrows. */
  .studio.is-stepper .studio-step .studio-sec-head { display: none; }
  .studio.is-stepper .studio-col[data-step="3"] .studio-sec-head {
    margin: var(--space-3) 0 var(--space-1);
    padding: 0;
    border: 0;
  }
  .studio.is-stepper .studio-col[data-step="3"] .studio-sec-head:first-child { margin-top: 0; }
  .studio.is-stepper .studio-col[data-step="3"] .studio-sec-title { display: none; }
  .studio.is-stepper .studio-eyebrow { font-size: var(--text-caption); }
  .studio.is-stepper .studio-step:not(.is-active),
  .studio.is-stepper .studio-col[data-step]:not(.is-active) { display: none; }
  .studio.is-stepper .studio-col[data-step].is-active { display: block; }
  .studio.is-stepper .studio-col[data-col="compose"] { display: block; }

  /* Step 1: accounts as a static list of tappable rows, no floating picker. */
  .studio.is-stepper .studio-chips > .studio-chip,
  .studio.is-stepper #studio-add-channel { display: none; }
  .studio.is-stepper .studio-chips .studio-anchor { display: block; flex: 1 1 100%; width: 100%; }
  .studio.is-stepper .studio-picker {
    position: static;
    width: 100%;
    max-height: none;
    box-shadow: var(--shadow-sm);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-lg);
  }
  /* Full path beats the generic portal `label:not(...)` rule (0,5,3). */
  body.app-portal .studio.is-stepper .studio-picker .studio-group label.studio-option {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 48px;
    margin: 0;
    font-size: var(--text-table);
    border-bottom: 1px solid var(--n-100);
    color: var(--ink);
    font-weight: 500;
  }
  .studio.is-stepper .studio-option:last-child { border-bottom: 0; }
  .studio.is-stepper .studio-option input[type="checkbox"] {
    width: 24px;
    height: 24px;
    margin: 0;
    order: 2;
    margin-left: auto;
    accent-color: var(--blue-500);
  }
  .studio.is-stepper .studio-switch { display: flex; margin-top: var(--space-3); }
  .studio.is-stepper .studio-switch button { flex: 1 1 auto; min-height: 44px; }
  .studio.is-stepper #studio-options .studio-group { grid-template-columns: minmax(0, 1fr); }

  /* Step 2: caption + media; camera button appears. */
  .studio.is-stepper .studio-camera { display: inline-flex; }
  .studio.is-stepper #studio-body { min-height: 160px; font-size: var(--text-body); }

  /* Step 3/4: bigger targets. */
  .studio.is-stepper .studio-format,
  .studio.is-stepper .studio-chip,
  .studio.is-stepper .studio-tab { min-height: 44px; }

  /* Footer becomes the thumb-zone action bar, clear of the tab bar. */
  .studio.is-stepper .studio-foot {
    position: sticky;
    bottom: calc(var(--tabbar-h, 0px) + var(--tabbar-safe, 0px));
    z-index: 40;
    margin: var(--space-3) calc(-1 * var(--space-3)) 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    background: var(--frosted-surface);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: var(--space-2) var(--space-3);
  }
  .studio.is-stepper .studio-foot-status { flex: 1 1 100%; min-width: 0; }
  .studio.is-stepper .studio-stepnav {
    display: flex;
    gap: var(--space-2);
    flex: 1 1 auto;
  }
  .studio.is-stepper[data-step="4"] .studio-stepnav { flex: 0 0 auto; }
  .studio.is-stepper .studio-stepnav .btn { min-height: 48px; }
  .studio.is-stepper #studio-step-back { flex: 0 0 auto; }
  .studio.is-stepper #studio-step-next { flex: 1 1 auto; }
  .studio.is-stepper .studio-foot-actions { flex: 1 1 auto; }
  .studio.is-stepper .studio-foot-actions .btn { min-height: 48px; }
  .studio.is-stepper #studio-primary-wrap { flex: 1 1 auto; display: flex; }
  .studio.is-stepper #studio-primary { flex: 1 1 auto; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Phone page pass (≤640px): dashboard, posts, calendar, inbox
   Each block fixes one page's phone layout without touching desktop.
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  /* Dashboard: the health table used to force the column to its min-content
     width (≈680px) and push the page sideways. */
  .dash-health-grid { grid-template-columns: minmax(0, 1fr); }
  .dashboard-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

.inbox-back { display: none; }

@media (max-width: 640px) {
  /* Impersonation banner: one compact line instead of a card. */
  .impersonation-banner {
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-3);
    font-size: var(--text-caption);
    gap: var(--space-2);
  }

  /* Posts: the status rail becomes a horizontally scrolling chip row. */
  .posts-subnav { display: block; }
  .posts-subnav-views {
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: var(--space-1);
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }
  .posts-subnav-views::-webkit-scrollbar { display: none; }
  .posts-subnav-views .posts-nav-btn {
    flex: 0 0 auto;
    width: auto;
    min-height: 40px;
    gap: var(--space-1);
    padding: 0 var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--white);
    white-space: nowrap;
    scroll-snap-align: start;
    font-size: var(--text-caption);
  }
  .posts-subnav-views .posts-nav-btn.is-active,
  .posts-subnav-views .posts-nav-btn[aria-current="page"] {
    border-color: var(--blue-500);
    background: var(--blue-500);
    color: var(--white);
  }
  .posts-hub,
  .posts-hub:has(#posts-drawer:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
  .posts-chips,
  .posts-toolbar-menus {
    flex: 1 1 100%;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .posts-chips::-webkit-scrollbar,
  .posts-toolbar-menus::-webkit-scrollbar { display: none; }
  .posts-chips > *,
  .posts-toolbar-menus > * { flex: 0 0 auto; }
  .posts-subnav-links {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-2);
    padding-top: 0;
    border-top: 0;
  }
  /* Post details open as a bottom sheet over the list. .app-main carries a
     view-transition-name (a stacking context), so the sheet cannot rise above
     the tab bar; it sits on top of it instead. */
  .posts-hub:has(#posts-drawer:not([hidden]))::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(11, 37, 69, 0.5);
    z-index: 70;
  }
  .posts-drawer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--tabbar-h, 0px) + var(--tabbar-safe, 0px));
    top: auto;
    z-index: 71;
    max-height: calc(100vh - var(--tabbar-h, 0px) - var(--space-7));
    overflow: auto;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: var(--space-3) var(--space-3) calc(var(--space-4) + var(--tabbar-safe, 0px));
    box-shadow: 0 -12px 32px rgba(11, 37, 69, 0.15);
  }
  .posts-drawer-head { position: sticky; top: 0; background: var(--white); padding-bottom: var(--space-2); z-index: 1; }

  /* Calendar: tools scroll sideways; the view switcher and + come first. */
  .cal-toolbar-right {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    justify-content: flex-start;
    gap: var(--space-2);
    padding-bottom: var(--space-1);
    -webkit-overflow-scrolling: touch;
  }
  .cal-toolbar-right::-webkit-scrollbar { display: none; }
  .cal-toolbar-right .btn,
  .cal-toolbar-right a.btn,
  .cal-toolbar-right select,
  .cal-toolbar-right .cal-plus { flex: 0 0 auto; min-height: 40px; }
  .cal-toolbar-right #view-switcher,
  .cal-toolbar-right .cal-plus { order: -1; }
  .cal-toolbar-left .cal-tz { display: none; }
  .cal-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .cal-filters::-webkit-scrollbar { display: none; }

  /* Inbox: list first; opening a thread swaps in the conversation. */
  .inbox-panes { min-height: 0; }
  .inbox-panes.is-thread-open .inbox-list-pane { display: none; }
  .inbox-panes:not(.is-thread-open) .inbox-thread-pane,
  .inbox-panes:not(.is-thread-open) .inbox-card-pane { display: none; }
  .inbox-row { min-height: 56px; justify-content: center; padding: var(--space-2) var(--space-2); }
  .inbox-back { display: inline-flex; margin-bottom: var(--space-2); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Phone page pass — staff (admin + employee) at ≤640px
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  /* Jobs: keep the queue numbers, drop the side lists that repeat the main
     list below (unassigned links, team load). */
  .jobs-ops__heading,
  .jobs-ops__list,
  .jobs-ops__more,
  .jobs-ops__scale,
  .jobs-ops__team,
  .jobs-ops__empty { display: none; }
  .jobs-ops__card { padding: var(--space-3); }
  .jobs-ops__stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-1); }

  /* Job cards: the primary action fills the row; Delete steps back to a
     text button so a thumb does not land on it by accident. */
  body.app-portal .job-card__actions .btn { flex: 1 1 100%; min-width: 0; min-height: 44px; }
  body.app-portal .job-card__actions .job-card__delete {
    flex: 0 0 auto;
    margin-left: auto;
    background: transparent;
    border-color: transparent;
    color: var(--n-500);
    min-height: 40px;
  }

  /* CRM clients: the 11-column table scrolls inside its panel. */
  .clients-table-panel { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .clients-table { min-width: 720px; }
  .clients-table th:first-child,
  .clients-table td:first-child {
    position: sticky;
    left: 0;
    background: var(--surface);
    z-index: 1;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Compose phone: "When" sheet + finished screen (≤640px)
   ═══════════════════════════════════════════════════════════════════════════ */
.studio-when-choices { display: grid; gap: var(--space-2); }
.studio-when-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  min-height: 56px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--n-200);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.studio-when-choice > span { display: grid; gap: 2px; }
.studio-when-choice[aria-pressed="true"] { border-color: var(--blue-500); box-shadow: inset 0 0 0 1px var(--blue-500); }
.studio-when-choice[aria-pressed="true"]::after {
  content: "";
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 50%;
  background: var(--blue-500);
  box-shadow: inset 0 0 0 5px var(--surface), 0 0 0 1px var(--blue-500);
}
.studio-when-choice:disabled { opacity: 0.55; cursor: default; }

@media (max-width: 640px) {
  .studio-when--row { display: block; }
  .studio-when-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    width: 100%;
    min-height: 56px;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--n-200);
    border-radius: var(--radius);
    background: var(--surface);
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
  }
  .studio-when-row__text { display: grid; gap: 2px; min-width: 0; }
  .studio-when-row__chevron { flex: none; color: var(--n-500); display: inline-flex; }
  .studio-when-row__chevron svg { width: 20px; height: 20px; }
  #studio-schedule-box:not([hidden]) { margin-top: var(--space-3); }

  .studio-done {
    display: grid;
    justify-items: center;
    text-align: center;
    gap: var(--space-3);
    padding: var(--space-7) var(--space-4) var(--space-6);
  }
  .studio-done__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--success-bg);
    color: var(--success);
  }
  .studio-done__icon svg { width: 36px; height: 36px; }
  .studio-done.is-warn .studio-done__icon { background: var(--warning-bg); color: var(--warning); }
  .studio-done__title { margin: 0; font-size: var(--text-h2); font-weight: var(--fw-h1); color: var(--navy); }
  .studio-done__detail { margin: 0; color: var(--n-500); max-width: 32ch; }
  .studio-done__actions { display: grid; gap: var(--space-2); width: 100%; margin-top: var(--space-4); }
  .studio-done__actions .btn { width: 100%; min-height: 48px; justify-content: center; }
}

/* ── Compose: autosave line, restored-draft note, quota pill ─────────────── */
.studio-counter-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}
.studio-autosave { font-size: var(--text-caption); color: var(--n-500); white-space: nowrap; }
.studio-autosave.is-error { color: var(--error); }
.studio-restored {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: 0 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--blue-50);
  color: var(--navy);
  font-size: var(--text-caption);
}
.studio-restored a { font-weight: 600; white-space: nowrap; }
.studio-quota {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  background: var(--n-100);
  color: var(--n-500);
  font-size: var(--text-caption);
}
.studio-quota strong { color: var(--navy); font-weight: 600; }
.studio-quota.is-full { background: var(--warning-bg); }
.studio-quota.is-full strong { color: var(--warning); }
@media (max-width: 640px) {
  .studio.is-stepper .studio-top #studio-quota { margin-top: 0; }
}
