:root {
  --ash-bg: #faf9f5;
  --ash-card: #faf9f5;
  --ash-surface: #ffffff;
  --ash-text: #10231f;
  --ash-text-soft: rgba(16, 35, 31, 0.64);
  --ash-border: #dad9d4;
  --ash-input: #b4b2a7;
  --ash-muted: #ede9de;
  --ash-accent: #e9e6dc;
  --ash-ring: #c96442;
  --ash-danger: #b42318;
  --ash-success: #1f6f43;
  --ash-radius: 14px;
  --ash-radius-lg: 20px;
  --ash-radius-xl: 28px;
}

html,
body {
  overflow-x: hidden;
}

#ash-create-listing-app,
#ash-create-listing-app * {
  box-sizing: border-box;
  min-width: 0;
}

#ash-create-listing-app {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

.ash-shell,
.ash-create {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: clamp(16px, 2vw, 28px);
}

.ash-shell-card,
.ash-card {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--ash-border);
  border-radius: var(--ash-radius-xl);
  background: var(--ash-card);
  padding: clamp(18px, 2vw, 26px);
  box-shadow: 0 1px 2px rgba(15, 15, 15, 0.02);
}

.ash-shell-card--center {
  text-align: center;
}

.ash-loading {
  color: var(--ash-text-soft);
  font-size: 16px;
  line-height: 1.4;
}

.ash-chooser-head,
.ash-auth-head,
.ash-warmup-copy {
  margin-bottom: 18px;
}

.ash-chooser-head h1,
.ash-auth-head h1,
.ash-warmup-copy h1,
.ash-topbar__copy h2 {
  margin: 0 0 8px;
  color: var(--ash-text);
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.ash-chooser-head p,
.ash-auth-head p,
.ash-warmup-copy p,
.ash-subtle,
.ash-help,
.ash-section-card__copy,
.ash-flow-choice__copy,
.ash-auth-box p,
.ash-warmup-step__copy span {
  color: var(--ash-text-soft);
  line-height: 1.5;
}

.ash-auth-box {
  border: 1px solid rgba(16, 35, 31, 0.08);
  border-radius: var(--ash-radius-lg);
  background: var(--ash-surface);
  padding: 18px;
}

.ash-auth-box p {
  margin: 0 0 8px;
  font-size: 15px;
}

.ash-auth-box p:last-child {
  margin-bottom: 0;
}

.ash-flow-chooser-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.ash-flow-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  padding: 18px;
  border: 1px solid var(--ash-border);
  border-radius: var(--ash-radius-lg);
  background: var(--ash-surface);
  color: var(--ash-text);
  text-align: left;
  cursor: pointer;
}

.ash-flow-choice:hover,
.ash-flow-choice:focus {
  border-color: rgba(16, 35, 31, 0.26);
  background: #fff;
  color: var(--ash-text);
}

.ash-flow-choice.is-active {
  background: #111;
  color: #fff;
  border-color: #111;
}

.ash-flow-choice__title {
  display: block;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.ash-flow-choice__copy {
  display: block;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.ash-flow-choice.is-active .ash-flow-choice__copy {
  color: rgba(255, 255, 255, 0.8);
}

.ash-warmup-grid {
  display: grid;
  gap: 20px;
}

.ash-warmup-steps {
  display: grid;
  gap: 12px;
}

.ash-warmup-step {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px 0;
  border-top: 1px solid rgba(16, 35, 31, 0.08);
}

.ash-warmup-step:first-child {
  border-top: 0;
}

.ash-warmup-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--ash-muted);
  color: var(--ash-text);
  font-weight: 800;
}

.ash-warmup-step__copy strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ash-text);
  font-size: 17px;
  line-height: 1.25;
}

.ash-shell-actions,
.ash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.ash-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid var(--ash-input);
  border-radius: 16px;
  background: var(--ash-surface);
  color: var(--ash-text);
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  box-shadow: none;
}

.ash-btn:hover,
.ash-btn:focus {
  background: #fff;
  color: var(--ash-text);
  border-color: var(--ash-ring);
}

.ash-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ash-btn--primary {
  background: #111;
  color: #fff;
  border-color: #111;
}

