/**
 * Bulk 4x6 photo print crop editor: the MagicPath uploader look, as a page.
 *
 * Translated from GeneratedComponent.tsx (PhotoUploader, lines ~85-430) the
 * same way photo-4x6-v2.css translates the product page: Tailwind 4 spacing,
 * the stone palette and the design's ink, gold and cream. The editor page does
 * not load the product page CSS, so the tokens below are copied from
 * photo-4x6-v2.css (.p46-page) under --ppce-* names. Keep the two in step.
 *
 * Everything is scoped under .ppce. Touch targets stay at or above 44px on
 * phones (docs/photo-calendar-mobile-editor.md).
 *
 * WCAG AA: small text uses --ppce-muted / --ppce-gold-text (the page's AA
 * shades), never stone-400/500 or #9a7944. Pills are 5:1 or better. Focus is a
 * 3px ink outline with an offset, visible on every surface here.
 */

/* ---- Inter, self-hosted (same files as the product page) ----------------- */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/inter/inter-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/fonts/inter/inter-500.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/fonts/inter/inter-600.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fonts/inter/inter-700.woff2") format("woff2"); }

/* ---- Tokens (values from photo-4x6-v2.css) -------------------------------- */

.ppce {
    --ppce-ivory: #fbfaf7;
    --ppce-shell: #faf9f6;
    --ppce-cream: #f4f0e7;
    --ppce-paper: #f6f1e7;
    --ppce-bar: #eeece4;
    --ppce-ink: #292c24;
    --ppce-ink-hover: #45493d;
    --ppce-text: #262820;
    --ppce-gold: #9a7944;
    --ppce-gold-line: #a2814b;
    --ppce-gold-light: #d7bd88;
    --ppce-gold-soft: #dac393;
    --ppce-gold-dash: #c9b78f;
    --ppce-gold-text: #86693b;
    --ppce-gold-deep: #7a5c2c;

    --ppce-stone-100: #f5f5f4;
    --ppce-stone-200: #e7e5e4;
    --ppce-stone-300: #d6d3d1;
    --ppce-stone-600: #57534e;
    --ppce-stone-800: #292524;
    --ppce-stone-900: #1c1917;
    --ppce-muted: #736c68;

    --ppce-ok-bg: #ecfdf5;
    --ppce-ok-ring: #a4f4cf;
    --ppce-ok: #007a55;
    --ppce-warn-bg: #fffbeb;
    --ppce-warn-ring: #fee685;
    --ppce-warn: #973c00;
    --ppce-error-bg: #fff1f2;
    --ppce-error-ring: #ffccd3;
    --ppce-error: #c70036;

    --ppce-radius-sm: 10px;
    --ppce-radius-md: 14px;
    --ppce-radius-card: 16px;
    --ppce-radius-lg: 24px;
    --ppce-radius-xl: 28px;
    --ppce-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
    --ppce-sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --ppce-shadow-card: 0 20px 70px rgba(51, 46, 33, .09);
    --ppce-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, .1), 0 1px 2px -1px rgba(0, 0, 0, .1);
    --ppce-shadow-lg-ink: 0 10px 15px -3px rgba(28, 25, 23, .1), 0 4px 6px -4px rgba(28, 25, 23, .1);
    --ppce-focus: #292c24;

    /* Older names, kept for the Crop & edit panel stylesheet. */
    --ppce-line: var(--ppce-stone-200);
    --ppce-raise: var(--ppce-stone-100);
    --ppce-accent: var(--ppce-gold-line);

    display: block;
    padding: 24px 16px 56px;
    background: var(--ppce-ivory);
    color: var(--ppce-text);
    font-family: var(--ppce-sans);
    font-size: 16px;
    line-height: 1.5;
}

.ppce *,
.ppce *::before,
.ppce *::after { box-sizing: border-box; }

.ppce [x-cloak],
.ppce[x-cloak] { display: none !important; }

