/* WeddingPrint: teal + coral, mobile first (360-430px), big touch targets.
   No external fonts, CDNs or frameworks. */

/* ---------- tokens ---------- */

:root {
    --teal-50: #EEF9F7;
    --teal-100: #D5F1EC;
    --teal-200: #A8E3DA;
    --teal-500: #14B8A6;
    --teal-600: #0F766E;
    --teal-700: #115E59;
    --teal-800: #0B3B38;
    --coral-50: #FFF1EF;
    --coral-100: #FDE3DF;
    --coral-500: #FF6F61;
    --coral-600: #E85D4F;
    --coral-700: #CF4436;   /* white text 4.6:1 */
    --coral-800: #B4362A;

    --bg: #FAF7F2;
    --surface: #FFFFFF;
    --surface-2: #F3EEE7;
    --text: #1F2328;
    --muted: #5E5954;       /* 5.4:1 on --bg */
    --line: #E7DFD5;
    --primary: var(--teal-600);
    --primary-soft: var(--teal-50);
    --accent: var(--coral-500);
    --accent-text: var(--coral-700);
    --cta-bg: var(--coral-700);
    --cta-bg-press: var(--coral-800);
    --cta-text: #FFFFFF;
    --danger: #B4362A;
    --focus: #0F766E;
    --hero-from: #0F766E;
    --hero-to: #CF4436;
    --hero-glow: rgba(207, 68, 54, 0.75);
    --hero-text: #FFFFFF;
    --stage: #12191A;
    --bar-bg: rgba(255, 255, 255, 0.9);

    --chip-pending-bg: #FFF2D6;  --chip-pending-fg: #7A4E00;
    --chip-printing-bg: #D5F1EC; --chip-printing-fg: #0B5550;
    --chip-done-bg: #DDF3E3;     --chip-done-fg: #1E6234;
    --chip-failed-bg: #FDE3DF;   --chip-failed-fg: #A3332A;
    --chip-muted-bg: #EDE8E1;    --chip-muted-fg: #5E5954;

    --radius: 18px;
    --radius-sm: 12px;
    --tap: 48px;
    --shadow-sm: 0 1px 2px rgba(31, 35, 40, 0.06);
    --shadow: 0 1px 2px rgba(31, 35, 40, 0.05), 0 8px 24px rgba(15, 59, 56, 0.08);
    --shadow-lift: 0 2px 4px rgba(31, 35, 40, 0.06), 0 16px 40px rgba(15, 59, 56, 0.14);
    --cta-glow: 0 6px 16px rgba(232, 93, 79, 0.32);
    --ease: cubic-bezier(0.2, 0.7, 0.3, 1);

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);

    color-scheme: light dark;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #101617;
        --surface: #182122;
        --surface-2: #1F2A2B;
        --text: #ECEFEE;
        --muted: #A9B4B2;
        --line: #2A3637;
        --primary: #2DD4BF;
        --primary-soft: #12302D;
        --accent: #FF8A7E;
        --accent-text: #FF8A7E;
        --cta-bg: #FF6F61;      /* dark text 6.5:1 */
        --cta-bg-press: #FF8A7E;
        --cta-text: #1A0E0C;
        --danger: #FF8A7E;
        --focus: #5EEAD4;
        --hero-from: #0B4A45;
        --hero-to: #8E3128;
        --hero-glow: rgba(142, 49, 40, 0.7);
        --stage: #12191A;
        --bar-bg: rgba(24, 33, 34, 0.9);

        --chip-pending-bg: #3A2D10;  --chip-pending-fg: #FFD58A;
        --chip-printing-bg: #10332F; --chip-printing-fg: #7CE7D7;
        --chip-done-bg: #15301E;     --chip-done-fg: #8EDCA6;
        --chip-failed-bg: #3B1C18;   --chip-failed-fg: #FFAAA0;
        --chip-muted-bg: #263031;    --chip-muted-fg: #A9B4B2;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px rgba(0, 0, 0, 0.35);
        --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.4), 0 18px 44px rgba(0, 0, 0, 0.5);
        --cta-glow: 0 6px 16px rgba(255, 111, 97, 0.2);
    }
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--bg); }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
}

img, svg { max-width: 100%; }

a { color: var(--primary); }

.page {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    flex: 1 0 auto;
    padding: 0 calc(16px + var(--safe-right)) 24px calc(16px + var(--safe-left));
}

