/* AI Autopilot Command Center — premium SaaS layout */

:root {
  --ap-bg: #f7f2ea;
  --ap-surface: #fffdf8;
  --ap-border: #e4d8c8;
  --ap-text: #2a211d;
  --ap-muted: #6f625a;
  --ap-accent: #0f8b7a;
  --ap-accent-soft: #e7f3ee;
  --ap-accent-dark: #0b6f62;
  --ap-sidebar: #4a3728;
  --ap-sidebar-text: #f3e7d8;
  --ap-sidebar-active: #c98b4a;
  --ap-shadow: 0 1px 3px rgba(74, 55, 40, 0.08), 0 10px 28px rgba(74, 55, 40, 0.06);
  --ap-radius: 8px;
  --ap-transition: 0.22s ease;
}

.autopilot-wizard-main {
  max-width: 1240px;
}

.autopilot-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
}

.autopilot-steps span {
  min-height: 42px;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ap-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
}

.autopilot-steps span.active {
  border-color: #0b6f62;
  color: #0b6f62;
  background: #e7f3ee;
  font-weight: 750;
}

.autopilot-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
  align-items: start;
}

.autopilot-form,
.autopilot-section,
.autopilot-status-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.autopilot-section {
  border-bottom: 1px solid var(--ap-border);
  padding-bottom: 18px;
}

.autopilot-section:last-child {
  border-bottom: 0;
}

.autopilot-section h3,
.autopilot-status-panel h3 {
  margin: 0;
  font-size: 17px;
}

.autopilot-form label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.autopilot-form input,
.autopilot-form select,
.autopilot-form textarea {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  padding: 10px 11px;
  font: inherit;
  background: #fff;
  color: var(--ap-text);
}

.autopilot-form select[multiple] {
  min-height: 132px;
}

.autopilot-form details {
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  padding: 10px;
  background: #fffdf8;
}

.autopilot-form summary {
  cursor: pointer;
  font-weight: 700;
}

.autopilot-preview {
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  padding: 12px;
  background: #fffdf8;
  display: grid;
  gap: 6px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.autopilot-preview p,
.autopilot-preview h4 {
  margin: 0;
}

.autopilot-status-panel {
  position: sticky;
  top: 16px;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

@media (max-width: 900px) {
  .autopilot-steps {
    grid-template-columns: 1fr;
  }

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

  .autopilot-status-panel {
    position: static;
  }
}

body.ap-body {
  margin: 0;
  background: var(--ap-bg);
  color: var(--ap-text);
  overflow-x: hidden;
}

.ap-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.ap-sidebar {
  background: var(--ap-sidebar);
  color: var(--ap-sidebar-text);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
}

.ap-brand {
  padding: 0 8px;
}

.ap-brand .eyebrow {
  color: #e3c9a8;
  font-size: 11px;
  letter-spacing: 0.08em;
  margin: 0 0 6px;
}

.ap-brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  color: #f8fafc;
  font-weight: 700;
}

.ap-brand p {
  margin: 8px 0 0;
  font-size: 13px;
  color: #eadcc8;
  line-height: 1.45;
}

.ap-nav {
  display: grid;
  gap: 4px;
}

.ap-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--ap-sidebar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background var(--ap-transition), color var(--ap-transition);
}

.ap-nav a:hover {
  background: rgba(255, 253, 248, 0.1);
  color: #fffdf8;
}

.ap-nav a.active {
  background: rgba(201, 139, 74, 0.22);
  color: #ffe2b7;
}

.ap-nav a.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.ap-main {
  min-width: 0;
  overflow-x: hidden;
  padding: clamp(16px, 3vw, 32px);
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

.ap-page-head {
  margin-bottom: 28px;
}

.ap-clarify-heading {
  margin: 8px 0 0;
  font-size: 16px;
  font-weight: 600;
}

.ap-page-head h2 {
  margin: 6px 0 8px;
  font-size: clamp(24px, 4vw, 32px);
  line-height: 1.15;
  letter-spacing: 0;
}

.ap-page-head .lead {
  margin: 0;
  color: var(--ap-muted);
  font-size: 15px;
  line-height: 1.55;
  max-width: 640px;
}

.ap-grid {
  display: grid;
  gap: 20px;
}

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

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

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

.ap-card {
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  padding: 20px;
  box-shadow: var(--ap-shadow);
  transition: transform var(--ap-transition), box-shadow var(--ap-transition);
}

.ap-card:hover {
  box-shadow: 0 2px 6px rgba(74, 55, 40, 0.08), 0 12px 32px rgba(74, 55, 40, 0.08);
}

.ap-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.ap-card .ap-card-meta {
  color: var(--ap-muted);
  font-size: 13px;
  margin: 0;
}

.ap-hero-upload {
  padding: clamp(24px, 4vw, 40px);
  text-align: center;
  border: 2px dashed #d8c5ad;
  border-radius: calc(var(--ap-radius) + 4px);
  background: linear-gradient(180deg, #fffdf8 0%, #f5efe6 100%);
  transition: border-color var(--ap-transition), background var(--ap-transition);
  cursor: pointer;
}

.ap-hero-upload.dragover {
  border-color: var(--ap-accent);
  background: var(--ap-accent-soft);
}

.ap-hero-upload strong {
  display: block;
  font-size: clamp(18px, 3vw, 22px);
  margin-bottom: 8px;
}

.ap-hero-upload span {
  color: var(--ap-muted);
  font-size: 14px;
}

.ap-upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}

.ap-btn {
  border: 0;
  border-radius: 10px;
  background: var(--ap-accent);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: background var(--ap-transition), opacity var(--ap-transition), transform var(--ap-transition);
}

.ap-btn:hover {
  background: var(--ap-accent-dark);
}

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

.ap-btn.secondary {
  background: #eadfce;
  color: var(--ap-text);
}

.ap-btn.secondary:hover {
  background: #ddccb5;
}

.ap-btn.danger {
  background: #b42318;
  color: #fff;
}

.ap-btn.danger:hover {
  background: #8f1b12;
}

.ap-btn.ghost {
  background: transparent;
  color: var(--ap-accent-dark);
  border: 1px solid var(--ap-border);
}

.ap-btn.block {
  width: 100%;
}

.ap-btn:focus-visible,
.ap-mobile-toggle:focus-visible,
.ap-nav a:focus-visible,
.kr-dropzone:focus-visible,
input:focus-visible,
textarea:focus-visible,
.kr-conflict-choice:focus-within {
  outline: 2px solid var(--ap-accent);
  outline-offset: 2px;
}

.ap-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;
}