/* Resets wrapped in :where() so they carry no weight: any .ppce-* class
   below sets its own margin or padding without a fight. */
:where(.ppce) :where(p, h1, h2, h3, ul, ol, dl, dd) { margin: 0; }
:where(.ppce) :where(ul, ol) { padding: 0; list-style: none; }
:where(.ppce) :where(button, select) { font-family: inherit; }
/* The site's Bootstrap gives labels a bottom margin. */
.ppce label { margin-bottom: 0; }
/* The site's style.css sizes every button 100 x 40px, which squashed the
   photo thumbnails into strips. One class of weight, placed before every
   .ppce-* rule, so those rules still set their own size. */
.ppce :where(button) { width: auto; height: auto; }

/* One focus style for every control on the page and in Crop & edit. */
.ppce :focus-visible {
    outline: 3px solid var(--ppce-focus);
    outline-offset: 2px;
}

.ppce-eyebrow {
    font-size: 10px;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--ppce-gold-text);
}
.ppce-eyebrow--muted { color: var(--ppce-muted); letter-spacing: .15em; }
.ppce-eyebrow--light { color: var(--ppce-gold-soft); letter-spacing: .18em; }

/* ---- Shell: the uploader's rounded sheet, as a page ---------------------- */

.ppce-shell {
    max-width: 1440px;
    margin: 0 auto;
    background: var(--ppce-shell);
    border: 1px solid var(--ppce-stone-200);
    border-radius: var(--ppce-radius-xl);
    box-shadow: var(--ppce-shadow-card);
    overflow: clip;
}

.ppce-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: #fff;
    border-bottom: 1px solid var(--ppce-stone-200);
}

.ppce-head__brand { display: flex; align-items: center; gap: 12px; }

.ppce-head__mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: var(--ppce-radius-card);
    background: var(--ppce-ink);
    color: #e8d2a4;
    font-size: 18px;
}

.ppce-head__title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -.01em;
    color: var(--ppce-stone-900);
}

.ppce-head__status { display: flex; align-items: center; gap: 12px; }

.ppce-save { font-size: 12px; color: var(--ppce-muted); }
.ppce-save--busy { color: var(--ppce-gold-text); font-weight: 600; }

/* steps */

.ppce-steps {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid var(--ppce-stone-200);
}

.ppce-step {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 9999px;
    background: var(--ppce-stone-100);
    color: var(--ppce-stone-600);
    font-size: 12px;
    font-weight: 600;
}

.ppce-step__n {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 9999px;
    background: #fff;
    font-size: 10px;
}