h1 {
    font-size: 1.65rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin: 0 0 10px;
    color: var(--text);
}

.lead { font-size: 1.08rem; line-height: 1.5; margin: 0 0 20px; }
.hint { color: var(--muted); font-size: 0.95rem; margin: 0; }
label .hint { font-weight: 500; }
.center { text-align: center; }
.stack + .hint { margin-top: 14px; }

.error {
    margin: 0;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--chip-failed-bg);
    color: var(--chip-failed-fg);
    font-weight: 600;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- guest hero band ---------- */

.hero {
    position: relative;
    overflow: hidden;
    color: var(--hero-text);
    /* teal band warming into a coral glow at the far corner (a straight teal-coral blend turns grey) */
    background:
        radial-gradient(circle at 105% 110%, var(--hero-to) 0, var(--hero-glow) 30%, transparent 65%),
        radial-gradient(120% 140% at 0% 0%, rgba(255, 255, 255, 0.1) 0, transparent 45%),
        linear-gradient(160deg, var(--hero-from), var(--teal-700));
    padding: calc(18px + var(--safe-top)) calc(16px + var(--safe-right)) 64px calc(16px + var(--safe-left));
}

.hero::after {      /* soft decorative ring */
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    right: -70px;
    bottom: -120px;
    border-radius: 50%;
    border: 28px solid rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.hero-inner { max-width: 528px; margin: 0 auto; position: relative; }

.hero-kicker {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hero-icon { width: 20px; height: 20px; color: #FFD9D4; flex: none; }

/* ---------- 3-step progress ---------- */

.steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.steps li {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.88);
}

.steps li + li::before {     /* connector to the previous step */
    content: "";
    position: absolute;
    top: 15px;
    right: calc(50% + 22px);
    width: calc(100% - 44px);
    height: 3px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.3);
}

.steps li.done + li::before { background: #FFFFFF; }

.step-dot {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 700;
    border: 2px solid rgba(255, 255, 255, 0.65);
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
    transition: transform 0.3s var(--ease);
}

.steps li.done .step-dot {
    background: #FFFFFF;
    border-color: #FFFFFF;
    color: transparent;
}

.steps li.done .step-dot::after {   /* tick */
    content: "";
    position: absolute;
    width: 11px;
    height: 6px;
    border-left: 3px solid var(--teal-600);
    border-bottom: 3px solid var(--teal-600);
    transform: translateY(-2px) rotate(-45deg);
}

.steps li.current { color: #FFFFFF; }
.steps li.current .step-dot {
    background: #FFFFFF;
    border-color: #FFFFFF;
    color: var(--coral-700);
    transform: scale(1.12);
    box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.22);
}

/* ---------- cards ---------- */

.card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 18px;
    margin-bottom: 16px;
}

/* the first card on a guest page overlaps the hero band */
body:not(.admin) .page > .card:first-child,
body:not(.admin) .page > .frame-head:first-child { margin-top: -44px; }

.card.narrow { max-width: 420px; margin-left: auto; margin-right: auto; }

.card-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin: 0 0 14px;
    border-radius: 16px;
    background: var(--primary-soft);
    color: var(--primary);
}
.card-icon svg { width: 28px; height: 28px; }
.card-icon.coral { background: var(--chip-failed-bg); color: var(--accent-text); }
.center .card-icon { margin-left: auto; margin-right: auto; }

/* ---------- forms ---------- */

.stack { display: flex; flex-direction: column; gap: 12px; }

label { font-weight: 600; }

input[type="text"],
input[type="password"] {
    width: 100%;
    min-height: 52px;
    padding: 12px 16px;
    font: inherit;
    font-size: 1.1rem;   /* 16px+ keeps iOS from zooming into the field */
    color: var(--text);
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]::placeholder { color: var(--muted); opacity: 0.85; }

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.25);
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* ---------- buttons ---------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 52px;
    padding: 12px 24px;
    font: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    color: var(--primary);
    background: transparent;
    border: 2px solid var(--primary);
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.12s var(--ease), background-color 0.15s, box-shadow 0.15s, color 0.15s, border-color 0.15s;
}

.button:active:not(:disabled) { transform: scale(0.97); }
.button:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.button:not(.primary):not(.danger):not(.ghost):active { background: var(--primary-soft); }