.ap-note-field {
  margin-top: 20px;
}

.ap-note-field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.ap-note-field textarea {
  width: 100%;
  border: 1px solid var(--ap-border);
  border-radius: 10px;
  padding: 12px 14px;
  min-height: 88px;
  resize: vertical;
  background: #fffdf8;
}

.ap-file-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.ap-file-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--ap-border);
  border-radius: 10px;
  background: #f5efe6;
  font-size: 13px;
}

.ap-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.ap-thumb-card {
  border: 1px solid var(--ap-border);
  border-radius: 12px;
  overflow: hidden;
  background: #fffdf8;
  transition: border-color var(--ap-transition), box-shadow var(--ap-transition);
}

.ap-thumb-card.selected {
  border-color: var(--ap-accent);
  box-shadow: 0 0 0 3px rgba(15, 139, 122, 0.16);
}

.ap-thumb-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #f5efe6;
  display: block;
}

.ap-thumb-body {
  padding: 10px;
  display: grid;
  gap: 8px;
}

.ap-thumb-name {
  font-size: 11px;
  color: var(--ap-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ap-thumb-note {
  width: 100%;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
}

.ap-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f5efe6;
  color: var(--ap-muted);
}

.ap-status-pill.ready {
  background: var(--ap-accent-soft);
  color: var(--ap-accent-dark);
}

.ap-status-pill.pending {
  background: #fef3c7;
  color: #b45309;
}

.ap-group-note-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  background: #f5efe6;
  border: 1px solid var(--ap-border);
}

.ap-timeline {
  display: grid;
  gap: 0;
  margin-top: 8px;
}

.ap-timeline-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  position: relative;
  padding-bottom: 18px;
}

.ap-timeline-step:last-child {
  padding-bottom: 0;
}

.ap-timeline-step::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: 0;
  width: 2px;
  background: #e4d8c8;
}

.ap-timeline-step:last-child::before {
  display: none;
}

.ap-timeline-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: #fffdf8;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--ap-muted);
  z-index: 1;
}

.ap-timeline-step.done .ap-timeline-dot {
  border-color: var(--ap-accent);
  background: var(--ap-accent);
  color: #fff;
}

.ap-timeline-step.active .ap-timeline-dot {
  border-color: var(--ap-accent);
  box-shadow: 0 0 0 4px rgba(15, 139, 122, 0.18);
  animation: ap-pulse 1.8s ease-in-out infinite;
}

.ap-timeline-step.active .ap-timeline-label {
  color: var(--ap-text);
  font-weight: 600;
}

.ap-timeline-label {
  padding-top: 4px;
  font-size: 14px;
  color: var(--ap-muted);
}

@keyframes ap-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(15, 139, 122, 0.18); }
  50% { box-shadow: 0 0 0 8px rgba(15, 139, 122, 0.08); }
}

.ap-skeleton {
  background: linear-gradient(90deg, #f5efe6 25%, #eadfce 50%, #f5efe6 75%);
  background-size: 200% 100%;
  animation: ap-shimmer 1.4s ease infinite;
  border-radius: 8px;
  min-height: 16px;
}

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

.ap-page-card {
  display: flex;
  gap: 16px;
  align-items: center;
}

.ap-page-avatar {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0f8b7a, #c98b4a);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.ap-page-avatar.empty {
  background: #eadfce;
  color: #6f625a;
}

.ap-stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.ap-stat {
  flex: 1 1 100px;
  min-width: 0;
}

.ap-stat strong {
  display: block;
  font-size: 22px;
  line-height: 1.2;
}

.ap-stat span {
  font-size: 12px;
  color: var(--ap-muted);
}

.ap-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--ap-accent-soft);
  color: var(--ap-accent-dark);
}

.ap-badge.warn {
  background: #fef3c7;
  color: #b45309;
}

.ap-badge.danger {
  background: #fee2e2;
  color: #991b1b;
}

.ap-badge.ok {
  background: #dcfce7;
  color: #166534;
}

.ap-badge.muted {
  background: #f5efe6;
  color: var(--ap-muted);
}

.ap-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--ap-muted);
}

.ap-clarify-card {
  border-left: 4px solid #f59e0b;
}

.ap-view-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--ap-border);
}