.ppce-step.is-active { background: var(--ppce-ink); color: #fff; }
.ppce-step.is-active .ppce-step__n { background: #d8bd87; color: var(--ppce-stone-900); }
.ppce-step.is-done { background: var(--ppce-ok-bg); color: var(--ppce-ok); }
.ppce-step.is-done .ppce-step__n { background: var(--ppce-ok); color: #fff; }

.ppce-steps__note {
    display: none;
    margin-left: auto;
    font-size: 12px;
    color: var(--ppce-muted);
}

/* layout: work area + order summary */

.ppce-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.ppce-main { min-width: 0; padding: 16px; }

.ppce-aside {
    padding: 20px;
    background: #fff;
    border-top: 1px solid var(--ppce-stone-200);
}

@media (min-width: 640px) {
    .ppce-head,
    .ppce-steps { padding-left: 32px; padding-right: 32px; }
    .ppce-head__title { font-size: 20px; }
    .ppce-steps__note { display: block; }
    .ppce-main { padding: 28px; }
}

@media (min-width: 1024px) {
    .ppce-layout { grid-template-columns: minmax(0, 1fr) 330px; }
    .ppce-main { padding: 32px; }
    .ppce-aside {
        padding: 24px;
        border-top: 0;
        border-left: 1px solid var(--ppce-stone-200);
    }
}

@media (max-width: 639.98px) {
    /* Full-bleed sheet on a phone; the content keeps a 16px gutter. */
    .ppce { padding: 0 0 40px; }
    .ppce-shell { border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
}

/* ---- Headings ------------------------------------------------------------ */

.ppce-title {
    margin-top: 8px;
    font-family: var(--ppce-serif);
    font-size: 30px;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -.025em;
    color: var(--ppce-stone-900);
}

@media (min-width: 640px) {
    .ppce-title { font-size: 36px; line-height: 1.11; }
}

.ppce-lead {
    max-width: 36rem;
    margin-top: 12px;
    font-size: 14px;
    line-height: 24px;
    color: var(--ppce-stone-600);
}

/* ---- Step 1: upload ------------------------------------------------------ */

.ppce-hero { max-width: 48rem; margin: 0 auto; }
.ppce-hero .ppce-lead { margin-bottom: 28px; }

.ppce-drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 28px;
    border: 2px dashed var(--ppce-gold-dash);
    border-radius: var(--ppce-radius-xl);
    background: var(--ppce-cream);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}

@media (min-width: 640px) {
    .ppce-drop { padding: 48px; }
}

.ppce-drop:hover,
.ppce-drop--over { border-color: var(--ppce-gold); background: #efe8d9; }

.ppce-drop:focus-within { outline: 3px solid var(--ppce-focus); outline-offset: 3px; }

/* Visually hidden, still focusable (the label shows the focus). */
.ppce-drop__input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.ppce-drop__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: var(--ppce-radius-card);
    background: #fff;
    box-shadow: var(--ppce-shadow-sm);
    color: #937544;
    font-size: 30px;
    line-height: 1;
}

.ppce-drop__label {
    margin-top: 20px;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--ppce-stone-900);
}

.ppce-drop__sub { margin-top: 8px; font-size: 14px; color: var(--ppce-stone-600); }

.ppce-drop__cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    margin-top: 24px;
    padding: 14px 28px;
    border-radius: 9999px;
    background: var(--ppce-ink);
    box-shadow: var(--ppce-shadow-lg-ink);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    transition: background-color .15s ease;
}
.ppce-drop:hover .ppce-drop__cta { background: var(--ppce-ink-hover); }

.ppce-drop__hint { margin-top: 16px; font-size: 12px; color: var(--ppce-muted); }

.ppce-note {
    margin-top: 16px;
    padding: 10px 12px;
    border-radius: var(--ppce-radius-sm);
    background: var(--ppce-error-bg);
    color: var(--ppce-error);
    font-size: 13px;
    line-height: 1.45;
}

.ppce-facts {
    display: grid;
    gap: 12px;
    margin-top: 28px;
}

@media (min-width: 640px) {
    .ppce-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.ppce-fact {
    padding: 16px;
    border-radius: var(--ppce-radius-card);
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--ppce-stone-200);
}
.ppce-fact__icon { font-size: 20px; line-height: 1.4; color: var(--ppce-gold-text); }
.ppce-fact__title { margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--ppce-stone-900); }
.ppce-fact__copy { margin-top: 4px; font-size: 12px; line-height: 20px; color: var(--ppce-muted); }

/* ---- Upload progress ----------------------------------------------------- */

/* Upload progress: pinned to the bottom of the screen, above the save bar and,
   below 992px, above the site's 60px bottom nav. */
.ppce-banner {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 14px;
    width: min(560px, calc(100% - 24px));
    padding: 14px 18px;
    border: 1px solid var(--ppce-stone-200);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 18px 40px -12px rgba(28, 25, 23, .35);
    transform: translateX(-50%);
}

@media (max-width: 991.98px) {
    .ppce-banner { bottom: calc(60px + 12px + env(safe-area-inset-bottom, 0px)); }
}

