/* ============================================================
   Watch Size Check — App Design System
   "Precision Craft" aesthetic: warm cream, deep navy, amber
   ============================================================ */

/* Typography */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400&display=swap');

/* ============================================================
   Design Tokens
   ============================================================ */

:root {
    /* Backgrounds */
    --bg-primary:    #F9F8F6;
    --bg-secondary:  #FFFFFF;
    --bg-tertiary:   #F3F1ED;
    --bg-input:      #FFFFFF;
    --bg-hover:      #EDEAE4;

    /* Text */
    --text-primary:   #1A1A1A;
    --text-secondary: #6B6860;
    --text-muted:     #9B9890;

    /* Borders & Shadows */
    --border-color:  #E4E0D8;
    --shadow-sm:     0 1px 3px rgba(28, 24, 20, 0.06), 0 1px 2px rgba(28, 24, 20, 0.04);
    --shadow-md:     0 4px 12px rgba(28, 24, 20, 0.08), 0 2px 4px rgba(28, 24, 20, 0.05);
    --shadow-lg:     0 12px 32px rgba(28, 24, 20, 0.12), 0 4px 8px rgba(28, 24, 20, 0.06);

    /* Brand colors */
    --accent:        #1C2B4A;   /* Deep navy — primary brand */
    --accent-hover:  #243660;
    --accent-warm:   #B8860B;   /* Warm amber — CTA */
    --accent-warm-hover: #9A7009;
    --accent-warm-light: rgba(200, 145, 42, 0.10);

    /* Semantic */
    --success:       #10B981;
    --success-light: rgba(16, 185, 129, 0.10);
    --error:         #DC2626;
    --error-light:   rgba(220, 38, 38, 0.08);
    --warning:       #D97706;

    /* Component tokens */
    --radius-sm:     6px;
    --radius-md:     10px;
    --radius-lg:     14px;
    --radius-xl:     20px;

    /* Typography */
    --font-body:     'Outfit', system-ui, -apple-system, sans-serif;
    --font-display:  'Cormorant Garamond', Georgia, serif;
}

html.dark-mode, body.dark-mode {
    --bg-primary:    #13161E;
    --bg-secondary:  #1C2130;
    --bg-tertiary:   #232840;
    --bg-input:      #232840;
    --bg-hover:      #2A3050;

    --text-primary:   #EAE8E2;
    --text-secondary: #9895A0;
    --text-muted:     #6B6878;

    --border-color:  #2E3450;
    --shadow-sm:     0 1px 3px rgba(0,0,0,0.25);
    --shadow-md:     0 4px 12px rgba(0,0,0,0.35);
    --shadow-lg:     0 12px 32px rgba(0,0,0,0.45);

    --accent:        #4A6FA5;
    --accent-hover:  #5A82BF;
    --accent-warm:   #C8960E;
    --accent-warm-hover: #D4A020;
    --accent-warm-light: rgba(212, 160, 69, 0.12);

    --success-light: rgba(16, 185, 129, 0.14);
    --error-light:   rgba(220, 38, 38, 0.12);
}

/* ============================================================
   Base
   ============================================================ */

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

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.55;
}

/* ============================================================
   Typography
   ============================================================ */

.display-heading {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* ============================================================
   Layout
   ============================================================ */

.page-container {
    max-width: 660px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

.page-container-wide {
    max-width: 840px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

/* View header inside wizard steps */
.view-header {
    margin-bottom: 24px;
}

.view-header h1 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin: 0 0 6px;
    line-height: 1.2;
}

.view-header p {
    color: var(--text-secondary);
    font-size: 0.975rem;
    margin: 0;
    line-height: 1.5;
}

/* ============================================================
   Cards
   ============================================================ */

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.card h2 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text-primary);
    margin: 0 0 14px;
}

.card-accent {
    border-left: 3px solid var(--accent-warm);
}

