/* ===================================================================
   NN One — Xingtian-style vertical 8-step order flow (home page only)
   Loaded after platforms.css. Scoped to the home order flow so shared
   styles (admin/account/...) are untouched. Uses the global warm theme
   variables defined in styles.css.
   =================================================================== */

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

/* ---- Centered single-column canvas ---- */
.app-content main > .overview {
  max-width: 880px;
  margin: 0 auto 16px;
  padding: 4px 2px 0;
}
.app-content main > .overview h1 {
  font-size: 22px;
  line-height: 1.3;
  margin: 6px 0;
}
.order-flow {
  max-width: 880px;
  margin: 0 auto;
  padding-bottom: 56px;
}

/* ---- Step card ---- */
.flow-step {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(40, 30, 20, 0.04), 0 8px 24px rgba(40, 30, 20, 0.06);
}
.flow-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.flow-head h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}
.flow-no {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 800;
  font-size: 12.5px;
  display: grid;
  place-items: center;
}
.flow-side {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

/* ---- Step 1: platform grid (4 columns) ---- */
.order-flow .platform-grid#platformList {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.order-flow .platform-grid#platformList .platform-button {
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 13px 6px 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, color 0.15s,
    border-color 0.15s;
}
.order-flow .platform-grid#platformList .platform-button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.order-flow .platform-grid#platformList .platform-button img,
.order-flow .platform-grid#platformList .platform-button .platform-symbol {
  width: 24px;
  height: 24px;
  margin: 0;
  font-size: 20px;
  line-height: 1;
}
.order-flow .platform-grid#platformList .platform-button .platform-label {
  font-size: 13px;
  line-height: 1.1;
  font-weight: 600;
}
.order-flow .platform-grid#platformList .platform-button > span:last-child {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.order-flow .platform-grid#platformList .platform-button.active {
  background: linear-gradient(145deg, var(--accent-light, #ef8e6e), var(--accent));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px rgba(215, 96, 65, 0.3);
}
.order-flow .platform-grid#platformList .platform-button.active .platform-label,
.order-flow .platform-grid#platformList .platform-button.active > span:last-child {
  color: #fff;
}
.order-flow .platform-grid#platformList .platform-button.active > span:last-child {
  opacity: 0.88;
}
.order-flow .platform-grid#platformList .platform-button.active img {
  filter: brightness(0) invert(1);
}

/* ---- Step 2: search ---- */
.flow-search.search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  height: 48px;
  margin: 0;
}
.flow-search.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.flow-search svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex: 0 0 auto;
}
.flow-search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  height: 100%;
}

/* ---- Native large selects / inputs ---- */
.flow-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 12px;
}
.flow-field > span,
.flow-field > label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.flow-field select,
.flow-field input,
.flow-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.flow-field select,
.flow-field input {
  height: 50px;
  padding: 0 14px;
}
.flow-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23777169' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
  font-weight: 600;
}
.flow-field textarea {
  padding: 12px 14px;
  min-height: 84px;
  resize: vertical;
  line-height: 1.6;
}
.flow-field select:focus,
.flow-field input:focus,
.flow-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.flow-field select:disabled,
.flow-field input:disabled {
  background: color-mix(in srgb, var(--muted) 8%, var(--paper));
  color: var(--muted);
  cursor: not-allowed;
}
.flow-field.field-invalid select,
.flow-field.field-invalid input,
.flow-field.field-invalid textarea,
.flow-field :invalid.field-invalid {
  border-color: #c0392b;
}
/* author display rules must never defeat the native hidden attribute */
.flow-field[hidden],
.order-ready[hidden],
.flow-step .sell-tags[hidden],
.flow-submit [hidden],
.platform-grid [hidden] {
  display: none !important;
}
.flow-subfield {
  margin-top: 4px;
}