.ppce-banner__copy { flex: 1; min-width: 0; }
.ppce-banner__row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ppce-banner__title { font-size: 14px; font-weight: 600; color: var(--ppce-stone-900); }
.ppce-banner__pct { font-size: 14px; font-weight: 700; color: var(--ppce-gold-text); font-variant-numeric: tabular-nums; }
.ppce-banner__meta { margin: 2px 0 8px; font-size: 12px; color: var(--ppce-stone-600); }
.ppce-banner__hint { margin-top: 6px; font-size: 11px; color: var(--ppce-muted); }

/* "Add more photos" waits while an upload runs. */
.ppce-btn--add.is-busy { opacity: .5; cursor: progress; }

.ppce-spinner {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border: 2px solid var(--ppce-stone-200);
    border-top-color: var(--ppce-gold);
    border-radius: 50%;
    animation: ppce-spin .8s linear infinite;
}

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

.ppce-progress {
    height: 8px;
    border-radius: 9999px;
    background: var(--ppce-stone-100);
    overflow: hidden;
}

.ppce-progress > span {
    position: relative;
    display: block;
    height: 100%;
    min-width: 8px;
    border-radius: 9999px;
    background: #a88954;
    overflow: hidden;
    transition: width .2s ease;
}

/* The server is storing or converting the photo: the bar keeps moving so
   the wait never looks frozen. */
.ppce-progress.is-working > span::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
    animation: ppce-shimmer 1.1s linear infinite;
}