.card-highlight {
    border: 2px solid var(--accent);
    position: relative;
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible {
    outline: 2px solid var(--accent-warm);
    outline-offset: 2px;
}

.btn:active {
    transform: translateY(1px);
}

/* Primary — navy */
.btn-primary {
    background: var(--accent);
    color: #FFFFFF;
    border-color: var(--accent);
    box-shadow: 0 1px 3px rgba(28, 43, 74, 0.25);
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: 0 2px 6px rgba(28, 43, 74, 0.3);
}
.btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* CTA — amber (for key wizard-advance actions) */
.btn-cta,
.btn-blue {
    background: var(--accent-warm);
    color: #FFFFFF;
    border-color: var(--accent-warm);
    box-shadow: 0 1px 3px rgba(200, 145, 42, 0.3);
}
.btn-cta:hover,
.btn-blue:hover {
    background: var(--accent-warm-hover);
    border-color: var(--accent-warm-hover);
    box-shadow: 0 2px 6px rgba(200, 145, 42, 0.35);
}

/* Secondary — ghost */
.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
}
.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: #C8C3BA;
}

/* Danger */
.btn-danger {
    background: transparent;
    color: var(--error);
    border-color: var(--error);
}
.btn-danger:hover {
    background: var(--error-light);
}

/* ============================================================
   Step navigation
   ============================================================ */

.step-nav {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* ============================================================
   Wizard Progress Bar
   ============================================================ */

.wizard-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 16px 24px 0;
    max-width: 660px;
    margin: 0 auto;
}

.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    border: 1.5px solid var(--border-color);
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    cursor: default;
    position: relative;
}

.step-dot::after {
    content: attr(title);
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    padding: 3px 7px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    box-shadow: var(--shadow-sm);
}

.step-dot:hover::after {
    opacity: 1;
}

.step-dot.complete {
    background: var(--accent-warm);
    border-color: var(--accent-warm);
}

.step-dot.active {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.4);
    box-shadow: 0 0 0 3px rgba(28, 43, 74, 0.15);
}

.step-connector {
    height: 1.5px;
    flex: 1;
    background: var(--border-color);
    max-width: 32px;
    min-width: 8px;
    transition: background 0.2s;
}

/* ============================================================
   Upload Zone
   ============================================================ */

.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 44px 24px;
    text-align: center;
    cursor: pointer;
    background: var(--bg-tertiary);
    transition: border-color 0.2s, background 0.2s;
    position: relative;
}

.upload-zone:hover {
    border-color: var(--accent);
    background: rgba(28, 43, 74, 0.03);
}

.upload-zone.dragover {
    border-color: var(--accent-warm);
    background: var(--accent-warm-light);
}

.upload-zone input[type="file"] {
    display: none;
}

.upload-zone-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 14px;
    color: var(--text-muted);
}