.ap-view-row:last-child {
  border-bottom: 0;
}

.ap-view-label {
  font-size: 13px;
  color: var(--ap-muted);
  min-width: 120px;
}

.ap-view-value {
  flex: 1;
  font-size: 15px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ap-edit-inline {
  display: none;
  gap: 8px;
  margin-top: 8px;
}

.ap-view-row.editing .ap-edit-inline {
  display: grid;
}

.ap-view-row.editing .ap-view-value-text {
  display: none;
}

.ap-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.ap-filter-chip {
  border: 1px solid var(--ap-border);
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--ap-transition);
}

.ap-filter-chip.active {
  background: var(--ap-accent);
  border-color: var(--ap-accent);
  color: #fff;
}

.ap-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.ap-media-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  background: #f1f5f9;
}

.ap-sticky-cta {
  position: fixed;
  left: 240px;
  right: 0;
  bottom: 0;
  padding: 12px clamp(16px, 3vw, 32px);
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  background: rgba(244, 246, 249, 0.92);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--ap-border);
  z-index: 15;
  display: flex;
  justify-content: flex-end;
}

.ap-mobile-toggle {
  display: none;
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 12px;
  z-index: 50;
  background: var(--ap-sidebar);
  color: #fff;
  border: 0;
  border-radius: 10px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  pointer-events: auto;
}

.ap-toast {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  max-width: min(360px, calc(100vw - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  background: var(--ap-sidebar);
  color: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}

.ap-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.ap-product-card {
  padding: 16px;
  border: 1px solid var(--ap-border);
  border-radius: 12px;
  background: #fffdf8;
}

.ap-next-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid rgba(15, 139, 122, 0.26);
  border-radius: 8px;
  background: #edf7f2;
}

.ap-next-step.warn {
  border-color: #f1c97a;
  background: #fff8e7;
}

.ap-next-step h3 {
  margin: 2px 0 4px;
  font-size: 16px;
}

.ap-next-step .ap-btn {
  flex: 0 0 auto;
}

.ap-command-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 20px;
  align-items: center;
  margin-bottom: 20px;
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid rgba(201, 139, 74, 0.34);
  border-radius: 12px;
  overflow: hidden;
  background:
    linear-gradient(135deg, #4a3728 0%, #65462d 58%, #0b6f62 140%);
  color: #fffdf8;
  box-shadow: 0 24px 70px rgba(74, 55, 40, 0.18);
}

.ap-command-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 8px);
}

.ap-command-copy,
.ap-readiness-orb {
  position: relative;
  z-index: 1;
}

.ap-command-copy .ap-section-title,
.ap-command-copy .ap-card-meta {
  color: #eadcc8;
}

.ap-command-copy h3 {
  margin: 8px 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.08;
  letter-spacing: 0;
}

.ap-command-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.ap-readiness-orb {
  width: min(220px, 100%);
  min-height: 140px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  align-content: center;
  justify-self: end;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 18px 42px rgba(0, 0, 0, 0.18);
}

.ap-readiness-orb span {
  display: block;
  font-size: 36px;
  font-weight: 900;
  color: #fff;
}

.ap-readiness-orb small {
  color: #ffe2b7;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cc-metrics {
  margin-bottom: 20px;
}

.cc-progress {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #eadfce;
  margin: 10px 0;
}

.cc-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f8b7a, #c98b4a);
  transition: width 0.25s ease;
}

.cc-readiness-card {
  margin-bottom: 20px;
}

.cc-readiness-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cc-readiness-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  background: #fffdf8;
  padding: 12px;
}

.cc-readiness-item span {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  background: #eadfce;
  color: #6f625a;
  font-weight: 900;
}

.cc-readiness-item.done {
  border-color: rgba(15, 139, 122, 0.28);
  background: #e7f3ee;
}

.cc-readiness-item.done span {
  background: #0f8b7a;
  color: #fff;
}

.cc-readiness-item.missing {
  border-color: rgba(245, 158, 11, 0.28);
  background: #fffbeb;
}

.cc-readiness-item strong,
.cc-readiness-item a {
  display: block;
  overflow-wrap: anywhere;
}

.cc-readiness-item a {
  margin-top: 3px;
  color: var(--ap-accent-dark);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.facebook-connect-steps {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  gap: 18px;
  margin-bottom: 20px;
  background:
    radial-gradient(circle at 0 0, rgba(20, 184, 166, 0.12), transparent 28%),
    #fff;
}

.facebook-connect-steps h3 {
  margin: 6px 0 0;
}

.facebook-connect-steps ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: connect-step;
}

.facebook-connect-steps li {
  counter-increment: connect-step;
  position: relative;
  min-width: 0;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  background: #fffdf8;
  padding: 14px;
}

.facebook-connect-steps li::before {
  content: counter(connect-step);
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  margin-bottom: 10px;
  background: var(--ap-accent);
  color: #fff;
  font-weight: 900;
}

.facebook-connect-steps strong,
.facebook-connect-steps span {
  display: block;
}

.facebook-connect-steps span {
  margin-top: 5px;
  color: var(--ap-muted);
  font-size: 13px;
  line-height: 1.45;
}

.facebook-safe-mode {
  margin-bottom: 20px;
  border-color: rgba(245, 158, 11, 0.32);
  background: #fffbeb;
}

