/*
 * Customer page (Phase 6). Builds on ui/css/components.css (body.nv-mobile).
 * Mobile first: everything is designed at 360 px wide and grows from there.
 */

body.cu-page { background: var(--nv-bg); }
body.cu-noscroll { overflow: hidden; }
body.cu-has-bar .nv-mobile-page { padding-bottom: 140px; }

.cu-h1 { font: 600 22px/28px var(--nv-font-display); margin: 4px 0 12px; }
.cu-h2 { font: 600 16px/22px var(--nv-font-display); margin: 20px 0 8px; }
.cu-h3 { font: 600 14px/20px var(--nv-font); margin: 16px 0 8px; }
.cu-hint { font-size: 13px; color: var(--nv-text-2); }
.cu-hero-icon { font-size: 48px; color: var(--app-accent-ink); }
.cu-avail { margin-bottom: 12px; }

.cu-icon-btn {
  flex: 0 0 auto; width: 40px; height: 40px; display: inline-grid; place-items: center;
  border: 0; border-radius: var(--nv-radius); background: transparent; color: var(--nv-text-2); font-size: 16px;
}
.cu-icon-btn:hover { background: var(--st-muted-bg); color: var(--nv-text); }
.cu-icon-btn:focus-visible { outline: 2px solid var(--nv-text); outline-offset: 1px; }

/* ---------------------------------------------------------------- start screen */
.cu-intro h1 { font: 600 26px/32px var(--nv-font-display); margin: 8px 0 6px; }
.cu-intro p { color: var(--nv-text-2); margin-bottom: 16px; }

.cu-add { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.cu-add-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  min-height: 116px; padding: 14px 8px; border: 1px solid var(--nv-stroke-strong); border-radius: var(--nv-radius-lg);
  background: var(--nv-card); color: var(--nv-text); box-shadow: 0 2px 4px rgba(0, 0, 0, .04);
  transition: transform .08s ease, background .12s ease;
}
.cu-add-tile .bi { font-size: 30px; line-height: 1; color: var(--app-accent-ink); margin-bottom: 4px; }
.cu-add-tile strong { font-size: 15px; font-weight: 600; }
.cu-add-tile span { font-size: 12px; color: var(--nv-text-2); line-height: 16px; }
.cu-add-tile:active { transform: scale(.97); background: var(--nv-layer); }
.cu-add-tile:focus-visible { outline: 2px solid var(--nv-text); outline-offset: 2px; }
.cu-add-tile:disabled { opacity: .45; }
.cu-add.is-compact .cu-add-tile { min-height: 56px; flex-direction: row; gap: 6px; padding: 8px; }
.cu-add.is-compact .cu-add-tile .bi { font-size: 18px; margin: 0; }
.cu-add.is-compact .cu-add-tile strong { font-size: 13px; }

.cu-steps { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 2px; }
.cu-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; color: var(--nv-text-2); counter-increment: step; }
.cu-steps .bi { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--app-accent-soft); color: var(--app-accent-ink); flex: 0 0 32px; }

/* ---------------------------------------------------------------- cart items */
.cu-item { padding: 12px; margin-bottom: 10px; border: 1px solid var(--nv-stroke-strong); border-radius: var(--nv-radius-lg); }
.cu-item-top { display: flex; align-items: flex-start; gap: 12px; }
.cu-thumb {
  flex: 0 0 48px; width: 48px; height: 64px; border: 1px solid var(--nv-stroke-strong); border-radius: 3px; overflow: hidden;
  background: #fff; display: grid; place-items: center; color: var(--nv-text-3); font-size: 22px;
}
.cu-thumb.is-card { height: 32px; margin-top: 12px; border-radius: 3px; }
.cu-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cu-item-info { flex: 1 1 auto; min-width: 0; padding-top: 2px; }
.cu-item-name { font-weight: 600; overflow-wrap: anywhere; line-height: 20px; }
.cu-item-meta { font-size: 13px; color: var(--nv-text-2); margin-top: 2px; }
.cu-item-status { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--nv-text-2); }
.cu-item-status .nv-ring { width: 16px; height: 16px; }
.cu-item-error { margin-top: 10px; }

.cu-progress { margin-top: 10px; }
.cu-bar { height: 6px; border-radius: 3px; background: var(--st-muted-bg); overflow: hidden; }
.cu-bar-fill { height: 100%; width: 0; background: var(--app-accent-strong); border-radius: 3px; transition: width .3s ease; }
.cu-progress-text { font-size: 12px; color: var(--nv-text-2); margin-top: 4px; font-variant-numeric: tabular-nums; }