.button.primary {
    color: var(--cta-text);
    background: var(--cta-bg);
    border-color: var(--cta-bg);
    box-shadow: var(--cta-glow);
}
.button.primary:active:not(:disabled) { background: var(--cta-bg-press); border-color: var(--cta-bg-press); }

.button.ghost { border-color: transparent; color: var(--muted); }

.button:disabled { opacity: 0.65; cursor: default; box-shadow: none; }

@media (hover: hover) {
    .button.primary:hover:not(:disabled) { background: var(--cta-bg-press); border-color: var(--cta-bg-press); }
    .button:not(.primary):not(.danger):hover:not(:disabled) { background: var(--primary-soft); }
}

/* ---------- upload drop zone ---------- */

.dropzone {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 220px;
    padding: 24px 16px;
    margin-bottom: 6px;
    text-align: center;
    border: 2.5px dashed var(--teal-500);
    border-radius: var(--radius);
    background:
        radial-gradient(circle at 50% 28%, rgba(255, 111, 97, 0.12), transparent 60%),
        var(--primary-soft);
    color: var(--primary);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.12s var(--ease), border-color 0.15s;
}

.dropzone:active, .dropzone.dragging { transform: scale(0.985); border-color: var(--accent); }
.stack:has(#photo:focus-visible) .dropzone { outline: 3px solid var(--focus); outline-offset: 3px; }

.dropzone-icon {
    position: relative;
    width: 64px;
    height: 64px;
    padding: 12px;
    margin-bottom: 6px;
    box-sizing: content-box;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--accent-text);
}

.dropzone-title { position: relative; font-size: 1.2rem; font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.dropzone-sub { position: relative; font-size: 0.92rem; font-weight: 500; color: var(--muted); max-width: 260px; }

.dropzone-preview {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.dropzone.has-file { justify-content: flex-end; border-style: solid; border-color: var(--primary); }
.dropzone.has-file .dropzone-preview { opacity: 1; }
.dropzone.has-file .dropzone-preview::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(8, 18, 18, 0.85), rgba(8, 18, 18, 0.15) 75%);
}
.dropzone.has-file .dropzone-icon { width: 36px; height: 36px; padding: 8px; }
.dropzone.has-file .dropzone-title,
.dropzone.has-file .dropzone-sub { color: #FFFFFF; }

/* ---------- framing ---------- */

/* framing needs every pixel for the photo: slimmer chrome */
body.framing .hero { padding-top: calc(12px + var(--safe-top)); padding-bottom: 50px; }
body.framing .hero-kicker { display: none; }

.frame-head {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px;
    margin-bottom: 12px;
}
.frame-head { padding: 12px 16px; }
.frame-head h1 { font-size: 1.25rem; margin-bottom: 2px; }
.frame-head .hint { font-size: 0.88rem; line-height: 1.35; }

.frame-stage {
    position: relative;
    width: 100%;
    margin: 0 0 8px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--stage);
    box-shadow: var(--shadow-lift);
}

#frame-canvas {
    display: block;
    touch-action: none; /* we handle pan and pinch ourselves */
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
}

#frame-canvas:active { cursor: grabbing; }

.frame-loading {
    position: absolute;
    inset: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: center;
    padding: 16px;
    color: #FFFFFF;
    text-align: center;
}

.frame-loading[hidden] { display: none; }

/* "Drag to move" hint: centred on the photo, never takes touches, fades on the first pan/zoom */
.drag-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px 10px 12px;
    color: #FFFFFF;
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    background: rgba(11, 59, 56, 0.72);  /* --teal-800 */
    border: 1.5px solid rgba(255, 111, 97, 0.85); /* --coral-500 */
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    transform: translate(-50%, -50%);
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    opacity: 1;
    transition: opacity 0.2s var(--ease);
}
.drag-hint svg { width: 22px; height: 22px; flex: none; color: var(--coral-500); }
.drag-hint.is-fading { opacity: 0; }
.drag-hint[hidden] { display: none; }

/* sticky control bar, kept clear of the home indicator */
.frame-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin: 0 calc(-16px - var(--safe-right)) 0 calc(-16px - var(--safe-left));
    padding: 8px calc(16px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(16px + var(--safe-left));
    background: var(--bar-bg);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--line);
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -8px 24px rgba(15, 59, 56, 0.12);
}