@keyframes ppce-shimmer {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

/* ---- Step 2: workspace header -------------------------------------------- */

.ppce-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.ppce-bar__meta { margin-top: 8px; font-size: 14px; color: var(--ppce-stone-600); }

.ppce-dot { margin: 0 6px; }

.ppce-flag {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 10px;
    border-radius: 9999px;
    background: var(--ppce-warn-bg);
    box-shadow: inset 0 0 0 1px var(--ppce-warn-ring);
    color: var(--ppce-warn);
    font-size: 12px;
    font-weight: 600;
}

.ppce-bar__actions { display: flex; align-items: center; gap: 12px; }

/* ---- Buttons ------------------------------------------------------------- */

.ppce-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: 9999px;
    background: #fff;
    color: var(--ppce-stone-800);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.33;
    text-align: center;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

/* "+ Add more photos" is a label around a hidden file input. */
label.ppce-btn:focus-within { outline: 3px solid var(--ppce-focus); outline-offset: 2px; }

.ppce-btn--primary { background: var(--ppce-ink); border-color: var(--ppce-ink); color: #fff; }
.ppce-btn--primary:hover:not(:disabled) { background: var(--ppce-ink-hover); border-color: var(--ppce-ink-hover); }

.ppce-btn--outline,
.ppce-btn--ghost { border-color: var(--ppce-stone-300); color: var(--ppce-stone-800); }
.ppce-btn--outline:hover:not(:disabled),
.ppce-btn--ghost:hover:not(:disabled) { background: #fafaf9; }

/* the batch toolbar's small rounded chips */
.ppce-btn--chip {
    min-height: 36px;
    padding: 8px 12px;
    border-color: var(--ppce-stone-300);
    color: var(--ppce-stone-600);
    font-size: 11px;
}
.ppce-btn--chip:hover:not(:disabled) { background: #fafaf9; color: var(--ppce-stone-800); }
.ppce-btn--chip.is-on,
.ppce-btn--chip[aria-pressed="true"] { border-color: var(--ppce-ink); background: var(--ppce-ink); color: #fff; }

.ppce-btn--quiet { border-color: transparent; background: transparent; }
.ppce-btn--danger { border-color: var(--ppce-error-ring); color: var(--ppce-error); }
.ppce-btn--danger:hover:not(:disabled) { background: var(--ppce-error-bg); color: var(--ppce-error); }

.ppce-btn:disabled { opacity: .45; cursor: not-allowed; }

.ppce-page-border[aria-pressed="true"]::before { content: "\2713\00a0"; }

.ppce-linkbtn {
    min-height: 32px;
    margin-top: 8px;
    padding: 4px 8px;
    border: 0;
    background: none;
    color: var(--ppce-gold-deep);
    font-size: 12px;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

/* ---- Count tiles: All photos / Needs review / Ready to print ------------- */

.ppce-bar__room { display: none; font-size: 12px; color: var(--ppce-muted); }
@media (min-width: 640px) { .ppce-bar__room { display: inline; } }

.ppce-btn--add { font-size: 13px; }
.ppce-btn--add span { font-size: 16px; line-height: 1; }

.ppce-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 12px;
    padding: 6px;
    border: 1px solid var(--ppce-stone-200);
    border-radius: 20px;
    background: #fff;
}

.ppce-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    min-height: 76px;
    padding: 12px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--ppce-stone-900);
    text-align: left;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.ppce-tile:hover { background: var(--ppce-stone-100); }

.ppce-tile__label {
    font-size: 10px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ppce-muted);
}

.ppce-tile__n {
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.ppce-tile--warn .ppce-tile__n { color: var(--ppce-warn); }

.ppce-tile.is-on,
.ppce-tile.is-on:hover { background: var(--ppce-ink); color: #fff; box-shadow: var(--ppce-shadow-lg-ink); }
.ppce-tile.is-on .ppce-tile__label { color: var(--ppce-stone-300); }
.ppce-tile.is-on.ppce-tile--warn .ppce-tile__n { color: #fcd38d; }

/* ---- Select / sort card and the bulk card -------------------------------- */

.ppce-panel {
    margin-bottom: 12px;
    padding: 14px 16px;
    border: 1px solid var(--ppce-stone-200);
    border-radius: 20px;
    background: #fff;
}

.ppce-select {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
}

.ppce-select__hint { margin: 2px 0 0 28px; font-size: 12px; color: var(--ppce-muted); }

.ppce-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ppce-stone-800);
    cursor: pointer;
}
.ppce-switch input { width: 18px; height: 18px; margin: 0; accent-color: var(--ppce-ink); }

.ppce-sort {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ppce-muted);
}
.ppce-sort select {
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--ppce-stone-300);
    border-radius: 9999px;
    background: #fff;
    color: var(--ppce-stone-800);
    font-size: 13px;
}

.ppce-bulk {
    border-color: #e6e1d6;
    background: #f3f0e8;
    transition: border-color .15s ease, background-color .15s ease;
}
.ppce-bulk.is-active { border-color: var(--ppce-gold-line); background: var(--ppce-paper); }

.ppce-bulk__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.ppce-bulk__title { font-size: 14px; font-weight: 600; color: var(--ppce-stone-900); }
.ppce-bulk__count { margin-top: 2px; font-size: 12px; color: var(--ppce-stone-600); }

.ppce-bulk__limit {
    display: none;
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ppce-gold-text);
}
@media (min-width: 640px) { .ppce-bulk__limit { display: block; } }

/* Phone: Fill / Fit side by side, the border action on its own row. */
.ppce-bulk__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.ppce-bulk__actions .ppce-page-border { grid-column: 1 / -1; }

@media (min-width: 640px) {
    .ppce-bulk__actions { display: flex; flex-wrap: wrap; }
}

.ppce-bulk .ppce-btn--chip {
    min-height: 44px;
    padding: 10px 18px;
    border-color: var(--ppce-stone-200);
    background: #fff;
    color: var(--ppce-stone-800);
    font-size: 13px;
}

.ppce-bulk__selected {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(162, 129, 75, .25);
}

.ppce-empty {
    margin: 0 0 16px;
    padding: 40px 16px;
    border: 1px dashed var(--ppce-stone-300);
    border-radius: var(--ppce-radius-card);
    background: #fff;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--ppce-stone-800);
}

/* ---- Photo grid ---------------------------------------------------------- */

.ppce-gridhead {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin: 20px 0 12px;
}
.ppce-gridhead__title { margin: 0; font-family: var(--ppce-sans); font-size: 15px; font-weight: 600; color: var(--ppce-stone-900); }
.ppce-gridhead__sub { margin-top: 2px; font-size: 12px; color: var(--ppce-muted); }
.ppce-gridhead__n {
    flex: 0 0 auto;
    padding: 4px 12px;
    border: 1px solid var(--ppce-stone-200);
    border-radius: 9999px;
    background: #fff;
    font-size: 12px;
    color: var(--ppce-stone-600);
}

.ppce-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 12px;
}