.ap-section-title {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ap-muted);
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .ap-shell {
    grid-template-columns: 1fr;
  }

  .ap-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(280px, 86vw);
    height: 100vh;
    height: 100dvh;
    transform: translateX(-110%);
    transition: transform var(--ap-transition);
    box-shadow: var(--ap-shadow);
    padding-top: calc(24px + env(safe-area-inset-top, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    overflow-y: auto;
  }

  .ap-sidebar.open {
    transform: translateX(0);
  }

  body.ap-sidebar-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    z-index: 19;
    pointer-events: auto;
  }

  .ap-mobile-toggle {
    display: grid;
    place-items: center;
  }

  .ap-main {
    --ap-mobile-gutter: clamp(16px, 3vw, 32px);
    --ap-mobile-menu-clearance: calc(12px + 44px + 8px);
    padding-top: calc(56px + env(safe-area-inset-top, 0px));
    padding-left: max(var(--ap-mobile-gutter), var(--ap-mobile-menu-clearance));
    padding-right: var(--ap-mobile-gutter);
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }

  .admin-status-bar:not([hidden]) ~ .ap-shell .ap-main {
    padding-top: calc(112px + env(safe-area-inset-top, 0px));
  }

  .ap-sticky-cta {
    left: 0;
  }

  .ap-grid.two,
  .ap-grid.three,
  .ap-grid.four,
  .ap-command-hero,
  .cc-readiness-groups,
  .facebook-connect-steps,
  .facebook-connect-steps ol {
    grid-template-columns: 1fr;
  }

  .ap-readiness-orb {
    justify-self: start;
    width: min(200px, 100%);
    min-height: 120px;
  }

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

@media (max-width: 480px) {
  .ap-page-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .ap-sticky-cta {
    justify-content: stretch;
  }

  .ap-sticky-cta .ap-btn {
    flex: 1;
  }
}

.ap-plan-card {
  display: grid;
  gap: 14px;
}

.ap-plan-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ap-plan-topic {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  word-break: break-word;
}

.ap-plan-assets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ap-plan-asset {
  width: 88px;
  height: 110px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--ap-border);
  background: #f5efe6;
}

.ap-plan-asset.missing {
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--ap-muted);
}

.ap-plan-block {
  min-width: 0;
}

.ap-plan-textarea,
.ap-plan-copy {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font: inherit;
  line-height: 1.5;
}

.ap-plan-textarea {
  border: 1px solid var(--ap-border);
  border-radius: 10px;
  padding: 10px 12px;
  resize: vertical;
  min-height: 120px;
}

.ap-plan-copy {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.ap-plan-copy.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.ap-plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ap-plan-actions .ap-btn {
  flex: 1 1 auto;
  min-width: 0;
}

.ap-warn {
  color: #b45309;
}

.ap-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
    max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}

.ap-modal-card {
  background: var(--ap-surface);
  border-radius: var(--ap-radius);
  box-shadow: var(--ap-shadow);
  padding: 20px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.ap-progress-steps {
  display: grid;
  gap: 6px;
  margin: 8px 0;
}

.ap-progress-step {
  font-size: 13px;
  color: var(--ap-muted);
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--ap-border);
}

.ap-progress-step.active {
  border-color: var(--ap-accent);
  background: var(--ap-accent-soft);
  color: var(--ap-accent-dark);
  font-weight: 600;
}

.ap-progress-step.done {
  color: var(--ap-accent-dark);
  border-color: #99f6e4;
}

.ap-activity-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--ap-border);
  font-size: 13px;
}

.ap-activity-item:last-child {
  border-bottom: none;
}

.ap-preview-img {
  width: 100%;
  max-width: 280px;
  border-radius: 10px;
  border: 1px solid var(--ap-border);
}

/* M3B Knowledge Review */
.kr-screen.hidden {
  display: none;
}

.kr-dropzone.dragover {
  border-color: var(--ap-accent);
  background: var(--ap-accent-soft);
}

.kr-start-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.kr-progress-steps {
  display: grid;
  gap: 10px;
  margin: 12px 0 16px;
}

.kr-progress-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f5efe6;
  color: var(--ap-muted);
  font-size: 14px;
}

.kr-progress-step.active {
  background: var(--ap-accent-soft);
  color: var(--ap-accent-dark);
  font-weight: 600;
}

.kr-progress-step.done {
  color: var(--ap-text);
}

.kr-progress-dot {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e2e8f0;
  font-size: 12px;
  flex-shrink: 0;
}

.kr-progress-step.active .kr-progress-dot {
  background: var(--ap-accent);
  color: #fff;
}

.kr-progress-step.done .kr-progress-dot {
  background: #10b981;
  color: #fff;
}

.kr-progress-current {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.kr-error {
  margin-top: 16px;
  padding: 12px;
  border-radius: 10px;
  background: #fef2f2;
  color: #991b1b;
}

.kr-group {
  margin-bottom: 12px;
}

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

.kr-group-head h3 {
  margin: 0;
  font-size: 16px;
}

.kr-count {
  display: inline-flex;
  min-width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #e2e8f0;
  font-size: 13px;
  font-weight: 700;
}

.kr-count.warn {
  background: #fef3c7;
  color: #92400e;
}

.kr-count.danger {
  background: #fee2e2;
  color: #991b1b;
}

.kr-fact-list {
  display: grid;
  gap: 10px;
}

.kr-fact-card {
  padding: 12px;
  border: 1px solid var(--ap-border);
  border-radius: 12px;
  background: #fff;
}

.kr-fact-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.kr-fact-label {
  font-weight: 600;
  font-size: 14px;
}

.kr-fact-meta {
  font-size: 12px;
  color: var(--ap-muted);
}

.kr-fact-value {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  word-break: break-word;
}

.kr-fact-actions,
.kr-inline-edit,
.kr-conflict-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}