.upload-zone-title {
    font-size: 0.975rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.upload-zone-subtitle {
    font-size: 0.84rem;
    color: var(--text-muted);
    margin: 0;
}

/* ============================================================
   Calibration UI — full-screen drag design
   Covers the viewport. Red line fixed at top.
   Green line draggable downward. Handle appears BELOW green line.
   Double-ended arrow shows the gap being measured.
   ============================================================ */

/* Full-screen overlay for the two drag-to-measure views. Keyed on the views
   themselves, not the host page's container, because index.html and
   calibration.html mount the module in different places. CalibrationUI's
   showView() sets display:flex on these (block on screen-auto, which stays
   in normal page flow). */
.cal-views-root [data-cal-view="screen-drag"],
.cal-views-root [data-cal-view="wrist"] {
    position: fixed;
    inset: 0;
    z-index: 1100;
    flex-direction: column;
    background: var(--bg-tertiary);
    margin: 0;
    padding: 0;
}

/* Thin header strip */
.cal-header {
    flex: 0 0 auto;
    padding: 14px 20px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.cal-header-title {
    font-family: var(--font-display, 'Cormorant Garamond', Georgia, serif);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.cal-header-sub {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Measurement field — fills all remaining space */
.cal-field {
    flex: 1;
    position: relative;
    overflow: visible; /* allow handle to sit below line without clipping */
    min-height: 0;
}

/* RED top line — static anchor at y=0 */
.cal-top-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #DC2626;
    box-shadow: 0 2px 20px rgba(220, 38, 38, 0.4);
    z-index: 3;
}

.cal-top-label {
    position: absolute;
    top: 8px;
    left: 16px;
    font-family: var(--font-body, 'Outfit', sans-serif);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #DC2626;
    pointer-events: none;
}

/* GREEN bottom line — draggable, JS sets top */
.cal-bottom-line {
    position: absolute;
    left: 0;
    right: 0;
    /* Visual line is top 4px; total height extends below for touch target */
    height: 4px;
    background: #10B981;
    box-shadow: 0 -2px 20px rgba(16, 185, 129, 0.4);
    z-index: 4;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    overflow: visible;
}

.cal-bottom-line:active {
    cursor: grabbing;
}

/* Handle — sits BELOW the green line */
.cal-drag-handle {
    position: absolute;
    top: 4px; /* immediately below the 4px line */
    left: 50%;
    transform: translateX(-50%);
    width: 72px;
    height: 48px;
    background: #10B981;
    border-radius: 0 0 16px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.85);
    cursor: grab;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
    transition: background 0.12s, transform 0.12s;
}

.cal-bottom-line:active .cal-drag-handle {
    background: #0d9f73;
    cursor: grabbing;
    transform: translateX(-50%) scaleY(1.05);
}

.cal-bottom-label {
    position: absolute;
    top: 10px; /* below the line, next to handle */
    right: 12px;
    /* The drag handle is 72px wide and centered, so its right edge sits at
       50% + 36px. Capping the label there keeps it clear of the handle at any
       viewport width, instead of sliding under it on narrow phones. */
    max-width: calc(50% - 48px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-body, 'Outfit', sans-serif);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #10B981;
    pointer-events: none;
}

/* Double-ended vertical arrow spanning the gap */
.cal-gap-arrow {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 4px;   /* flush under the red line */
    width: 40px;
    /* height = gap, set by JS */
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    z-index: 2;
}

.cal-arrow-head-up {
    width: 0;
    height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 13px solid var(--accent);
    flex-shrink: 0;
}

.cal-arrow-shaft {
    flex: 1;
    width: 2px;
    background: var(--accent);
    min-height: 2px;
}

.cal-arrow-head-down {
    width: 0;
    height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-top: 13px solid var(--accent);
    flex-shrink: 0;
}

/* Wrist calibration mm readout — offset right of the gap arrow */
.cal-wrist-mm-chip {
    position: absolute;
    left: calc(50% + 36px); /* right of the 40px-wide arrow */
    top: 4px; /* JS updates this to vertically center in gap */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    pointer-events: none;
    z-index: 2;
}

.cal-wrist-mm-chip .cal-chip-number {
    font-family: var(--font-display, 'Cormorant Garamond', Georgia, serif);
    font-size: 2.4rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1;
}

.cal-wrist-mm-chip .cal-chip-unit {
    font-family: var(--font-body, 'Outfit', sans-serif);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-top: 3px;
}

/* Action bar at bottom */
.cal-action-bar {
    flex: 0 0 auto;
    padding: 16px 20px env(safe-area-inset-bottom, 16px);
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 16px rgba(28, 24, 20, 0.06);
}

/* ============================================================
   Form inputs
   ============================================================ */

.form-input,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"] {
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
    outline: none;
}

.form-input:focus,
input[type="text"]:focus,
input[type="number"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(28, 43, 74, 0.08);
}

.width-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.width-input-wrap label {
    font-weight: 500;
    font-size: 0.925rem;
}

.width-input-wrap input {
    width: 110px;
    flex-shrink: 0;
}

/* ============================================================
   Status messages
   ============================================================ */

.error-msg,
.msg-error {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--error);
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 10px;
    padding: 10px 14px;
    background: var(--error-light);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(220, 38, 38, 0.15);
}

.msg-success {
    color: var(--success);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 10px 14px;
    background: var(--success-light);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.muted {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 10px;
    line-height: 1.5;
}

/* ============================================================
   Loading states
   ============================================================ */

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto;
}

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

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 56px 24px;
    color: var(--text-secondary);
    font-size: 0.925rem;
}

/* Skeleton */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 25%,
        var(--border-color) 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Fits-and-starts progress bar (wrist detection) */
.progress-track {
    width: 100%;
    max-width: 320px;
    height: 6px;
    margin: 0 auto;
    background: var(--bg-tertiary);
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    width: 0;
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
    transition: width 0.4s ease;
}

.skeleton-text {
    height: 16px;
    width: 60%;
    margin: 6px 0;
}