.cu-settings { margin-top: 8px; border-top: 1px solid var(--nv-stroke); padding-top: 4px; }
.cu-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.cu-row-top { align-items: flex-start; padding: 8px 0; }
.cu-label { color: var(--nv-text-2); font-size: 14px; flex: 0 0 auto; }
.cu-value { font-size: 13px; color: var(--nv-text-2); text-align: right; }
.cu-pages-btn .bi { font-size: 12px; margin-left: 2px; }

/* Segmented control (two options, Windows "toggle button" pair) */
.cu-seg { display: inline-flex; padding: 2px; border-radius: 6px; background: var(--st-muted-bg); gap: 2px; }
.cu-seg button {
  min-width: 72px; height: 36px; padding: 0 12px; border: 0; border-radius: 4px; background: transparent;
  color: var(--nv-text); font-size: 14px; font-weight: 500;
}
.cu-seg button[aria-pressed="true"] { background: var(--app-accent); color: var(--app-on-accent); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.cu-seg button:disabled { color: var(--nv-text-3); text-decoration: line-through; }
.cu-seg button:focus-visible { outline: 2px solid var(--nv-text); outline-offset: -2px; }

.cu-stepper { display: inline-flex; align-items: center; border: 1px solid var(--nv-stroke-strong); border-radius: 6px; background: var(--nv-card); }
.cu-stepper button { width: 44px; height: 40px; border: 0; background: transparent; color: var(--nv-text); font-size: 16px; }
.cu-stepper button:disabled { color: var(--nv-text-3); }
.cu-stepper output { min-width: 36px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

.cu-plan { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 0; }
.cu-plan-seg { font-size: 13px; padding: 2px 8px; border-radius: 10px; background: var(--st-muted-bg); text-align: right; }
.cu-plan-seg.is-color { background: var(--st-purple-bg); color: var(--st-purple); }
.cu-plan-btns { display: flex; gap: 6px; margin-top: 4px; }

.cu-item-price { display: flex; justify-content: space-between; align-items: baseline; padding-top: 8px; border-top: 1px solid var(--nv-stroke); margin-top: 4px; }
.cu-item-price span { font-size: 13px; color: var(--nv-text-2); }
.cu-item-price strong { font: 600 17px/22px var(--nv-font-display); }

.cu-prices { padding: 0 12px; margin: 8px 0 16px; border: 1px solid var(--nv-stroke-strong); border-radius: var(--nv-radius-lg); }
.cu-prices summary { min-height: 48px; display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; list-style: none; }
.cu-prices summary::-webkit-details-marker { display: none; }
.cu-prices summary::after { content: "\F282"; font-family: bootstrap-icons; margin-left: auto; font-size: 12px; transition: transform .15s; }
.cu-prices[open] summary::after { transform: rotate(180deg); }
.cu-prices table { --bs-table-bg: transparent; }
.cu-prices[open] { padding-bottom: 12px; }

/* ---------------------------------------------------------------- sheets */
.cu-sheet-backdrop {
  position: fixed; inset: 0; z-index: 1080; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, .35); animation: nv-fade .15s ease-out;
}
.cu-sheet {
  width: min(520px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--nv-card); border-radius: var(--nv-radius-lg); box-shadow: var(--nv-shadow-dialog);
  animation: nv-dialog-in .2s cubic-bezier(.1, .9, .2, 1);
}
.cu-sheet.is-full { width: min(640px, 100%); height: calc(100vh - 32px); height: calc(100dvh - 32px); }
.cu-sheet-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 4px 20px; }
.cu-sheet-head h2 { flex: 1 1 auto; margin: 0; font: 600 18px/24px var(--nv-font-display); }
.cu-sheet-body { flex: 1 1 auto; overflow-y: auto; padding: 8px 20px 16px; overscroll-behavior: contain; }
.cu-sheet-foot {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--nv-stroke); background: var(--nv-layer);
}
.cu-sheet-foot > .btn { flex: 1 1 0; }
.cu-sheet-foot-btns { display: flex; gap: 8px; flex: 1 1 100%; }
.cu-sheet-foot-btns .btn { flex: 1 1 0; }
@media (max-width: 575.98px) {
  .cu-sheet-backdrop { place-items: end stretch; padding: 0; }
  .cu-sheet { width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: var(--nv-radius-lg) var(--nv-radius-lg) 0 0; animation: nv-sheet-in .24s cubic-bezier(.1, .9, .2, 1); }
  .cu-sheet.is-full { height: 96vh; height: 96dvh; max-height: none; }
  .cu-sheet-head { padding-top: 4px; }
}