.kr-inline-edit {
  width: 100%;
}

.kr-edit-input,
.kr-custom-value {
  flex: 1;
  min-width: 160px;
  min-height: 40px;
  border: 1px solid var(--ap-border);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
}

.kr-conflict-choice {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--ap-border);
  border-radius: 10px;
  font-size: 14px;
}

.kr-confirm-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.kr-confirm-list {
  display: grid;
  gap: 12px;
}

.kr-confirm-footer {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.kr-complete-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.kr-stat {
  text-align: center;
  padding: 12px 8px;
  border-radius: 12px;
  background: #fffdf8;
  border: 1px solid var(--ap-border);
}

.kr-stat strong {
  display: block;
  font-size: 22px;
  margin-bottom: 4px;
}

.kr-stat span {
  font-size: 12px;
  color: var(--ap-muted);
}

@media (max-width: 640px) {
  .kr-complete-stats {
    grid-template-columns: 1fr;
  }

  .kr-fact-actions .ap-btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }

  .kr-confirm-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .kr-confirm-toolbar .ap-btn {
    width: 100%;
  }
}

/* M3D — knowledge review QA */
.kr-stale-banner {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
  font-size: 14px;
  line-height: 1.45;
}

.kr-stale-banner.hidden,
.kr-progress-busy.hidden {
  display: none;
}

.kr-progress-busy {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  color: var(--ap-muted);
  font-size: 14px;
}

.kr-loading-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid #e2e8f0;
  border-top-color: var(--ap-accent);
  border-radius: 999px;
  animation: kr-spin 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes kr-spin {
  to {
    transform: rotate(360deg);
  }
}

.kr-btn-compact {
  min-height: 44px;
  font-size: 13px;
  padding: 0 12px;
  margin-top: 8px;
}

.kr-fact-label,
.kr-fact-meta,
.kr-fact-value,
.kr-conflict-choice span,
.kr-conflict-choice small {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.kr-conflict-choice {
  min-height: 44px;
  cursor: pointer;
}

.kr-conflict-choice input[type="radio"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin: 2px 0 0;
}

.kr-edit-input:focus-visible,
.kr-custom-value:focus-visible {
  outline: 2px solid var(--ap-accent);
  outline-offset: 1px;
}

.ap-main[aria-busy="true"] .kr-screen:not(.hidden) {
  opacity: 0.92;
}

/* M4F — structured content planning UI */
.cp-main {
  min-width: 0;
  min-height: 0;
}

.cp-stale-banner {
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}

.cp-generate-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.cp-brief-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.cp-brief-aside {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(201, 139, 74, 0.28);
  border-radius: 8px;
  background: #fff8ec;
}

.cp-brief-aside h3 {
  margin: 0;
  font-size: 18px;
}

.cp-brief-checklist {
  display: grid;
  gap: 8px;
}

.cp-brief-checklist span {
  padding: 8px 10px;
  border: 1px solid #eadcc8;
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ap-text);
  font-size: 13px;
  font-weight: 750;
}

.cp-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.cp-field span {
  font-size: 13px;
  color: var(--ap-muted, #6f625a);
}

.cp-field input,
.cp-field select,
.cp-field textarea,
.cp-input {
  min-height: 44px;
  min-width: 0;
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  overflow-wrap: anywhere;
}

.cp-field textarea {
  resize: vertical;
}

.cp-field-wide {
  grid-column: 1 / -1;
}

.cp-check {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  color: var(--ap-text, #17202a);
}

.cp-check input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.cp-check span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.cp-error {
  margin-top: 12px;
  padding: 10px;
  border-radius: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.cp-plan-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  min-width: 0;
}

.cp-plan-preview-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(15, 139, 122, 0.24);
  border-radius: 8px;
  background: #edf7f2;
}

.cp-plan-preview-summary h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.cp-plan-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cp-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  min-height: 0;
}

@media (min-width: 1024px) {
  .cp-workspace {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  }
}

.cp-list-pane {
  min-width: 0;
  min-height: 0;
}

.cp-item-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.cp-plan-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  min-width: 0;
  overflow: hidden;
  background: #fff;
}