.ash-btn--primary:hover,
.ash-btn--primary:focus {
  background: #1f1f1f;
  color: #fff;
  border-color: #1f1f1f;
}

.ash-btn--success {
  background: var(--ash-success);
  color: #fff;
  border-color: var(--ash-success);
}

.ash-btn--success:hover,
.ash-btn--success:focus {
  background: #175534;
  color: #fff;
  border-color: #175534;
}

.ash-btn--small {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
}

.ash-btn--ghost,
.ash-photo-remove {
  background: var(--ash-surface) !important;
  color: var(--ash-text) !important;
  border: 1px solid var(--ash-input) !important;
}

.ash-btn--ghost:hover,
.ash-btn--ghost:focus,
.ash-photo-remove:hover,
.ash-photo-remove:focus {
  background: #fff !important;
  color: var(--ash-text) !important;
  border-color: var(--ash-ring) !important;
}

.ash-flow-kicker {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--ash-text-soft);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  text-transform: none;
}

.ash-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.ash-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--ash-accent);
  color: var(--ash-text);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.ash-subtle {
  margin: 0;
  font-size: 15px;
}

.ash-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.ash-step-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--ash-input);
  border-radius: 18px;
  background: var(--ash-surface);
  color: var(--ash-text);
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.ash-step-tab:hover,
.ash-step-tab:focus {
  background: #fff;
  color: var(--ash-text);
  border-color: var(--ash-ring);
}

.ash-step-tab.is-active {
  background: #111;
  color: #fff;
  border-color: #111;
}

.ash-global-error {
  margin-bottom: 12px;
  color: var(--ash-danger);
  font-size: 14px;
  line-height: 1.45;
}

.ash-global-error:empty {
  display: none;
}

.ash-form .ash-step {
  display: none;
}

.ash-form .ash-step.is-active {
  display: block;
}

.ash-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ash-field {
  width: 100%;
  max-width: 100%;
}

.ash-field--full {
  grid-column: 1 / -1;
}

.ash-field label {
  display: block;
  margin: 0 0 8px;
  color: var(--ash-text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
}

.ash-category-micro-label {
  margin: 0 0 6px;
  color: var(--ash-text-soft);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.ash-help {
  margin: 0;
  font-size: 13px;
}

.ash-field input,
.ash-field select,
.ash-field textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 14px 15px;
  border: 1px solid var(--ash-input);
  border-radius: 16px;
  background: var(--ash-surface);
  color: var(--ash-text);
  font: inherit;
  line-height: 1.35;
  appearance: none;
  -webkit-appearance: none;
}

.ash-field textarea {
  resize: vertical;
  min-height: 120px;
}

.ash-field input:focus,
.ash-field select:focus,
.ash-field textarea:focus {
  outline: none;
  border-color: var(--ash-ring);
  box-shadow: 0 0 0 3px rgba(201, 100, 66, 0.12);
}

.ash-error {
  min-height: 18px;
  margin-top: 6px;
  color: var(--ash-danger);
  font-size: 13px;
  line-height: 1.4;
}

.ash-error:empty {
  min-height: 0;
  margin-top: 0;
}

.ash-photos-panel,
.ash-section-card {
  border: 1px solid rgba(16, 35, 31, 0.08);
  border-radius: 20px;
  background: var(--ash-surface);
  padding: 16px;
}

.ash-section-card__head {
  margin-bottom: 14px;
}

.ash-section-card__title {
  margin: 0 0 6px;
  color: var(--ash-text);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.15;
  text-wrap: balance;
}

.ash-section-card__copy {
  margin: 0;
  font-size: 14px;
}

.ash-section-card__grid {
  display: grid;
  gap: 16px;
}

.ash-section-card__grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ash-section-card__grid--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ash-category-stack {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.ash-category-select {
  display: none;
}

.ash-category-select.is-active {
  display: block;
}

.ash-photos-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.ash-photos-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ash-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.ash-empty-media,
.ash-empty-slots {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  border: 1px dashed rgba(16, 35, 31, 0.14);
  border-radius: 18px;
  background: #fbfbfb;
  color: var(--ash-text-soft);
  text-align: center;
  padding: 18px;
}

.ash-photo-card {
  border: 1px solid rgba(16, 35, 31, 0.1);
  border-radius: 18px;
  overflow: hidden;
  background: var(--ash-surface);
}

.ash-photo-media {
  aspect-ratio: 4 / 3;
  background: #f4f4f4;
  overflow: hidden;
}

.ash-photo-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ash-photo-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
}

.ash-photo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--ash-accent);
  color: var(--ash-text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.ash-photo-card.is-cover .ash-photo-badge {
  background: #111;
  color: #fff;
}

.ash-photo-remove {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.ash-condition-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ash-condition-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  min-height: 120px;
  padding: 16px;
  border: 1px solid var(--ash-input);
  border-radius: 18px;
  background: var(--ash-surface);
  color: var(--ash-text);
  text-align: left;
  cursor: pointer;
}

.ash-condition-card:hover,
.ash-condition-card:focus {
  background: #fff;
  color: var(--ash-text);
  border-color: var(--ash-ring);
}

.ash-condition-card.is-active {
  border-color: #111;
  box-shadow: inset 0 0 0 1px #111;
}

.ash-condition-card__title {
  display: block;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.ash-condition-card__copy {
  display: block;
  color: var(--ash-text-soft);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.ash-check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ash-check {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid rgba(16, 35, 31, 0.1);
  border-radius: 16px;
  background: var(--ash-surface);
  overflow: hidden;
}

.ash-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  max-width: 18px;
  margin: 0;
  padding: 0;
  align-self: center;
  justify-self: start;
}

.ash-check__text {
  display: block;
  width: 100%;
  min-width: 0;
  color: var(--ash-text);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ash-toggle-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.ash-toggle-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(16, 35, 31, 0.1);
  border-radius: 16px;
  background: var(--ash-surface);
}

.ash-toggle-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin: 2px 0 0;
}

.ash-toggle-copy {
  display: block;
  min-width: 0;
}

.ash-toggle-copy strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ash-text);
  line-height: 1.25;
}