/* Photo layouts */
.cu-layouts { display: grid; gap: 8px; }
.cu-layout {
  display: flex; align-items: center; gap: 14px; padding: 12px; text-align: left;
  border: 1px solid var(--nv-stroke-strong); border-radius: var(--nv-radius-lg); background: var(--nv-card); color: var(--nv-text);
}
.cu-layout[aria-checked="true"] { border-color: var(--app-accent-strong); box-shadow: inset 0 0 0 1px var(--app-accent-strong); background: var(--app-accent-soft); }
.cu-layout-text { display: flex; flex-direction: column; }
.cu-layout-text span { font-size: 13px; color: var(--nv-text-2); }
.cu-layout-pic { flex: 0 0 38px; width: 38px; height: 52px; padding: 4px; display: grid; gap: 3px; background: #fff; border: 1px solid var(--nv-stroke-strong); border-radius: 2px; }
.cu-layout-pic span { background: var(--nv-text-3); border-radius: 1px; }
.cu-layout-pic.is-2 { grid-template-rows: 1fr 1fr; }
.cu-layout-pic.is-4 { grid-template: 1fr 1fr / 1fr 1fr; }

/* ID card */
.cu-card-slots { display: grid; gap: 12px; margin-top: 12px; }
.cu-card-slot {
  position: relative; aspect-ratio: 85.6 / 54; width: 100%; padding: 0; overflow: hidden;
  border: 2px dashed var(--nv-stroke-strong); border-radius: 12px; background: var(--nv-layer); color: var(--nv-text-2);
}
.cu-card-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cu-card-slot-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 600; }
.cu-card-slot-empty .bi { font-size: 28px; color: var(--app-accent-ink); }
.cu-card-slot-label { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 10px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 12px; }
.cu-card-slot:has(img) { border-style: solid; }

.cu-crop-wrap { padding: 12px; background: #3a3a3a; border-radius: var(--nv-radius-lg); }
.cu-crop { display: block; width: 100%; aspect-ratio: 85.6 / 54; border-radius: 12px; touch-action: none; box-shadow: 0 0 0 2px var(--app-accent); cursor: grab; }
.cu-crop:active { cursor: grabbing; }
.cu-hint + .cu-slider, .cu-crop-wrap + .cu-hint { margin-top: 8px; }
.cu-slider { display: block; margin: 12px 0 0; }
.cu-slider > span { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--nv-text-2); }
.cu-slider output { margin-left: auto; font-variant-numeric: tabular-nums; }
.cu-slider input { width: 100%; height: 32px; accent-color: var(--app-accent-strong); }
.cu-crop-tools { display: flex; gap: 8px; margin-top: 12px; }
.cu-crop-tools .btn { flex: 1 1 0; }

/* Page ranges */
.cu-range { padding: 10px 0; border-bottom: 1px solid var(--nv-stroke); }
.cu-range-pages { display: flex; align-items: center; gap: 8px; }
.cu-range-pages label { display: flex; align-items: center; gap: 8px; color: var(--nv-text-2); }
.cu-range-pages input {
  width: 68px; height: 40px; padding: 0 8px; text-align: center; font-size: 16px; font-variant-numeric: tabular-nums;
  border: 1px solid var(--nv-stroke-strong); border-bottom-color: rgba(0, 0, 0, .45); border-radius: var(--nv-radius); background: var(--nv-card);
}
.cu-range-pages input:focus { outline: 0; border-bottom: 2px solid var(--app-accent-strong); }
.cu-range-pages .cu-icon-btn { margin-left: auto; }
.cu-range-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.cu-range-opts .cu-seg button { min-width: 64px; }
.cu-range-actions { display: flex; gap: 8px; margin-top: 12px; }
.cu-range-actions .btn { flex: 1 1 0; }
.cu-range-error { margin-top: 10px; padding: 8px 12px; border-radius: var(--nv-radius); background: var(--st-danger-bg); color: var(--st-danger); font-size: 14px; }
.cu-range-sum { flex: 1 1 100%; font-size: 14px; color: var(--nv-text-2); min-height: 20px; }
.cu-range-sum strong { color: var(--nv-text); }

.cu-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.cu-page { position: relative; }
.cu-page-img {
  aspect-ratio: 210 / 297; background: #fff; border: 1px solid var(--nv-stroke-strong); border-radius: 2px; overflow: hidden;
  outline: 3px solid transparent; outline-offset: -1px;
}
.cu-page-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cu-page.is-color .cu-page-img { outline-color: var(--st-purple); }
.cu-page:not(.is-skip):not(.is-color) .cu-page-img { outline-color: var(--nv-text-2); }
.cu-page.is-skip .cu-page-img { opacity: .35; }
.cu-page-num { position: absolute; top: 4px; left: 4px; min-width: 20px; padding: 0 5px; border-radius: 10px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 11px; text-align: center; }
.cu-page-badge { display: block; margin-top: 4px; font-size: 11px; line-height: 14px; text-align: center; color: var(--nv-text-2); }
.cu-page.is-color .cu-page-badge { color: var(--st-purple); font-weight: 600; }
.cu-page.is-skip .cu-page-badge { color: var(--nv-text-3); text-decoration: line-through; }