.cp-plan-card.selected {
  border-color: var(--ap-accent, #0f8b7a);
  box-shadow: 0 0 0 1px var(--ap-accent, #0f8b7a);
}

.cp-plan-card.disabled {
  opacity: 0.72;
}

.cp-card-grid {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
}

.cp-card-body {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.cp-card-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.cp-card-angle {
  margin: 0;
  font-size: 13px;
  color: #475569;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.cp-card-product {
  margin: 0;
  font-size: 12px;
  color: #6f625a;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-all;
  min-width: 0;
}

.cp-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: #6f625a;
  min-width: 0;
}

.cp-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.cp-btn-compact {
  min-height: 44px;
  font-size: 13px;
  padding: 0 10px;
}

.cp-layout-preview {
  position: relative;
  width: 100%;
  max-width: 96px;
  border: 1px dashed #d8c5ad;
  border-radius: 8px;
  background: #f5efe6;
  min-width: 0;
  overflow: hidden;
}

.cp-layout-preview[data-broken="1"] {
  background: #fef2f2;
  border-color: #fecaca;
}

.cp-layout-frames {
  display: grid;
  gap: 4px;
  padding: 6px;
  min-width: 0;
  min-height: 0;
}

.cp-layout-frame {
  background: linear-gradient(135deg, #eadfce, #f7f2ea);
  border-radius: 4px;
  min-height: 12px;
}

.cp-layout-meta {
  display: block;
  font-size: 10px;
  color: #6f625a;
  padding: 0 6px 6px;
  overflow-wrap: anywhere;
}

.cp-detail-panel {
  border: 1px solid var(--ap-border);
  border-radius: 10px;
  background: #fffdf8;
  min-width: 0;
  max-height: calc(100vh - 180px);
  overflow: auto;
}

.cp-detail-inner {
  padding: 12px;
  min-width: 0;
}

.cp-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.cp-detail-head h3 {
  margin: 0;
  font-size: 16px;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cp-detail-dl {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  min-width: 0;
}

.cp-detail-dl dt {
  font-size: 12px;
  color: #6f625a;
}

.cp-detail-dl dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  min-width: 0;
}

.cp-detail-caption {
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.cp-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cp-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cp-mobile-sheet {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 40;
  display: flex;
  align-items: flex-end;
}

.cp-mobile-sheet-body {
  width: 100%;
  max-height: 92vh;
  max-height: 92dvh;
  overflow: auto;
  background: #fff;
  border-radius: 16px 16px 0 0;
  min-width: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.cp-skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 37%, #f1f5f9 63%);
  background-size: 400% 100%;
  animation: cp-shimmer 1.2s ease infinite;
  border-radius: 8px;
  min-height: 14px;
}

.cp-skeleton-head {
  height: 22px;
  width: 60%;
}

.cp-skeleton-line.short {
  width: 40%;
}

.cp-generating-label {
  margin-top: 12px;
  font-size: 14px;
  color: #475569;
}

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

.cp-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
}

.cp-list-footer {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

/* Owner admin login + security */

.admin-auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.admin-auth-card {
  width: min(420px, calc(100vw - 32px));
  margin: 48px auto;
  padding: 28px 24px;
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  box-shadow: var(--ap-shadow);
}

.admin-auth-card h1 {
  margin: 8px 0 12px;
  font-size: 1.5rem;
}

.admin-auth-card label {
  display: block;
  margin: 14px 0 6px;
  font-size: 0.9rem;
  color: var(--ap-muted);
}

.admin-auth-card input {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid var(--ap-border);
  border-radius: 10px;
  font: inherit;
}

.admin-auth-error {
  margin: 12px 0 0;
  color: #b91c1c;
  font-size: 0.92rem;
}

.admin-auth-success {
  margin: 12px 0 0;
  color: #047857;
  font-size: 0.92rem;
}

.admin-auth-error.hidden,
.admin-auth-success.hidden {
  display: none;
}

.admin-status-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #4a3728;
  color: #f3e7d8;
  border-bottom: 1px solid rgba(228, 216, 200, 0.32);
}

.admin-status-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 0.88rem;
}

.kr-upload-status {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(15, 139, 122, 0.28);
  background: rgba(231, 243, 238, 0.78);
}

.kr-upload-state {
  color: #0f766e;
  margin-bottom: 6px;
}

.kr-upload-error {
  color: #b91c1c;
  font-size: 0.92rem;
  margin-bottom: 6px;
}

.kr-upload-docs {
  display: grid;
  gap: 6px;
}

.kr-upload-doc {
  display: grid;
  gap: 2px;
  font-size: 0.92rem;
}

.kr-upload-doc span {
  color: #6f625a;
}

.kr-evidence-snippet {
  color: #475569;
  font-size: 0.88rem;
  font-style: italic;
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

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

.admin-status-bar a,
.admin-status-bar button {
  color: #5eead4;
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.admin-provider-card {
  max-width: 1120px;
}

.admin-provider-list {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.admin-provider-policy {
  border: 1px solid rgba(15, 139, 122, 0.24);
  border-radius: 8px;
  padding: 16px;
  background: #edf7f2;
}

.admin-provider-item {
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  padding: 18px;
  background: var(--ap-surface);
}

.admin-provider-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.admin-provider-heading h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.admin-provider-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.admin-provider-meta div {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: #fffdf8;
}

.admin-provider-meta dt {
  margin-bottom: 4px;
  color: var(--ap-muted);
  font-size: 0.78rem;
}

.admin-provider-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 600;
}

.admin-provider-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-provider-form label {
  display: grid;
  gap: 6px;
  color: var(--ap-muted);
  font-size: 0.9rem;
}

.admin-provider-form input[type="text"],
.admin-provider-form input[type="password"],
.admin-provider-form input:not([type]) {
  width: 100%;
  min-height: 42px;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  font: inherit;
  color: var(--ap-text);
}

.admin-provider-check {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.admin-provider-check input {
  width: 18px;
  height: 18px;
}

.admin-provider-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 900px) {
  .admin-status-bar {
    padding-top: env(safe-area-inset-top, 0px);
  }

  .admin-status-bar:not([hidden]) .admin-status-inner {
    padding-left: calc(16px + 44px + 8px);
    min-height: 44px;
  }

  .admin-status-bar:not([hidden]) ~ .ap-mobile-toggle {
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    z-index: 50;
  }
}

@media (max-width: 480px) {
  .admin-status-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-status-bar:not([hidden]) ~ .ap-shell .ap-main {
    padding-top: calc(136px + env(safe-area-inset-top, 0px));
  }

  .admin-auth-card {
    margin: 24px auto;
  }

  .admin-provider-meta,
  .admin-provider-form {
    grid-template-columns: 1fr;
  }

  .admin-provider-heading {
    flex-direction: column;
  }
}

.admin-dashboard-body {
  background: var(--ap-bg);
}

.admin-dashboard {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-dashboard-nav {
  background: #4a3728;
  color: #fffdf8;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.admin-dashboard-nav strong {
  padding: 0 10px 12px;
}

.admin-dashboard-nav a {
  color: #f3e7d8;
  text-decoration: none;
  border-radius: 8px;
  padding: 10px;
  font-weight: 650;
}

.admin-dashboard-nav a.active,
.admin-dashboard-nav a:hover {
  color: #fffdf8;
  background: rgba(201, 139, 74, 0.22);
}

.admin-dashboard-main {
  min-width: 0;
  padding: 32px;
  padding-top: calc(32px + env(safe-area-inset-top, 0px));
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  background: #fff;
}

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

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--ap-border);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.admin-table th {
  background: #f5efe6;
  color: #6f625a;
  font-size: 12px;
  text-transform: uppercase;
}

.admin-table code {
  white-space: normal;
  overflow-wrap: anywhere;
}

.admin-readiness-panel,
.admin-info-strip {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(201, 139, 74, 0.32);
  border-radius: 8px;
  background: #fff8ec;
}

.admin-info-strip {
  align-items: center;
  justify-content: flex-start;
  margin: 0 0 14px;
  padding: 10px 12px;
}

.admin-info-strip span:last-child {
  color: var(--ap-muted);
  font-size: 13px;
}

.admin-readiness-panel h3 {
  margin: 2px 0 4px;
  font-size: 17px;
}

.admin-readiness-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: min(420px, 100%);
}

.admin-readiness-grid.compact {
  margin-top: 12px;
  min-width: 0;
}

.admin-readiness-grid > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-payment-preview code {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  background: #fffdf8;
  overflow-wrap: anywhere;
}

.admin-qr-placeholder {
  display: grid;
  place-items: center;
  width: min(180px, 100%);
  aspect-ratio: 1;
  border: 1px dashed #c98b4a;
  border-radius: 8px;
  background: #fffdf8;
  color: #8a5b2e;
  font-weight: 850;
}

.admin-auth-card .checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0 0;
  color: var(--ap-text);
  line-height: 1.45;
}

.admin-auth-card .checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  margin: 3px 0 0;
  flex: 0 0 16px;
  accent-color: #146c5f;
}

.admin-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 10px;
  margin-bottom: 14px;
  align-items: center;
}