/* framing: the bar always sits at the bottom of the screen, even when the page is short */
body.framing .page { display: flex; flex-direction: column; padding-bottom: 0; }
body.framing .frame-bar { margin-top: auto; }
body.framing .site-footer { display: none; }

.frame-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    color: var(--muted);
}

.zoom-icon { width: 24px; height: 24px; flex: none; }

.frame-controls input[type="range"],
.tune-row input[type="range"] {
    flex: 1;
    min-width: 0;
    height: var(--tap);
    margin: 0;
    background: transparent;
    accent-color: var(--coral-600);
    -webkit-appearance: none;
    appearance: none;
}

.frame-controls input[type="range"]::-webkit-slider-runnable-track,
.tune-row input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--teal-500), var(--coral-500));
}
.frame-controls input[type="range"]::-webkit-slider-thumb,
.tune-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    margin-top: -11px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 3px solid var(--coral-600);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: transform 0.12s var(--ease);
}
.frame-controls input[type="range"]:active::-webkit-slider-thumb,
.tune-row input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }
.frame-controls input[type="range"]::-moz-range-track,
.tune-row input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--teal-500), var(--coral-500));
}
.frame-controls input[type="range"]::-moz-range-thumb,
.tune-row input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 3px solid var(--coral-600);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.frame-controls input[type="range"]:focus-visible,
.tune-row input[type="range"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }

.button.rotate {
    flex: none;
    min-height: var(--tap);
    padding: 6px 14px 6px 12px;
    gap: 6px;
}
.button.rotate svg { width: 20px; height: 20px; flex: none; }

.frame-actions { display: grid; gap: 8px; }
.frame-actions .button { min-height: var(--tap); }

/* submit row: the "Adjust" pill sits left of the call to action */
.frame-submit-row { display: flex; gap: 8px; }
.frame-submit-row .button.primary { flex: 1; min-width: 0; padding-left: 14px; padding-right: 14px; }

.button.tune-toggle {
    position: relative;
    flex: none;
    width: auto;
    min-height: var(--tap);
    padding: 6px 16px 6px 12px;
    gap: 6px;
    font-size: 1rem;
}
.button.tune-toggle svg { width: 22px; height: 22px; flex: none; }
.button.tune-toggle.is-open { background: var(--primary-soft); }
/* a coral dot says "this photo has adjustments" while the drawer is closed */
.button.tune-toggle.is-tuned::after {
    content: "";
    position: absolute;
    top: 6px;
    right: 8px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--surface);
}

/* ---------- adjust-photo drawer ---------- */

/* opens upwards out of the sticky bar and overlays the lower part of the photo */
.tune-drawer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% - 1px);
    max-height: calc(100vh - 230px);
    max-height: calc(100dvh - 230px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px calc(16px + var(--safe-right)) 10px calc(16px + var(--safe-left));
    background: var(--surface);
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -10px 28px rgba(15, 59, 56, 0.18);
    animation: drawer-up 0.18s var(--ease);
}
.tune-drawer[hidden] { display: none; }

.tune-head { display: flex; align-items: center; gap: 4px; }
.tune-head h2 { flex: 1; margin: 0; font-size: 1.05rem; }
.button.tune-reset { min-height: 44px; color: var(--primary); }

.tune-close {
    display: grid;
    place-items: center;
    flex: none;
    width: 44px;
    height: 44px;
    margin-right: -8px;
    padding: 0;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.tune-close svg { width: 22px; height: 22px; }
.tune-close:active { background: var(--primary-soft); }

.tune-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.tune-switch > span:first-child { flex: 1; }
.tune-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.switch-track {
    position: relative;
    flex: none;
    width: 52px;
    height: 32px;
    border-radius: 999px;
    background: var(--line);
    transition: background-color 0.15s;
}
.switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    transition: transform 0.18s var(--ease);
}
.tune-switch input:checked + .switch-track { background: var(--coral-600); }
.tune-switch input:checked + .switch-track .switch-thumb { transform: translateX(20px); }
.tune-switch input:focus-visible + .switch-track { outline: 3px solid var(--focus); outline-offset: 2px; }