/* Checkout */
.cu-summary { list-style: none; padding: 0; margin: 0; }
.cu-summary li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--nv-stroke); }
.cu-summary li div { min-width: 0; display: flex; flex-direction: column; }
.cu-summary li strong { overflow-wrap: anywhere; }
.cu-summary li span { font-size: 13px; color: var(--nv-text-2); }
.cu-summary li b { white-space: nowrap; font-weight: 600; }
.cu-summary-total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0 0; font-size: 16px; }
.cu-summary-total strong { font: 600 22px/28px var(--nv-font-display); }

/* ---------------------------------------------------------------- receipt */
.cu-hero {
  display: flex; align-items: center; gap: 14px; padding: 18px 16px; margin-bottom: 12px; border-radius: var(--nv-radius-lg);
  background: var(--st-info-bg); color: var(--nv-text);
}
.cu-hero > .bi { font-size: 34px; line-height: 1; color: var(--st-info); }
.cu-hero h1 { font: 600 20px/26px var(--nv-font-display); margin: 0 0 2px; }
.cu-hero p { margin: 0; color: var(--nv-text-2); }
.cu-hero.is-accent { background: var(--app-accent); color: var(--app-on-accent); }
.cu-hero.is-accent > .bi, .cu-hero.is-accent p { color: inherit; }
.cu-hero.is-accent > .bi { animation: cu-pulse 1.4s ease-in-out infinite; }
.cu-hero.is-success { background: var(--brand-green); color: #fff; }
.cu-hero.is-success > .bi, .cu-hero.is-success p { color: #fff; }
.cu-hero.is-danger { background: var(--st-danger-bg); }
.cu-hero.is-danger > .bi { color: var(--st-danger); }
.cu-hero.is-warning { background: var(--st-warning-bg); }
.cu-hero.is-warning > .bi { color: var(--st-warning); }
@keyframes cu-pulse { 50% { opacity: .45; } }

.cu-code-card { padding: 16px; text-align: center; border: 1px solid var(--nv-stroke-strong); border-radius: var(--nv-radius-lg); }
.cu-code-label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--nv-text-2); }
.cu-code { font: 700 56px/64px var(--nv-font-mono); letter-spacing: .18em; padding-left: .18em; margin: 2px 0 4px; color: var(--nv-text); }
.cu-code-sub { font-size: 14px; color: var(--nv-text-2); margin: 0 0 12px; }
.cu-facts { display: grid; gap: 4px; margin: 0; padding-top: 12px; border-top: 1px solid var(--nv-stroke); text-align: left; }
.cu-facts div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.cu-facts dt { font-weight: 400; color: var(--nv-text-2); }
.cu-facts dd { margin: 0; font-family: var(--nv-font-mono); font-size: 13px; overflow-wrap: anywhere; text-align: right; }

.cu-jobs { list-style: none; padding: 0 12px; margin: 0 0 12px; border: 1px solid var(--nv-stroke-strong); border-radius: var(--nv-radius-lg); }
.cu-jobs li { padding: 12px 0; border-bottom: 1px solid var(--nv-stroke); }
.cu-jobs li:last-child { border-bottom: 0; }
.cu-job-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.cu-job-head strong { overflow-wrap: anywhere; font-weight: 600; }
.cu-job-head .nv-chip { flex: 0 0 auto; }
.cu-job-meta { font-size: 13px; color: var(--nv-text-2); margin: 2px 0 6px; }
.cu-job-error { font-size: 13px; color: var(--st-danger); margin-top: 6px; }

.cu-support { padding: 16px; margin-bottom: 12px; border: 1px solid var(--nv-stroke-strong); border-radius: var(--nv-radius-lg); }
.cu-support p { color: var(--nv-text-2); }
.cu-support-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.cu-support-list li { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.cu-support-list .bi { color: var(--nv-text-2); }

.cu-receipt-actions { display: flex; gap: 8px; margin: 16px 0; }
.cu-receipt-actions .btn { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }

/* ---------------------------------------------------------------- footer */
.cu-footer { margin-top: 24px; text-align: center; font-size: 12px; color: var(--nv-text-3); }
.cu-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-bottom: 6px; }
.cu-footer a { color: var(--nv-text-2); }

@media (prefers-reduced-motion: reduce) {
  .cu-sheet, .cu-sheet-backdrop, .cu-hero.is-accent > .bi { animation: none; }
  .cu-bar-fill { transition: none; }
}