.admin-toolbar input,
.admin-toolbar select {
  min-width: 0;
  min-height: 38px;
  border-radius: 8px;
}

.admin-toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 0 0 14px;
  color: var(--ap-muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-toolbar .admin-toggle-row,
.admin-toggle-row.compact {
  margin: 0;
}

.admin-toggle-row input {
  width: 16px;
  min-height: 16px;
  padding: 0;
  accent-color: var(--ap-accent);
}

.admin-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 8px;
  background: #eef2f7;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
}

.admin-badge-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

.admin-label.ok {
  background: #dcfce7;
  color: #166534;
}

.admin-label.warn {
  background: #fef3c7;
  color: #92400e;
}

.admin-label.danger {
  background: #fee2e2;
  color: #991b1b;
}

.admin-big-number {
  margin: 0;
  color: var(--ap-text);
  font-size: 2.2rem;
  font-weight: 850;
}

.admin-actions-cell {
  min-width: 360px;
}

.admin-actions-cell .ap-btn,
.admin-actions-cell button {
  min-height: 32px;
  padding: 0 10px;
  margin: 0 6px 6px 0;
  font-size: 12px;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
}

.admin-table .ap-btn,
.admin-table .ap-btn.nowrap {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
}

.admin-inline-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 6px 6px 0;
}

.admin-inline-select select {
  width: 132px;
  min-height: 32px;
  padding: 4px 8px;
}

.admin-settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.admin-settings-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.admin-settings-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.admin-detail-panel {
  margin-top: 16px;
}

.admin-detail-panel ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.admin-security-checklist {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.admin-security-checklist span {
  padding: 8px 10px;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ap-muted);
  font-size: 13px;
  font-weight: 750;
}

.onboarding-wizard {
  display: grid;
  gap: 16px;
}