.tune-row {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) 48px;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}
.tune-row label { font-size: 0.95rem; }
.tune-row output { text-align: right; font-size: 0.88rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.tune-row input[type="range"] { width: 100%; }
.tune-row input[type="range"]:disabled { opacity: 0.4; }

.tune-note { margin: 4px 0 0; font-size: 0.78rem; color: var(--muted); }

@keyframes drawer-up { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- done ---------- */

.status-card { padding-top: 26px; }

.status-visual {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    border-radius: 50%;
}
.status-visual svg { width: 34px; height: 34px; }
.tone-ok .status-visual { background: var(--chip-done-bg); color: var(--chip-done-fg); animation: pop 0.45s var(--ease) both; }
.tone-wait .status-visual { background: var(--primary-soft); }
.tone-bad .status-visual { background: var(--chip-failed-bg); color: var(--chip-failed-fg); }
.status-card .lead { margin-bottom: 14px; }

.spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: var(--coral-500);
    animation: spin 0.9s linear infinite;
}
.spinner.large {
    width: 36px;
    height: 36px;
    border-width: 4px;
    border-color: rgba(20, 184, 166, 0.3);
    border-top-color: var(--accent);
}

.progress-track {
    position: relative;
    height: 6px;
    margin: 0 auto 12px;
    max-width: 240px;
    overflow: hidden;
    border-radius: 6px;
    background: var(--surface-2);
}
.progress-track span {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 40%;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--teal-500), var(--coral-500));
    animation: slide 1.6s var(--ease) infinite;
}

.preview-frame {
    margin: 4px auto 22px;
    max-width: 320px;
    padding: 10px 10px 28px;
    background: #FFFFFF;
    border-radius: 6px;
    box-shadow: var(--shadow-lift);
    transform: rotate(-1.5deg);
}

/* Landscape: the print file is the photo turned 90 degrees clockwise; turn it back for viewing.
   The inner box is 3:2; the image is as wide as that box is tall, centred, then rotated. */
.preview-frame.landscape { max-width: 420px; }
.preview-frame.landscape .preview-box { position: relative; width: 100%; aspect-ratio: 3 / 2; overflow: hidden; }
.preview-frame.landscape .preview {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 66.6667%;
    transform: translate(-50%, -50%) rotate(-90deg);
}

.notice {
    margin: 0 0 14px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--chip-pending-bg, rgba(255, 196, 0, 0.15));
    color: inherit;
    font-weight: 600;
}

.preview {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 2px;
    background: linear-gradient(100deg, #ECE6DE 30%, #F8F4EF 50%, #ECE6DE 70%) 0 0 / 300% 100%;
    animation: shimmer 1.4s linear infinite;
}

/* ---------- footer ---------- */

.site-footer {
    flex: none;
    padding: 8px 16px calc(20px + var(--safe-bottom));
    text-align: center;
    font-size: 0.92rem;
    color: var(--muted);
}
.site-footer span { color: var(--accent-text); }

/* ---------- admin ---------- */

body.admin .page { max-width: 1100px; padding-top: 16px; }

.admin-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(10px + var(--safe-top)) calc(16px + var(--safe-right)) 10px calc(16px + var(--safe-left));
    color: #FFFFFF;
    background:
        radial-gradient(60% 260% at 100% 50%, var(--hero-glow) 0, transparent 70%),
        linear-gradient(90deg, var(--hero-from), var(--teal-700));
    box-shadow: var(--shadow-sm);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.brand-icon { width: 22px; height: 22px; }
.admin-tag {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.18);
}

body.admin-login .page { padding-top: 32px; }