@media (min-width: 640px) { .ppce-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 1280px) { .ppce-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.ppce-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 8px;
    border: 1px solid var(--ppce-stone-200);
    border-radius: 20px;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.ppce-card:hover { border-color: #a8a29e; }

/* Flagged for review: an amber outline and a one-line reason (below). The
   server flag and the pill share one rule, so the two always agree. */
.ppce-card--review { border-color: #e17100; box-shadow: 0 0 0 2px #fee685; }
.ppce-card--review:hover { border-color: #bb4d00; }

.ppce-card--picked,
.ppce-card--picked:hover { border-color: #9e7b43; box-shadow: 0 0 0 2px #d8c39b; }

.ppce-card__media { position: relative; }

/* The print's own shape: 4x6 portrait, or 6x4 when it prints landscape. */
.ppce-thumb {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 2 / 3;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: var(--ppce-stone-100);
    overflow: hidden;
    cursor: pointer;
}
.ppce-thumb--landscape { aspect-ratio: 3 / 2; }

.ppce-thumb img { display: block; width: 100%; height: 100%; }

/* The white inset is drawn by thumbStyle(); this outlines it so a white
   margin is visible against a pale photo. */
.ppce-thumb--border img { outline: 1px solid rgba(0, 0, 0, .12); outline-offset: -1px; }

/* Checkbox: a 44px tap area, a small white square on the photo. */
.ppce-card__pick {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    cursor: pointer;
}
.ppce-card__pick input {
    width: 20px;
    height: 20px;
    margin: 0;
    border-radius: 6px;
    accent-color: var(--ppce-ink);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .9), var(--ppce-shadow-sm);
    cursor: pointer;
}

.ppce-card__size {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 3px 8px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, .92);
    color: var(--ppce-stone-800);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

.ppce-card__tags {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    pointer-events: none;
}

.ppce-thumb__ratio {
    padding: 4px 8px;
    border-radius: 9999px;
    background: rgba(37, 40, 32, .85);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
}
.ppce-thumb__ratio--light { background: rgba(255, 255, 255, .92); color: var(--ppce-stone-800); }

.ppce-card__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 8px;
    padding: 10px 4px 2px;
}

.ppce-card__title { display: flex; align-items: center; gap: 4px; }

.ppce-card__name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    font-size: 13px;
    font-weight: 600;
    color: var(--ppce-stone-800);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ppce-card__remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    margin: -6px -4px -6px 0;
    border: 0;
    border-radius: 9999px;
    background: transparent;
    color: var(--ppce-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.ppce-card__remove:hover { background: var(--ppce-error-bg); color: var(--ppce-error); }

.ppce-card__status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.ppce-card__reason {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 6px 8px;
    border-radius: var(--ppce-radius-sm);
    background: var(--ppce-warn-bg);
    color: var(--ppce-warn);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.35;
}
.ppce-card__reason-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    margin-top: 1px;
    border-radius: 9999px;
    background: var(--ppce-warn);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}
.ppce-card__reason-lead { font-weight: 700; }

.ppce-card__dpi { font-size: 11px; color: var(--ppce-muted); font-variant-numeric: tabular-nums; }

/* status pill: Print-ready / Check crop / Low resolution */
.ppce-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 9999px;
    background: var(--ppce-stone-100);
    box-shadow: inset 0 0 0 1px var(--ppce-stone-200);
    color: var(--ppce-stone-600);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}
.ppce-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    border-radius: 9999px;
    background: currentColor;
}
.ppce-pill[data-status="ready"] { background: var(--ppce-ok-bg); box-shadow: inset 0 0 0 1px var(--ppce-ok-ring); color: var(--ppce-ok); }
.ppce-pill[data-status="check"] { background: var(--ppce-warn-bg); box-shadow: inset 0 0 0 1px var(--ppce-warn-ring); color: var(--ppce-warn); }
.ppce-pill[data-status="low"] { background: var(--ppce-error-bg); box-shadow: inset 0 0 0 1px var(--ppce-error-ring); color: var(--ppce-error); }

/* "Suggested framing": only shown for a real face suggestion */
.ppce-badge {
    align-self: flex-start;
    padding: 3px 8px;
    border-radius: 9999px;
    background: var(--ppce-cream);
    color: var(--ppce-gold-deep);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
}

/* Copies and border share a row; Crop & edit sits below. */
.ppce-card__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: auto;
}