.skeleton-stat {
    height: 32px;
    width: 80px;
    margin: 8px 0 4px;
}

/* ============================================================
   Empty states
   ============================================================ */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.empty-state p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    max-width: 280px;
}

/* ============================================================
   Guest / auth state
   ============================================================ */

.auth-gate {
    text-align: center;
    padding: 64px 24px;
}

.auth-gate h1 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0 0 10px;
}

.auth-gate p {
    color: var(--text-secondary);
    margin: 0 0 24px;
}

/* ============================================================
   Stat cards
   ============================================================ */

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin: 0 0 4px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.card-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.card-row .card {
    margin-bottom: 0;
}

/* ============================================================
   Badge / tier
   ============================================================ */

.tier-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.tier-badge.pro {
    background: var(--accent-warm-light);
    color: var(--accent-warm);
    border-color: rgba(200, 145, 42, 0.25);
}

.tier-badge.team,
.tier-badge.enterprise {
    background: rgba(28, 43, 74, 0.08);
    color: var(--accent);
    border-color: rgba(28, 43, 74, 0.2);
}

/* ============================================================
   Pricing
   ============================================================ */

.pricing-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 28px;
}

.pricing-card {
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.pricing-card:hover {
    box-shadow: var(--shadow-md);
}

.pricing-card.recommended {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    position: relative;
}

.pricing-card.recommended::before {
    content: 'Popular';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
    background: var(--accent);
    color: #FFFFFF;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px 12px;
    border-radius: 20px;
}

.pricing-tier-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 16px;
}

.pricing-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    flex: 1;
}

.pricing-features li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 5px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.pricing-features li::before {
    content: '';
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--success-light);
    border: 1.5px solid var(--success);
    flex-shrink: 0;
    margin-top: 1px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 6l3 3 5-5' stroke='%2310B981' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

/* ============================================================
   API keys
   ============================================================ */

.api-keys-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.api-keys-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

.api-keys-list li:last-child {
    border-bottom: none;
}

.api-keys-list .key-name {
    font-weight: 600;
    font-size: 0.925rem;
}

.api-keys-list .key-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.api-keys-list .btn-revoke {
    padding: 5px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    background: transparent;
    color: var(--error);
    border: 1.5px solid var(--error);
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    font-family: var(--font-body);
}

.api-keys-list .btn-revoke:hover {
    background: var(--error-light);
}

/* API key reveal */
.api-key-reveal {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 14px 16px;
    border-radius: var(--radius-md);
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    word-break: break-all;
    margin: 14px 0;
    color: var(--text-primary);
}

.api-key-reveal .copy-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 8px;
    font-family: var(--font-body);
}

/* ============================================================
   Modal
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13, 15, 22, 0.55);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeInOverlay 0.15s ease;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: slideUpModal 0.2s ease;
}

@keyframes slideUpModal {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 16px;
}

.modal .btn {
    margin-right: 8px;
    margin-top: 12px;
}

/* Form label */
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* ============================================================
   Watch-specific: segmented image, realsize, canvas areas
   ============================================================ */

.segmented-preview {
    max-width: 100%;
    border-radius: var(--radius-md);
    margin: 16px 0;
    display: block;
    background: repeating-conic-gradient(#E8E4DC 0% 25%, transparent 0% 50%) 0 0 / 20px 20px;
}

html.dark-mode .segmented-preview {
    background: repeating-conic-gradient(#2A2E40 0% 25%, transparent 0% 50%) 0 0 / 20px 20px;
}

.realsize-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 280px;
    padding: 24px;
    overflow: auto;
    background: repeating-conic-gradient(#F0EDE8 0% 25%, transparent 0% 50%) 0 0 / 16px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

html.dark-mode .realsize-container {
    background: repeating-conic-gradient(#232840 0% 25%, transparent 0% 50%) 0 0 / 16px 16px;
}

.realsize-container img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Wrist source row: upload zone + camera button side by side */
.wrist-source-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
    margin-bottom: 4px;
}

.upload-zone-compact {
    flex: 1;
    min-height: 100px;
    padding: 16px 12px;
}

.upload-zone-compact .upload-zone-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 6px;
}

.wrist-camera-btn {
    flex: 0 0 auto;
    width: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 16px 8px;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.wrist-camera-btn svg {
    width: 32px;
    height: 32px;
    stroke: currentColor;
}

.wrist-camera-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}

/* Wrist areas */

.wrist-canvas-wrap {
    width: 100%;
    margin-top: 12px;
}

/* Wrist marking: fixed viewport (wristmark-wrap) + transformed container,
   same DOM triad as the on-wrist try-on screen. touch-action:none lives on
   the WRAP because a zoomed-out photo doesn't cover the viewport and
   gestures must still work on the empty area around it. */
.wristmark-wrap {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: #141414;
    touch-action: none;
    cursor: grab;
}
.wristmark-container {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
}
#wrist-draw-canvas {
    display: block;
    width: 100%;
    height: auto;
}
.wristmark-guide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.wristmark-rotbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}
.wristmark-rotlabel {
    font-size: 12px;
    color: var(--text-secondary);
}
.wristmark-rotbar input { flex: 1; min-width: 0; }