.admin-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin-bottom: 12px;
}
.admin-head h1 { margin: 0; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    min-height: 28px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
    background: var(--chip-muted-bg);
    color: var(--chip-muted-fg);
}
.chip b { font-variant-numeric: tabular-nums; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

.chip-pending  { background: var(--chip-pending-bg);  color: var(--chip-pending-fg); }
.chip-printing { background: var(--chip-printing-bg); color: var(--chip-printing-fg); }
.chip-done     { background: var(--chip-done-bg);     color: var(--chip-done-fg); }
.chip-failed   { background: var(--chip-failed-bg);   color: var(--chip-failed-fg); }
.chip-draft, .chip-removed { background: var(--chip-muted-bg); color: var(--chip-muted-fg); }
.chip-printing .dot { animation: pulse 1.2s ease-in-out infinite; }

.agent {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}
.agent-detail { font-size: 0.88rem; color: var(--muted); }
.agent.online .agent-chip { background: var(--teal-600); color: #FFFFFF; }
.agent.online .agent-chip .dot { background: #7CF5E3; animation: pulse 2s ease-in-out infinite; }
.agent.offline .agent-chip { background: var(--cta-bg); color: var(--cta-text); }
@media (prefers-color-scheme: dark) {
    .agent.online .agent-chip { background: #2DD4BF; color: #08201E; }
    .agent.online .agent-chip .dot { background: #08201E; }
}

.summary {
    list-style: none;
    display: flex;
    gap: 8px;
    margin: 0 calc(-16px - var(--safe-right)) 14px calc(-16px - var(--safe-left));
    padding: 2px calc(16px + var(--safe-right)) 4px calc(16px + var(--safe-left));
    overflow-x: auto;
    scrollbar-width: none;
}
.summary::-webkit-scrollbar { display: none; }

.thumb {
    display: block;
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 14px;
    background: var(--surface-2);
    box-shadow: var(--shadow-sm);
}

.error-text { color: var(--danger); font-size: 0.88rem; overflow-wrap: anywhere; }

.actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }

.button.small {
    width: auto;
    min-height: 40px;
    padding: 6px 14px;
    font-size: 0.9rem;
    border-width: 1.5px;
}

.button.danger { color: var(--danger); border-color: var(--danger); }
.button.danger:active { background: var(--chip-failed-bg); }

.status-removed { opacity: 0.55; }

.card.empty { padding: 28px 18px; }

/* phones: each job is a compact card */
@media (max-width: 767.98px) {
    .table-scroll { overflow: visible; }
    table.jobs, .jobs tbody { display: block; }
    .jobs thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

    .jobs tr {
        display: grid;
        grid-template-columns: 72px minmax(0, 1fr) auto;
        grid-template-areas:
            "thumb name    status"
            "thumb created tries"
            "error error   error"
            "actions actions actions";
        gap: 4px 12px;
        align-items: center;
        padding: 12px;
        margin-bottom: 10px;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
    }
    .jobs td { display: block; padding: 0; min-width: 0; }
    .cell-thumb { grid-area: thumb; align-self: start; }
    .cell-name { grid-area: name; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; align-self: end; }
    .cell-created { grid-area: created; color: var(--muted); font-size: 0.88rem; align-self: start; }
    .cell-status { grid-area: status; justify-self: end; align-self: end; }
    .cell-tries { grid-area: tries; justify-self: end; color: var(--muted); font-size: 0.85rem; align-self: start; }
    .cell-tries::before { content: "Tries "; }
    .cell-error { grid-area: error; padding: 6px 10px; margin-top: 4px; border-radius: 10px; background: var(--chip-failed-bg); color: var(--chip-failed-fg); }
    .cell-error:empty { display: none; }
    .cell-actions { grid-area: actions; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
}

/* laptops: a real table */
@media (min-width: 768px) {
    h1 { font-size: 1.9rem; }

    .summary { margin: 0 0 16px; padding: 0; overflow: visible; flex-wrap: wrap; }

    .table-scroll {
        overflow-x: auto;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
    }

    table.jobs { width: 100%; border-collapse: collapse; font-size: 0.95rem; }

    .jobs th, .jobs td {
        padding: 10px 14px;
        border-bottom: 1px solid var(--line);
        text-align: left;
        vertical-align: middle;
    }
    .jobs tbody tr:last-child td { border-bottom: 0; }
    .jobs tbody tr { transition: background-color 0.15s; }
    .jobs tbody tr:hover { background: var(--primary-soft); }

    .jobs th {
        white-space: nowrap;
        font-size: 0.78rem;
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--muted);
        background: var(--surface-2);
    }

    .thumb { width: 60px; height: 60px; border-radius: 12px; }
    .cell-name { font-weight: 600; }
    .cell-created, .cell-tries { color: var(--muted); white-space: nowrap; }
    .error-text { max-width: 240px; }
    .actions { min-width: 210px; }
    .button.small { min-height: 36px; }
}

/* ---------- motion ---------- */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }
@keyframes slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
    .spinner { animation: spin 1.6s linear infinite !important; animation-iteration-count: infinite !important; animation-duration: 1.6s !important; }
}

/* done page: keep the next action above the fold */
.card-action { margin-top: 18px; }