.ppce-qty { display: flex; align-items: center; gap: 2px; }

.ppce-qty button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--ppce-stone-200);
    border-radius: 9999px;
    background: #fff;
    color: var(--ppce-stone-800);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}
.ppce-qty button:hover { background: var(--ppce-stone-100); }

.ppce-qty span {
    min-width: 22px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* White border, per photo: a compact switch. */
.ppce-border-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 4px 4px 4px 10px;
    border: 1px solid var(--ppce-stone-200);
    border-radius: 9999px;
    background: #fff;
    color: var(--ppce-stone-800);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}
.ppce-border-toggle::after {
    content: "Off";
    padding: 4px 8px;
    border-radius: 9999px;
    background: var(--ppce-stone-100);
    color: var(--ppce-stone-600);
    font-size: 10px;
}
.ppce-border-toggle:hover { border-color: var(--ppce-stone-300); }
.ppce-border-toggle[aria-pressed="true"] { border-color: var(--ppce-gold-line); background: var(--ppce-paper); }
.ppce-border-toggle[aria-pressed="true"]::after { content: "On"; background: var(--ppce-ink); color: #fff; }

.ppce-btn--edit {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border-color: var(--ppce-stone-300);
    font-size: 12px;
    white-space: nowrap;
}
.ppce-btn--edit:hover { background: #fafaf9; }

/* ---- Save bar ------------------------------------------------------------ */

/* Sticks to the bottom of the screen so the next step is always in reach.
   Below 992px the site's bottom nav (#ppBottomNav, 60px) covers the edge. */
.ppce-foot {
    position: sticky;
    bottom: 12px;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 12px;
    margin-top: 20px;
    padding: 12px 12px 12px 18px;
    border: 1px solid var(--ppce-stone-200);
    border-radius: 20px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 10px 30px -8px rgba(28, 25, 23, .25);
}

@supports ((-webkit-backdrop-filter: blur(8px)) or (backdrop-filter: blur(8px))) {
    .ppce-foot { background: rgba(255, 255, 255, .88); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
}

@media (max-width: 991.98px) {
    .ppce-foot { bottom: calc(60px + 8px + env(safe-area-inset-bottom, 0px)); }
}

.ppce-foot__meta { min-width: 0; }
.ppce-foot__title { font-size: 12px; font-weight: 600; color: var(--ppce-stone-800); }
/* stone-600, not the muted shade: #736c68 is under 4.5:1 on this bar */
.ppce-foot__sub { margin-top: 2px; font-size: 12px; color: var(--ppce-stone-600); }
.ppce-foot__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ppce-foot .ppce-btn--primary { min-height: 48px; padding: 12px 22px; font-size: 14px; }

/* Copies vs pack reminder above the save bar. */
.ppce-foot__note {
    margin-top: 16px;
    padding: 10px 12px;
    border-radius: var(--ppce-radius-sm);
    background: #f1eee5;
    color: var(--ppce-stone-800);
    font-size: 13px;
    line-height: 1.45;
}


/* ---- Order summary ------------------------------------------------------- */

.ppce-order {
    padding: 16px;
    border-radius: var(--ppce-radius-card);
    background: var(--ppce-ink);
    color: #fff;
}

.ppce-order__item { display: flex; align-items: center; gap: 12px; margin-top: 12px; }

.ppce-order__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 64px;
    flex: 0 0 48px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: var(--ppce-radius-sm);
    background: rgba(255, 255, 255, .1);
    color: #e0c58f;
    font-size: 24px;
}

.ppce-order__name { font-size: 14px; font-weight: 600; }
.ppce-order__meta { margin-top: 4px; font-size: 12px; color: #e0c58f; }

.ppce-order__count {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, .15);
    font-size: 12px;
    color: var(--ppce-stone-300);
}
.ppce-order__count strong { color: #fff; }

.ppce-order__bar {
    height: 6px;
    margin-top: 8px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, .15);
    overflow: hidden;
}
.ppce-order__bar span { display: block; height: 100%; border-radius: 9999px; background: var(--ppce-gold-light); }

.ppce-specs { margin-top: 20px; font-size: 12px; color: var(--ppce-stone-600); }
.ppce-specs div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.ppce-specs dd { font-weight: 600; color: var(--ppce-stone-900); }

.ppce-legend,
.ppce-tip {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid var(--ppce-stone-200);
    border-radius: var(--ppce-radius-card);
    background: var(--ppce-shell);
}

.ppce-legend ul { display: grid; gap: 8px; margin-top: 10px; }
.ppce-legend li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--ppce-stone-600); }
.ppce-legend__note,
.ppce-tip p + p { margin-top: 8px; font-size: 12px; line-height: 20px; color: var(--ppce-stone-600); }