.ash-toggle-copy small {
  display: block;
  color: var(--ash-text-soft);
  font-size: 13px;
  line-height: 1.45;
}

.ash-slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.ash-slots {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.ash-slot-row {
  border: 1px solid rgba(16, 35, 31, 0.1);
  border-radius: 18px;
  padding: 12px;
  background: var(--ash-surface);
}

.ash-slot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ash-slot-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

body.admin-bar .media-modal {
  top: 46px !important;
}

body.admin-bar .media-modal-content {
  min-height: calc(100vh - 46px) !important;
}

@media (max-width: 1024px) {
  .ash-check-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ash-section-card__grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 782px) {
  .ash-shell,
  .ash-create {
    width: 100%;
    max-width: 100%;
    padding: 14px;
  }

  .ash-shell-card,
  .ash-card {
    width: 100%;
    max-width: 100%;
    padding: 16px;
    border-radius: 22px;
  }

  .ash-topbar {
    grid-template-columns: 1fr auto;
    gap: 12px;
  }

  .ash-status {
    min-height: 42px;
    padding: 8px 12px;
    font-size: 13px;
  }

  .ash-grid,
  .ash-section-card__grid--2,
  .ash-section-card__grid--4,
  .ash-slot-grid,
  .ash-flow-chooser-grid {
    grid-template-columns: 1fr !important;
  }

  /* condition cards and checkboxes stay 2-col on tablets; collapse at 480px */
  .ash-condition-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ash-check-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ash-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .ash-step-tab {
    min-height: 46px;
    padding: 10px 6px;
    font-size: clamp(12px, 3.2vw, 15px);
    white-space: normal;
    text-align: center;
    line-height: 1.25;
    word-break: break-word;
  }

  .ash-shell-actions .ash-btn,
  .ash-actions .ash-btn {
    flex: 1 1 0;
  }

  .ash-media-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ash-photo-media {
    aspect-ratio: 16 / 10;
  }

  .ash-photos-top,
  .ash-slot-head {
    flex-direction: column;
    align-items: stretch;
  }

  .ash-photos-actions {
    width: 100%;
  }

  .ash-check,
  .ash-toggle-row {
    overflow: hidden;
  }

  .ash-check__text,
  .ash-toggle-copy,
  .ash-flow-choice__title,
  .ash-flow-choice__copy,
  .ash-condition-card__title,
  .ash-condition-card__copy,
  .ash-section-card__copy,
  .ash-subtle,
  .ash-help {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  body.admin-bar .media-modal {
    top: 46px !important;
  }

  body.admin-bar .media-modal-content {
    min-height: calc(100vh - 46px) !important;
  }
}

@media (max-width: 480px) {
  .ash-shell,
  .ash-create {
    padding: 10px;
  }

  .ash-shell-card,
  .ash-card {
    padding: 14px;
    border-radius: 18px;
  }

  .ash-photos-panel,
  .ash-section-card {
    padding: 12px;
    border-radius: 16px;
  }

  /* collapse condition cards and checkboxes to 1-col on small phones */
  .ash-condition-grid,
  .ash-check-grid {
    grid-template-columns: 1fr;
  }

  /* stack topbar so status badge doesn't squeeze the title */
  .ash-topbar {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .ash-status {
    justify-self: start;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 12px;
  }

  .ash-steps {
    gap: 6px;
  }

  .ash-step-tab {
    min-height: 42px;
    padding: 8px 4px;
    font-size: clamp(11px, 3vw, 13px);
    border-radius: 14px;
  }

  .ash-condition-card {
    min-height: 90px;
    padding: 12px;
  }

  .ash-slot-row {
    padding: 10px;
  }

  .ash-field input,
  .ash-field select,
  .ash-field textarea {
    padding: 12px 13px;
  }
}

/* --------------------------------------------------------
   Exposure chips
   -------------------------------------------------------- */
.ash-exposure-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.ash-exposure-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1.5px solid var(--ash-border);
  border-radius: 99px;
  background: var(--ash-bg);
  color: var(--ash-text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.ash-exposure-chip input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.ash-exposure-chip:hover {
  border-color: var(--ash-ring);
}

.ash-exposure-chip.is-active {
  border-color: var(--ash-ring);
  background: var(--ash-ring);
  color: #fff;
}

/* --------------------------------------------------------
   Optional field label hint
   -------------------------------------------------------- */
.ash-field-optional {
  font-size: 0.8em;
  font-weight: 400;
  color: var(--ash-muted, #888);
  margin-left: 4px;
}

/* --------------------------------------------------------
   Plan limit upgrade banner
   -------------------------------------------------------- */
.ash-plan-limit-banner {
  margin: 16px 0 0;
  padding: 14px 16px;
  border: 1px solid #f5c2c7;
  border-radius: 6px;
  background: #fff5f5;
  color: #842029;
  font-size: 0.9em;
  line-height: 1.5;
}

.ash-plan-limit-banner p {
  margin: 0;
}

.ash-plan-limit-banner a {
  color: #842029;
  font-weight: 600;
  text-decoration: underline;
}

/* ==========================================================================
   Phase 8 — Mobile / UX polish
   ========================================================================== */

/* ── iOS zoom prevention: font-size must be ≥ 16 px on mobile inputs ──────── */

@media (max-width: 767px) {
  .ash-field input,
  .ash-field select,
  .ash-field textarea {
    font-size: 1rem; /* 16 px — prevents Safari auto-zoom on focus */
  }
}

/* ── Photo grid: 2 columns on tablets → 1 column on small phones ─────────── */
/* Note: the 782px block above already sets repeat(2, 1fr); collapse to 1 here */

@media (max-width: 480px) {
  .ash-media-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Safe-area insets for notched phones ─────────────────────────────────── */

.ash-shell,
.ash-create {
  padding-left:  max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
}

/* ── focus-visible: suppress ring on mouse clicks ───────────────────────── */

.ash-btn:focus:not(:focus-visible) {
  outline: none;
}

.ash-btn:focus-visible {
  outline: 2px solid var(--ash-ring);
  outline-offset: 2px;
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .ash-btn,
  .ash-step-tab,
  .ash-check,
  .ash-toggle-row,
  .ash-condition-card,
  .ash-flow-choice {
    transition: none;
  }
}