/* Measuring mode: wrist photo + crop tool fill the screen */
#view-wrist-upload.wrist-measuring .view-header { display: none; }
#view-wrist-upload.wrist-measuring .card {
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 0;
}
#view-wrist-upload.wrist-measuring .wrist-canvas-wrap {
    margin-top: 0;
    padding: 0 16px;
}
#view-wrist-upload.wrist-measuring .wristmark-wrap {
    border-radius: 8px;
    border-left: none;
    border-right: none;
}
#view-wrist-upload.wrist-measuring .step-nav { padding: 12px 16px 0; }

/* Loading mode: only the progress bar, nothing else */
#view-wrist-upload.wrist-loading .view-header { display: none; }
#view-wrist-upload.wrist-loading .card { padding: 60px 24px; }
#view-wrist-upload.wrist-loading #wrist-last-photo-row { display: none !important; }

.wrist-own-canvas-wrap {
    width: 100%;
    margin: 16px 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    touch-action: none;
    cursor: grab;
}

.wrist-own-zoom-proxy {
    position: relative;
    display: block;
}

.wrist-own-canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    transform-origin: 0 0;
}

.wrist-own-canvas-container canvas {
    display: block;
    width: 100%;
    height: auto;
    vertical-align: top;
    touch-action: none;
}

.wrist-own-tryon-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    border-radius: var(--radius-md);
}

.wrist-own-zoom-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin: 8px 0 4px;
}

.wrist-own-zoom-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f0f0f0;
    border: 1px solid #ddd;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.wrist-own-zoom-btn:hover { background: #e0e0e0; }

.wrist-own-zoom-val {
    font-size: 13px;
    color: #555;
    font-variant-numeric: tabular-nums;
    min-width: 28px;
    text-align: center;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 640px) {
    .page-container,
    .page-container-wide {
        padding: 20px 16px 56px;
    }

    .wizard-progress {
        padding: 14px 16px 0;
    }

    .step-connector {
        max-width: 20px;
        min-width: 6px;
    }

    .card {
        padding: 18px 16px;
        border-radius: var(--radius-md);
    }

    .pricing-grid {
        grid-template-columns: 1fr;
    }

    .card-row {
        grid-template-columns: 1fr;
    }

    .view-header h1 {
        font-size: 1.45rem;
    }

    .step-nav {
        gap: 8px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.875rem;
    }

    .upload-zone {
        padding: 36px 16px;
    }
}

/* ============================================================
   Accessibility: focus rings
   ============================================================ */

:focus-visible {
    outline: 2px solid var(--accent-warm);
    outline-offset: 2px;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent-warm);
    outline-offset: 2px;
}

/* ============================================================
   Page lead text
   ============================================================ */

.lead {
    color: var(--text-secondary);
    font-size: 0.975rem;
    margin-bottom: 24px;
    line-height: 1.55;
}

/* Page heading */
.page-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin: 0 0 8px;
    line-height: 1.15;
}

/* ============================================================
   Utility
   ============================================================ */

.hidden { display: none !important; }

.text-muted {
    color: var(--text-muted);
    font-size: 0.85rem;
}

code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875em;
    background: var(--bg-tertiary);
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid var(--border-color);
}