@media (max-width: 575.98px) {
    /* Phone touch targets: 44px or more. */
    .ppce-btn--chip,
    .ppce-sort select,
    .ppce-switch { min-height: 44px; }
    .ppce-title { font-size: 32px; }
    .ppce-bar { margin-bottom: 16px; }
    .ppce-bar__actions { width: 100%; }
    .ppce-btn--add { width: 100%; }
    .ppce-tile { min-height: 68px; padding: 10px; }
    .ppce-tile__label { font-size: 9px; letter-spacing: .06em; }
    .ppce-tile__n { font-size: 22px; }
    .ppce-select { padding: 10px 14px; }
    .ppce-sort { width: 100%; justify-content: space-between; }
    .ppce-sort select { flex: 1 1 auto; max-width: 220px; }
    .ppce-card { padding: 6px; border-radius: 18px; }
    .ppce-card__body { padding: 8px 2px 2px; gap: 6px; }
    .ppce-card__remove { width: 44px; height: 44px; flex-basis: 44px; margin: -10px -8px -10px 0; }
    /* Two columns of ~160px: copies on one row, border below, then edit. */
    .ppce-card__row { justify-content: center; }
    .ppce-card .ppce-qty { width: 100%; justify-content: space-between; }
    .ppce-qty button { width: 44px; height: 44px; }
    /* Border is in Crop & edit and "Edit multiple photos"; the card stays short. */
    .ppce-card .ppce-border-toggle { display: none; }
    .ppce-steps { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .ppce-steps::-webkit-scrollbar { display: none; }
    .ppce-step { flex: 0 0 auto; padding: 6px 10px 6px 6px; font-size: 11px; }
    .ppce-btn--edit { min-height: 44px; }
    .ppce-foot { padding: 10px 10px 10px 14px; }
    .ppce-foot__meta { flex: 1 1 auto; }
    .ppce-foot__actions { flex: 0 0 auto; }
    .ppce-foot .ppce-btn--primary { padding: 12px 16px; font-size: 13px; }
    .ppce-foot .ppce-btn--outline { order: 2; }
}

@media (prefers-reduced-motion: reduce) {
    .ppce-spinner,
    .ppce-progress.is-working > span::after { animation: none; }
    .ppce *,
    .ppce *::before,
    .ppce *::after { transition: none !important; }
}