.onboarding-progress {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.onboarding-dot {
  min-width: 0;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  background: #fffdf8;
  padding: 10px;
}

.onboarding-dot.done {
  border-color: #0f8b7a;
  background: #e7f3ee;
}

.onboarding-dot span,
.onboarding-dot strong {
  display: block;
  overflow-wrap: anywhere;
}

.onboarding-dot span {
  color: var(--ap-muted);
  font-size: 12px;
  font-weight: 800;
}

.onboarding-dot strong {
  margin-top: 4px;
}

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

.onboarding-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.onboarding-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--ap-muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.onboarding-form-grid .wide {
  grid-column: 1 / -1;
}

.onboarding-form-grid input,
.onboarding-form-grid textarea {
  border: 1px solid var(--ap-border);
  border-radius: 8px;
}

.profile-data-center {
  display: grid;
  gap: 18px;
}

.profile-readiness {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  padding: 16px;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  background: linear-gradient(135deg, #fffdf8, #f5efe6);
}

.profile-readiness strong {
  display: block;
  margin: 4px 0;
  font-size: 2rem;
}

.profile-readiness span {
  color: var(--ap-muted);
  font-size: 0.9rem;
}

.profile-readiness-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.profile-readiness-grid span {
  min-width: 0;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  background: #fffdf8;
  padding: 10px;
  overflow-wrap: anywhere;
}

.profile-stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.profile-stepper button {
  min-width: 0;
  color: var(--ap-accent-dark);
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  background: #fffdf8;
  padding: 9px 10px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.profile-stepper button.active {
  color: #fffdf8;
  border-color: var(--ap-accent-dark);
  background: var(--ap-accent-dark);
}

.profile-data-form,
.profile-section {
  display: grid;
  gap: 16px;
}

.profile-step-panel,
.profile-secondary-section {
  display: none;
}

.profile-step-panel.is-active {
  display: grid;
}

.profile-section {
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  background: #fffdf8;
  padding: 18px;
}

.profile-section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.profile-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profile-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--ap-muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.profile-field.wide {
  grid-column: 1 / -1;
}

.profile-field input,
.profile-field textarea,
.profile-field select,
.profile-product-editor input,
.profile-product-editor textarea,
.profile-product-editor select,
.profile-media-card input,
.profile-media-card select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ap-text);
  padding: 9px 10px;
}

.profile-product-editors,
.profile-product-editor {
  display: grid;
  gap: 12px;
}

.profile-product-editor {
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  background: #fffdf8;
  padding: 14px;
}

.profile-product-editor details {
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  background: #fffaf0;
  padding: 10px;
}

.profile-product-editor summary {
  color: var(--ap-accent-dark);
  cursor: pointer;
  font-weight: 800;
  margin-bottom: 10px;
}

.profile-business-details,
.profile-edit-details {
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  background: #fffaf0;
  padding: 12px;
}

.profile-business-details > summary,
.profile-edit-details > summary {
  color: var(--ap-accent-dark);
  cursor: pointer;
  font-weight: 800;
}

.profile-business-details[open] > summary,
.profile-edit-details[open] > summary {
  margin-bottom: 12px;
}

.profile-product-reference-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.profile-product-reference {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.profile-product-reference img,
.profile-logo-preview img {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  background: #fffdf8;
  object-fit: contain;
}

.profile-product-reference-upload {
  display: grid;
  gap: 10px;
}

.profile-logo-preview {
  display: grid;
  grid-template-columns: minmax(96px, 160px) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  max-width: 520px;
}

.profile-oauth-chooser {
  display: grid;
  gap: 14px;
  border: 2px solid var(--ap-accent-dark);
  border-radius: 8px;
  background: #fffaf0;
  padding: 16px;
}

.profile-oauth-page-card {
  display: grid;
  align-content: start;
  gap: 8px;
}

.profile-media-card {
  display: grid;
  gap: 10px;
}

.profile-media-card img,
.profile-media-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  background: #f7efe0;
  object-fit: cover;
}

.profile-media-placeholder {
  display: grid;
  place-items: center;
  color: var(--ap-muted);
  font-weight: 800;
}

.profile-media-actions {
  display: grid;
  gap: 8px;
}

.profile-sticky-actions {
  position: sticky;
  bottom: 16px;
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--ap-shadow);
}

@media (max-width: 900px) {
  .admin-dashboard {
    grid-template-columns: 1fr;
  }

  .admin-dashboard-nav {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .admin-dashboard-main {
    padding: 18px;
  }

  .admin-toolbar,
  .onboarding-progress,
  .onboarding-form-grid,
  .cp-brief-layout,
  .cp-generate-form,
  .profile-readiness,
  .profile-readiness-grid,
  .profile-stepper,
  .profile-form-grid,
  .profile-product-reference-grid {
    grid-template-columns: 1fr;
  }

  .ap-next-step,
  .cp-plan-preview-summary,
  .admin-readiness-panel,
  .admin-info-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-readiness-grid {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .admin-actions-cell {
    min-width: 280px;
  }

  .profile-section-head,
  .profile-sticky-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .admin-table-wrap {
    overflow-x: visible;
    border: 0;
    background: transparent;
  }

  .admin-table.responsive {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  .admin-table.responsive thead {
    display: none;
  }

  .admin-table.responsive,
  .admin-table.responsive tbody,
  .admin-table.responsive tr,
  .admin-table.responsive td {
    display: block;
    width: 100%;
  }

  .admin-table.responsive tr {
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid var(--ap-border);
    border-radius: 8px;
    background: #fffdf8;
  }

  .admin-table.responsive td {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(228, 216, 200, 0.72);
  }

  .admin-table.responsive td:last-child {
    border-bottom: 0;
  }

  .admin-table.responsive td::before {
    content: attr(data-label);
    color: var(--ap-muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
  }

.admin-actions-cell {
  min-width: 0;
}

  .admin-inline-select {
    display: grid;
    width: 100%;
  }

  .admin-inline-select select {
    width: 100%;
  }

  .cp-card-grid {
    grid-template-columns: 1fr;
  }

  .cp-layout-preview {
    max-width: none;
  }
}