/* ---- Step 5: description + meta ---- */
/* Order result dialog (success after placing an order) */
.result-dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  width: min(92vw, 400px);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(40, 28, 20, .28);
}
.result-dialog::backdrop {
  background: rgba(20, 14, 10, .55);
}
.result-card {
  padding: 26px 24px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.result-ic {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e7f6ec;
  color: #2e7d52;
  margin-bottom: 12px;
}
.result-card h2 {
  margin: 0 0 6px;
  font-size: 19px;
  letter-spacing: -.01em;
}
.result-sub {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
}
.result-meta {
  width: 100%;
  margin: 14px 0 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.result-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  font-size: 13px;
}
.result-meta-row + .result-meta-row {
  border-top: 1px solid var(--line);
}
.result-meta-row span {
  color: var(--muted);
}
.result-meta-row b {
  font-weight: 700;
}
.result-actions {
  width: 100%;
  margin-top: 6px;
}
.result-actions .wide {
  margin-top: 10px;
}
@media (max-width: 560px) {
  .result-card { padding: 22px 18px 18px; }
}
.flow-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.flow-meta-item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 0;
}
.flow-meta-item span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flow-meta-item b {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-top: 2px;
  word-break: break-word;
}
.flow-desc {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink);
  white-space: pre-line;
  word-break: break-word;
  min-height: 84px;
  margin: 0;
}
.flow-step .sell-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
}
.flow-step .sell-tag {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border: none;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

/* ---- Ready note ---- */
.order-ready {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #2e7d52;
  background: color-mix(in srgb, #2e7d52 9%, var(--paper));
  border: 1px solid color-mix(in srgb, #2e7d52 22%, var(--line));
  border-radius: 10px;
  padding: 9px 12px;
  margin: 0 0 12px;
}

/* ---- Step 7: price + total ---- */
.flow-unitprice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  margin-top: 2px;
}
.flow-unitprice strong {
  color: var(--ink);
  font-weight: 700;
}
.flow-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  background: color-mix(in srgb, var(--accent) 7%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-radius: 12px;
  padding: 13px 16px;
}
.flow-total span {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.flow-total strong {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-dark);
  line-height: 1.1;
}

/* ---- Step 8: submit ---- */
.flow-submit {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 4px 0 0;
}
.flow-place.wide.primary {
  width: 100%;
  height: 54px;
  border: none;
  border-radius: 14px;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  background: linear-gradient(145deg, var(--accent-light, #ef8e6e), var(--accent));
  box-shadow: 0 10px 22px rgba(215, 96, 65, 0.28);
  transition: filter 0.15s;
}
.flow-place.wide.primary:hover:not(:disabled) {
  filter: brightness(1.03);
}
.flow-place.wide.primary:disabled {
  background: #d8d0c6;
  box-shadow: none;
  cursor: not-allowed;
  color: #fff;
}
.flow-submit .hint {
  min-height: 20px;
  margin: 10px 2px 0;
  font-size: 13px;
}
.flow-submit .hint-ok {
  color: #2e7d52;
}
.flow-submit .hint-error {
  color: #c0392b;
}
.flow-submit .ghost {
  margin: 4px 0;
}
.payment-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  margin: 10px 2px 0;
  text-align: center;
}

/* ===================================================================
   Mobile (<=720px): keep the 4-column platform grid, tidy the top bar
   =================================================================== */
@media (max-width: 720px) {
  /* Fix the cramped / ragged account row (red-circle issue) */
  .app-content .topbar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    height: auto;
  }
  .app-content .topbar #navigationToggle {
    flex: 0 0 auto;
    align-self: flex-start;
    margin-top: 2px;
  }
  .app-content .topbar .top-actions {
    flex: 1 1 auto;
    width: auto !important;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
  }
  .app-content .topbar .account-summary {
    margin-right: 0 !important;
    flex: 0 0 auto;
  }
  .app-content .topbar .header-balance {
    padding: 6px 10px;
    gap: 6px;
  }
  .app-content .topbar .header-balance > span {
    display: none;
  }
  .app-content .topbar .top-actions > button,
  .app-content .topbar .top-actions > select,
  .app-content .topbar .top-actions > span,
  .app-content .topbar .top-actions > .account-summary {
    flex: 0 0 auto;
  }

  .app-content main > .overview {
    margin-bottom: 12px;
  }
  .app-content main > .overview h1 {
    font-size: 18px;
  }
  .order-flow {
    padding: 0 2px 44px;
  }
  .flow-step {
    padding: 14px;
    border-radius: 14px;
    margin-bottom: 12px;
  }
  /* 4 platforms per row, slightly tighter (no horizontal scroller) */
  .order-flow .platform-grid#platformList {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
  .order-flow .platform-grid#platformList .platform-button {
    padding: 10px 3px;
    border-radius: 12px;
    gap: 4px;
  }
  .order-flow .platform-grid#platformList .platform-button img,
  .order-flow .platform-grid#platformList .platform-button .platform-symbol {
    width: 22px;
    height: 22px;
  }
  .order-flow .platform-grid#platformList .platform-button .platform-label {
    font-size: 11.5px;
  }
  .order-flow .platform-grid#platformList .platform-button > span:last-child {
    font-size: 10px;
  }
  .flow-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .flow-total strong {
    font-size: 20px;
  }
  /* >=16px prevents iOS auto-zoom on focus */
  .flow-search input,
  .flow-field select,
  .flow-field input,
  .flow-field textarea {
    font-size: 16px;
  }
  .flow-place.wide.primary {
    font-size: 15px;
  }
}
