/* ============================================
   DECK BUILDER - Professional UI 2026
   
   Copyright © 2026 Hallmark Sundecks. All Rights Reserved.
   This software is proprietary and confidential.
   Unauthorized copying or distribution is prohibited.
   ============================================ */

:root {
    /* Color System - Based on Hallmark Sundecks Logo */
    --bg-primary: #363639;
    --bg-secondary: #404044;
    --bg-tertiary: #4a4a4e;
    --bg-elevated: #2f4050; /* Logo blue-grey */
    
    --surface-1: #374151; /* Slightly lighter than logo */
    --surface-2: #3f4a57; /* Mid-tone blue-grey */
    --surface-3: #475361; /* Lighter blue-grey */
    
    --border-subtle: rgba(255, 255, 255, 0.18);
    --border-default: rgba(255, 255, 255, 0.25);
    --border-strong: rgba(255, 255, 255, 0.35);
    
    --text-primary: #fafafa;
    --text-secondary: #c8c8d0;
    --text-muted: #a0a0a0; /* Logo grey */
    
    /* Primary Accent - Blue (replaced green) */
    --accent-primary: #3b82f6; /* Bright blue */
    --accent-primary-hover: #2563eb; /* Darker blue on hover */
    --accent-secondary: #60a5fa;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --success: #3b82f6; /* Success color - blue */

    /* Adaptive Android bottom inset (set via JS) */
    --android-nav-inset: 0px;
    
    /* Metallic accent (inspired by logo lines) */
    --accent-metallic-start: #cbd5e1;
    --accent-metallic-end: #94a3b8;
    
    /* Deck Colors - Blue theme */
    --deck-fill: rgba(59, 130, 246, 0.15);
    --deck-stroke: #3b82f6;
    --balustrade-color: #ef4444;
    --post-color: #fbbf24;
    --step-color: #6366f1;
    --gate-color: #8b5cf6;
    --caravan-fill: #5a5a5e;
    --caravan-stroke: #727276;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* Typography */
    --font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'Space Mono', monospace;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Shadows - Refined */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3); /* Blue glow */
    
    /* Border Radius - Softer, more modern */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;
}

/* Light Mode Variables */
[data-theme="light"] {
    /* Warmer, softer greys - more comfortable on the eyes */
    --bg-primary: #d8d8d8;
    --bg-secondary: #d0d0d0;
    --bg-tertiary: #c8c8c8;
    --bg-elevated: #c0c0c0; /* Slightly darker for elevated surfaces */
    
    --surface-1: #b8b8b8;
    --surface-2: #b0b0b0;
    --surface-3: #a8a8a8;
    
    /* Softer borders - more subtle */
    --border-subtle: rgba(0, 0, 0, 0.06);
    --border-default: rgba(0, 0, 0, 0.1);
    --border-strong: rgba(0, 0, 0, 0.16);
    
    /* Softer text - dark grey instead of pure black for better readability */
    --text-primary: #2a2a2a;
    --text-secondary: #4a4a4a;
    --text-muted: #555555;
    
    /* Primary Accent - Blue (replaced green) */
    --accent-primary: #2563eb;
    --accent-primary-hover: #1d4ed8;
    --accent-secondary: #3b82f6;
    --accent-warning: #d97706;
    --accent-danger: #dc2626;
    
    /* Deck Colors - Blue theme for light mode */
    --deck-fill: rgba(59, 130, 246, 0.25);
    --deck-stroke: #2563eb;
    --balustrade-color: #dc2626;
    --post-color: #d97706;
    --step-color: #4f46e5;
    --gate-color: #7c3aed;
    --caravan-fill: #d4d4d4;
    --caravan-stroke: #a8a8a8;
    
    /* Softer shadows - lighter and more subtle */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15); /* Softer blue glow */
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
}

/* App Container - use visibility instead of display to maintain layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    visibility: hidden; /* Hidden until user is authenticated */
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

/* iOS Safari specific fixes - only apply on touch devices */
@supports (-webkit-touch-callout: none) {
    .app-container {
        /* iOS Safari: 100vh includes area behind toolbar, use dvh or fill-available */
        height: 100dvh;
        height: -webkit-fill-available;
    }
}

/* Show app container when authenticated (body does NOT have loading/gate classes) */
body:not(.checking-auth):not(.showing-auth-gate):not(.showing-maintenance):not(.showing-welcome) .app-container {
    visibility: visible;
    opacity: 1;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 100;
}

/* PWA Offline / Update Banners */
.offline-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10001;
    background: linear-gradient(135deg, #92400e 0%, #b45309 100%);
    color: #fefce8;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
    font-weight: 500;
    animation: bannerSlideUp 0.3s ease-out;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.3);
}

.offline-banner-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sw-update-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10001;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
    font-weight: 500;
    animation: bannerSlideUp 0.3s ease-out;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.3);
}

.sw-update-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-sm);
    padding: 0.35rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.sw-update-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.sw-update-dismiss {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
    transition: color 0.2s;
}

.sw-update-dismiss:hover {
    color: #fff;
}

@keyframes bannerSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: var(--space-md);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    pointer-events: none;
    max-height: calc(100vh - 150px); /* Prevent toasts from going below footer */
    overflow: hidden;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    min-width: 280px;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    animation: toastSlideIn 0.3s ease-out;
    pointer-events: auto;
}

.toast.toast-success {
    border-left: 3px solid var(--success);
}

.toast.toast-error {
    border-left: 3px solid var(--accent-danger);
}

.toast.toast-info {
    border-left: 3px solid var(--accent-primary);
}

.toast.toast-warning {
    border-left: 3px solid var(--accent-warning);
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.toast-exiting {
    animation: toastSlideOut 0.3s ease-in forwards;
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-loading {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
}

.toast-loading .toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-spinner {
    width: 16px;
    height: 16px;
    color: var(--accent-primary);
    animation: spin 1s linear infinite;
}

/* Button spinner for loading states */
.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

.toast-message {
    flex: 1;
    min-width: 0;
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.toast-button,
.toast-dismiss {
    flex-shrink: 0;
}

.toast-clickable {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.toast-clickable:hover {
    transform: translateX(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.toast-dismiss {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    padding: 2px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background-color 0.2s;
}

.toast-dismiss:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

/* Slide-in Notification (Sales Manager discount requests) */
.slide-notification {
    position: fixed;
    top: 80px;
    right: -400px;
    width: 380px;
    max-width: calc(100vw - 32px);
    background: var(--bg-elevated);
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 10001;
    transition: right 0.4s ease-out;
    overflow: hidden;
}

.slide-notification.entering {
    right: -400px;
}

.slide-notification.visible {
    right: 16px;
}

.slide-notification-content {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-md);
}

.slide-notification-icon {
    font-size: 2rem;
    flex-shrink: 0;
    line-height: 1;
}

.slide-notification-text {
    flex: 1;
    min-width: 0;
}

.slide-notification-text strong {
    display: block;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.slide-notification-text p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.slide-notification-action {
    flex-shrink: 0;
    margin-top: var(--space-xs);
}

.slide-notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
}

.slide-notification-close:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.toast-button {
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
    margin-left: var(--space-sm);
    flex-shrink: 0;
}

.toast-button:hover {
    background: var(--accent-primary-hover);
    transform: scale(1.05);
}

.toast-button:active {
    transform: scale(0.98);
}

/* Make warning toasts more prominent */
.toast.toast-warning {
    border-left: 4px solid var(--accent-warning);
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.1) 0%, var(--bg-elevated) 4px);
    animation: toastSlideIn 0.3s ease-out, toastPulse 2s ease-in-out infinite;
}

@keyframes toastPulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
    }
}

/* Current Project Name Display */
.current-project-name {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 4px 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.current-project-name::before {
    content: '📄';
    font-size: 0.875rem;
}

.app-footer {
    position: fixed;
    bottom: env(safe-area-inset-bottom, 0);
    left: 0;
    right: 0;
    padding: var(--space-xs) var(--space-md);
    padding-bottom: calc(var(--space-xs) + env(safe-area-inset-bottom, 0));
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    z-index: 999;
    user-select: none;
    display: block;
    min-height: 24px;
}

/* On touch devices / tablets, show footer and add padding above system nav bar */
@media (pointer: coarse) {
    .app-footer {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        min-height: 28px !important;
        bottom: env(safe-area-inset-bottom, 0) !important;
        padding-bottom: calc(var(--space-xs) + env(safe-area-inset-bottom, 0)) !important;
        z-index: 999 !important;
    }
    
    .sidebar {
        padding-bottom: calc(28px + env(safe-area-inset-bottom, 0));
    }
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.logo:hover {
    opacity: 0.85;
}

.logo-icon {
    font-size: 1.5rem;
    color: var(--text-secondary);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.btn-new-deck {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-new-deck:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-new-deck svg {
    flex-shrink: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

@media (max-width: 1400px) {
    .app-header {
        flex-wrap: wrap;
        gap: var(--space-sm) var(--space-md);
        flex-direction: column;
        align-items: stretch;
    }

    .logo-container {
        gap: var(--space-sm);
    }

    .logo-text {
        font-size: 1.1rem;
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: var(--space-md);
        row-gap: var(--space-sm);
    }

    .header-actions .current-project-name {
        max-width: 140px;
    }

    .unit-toggle,
    .mm-toggle {
        flex-shrink: 0;
    }

    .header-btn-group {
        min-width: 0;
        flex-wrap: wrap;
        row-gap: var(--space-xs);
    }

    .header-actions #user-name {
        max-width: 90px;
    }

    .header-actions #role-display {
        display: none;
    }

    .admin-header-btn,
    .btn-new-deck {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    .unit-toggle .btn,
    .mm-toggle .btn {
        padding: 4px 6px;
        font-size: 0.75rem;
    }
}

@media (pointer: coarse) and (min-width: 768px) {
    .app-header {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
    }

    .header-actions {
        flex: 1;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: var(--space-sm);
        row-gap: var(--space-xs);
    }

    .logo-container {
        flex-shrink: 0;
    }
}

@media (max-width: 1400px) {
    body.android-device .app-header {
        flex-direction: row;
        align-items: center;
    }

    body.android-device .header-actions {
        width: auto;
        flex: 1;
    }
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
}

#theme-icon-sun,
#theme-icon-moon {
    transition: opacity var(--transition-fast);
}

/* Unit Toggle */
.unit-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.unit-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.unit-label.active {
    color: var(--text-primary);
}

.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #9ca3af;
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
}

.toggle-track::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--text-primary);
    border-radius: 50%;
    transition: transform var(--transition-fast);
}

.toggle input:checked + .toggle-track {
    background: #2f4050;
}

.toggle input:checked + .toggle-track::before {
    transform: translateX(20px);
}

/* Main Layout */
.app-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 28px; /* Space for fixed footer */
}

.sidebar::-webkit-scrollbar,
.workflow-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track,
.workflow-content::-webkit-scrollbar-track {
    background: transparent;
}

/* Workflow Header */
.workflow-header {
    padding: var(--space-md);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-default);
    position: sticky;
    top: 0;
    z-index: 10;
}

.workflow-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.workflow-progress-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.workflow-steps-indicator {
    display: flex;
    gap: var(--space-xs);
    justify-content: center;
}

.workflow-step-indicator {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.workflow-step-indicator.current {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.workflow-step-indicator.completed {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    cursor: pointer;
}

.workflow-step-indicator.completed:hover {
    transform: scale(1.1);
}

.workflow-step-indicator.locked {
    background: var(--surface-1);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Workflow Content Container */
.workflow-content {
    flex: 1;
    overflow-y: auto;
}

/* Workflow Steps */
.workflow-step {
    margin: 0;
    padding: 0;
}

.workflow-step .panel {
    margin: 0;
}

.workflow-step.collapsed .panel {
    display: none;
}

.workflow-step.collapsed .workflow-step-summary {
    display: flex;
}

.workflow-step-summary {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-xs) var(--space-md);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-subtle);
    margin: 0;
    min-height: 32px;
}

.workflow-step-summary .summary-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.workflow-step-summary .workflow-edit-btn {
    font-size: 0.7rem;
    padding: 2px var(--space-xs);
    min-height: 22px;
    line-height: 1.2;
}

/* Workflow Navigation */
.workflow-navigation {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-md);
    padding-bottom: var(--space-md);
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-default);
    position: sticky;
    bottom: 0;
    z-index: 10;
}

@media (pointer: coarse) {
    .workflow-navigation {
        padding-bottom: calc(28px + env(safe-area-inset-bottom, 0));
    }
}

.workflow-navigation .btn {
    flex: 1;
}

#workflow-skip {
    flex: 0.5;
}

.btn-complete {
    background: var(--accent-primary) !important;
    color: white !important;
    cursor: default !important;
    opacity: 1 !important;
}

.btn-complete:hover {
    background: var(--accent-primary) !important;
}

.sidebar::-webkit-scrollbar-thumb,
.workflow-content::-webkit-scrollbar-thumb {
    background: var(--surface-2);
    border-radius: var(--radius-full);
}

/* Panels */
.panel {
    border-bottom: 1px solid var(--border-subtle);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background: var(--bg-tertiary);
}

.panel-header h2 {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.panel-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.panel-body {
    padding: var(--space-md);
}

/* Form Elements */
.form-row {
    margin-bottom: var(--space-md);
}

.form-row:last-child {
    margin-bottom: 0;
}

/* Offset Section */
.offset-section {
    margin-top: var(--space-lg);
}

.offset-divider {
    height: 1px;
    background: var(--border-default);
    margin-bottom: var(--space-md);
}

.form-row label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.input-with-unit {
    display: flex;
    align-items: stretch;
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color var(--transition-fast);
}

.input-with-unit:focus-within {
    border-color: var(--accent-primary);
}

.input-with-unit input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    outline: none;
}

.input-with-unit input::-webkit-inner-spin-button,
.input-with-unit input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-with-unit .unit {
    display: flex;
    align-items: center;
    padding: 0 var(--space-md);
    background: var(--surface-1);
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-family: var(--font-mono);
}

/* Imperial dual input (feet + inches) */
.input-imperial {
    display: flex;
    align-items: stretch;
    gap: var(--space-xs);
    width: 100%;
}

.input-imperial input {
    flex: 1;
    min-width: 0;
    padding: var(--space-sm) var(--space-sm);
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    text-align: center;
    outline: none;
    transition: border-color var(--transition-fast);
}

.input-imperial input:focus {
    border-color: var(--accent-primary);
}

.input-imperial input::-webkit-inner-spin-button,
.input-imperial input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-imperial .unit {
    display: flex;
    align-items: center;
    padding: 0 var(--space-xs);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    flex-shrink: 0;
}

.hidden {
    display: none !important;
}

/* Deck Pieces Grid */
.deck-pieces-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
}

.deck-piece-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    cursor: grab;
    transition: all var(--transition-fast);
}

.deck-piece-item {
    cursor: pointer;
}

.deck-piece-item:hover {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
    transform: translateY(-2px);
}

.deck-piece-item:active {
    transform: scale(0.98);
}

/* Setting Row (toggle with label) */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.setting-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Color Selectors */
.color-selector-group {
    margin-bottom: var(--space-lg);
}

.color-selector-group:last-child {
    margin-bottom: 0;
}

.color-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.color-swatch-btn {
    width: 36px;
    height: 36px;
    padding: 2px;
    background: var(--bg-primary);
    border: 2px solid var(--border-default);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-swatch-btn:hover {
    border-color: var(--accent-primary);
    transform: scale(1.1);
}

.color-swatch-btn.active {
    border-color: var(--accent-primary);
    border-width: 2px;
    box-shadow: 0 0 0 1px var(--bg-primary), 0 0 0 2px var(--accent-primary);
}

.color-swatch-btn .swatch {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-xs);
    border: 1px solid rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

/* Animated sheen effect for Excel deckboard and foiled products */
.color-swatch-btn.excel-deck .swatch::before,
.color-swatch-btn.foiled .swatch::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        rgba(255, 255, 255, 0.6),
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: sheen 3s infinite;
    pointer-events: none;
}

/* Sparkle effect overlay */
.color-swatch-btn.excel-deck .swatch::after,
.color-swatch-btn.foiled .swatch::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle at 30% 30%,
        rgba(255, 255, 255, 0.8) 0%,
        rgba(255, 255, 255, 0.4) 25%,
        transparent 50%
    );
    animation: sparkle 2s infinite;
    pointer-events: none;
    opacity: 0.6;
}

@keyframes sheen {
    0% {
        left: -100%;
    }
    50% {
        left: 100%;
    }
    100% {
        left: 100%;
    }
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    25% {
        opacity: 0.8;
        transform: scale(1.1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.95);
    }
    75% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

/* Strike-through for disabled Rustic Oak */
.color-swatch-btn.strike-through {
    position: relative;
}

.color-swatch-btn.strike-through::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--text-error, #ef4444);
    transform: rotate(-45deg);
    z-index: 1;
    pointer-events: none;
}

.caravan-color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
}

.caravan-color-input {
    width: 60px;
    height: 40px;
    border: 2px solid var(--border-default);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: none;
    padding: 0;
    flex-shrink: 0;
}

.caravan-color-input:hover {
    border-color: var(--accent-primary);
    transform: scale(1.05);
}

.caravan-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
    border-radius: var(--radius-xs);
}

.caravan-color-input::-webkit-color-swatch {
    border: none;
    border-radius: var(--radius-xs);
}

.caravan-color-input::-moz-color-swatch {
    border: none;
    border-radius: var(--radius-xs);
}

.caravan-color-pickr-btn {
    width: 60px;
    height: 40px;
    border: 2px solid var(--border-default);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    background-color: #A8A8A8;
}

.caravan-color-pickr-btn:hover {
    border-color: var(--accent-primary);
    transform: scale(1.05);
}

.caravan-color-display {
    font-size: 0.875rem;
    color: var(--text-primary);
    flex: 1;
}

/* Color Picker Modal */
.modal-small {
    max-width: min(400px, 90vw);
}

.color-picker-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    align-items: center;
}

.color-picker-container input[type="color"] {
    width: 200px;
    height: 200px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.color-picker-container input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-container input[type="color"]::-webkit-color-swatch {
    border: 2px solid var(--border-default);
    border-radius: var(--radius-md);
}

.color-picker-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.color-preview-box {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-default);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.color-hex-display {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: var(--space-xs) var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

/* Deck Type Thumbnails - SVG files in pics/thumbnails/ */
.piece-preview {
    width: 64px;
    height: 64px;
    margin-bottom: var(--space-sm);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: var(--radius-sm);
}

.side-preview {
    background: url('../pics/thumbnails/side.svg') no-repeat center / contain !important;
}

.front-preview {
    background: url('../pics/thumbnails/front.svg') no-repeat center / contain !important;
}

.lshape-preview {
    background: url('../pics/thumbnails/lshape.svg') no-repeat center / contain !important;
}

.lpatio-preview {
    background: url('../pics/thumbnails/lpatio.svg') no-repeat center / contain !important;
}

.ushape-preview {
    background: url('../pics/thumbnails/ushape.svg') no-repeat center / contain !important;
}

.pshape-preview {
    background: url('../pics/thumbnails/pshape.svg') no-repeat center / contain !important;
}

.freestandingsteps-preview {
    background: url('../pics/thumbnails/freestandingsteps.svg') no-repeat center / contain !important;
}

/* Advanced deck type previews — mirror existing SVGs */
.rear-preview {
    background: url('../pics/thumbnails/front.svg') no-repeat center / contain !important;
    transform: scaleX(-1);
}

.topside-preview {
    background: url('../pics/thumbnails/side.svg') no-repeat center / contain !important;
    transform: scaleY(-1);
}

.reverselshape-preview {
    background: url('../pics/thumbnails/lshape.svg') no-repeat center / contain !important;
    transform: scaleX(-1);
}

.reverselpatio-preview {
    background: url('../pics/thumbnails/lpatio.svg') no-repeat center / contain !important;
    transform: scaleX(-1);
}

.topsidepshape-preview {
    background: url('../pics/thumbnails/pshape.svg') no-repeat center / contain !important;
    transform: scaleY(-1);
}

.piece-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-primary-hover) 0%, var(--accent-primary) 100%);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface-1);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    -webkit-tap-highlight-color: transparent;
}

.btn-secondary:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}

.btn-block {
    width: 100%;
}

.btn-danger-outline {
    background: transparent;
    color: #ef4444;
    border: 1px solid #ef4444;
}
.btn-danger-outline:hover {
    background: #ef4444;
    color: white;
}
.btn-danger-outline svg {
    stroke: currentColor;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--surface-1);
    color: var(--text-primary);
}

/* Help/Tutorial button in header */
#help-tutorial-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

#help-tutorial-btn:hover {
    background: var(--surface-2);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

#help-tutorial-btn svg {
    display: block;
    width: 24px !important;
    height: 24px !important;
    stroke: currentColor;
    fill: none;
}

.btn-tool {
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
}

.btn-tool:hover {
    background: var(--surface-1);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-tool:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-tool:disabled:hover {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-color: var(--border-default);
}

/* Helper Text */
.helper-text {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.sales-cutout-note {
    color: var(--text-primary);
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
}

/* Steps List */
#steps-list {
    margin-bottom: var(--space-md);
}

.step-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    overflow: hidden;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.step-item:hover {
    border-color: var(--border-strong);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background: var(--surface-1);
    border-bottom: 1px solid var(--border-default);
}

.step-number {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.step-delete {
    width: 28px;
    height: 28px;
    opacity: 0.6;
}

.step-delete:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-danger);
}

.step-content {
    padding: var(--space-md);
}

.step-specs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.step-spec {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.step-spec-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.step-spec-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.step-spec-value-success {
    color: var(--accent-primary);
}

.step-spec-value-warning {
    color: var(--accent-warning);
}

.step-warning {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-md);
    font-size: 0.8125rem;
    color: var(--accent-warning);
}

.step-warning svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.step-controls {
    display: flex;
    gap: var(--space-md);
    align-items: flex-end;
    flex-wrap: wrap;
}

.step-control-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    flex: 1;
    min-width: 140px;
    max-width: 200px;
}

.step-control-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.step-control-label-required {
    color: var(--error-color) !important;
    font-weight: 700 !important;
    font-size: 0.8125rem !important;
    animation: label-pulse 1.5s ease-in-out infinite;
}

.step-control-label-required .warning-icon {
    display: inline-block;
    margin-right: 4px;
    animation: icon-bounce 1s ease-in-out infinite;
}

@keyframes label-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes icon-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-2px);
    }
}

.btn-step-action {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 8px 14px;
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    height: 36px;
    white-space: nowrap;
}

.btn-step-action:hover {
    background: var(--surface-2);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-step-action.has-gate {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--gate-color);
    color: var(--gate-color);
}

.btn-step-action.has-gate:hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: var(--gate-color);
}

.btn-icon.has-gate {
    color: var(--gate-color);
}

.btn-icon.has-gate:hover {
    background: rgba(139, 92, 246, 0.2);
}

.btn-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    min-width: 32px;
    height: 28px;
}

.btn-text:hover {
    background: var(--surface-2);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-text.has-gate {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--gate-color);
    color: var(--gate-color);
    padding: 4px 8px;
}

.btn-text.has-gate:hover {
    background: rgba(139, 92, 246, 0.25);
}

.btn-text svg {
    flex-shrink: 0;
}

.empty-state {
    text-align: center;
    padding: var(--space-md);
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    overflow: hidden;
}

/* Combined Colours & Statistics Panel */
.colours-stats-panel {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 200px;
    max-width: calc(100% - var(--space-md) * 2);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.colours-stats-panel.collapsed {
    /* When collapsed, hide content and show only header */
    min-width: auto;
    width: auto;
    transform: translateX(-50%) translateY(calc(-100% + 40px)); /* Show only header peeking from top */
}

.colours-stats-panel.collapsed .colours-stats-content {
    display: none;
}

.colours-stats-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    cursor: pointer;
    user-select: none;
}

.colours-stats-panel:not(.collapsed) .colours-stats-header {
    justify-content: space-between;
    border-bottom: 1px solid var(--border-default);
}

.colours-stats-header:hover {
    background: var(--bg-hover);
}

.colours-stats-header-content {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.colours-stats-header-title {
    font-weight: 600;
}

.colours-stats-toggle-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.colours-stats-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.colours-stats-toggle-icon {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* When collapsed, rotate to show down arrow. When expanded, show up arrow (default) */
.colours-stats-panel.collapsed .colours-stats-toggle-icon {
    transform: rotate(180deg);
}

.colours-stats-content {
    padding: var(--space-md);
    display: flex;
    flex-direction: row;
    gap: var(--space-lg);
    align-items: flex-start;
}

.colours-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    min-width: 180px;
}

.colours-section-header {
    margin-bottom: var(--space-xs);
}

.colours-section-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.colours-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.material-item {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-sm);
}

.material-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.material-value {
    font-size: 0.8125rem;
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
}

.statistics-section {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.statistics-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 120px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.stat-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

/* Legacy support - hide old panels if they still exist */
.materials-summary-panel,
.statistics-panel {
    display: none !important;
}

.canvas-toolbar {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    z-index: 10;
}

/* Undo/Redo buttons - top left of canvas */
.canvas-undo-redo {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    display: flex;
    flex-direction: row;
    gap: var(--space-xs);
    z-index: 10;
}

.canvas-undo-redo .btn-tool {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.canvas-undo-redo .btn-tool:hover:not(:disabled) {
    background: var(--surface-2);
    border-color: var(--primary);
}

.canvas-undo-redo .btn-tool:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#deck-canvas {
    flex: 1;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    /* Enable gesture handling for trackpad pinch-to-zoom */
    touch-action: none;
}

.canvas-status {
    position: absolute;
    bottom: 40px; /* Increased to account for fixed footer (28px + padding) */
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    z-index: 10;
    box-shadow: var(--shadow-md);
}

/* Drag States */
.canvas-area.drag-over {
    background: rgba(59, 130, 246, 0.05);
}

[data-theme="light"] .canvas-area.drag-over {
    background: rgba(59, 130, 246, 0.08);
}

.canvas-area.drag-over::after {
    content: 'Drop to place deck';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: var(--space-md) var(--space-xl);
    background: var(--bg-elevated);
    border: 2px dashed var(--accent-primary);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 500;
    color: var(--accent-primary);
    pointer-events: none;
    z-index: 20;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* Pan/zoom instructions modal should be below tutorial overlay */
#pan-zoom-instructions-modal {
    z-index: 9999; /* Below tutorial overlay (10000) but above other modals */
    backdrop-filter: blur(4px);
}

[data-theme="light"] .modal-overlay {
    background: rgba(0, 0, 0, 0.5);
}

.modal {
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    overflow-y: auto;
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    color: var(--text-muted);
}

.modal-close:hover {
    color: var(--text-primary);
    background: transparent;
}

/* Warning modal header style */
.modal-header.warning {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border-bottom: none;
}

.modal-header.warning h3 {
    color: white;
}

.modal-header.warning .modal-close,
.modal-header.warning .btn-icon {
    color: rgba(255, 255, 255, 0.8);
}

.modal-header.warning .modal-close:hover,
.modal-header.warning .btn-icon:hover {
    color: white;
}

/* Info modal header style */
.modal-header.info {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    border-bottom: none;
}

.modal-header.info h3 {
    color: white;
}

.modal-header.info .modal-close,
.modal-header.info .btn-icon {
    color: rgba(255, 255, 255, 0.8);
}

.modal-header.info .btn-icon:hover {
    color: white;
}

.modal-body {
    padding: var(--space-lg);
}

/* Help Menu Options */
.help-menu-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.help-menu-option {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.help-menu-option:hover {
    background: var(--surface-2);
    border-color: var(--border-default);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.help-menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    color: var(--accent-primary);
    flex-shrink: 0;
}

.help-menu-option:hover .help-menu-icon {
    background: var(--accent-primary);
    color: white;
}

.help-menu-content {
    flex: 1;
    min-width: 0;
}

.help-menu-content h4 {
    margin: 0 0 4px 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.help-menu-content p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.help-menu-arrow {
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.help-menu-option:hover .help-menu-arrow {
    color: var(--accent-primary);
    transform: translateX(4px);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-subtle);
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: var(--space-sm);
}

.radio-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.radio-option:has(input:checked) {
    background: var(--surface-2);
    border-color: var(--surface-3);
    color: var(--text-primary);
}

.radio-option input {
    display: none;
}

.radio-option span {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Header Button Groups */
.header-btn-group {
    display: flex;
    gap: 2px;
    background: var(--surface-1);
    border-radius: var(--radius-sm);
    padding: 2px;
}

#signin-buttons {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
}

.header-btn-group .btn-icon {
    width: 28px;
    height: 28px;
}

.header-btn-group .btn-icon:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.header-btn-group .btn-icon:not(:disabled):hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

/* Collapsible Panels */
.panel.collapsible .panel-header.clickable {
    cursor: pointer;
    user-select: none;
}

.panel.collapsible .panel-header.clickable:hover {
    background: var(--surface-1);
}

.collapse-icon {
    transition: transform var(--transition-fast);
}

.panel.collapsible.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.panel.collapsible.collapsed .panel-body {
    display: none;
}

/* Components List */
.component-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm);
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-xs);
    font-size: 0.8125rem;
}

.component-item:last-child {
    margin-bottom: 0;
}

.component-name {
    color: var(--text-secondary);
}

.component-value {
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--text-primary);
}

.component-category {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: var(--space-sm) 0 var(--space-xs);
}

.component-category:first-child {
    margin-top: 0;
}

/* Toolbar Divider */
.toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border-default);
    margin: 8px 0;
}

/* Tool Button Active State */
.btn-tool.active {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-color: var(--accent-primary);
}

.btn-tool.active:hover {
    background: var(--accent-primary-hover);
}

/* Placement Mode Indicator */
.placement-mode-hint {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid var(--step-color);
    border-radius: var(--radius-sm);
    color: var(--step-color);
    font-weight: 500;
}

.mode-indicator {
    width: 8px;
    height: 8px;
    background: var(--step-color);
    border-radius: 50%;
    animation: pulse-mode 1.5s ease-in-out infinite;
}

@keyframes pulse-mode {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.canvas-area.placement-mode {
    cursor: crosshair !important;
}

.canvas-area.placement-mode #deck-canvas {
    cursor: crosshair !important;
}

.canvas-area.placement-mode::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid var(--step-color);
    border-radius: var(--radius-sm);
    pointer-events: none;
    z-index: 5;
    animation: border-pulse 2s ease-in-out infinite;
}

@keyframes border-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

#add-steps-btn.active {
    background: var(--step-color);
    border-color: var(--step-color);
}

#add-steps-btn svg {
    transition: transform var(--transition-fast);
}

#add-steps-btn.active svg {
    transform: rotate(45deg);
}

/* Glass Rails Button */
.btn-glass {
    background: var(--surface-1);
    color: var(--text-primary);
    border: 1px solid #22d3ee;
}

.btn-glass:hover {
    background: rgba(34, 211, 238, 0.15);
    border-color: #22d3ee;
}

.btn-lights {
    background: var(--surface-1);
    color: var(--text-primary);
    border: 1px solid #ef4444;
}

.btn-lights:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
}

#add-glass-btn.active {
    background: #22d3ee;
    border-color: #22d3ee;
    color: #0a0a0b;
}

#add-glass-btn svg {
    transition: transform var(--transition-fast);
}

#add-glass-btn.active svg {
    transform: rotate(45deg);
}

/* Glass placement mode hint */
.placement-mode-hint.glass-mode {
    background: rgba(34, 211, 238, 0.15);
    border-color: #22d3ee;
    color: #22d3ee;
}

.placement-mode-hint.lights-mode {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #ef4444;
}

.mode-indicator.glass {
    background: #22d3ee;
}

.mode-indicator.lights {
    background: #ef4444;
}

/* ==================== LIGHTS SELECTOR STYLES ==================== */

.lights-selector {
    margin-bottom: var(--space-sm);
}

.lights-selector-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
    font-weight: 500;
}

.lights-type-buttons,
.lights-color-buttons {
    display: flex;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

.btn-light-type,
.btn-light-color {
    flex: 1;
    min-width: 60px;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: all var(--transition-fast);
}

.btn-light-type:hover,
.btn-light-color:hover {
    background: var(--surface-2);
    border-color: var(--accent-primary);
}

.btn-light-type.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn-light-color.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

/* Light type icons with specific colors */
.light-type-icon {
    font-size: 1rem;
    line-height: 1;
}

.light-type-icon.solar { color: #fbbf24; }
.light-type-icon.ball { color: #3b82f6; }
.light-type-icon.globe { color: #9ca3af; }
.light-type-icon.coach { color: #6b7280; }
.light-type-icon.smart-post-led { 
    background: linear-gradient(135deg, #ef4444, #f97316, #facc15, #22c55e, #2563eb, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
}
.light-type-icon.deck-led { 
    color: #f59e0b;
    text-shadow: 0 0 4px rgba(251, 191, 36, 0.6);
}

/* Light color swatches */
.light-color-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid var(--border-default);
}

.light-color-swatch.white {
    background: #ffffff;
}

.light-color-swatch.black {
    background: #1f2937;
}

/* Disabled state for Add Light button */
#add-lights-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#add-lights-btn:disabled:hover {
    background: var(--surface-1);
    border-color: #ef4444;
}

/* Connection toggle for Surveyor */
.lights-connection-toggle {
    margin-top: var(--space-md);
    padding: var(--space-sm);
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-sm);
}

.lights-connection-toggle .toggle-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.lights-connection-toggle .toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
}

.lights-connection-toggle .toggle-text {
    font-weight: 500;
}

.lights-connection-toggle .helper-text {
    margin-top: var(--space-xs);
    margin-bottom: 0;
    padding-left: 24px;
}

/* Lights list item */
.light-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-sm);
}

.light-item.wired {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

.light-info {
    display: flex;
    flex-direction: column;
}

.light-title {
    font-size: 0.875rem;
    font-weight: 500;
}

.light-item:not(.wired) .light-title {
    color: #fbbf24;
}

.light-item.wired .light-title {
    color: #3b82f6;
}

.light-details {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Glass Mode Canvas Border */
.canvas-area.glass-mode::before {
    border-color: #22d3ee !important;
}

.canvas-area.lights-mode::before {
    border-color: #ef4444 !important;
}

/* Glass Section List Item */
.glass-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-sm);
}

.glass-info {
    display: flex;
    flex-direction: column;
}

.glass-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #22d3ee;
}

.glass-details {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.gate-glass-section {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-subtle);
}

.gate-glass-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.gate-glass-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.gate-glass-toggle {
    flex-shrink: 0;
}

.gate-glass-tint-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gate-glass-tint-select {
    width: 100%;
}

.light-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-sm);
}

.light-info {
    display: flex;
    flex-direction: column;
}

.light-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #ef4444;
}

/* Hot Tub List Item - matches glass styling but in blue */
.hot-tub-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-sm);
}

.hot-tub-info {
    display: flex;
    flex-direction: column;
}

.hot-tub-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #3b82f6;
}

.hot-tub-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Step actions container (used for glass, hot tub, etc.) */
.step-actions {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
}

.step-actions .btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
}

/* Hot tub item button colors (blue theme) */
.hot-tub-item .btn-icon:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.15);
}

/* Glass item button colors (cyan theme) */
.glass-item .btn-icon:hover {
    color: #22d3ee;
    background: rgba(34, 211, 238, 0.15);
}

/* Light item button colors (red theme) */
.light-item .btn-icon:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

/* Placement Tools Panel */
.placement-section {
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
}

.placement-section:last-of-type {
    border-bottom: none;
    margin-bottom: var(--space-sm);
}

.placement-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.placement-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.btn-placement {
    background: var(--surface-1);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    margin-bottom: var(--space-xs);
}

.btn-placement:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}

.btn-placement.active {
    background: var(--step-color);
    border-color: var(--step-color);
    color: white;
}

.btn-placement.btn-glass.active {
    background: #22d3ee;
    border-color: #22d3ee;
    color: #0a0a0b;
}

.btn-placement.btn-lights.active {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.placement-clear-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border-subtle);
}

.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    flex: 1;
}

.btn-xs {
    padding: 2px var(--space-xs);
    font-size: 0.7rem;
    min-height: 24px;
    line-height: 1.2;
}

/* Caravan Size Preset Buttons */
.btn-preset {
    padding: 6px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--surface-1);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    line-height: 1.3;
}

.btn-preset:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.btn-preset:active {
    transform: translateY(0);
}

.btn-preset .preset-metric {
    font-size: 0.65rem;
    opacity: 0.7;
    font-weight: 400;
}

.btn-preset:hover .preset-metric {
    opacity: 0.9;
}

/* MM/CM Toggle - Segmented Control Style */
.mm-toggle {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 2px;
    min-width: 100px; /* Fixed width to prevent layout shift */
    position: relative;
}

.mm-toggle.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.mm-toggle.disabled::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -2px;
    right: -2px;
    height: 2px;
    background: #ef4444; /* Red strike-through */
    transform: translateY(-50%) rotate(-15deg);
    z-index: 10;
    pointer-events: none;
}

.mm-toggle-btn {
    flex: 1;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: calc(var(--radius-md) - 2px);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    white-space: nowrap;
}

.mm-toggle-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.mm-toggle-btn.active {
    color: var(--text-primary);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.mm-toggle-btn:focus {
    outline: none;
}

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

.mm-toggle.disabled .mm-toggle-btn {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Pricing Display */
.pricing-display {
    position: absolute;
    bottom: 60px;
    right: 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 10;
    min-width: 200px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.pricing-display.collapsed {
    /* When collapsed, show only the header (minimal box with icon and "Price") */
    min-width: auto;
    width: auto;
}

.pricing-display.collapsed .pricing-content {
    display: none;
}

.pricing-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    cursor: pointer;
    user-select: none;
}

.pricing-display:not(.collapsed) .pricing-header {
    justify-content: space-between;
    border-bottom: 1px solid var(--border-default);
}

.pricing-header:hover {
    background: var(--bg-hover);
}

.pricing-header-content {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.pricing-header-title {
    font-weight: 600;
}

.pricing-toggle-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.pricing-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.pricing-currency-symbol {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.pricing-toggle-icon {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* When collapsed, show left arrow (default). When expanded, rotate to show right arrow */
.pricing-display:not(.collapsed) .pricing-toggle-icon {
    transform: rotate(180deg);
}

.pricing-content {
    padding: var(--space-sm) var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.pricing-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
}

.pricing-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.pricing-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}


.pricing-row.pricing-total {
    padding-top: var(--space-xs);
    border-top: 1px solid var(--border-default);
}

.pricing-row.pricing-total .pricing-label {
    font-weight: 600;
    color: var(--text-primary);
}

/* Base price override input (OWNER/ADMIN only) */
.pricing-input-group {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.pricing-currency {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Park selector for Surveyors in pricing panel */
.pricing-park-select {
    flex: 1;
    min-width: 0;
    max-width: 200px;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
}

.pricing-park-select:hover {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.pricing-park-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.pricing-park-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: var(--space-xs);
}

/* Flash animation for park selector row highlight */
/* Note: Applied to the parent ROW, not the <select> itself, because native selects don't animate well */
.pricing-park-select-flash {
    animation: parkSelectorFlash 0.5s ease-in-out 4 !important;
    border-radius: var(--radius-sm) !important;
    background-color: rgba(59, 130, 246, 0.15) !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.6), 0 0 25px rgba(59, 130, 246, 0.5), 0 0 50px rgba(59, 130, 246, 0.3) !important;
    z-index: 1000;
    position: relative;
}

/* Also highlight the select inside the flashing row */
.pricing-park-select-flash .pricing-park-select {
    border-color: var(--accent-primary) !important;
    background-color: rgba(59, 130, 246, 0.2) !important;
}

@keyframes parkSelectorFlash {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.6), 0 0 25px rgba(59, 130, 246, 0.5), 0 0 50px rgba(59, 130, 246, 0.3);
        background-color: rgba(59, 130, 246, 0.15);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.9), 0 0 40px rgba(59, 130, 246, 0.7), 0 0 80px rgba(59, 130, 246, 0.4);
        background-color: rgba(59, 130, 246, 0.3);
    }
}

.pricing-input {
    width: 120px;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: var(--font-mono);
    font-weight: 500;
    text-align: right;
    -moz-appearance: textfield; /* Remove spinner arrows in Firefox */
}

/* Remove spinner arrows in Chrome/Safari */
.pricing-input::-webkit-outer-spin-button,
.pricing-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pricing-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

.pricing-input::placeholder {
    color: var(--text-muted);
}

.btn-clear-price {
    padding: var(--space-xs);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.btn-clear-price:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-icon {
    width: 20px;
    height: 20px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pricing-row.pricing-total .pricing-value {
    font-size: 1rem;
    color: var(--accent-primary);
}

/* Context Menu */
.context-menu {
    position: fixed;
    min-width: 160px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    overflow: hidden;
    animation: contextMenuIn 0.15s ease-out;
}

@keyframes contextMenuIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.context-menu-item:hover {
    background: var(--surface-1);
}

.context-menu-item.danger {
    color: var(--accent-danger);
}

.context-menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.context-menu-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: var(--space-xs) 0;
}

.context-menu-item svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.context-menu-shortcut {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Tooltip */
.tooltip {
    position: fixed;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-primary);
    pointer-events: none;
    z-index: 1001;
    box-shadow: var(--shadow-md);
    max-width: 300px;
    min-width: fit-content;
    white-space: normal;
    word-wrap: break-word;
}

/* Grid Overlay (rendered on canvas) */
.grid-overlay {
    pointer-events: none;
}

/* Save/Load Modal Styles */
.project-name-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.project-name-input:focus {
    border-color: var(--accent-primary);
}

.saved-project-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.saved-project-item:hover {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.saved-project-item.selected {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.1);
}

.saved-project-info {
    display: flex;
    flex-direction: column;
}

.saved-project-name {
    font-weight: 500;
}

.saved-project-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.saved-project-delete {
    padding: 4px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.saved-project-delete:hover {
    color: var(--accent-danger);
    background: rgba(239, 68, 68, 0.1);
}

.no-projects {
    text-align: center;
    padding: var(--space-lg);
    color: var(--text-muted);
}

/* Save/Load Modal - fixed header/footer with scrollable body */
.save-load-modal {
    max-width: 480px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.save-load-modal .modal-body {
    overflow-y: auto;
    max-height: calc(80vh - 130px);
    padding: var(--space-md) var(--space-lg);
}

/* Project toolbar (search + sort) */
.project-toolbar {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    flex-shrink: 0;
}

.project-search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.project-search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.project-sort-select {
    padding: 8px 10px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.project-sort-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Project metadata line (park, plot) */
.saved-project-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.saved-project-cloud {
    color: var(--accent-primary);
    font-size: 0.7rem;
    margin-left: 4px;
}

/* Section headers (Recent / Older) */
.projects-section-header {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: var(--space-xs) 0;
    margin-bottom: var(--space-xs);
}

/* Archive toggle button */
.projects-archive-toggle {
    display: block;
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    margin-top: var(--space-xs);
    background: transparent;
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.projects-archive-toggle::before {
    content: '+ ';
}

.projects-archive-toggle.is-expanded::before {
    content: '- ';
}

.projects-archive-toggle:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.05);
}

.projects-archived {
    margin-top: var(--space-sm);
}

/* Selection Feedback - Canvas cursor states */
.canvas-area[data-cursor="pointer"] #deck-canvas {
    cursor: pointer;
}

.canvas-area[data-cursor="grab"] #deck-canvas {
    cursor: grab;
}

.canvas-area[data-cursor="grabbing"] #deck-canvas {
    cursor: grabbing;
}

.canvas-area[data-cursor="move"] #deck-canvas {
    cursor: move;
}

/* Keyboard Shortcut Hint */
.shortcut-hint {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
    z-index: 5;
}

.shortcut-hint kbd {
    display: inline-block;
    padding: 2px 6px;
    background: var(--surface-1);
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
}

/* Caravan Shape Edit UI */
#edit-caravan-shape-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-mode-banner {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-md);
    color: var(--text-primary);
    font-size: 0.8125rem;
}

.edit-mode-icon {
    font-size: 1rem;
}

#done-editing-btn {
    margin-bottom: var(--space-md);
}

#cutout-config {
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-subtle);
    margin-top: var(--space-md);
}

.cutout-config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.cutout-config-header span {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Cutout type visual indicators */
.radio-option[data-cutout-type="angled"]::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: var(--space-xs);
    background: linear-gradient(135deg, transparent 50%, var(--accent-primary) 50%);
    border-radius: 2px;
}

.radio-option[data-cutout-type="rectangle"]::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: var(--space-xs);
    background: var(--bg-primary);
    border: 2px solid var(--accent-primary);
    border-radius: 2px;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }
    
    .header-btn-group {
        gap: 1px;
        padding: 1px;
    }
    
    .header-btn-group .btn-icon {
        width: 24px;
        height: 24px;
    }
    
    .header-btn-group .btn-icon svg {
        width: 14px;
        height: 14px;
    }
    
    /* Condense auth section text on tablets */
    #role-display {
        font-size: 0.6875rem !important;
    }
    
    #signin-buttons span {
        display: none; /* Hide "Sign in with:" label */
    }
    
    /* Condense project name on tablets */
    .current-project-name {
        max-width: 100px !important;
        font-size: 0.75rem !important;
    }
}

@media (max-width: 768px) {
    .app-main {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }
    
    .canvas-area {
        min-height: 60vh;
    }
    
    .minimap-container {
        display: none !important;
    }
}

/* Responsive adjustments for canvas panels */
@media (max-width: 1400px) {
    /* On medium screens, move statistics below materials panel */
    .statistics-panel {
        top: auto;
        bottom: 100px; /* Above color legend and footer */
        left: var(--space-md);
        right: var(--space-md);
        transform: none;
        max-width: none;
        justify-content: center;
    }
    
    .materials-summary-panel {
        top: var(--space-md);
        right: var(--space-md);
        left: auto;
    }
    
    .canvas-toolbar {
        top: var(--space-md);
        right: var(--space-md);
    }
}

@media (max-width: 1024px) {
    .materials-summary-panel {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        margin: var(--space-md);
        width: auto;
    }
    
    .statistics-panel {
        position: relative;
        top: auto;
        bottom: auto;
        left: auto;
        right: auto;
        transform: none;
        margin: var(--space-md);
        width: auto;
        max-width: none;
    }
    
    .canvas-toolbar {
        position: relative;
        top: auto;
        right: auto;
        margin: var(--space-md);
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .stat-item {
        min-width: 100px;
        flex: 1 1 auto;
    }
    
    .modal {
        margin: var(--space-md);
        max-width: calc(100vw - var(--space-md) * 2) !important;
        max-height: 95vh !important;
    }
    
    .modal-body {
        max-height: calc(95vh - 140px) !important;
    }
}

@media (max-width: 768px) {
    .statistics-panel {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .stat-item {
        min-width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .stat-label {
        margin-bottom: 0;
    }
    
    .canvas-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ============================================
   Responsive - Small Screens
   ============================================ */

/* Hide on very small screens */
@media (max-width: 480px) {
    .materials-summary-panel,
    .statistics-panel,
    .canvas-toolbar {
        margin: var(--space-sm);
        padding: var(--space-sm);
    }
    
    .stat-item {
        min-width: 100px;
    }
    
    .modal {
        margin: var(--space-sm);
        max-width: calc(100vw - var(--space-sm) * 2) !important;
        max-height: 95vh !important;
    }
    
    .modal-body {
        max-height: calc(95vh - 120px) !important;
    }
    
    .modal-header h2 {
        font-size: 1.125rem;
    }
    
    .canvas-status {
        bottom: 50px;
        font-size: 0.75rem;
        padding: var(--space-xs) var(--space-sm);
    }
    
    /* Small screen: toast container adjustments */
    .toast-container {
        top: 70px;
        right: var(--space-sm);
        left: var(--space-sm);
        max-height: calc(100vh - 120px);
    }
    
    .toast {
        min-width: auto;
    }
    
    /* Small screen: sidebar needs more bottom padding for footer */
    .sidebar {
        padding-bottom: 40px;
    }
}

/* ============================================
   FEATURE ACCESS CONTROL
   Use these classes to show/hide elements based on login status
   ============================================ */

/* Elements with .extra-feature-only are hidden by default */
.extra-feature-only {
    display: none !important;
}

/* Show .extra-feature-only elements when user has extra features */
body.has-extra-features .extra-feature-only {
    display: flex !important;
}

/* Hide .hide-for-extra-features elements when user has extra features */
body.has-extra-features .hide-for-extra-features {
    display: none !important;
}

/* ============================================
   PARK SETTINGS DROPDOWN
   ============================================ */

.dropdown-wrapper {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    min-width: 220px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    overflow: hidden;
}

.dropdown-menu.open {
    display: block;
}

.dropdown-header {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-tertiary);
}

.dropdown-item {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
}

.dropdown-item:last-child {
    border-bottom: none;
}

/* Toggle switch styles */
.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.toggle-input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background: #9ca3af;
    border-radius: 10px;
    transition: background 0.2s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: var(--text-primary);
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-input:checked + .toggle-slider {
    background: #2f4050;
}

.toggle-input:checked + .toggle-slider::after {
    transform: translateX(16px);
}

/* Input with suffix styles */
.input-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.input-with-suffix {
    display: flex;
    align-items: center;
    gap: 4px;
}

.input-with-suffix input {
    width: 60px;
    padding: 4px 8px;
    font-size: 0.8125rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-align: right;
}

.input-with-suffix input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.input-suffix {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ============================================
   TUTORIAL SYSTEM
   ============================================ */

/* Tutorial Overlay Container */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    pointer-events: none;
}

.tutorial-overlay.active {
    pointer-events: auto;
}

/* Dark backdrop with hole for spotlight */
.tutorial-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    transition: opacity 0.3s ease;
}

/* Spotlight effect - highlights the target element */
.tutorial-spotlight {
    position: absolute;
    border-radius: 8px;
    box-shadow: 
        0 0 0 9999px rgba(0, 0, 0, 0.75),
        0 0 0 4px var(--accent-primary),
        0 0 20px 4px rgba(99, 102, 241, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

/* Tooltip box */
.tutorial-tooltip {
    position: absolute;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    min-width: 300px;
    max-width: 400px;
    z-index: 10001;
    animation: tutorial-tooltip-enter 0.3s ease-out;
    pointer-events: auto;
    transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes tutorial-tooltip-enter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tooltip arrow */
.tutorial-tooltip-arrow {
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    transform: rotate(45deg);
    z-index: -1;
}

.tutorial-tooltip-arrow.arrow-top {
    top: -9px;
    left: 50%;
    margin-left: -8px;
    border-right: none;
    border-bottom: none;
}

.tutorial-tooltip-arrow.arrow-bottom {
    bottom: -9px;
    left: 50%;
    margin-left: -8px;
    border-left: none;
    border-top: none;
}

.tutorial-tooltip-arrow.arrow-left {
    left: -9px;
    top: 50%;
    margin-top: -8px;
    border-right: none;
    border-top: none;
}

.tutorial-tooltip-arrow.arrow-right {
    right: -9px;
    top: 50%;
    margin-top: -8px;
    border-left: none;
    border-bottom: none;
}

/* Tooltip content */
.tutorial-tooltip-content {
    padding: 20px;
}

.tutorial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tutorial-step-indicator {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tutorial-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 12px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    touch-action: manipulation; /* Better touch response */
    -webkit-tap-highlight-color: transparent;
}

.tutorial-close-btn:hover,
.tutorial-close-btn:active {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.tutorial-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.tutorial-description {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.tutorial-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.tutorial-actions .btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================
   LOADING SCREEN (While checking auth)
============================================ */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e293b 0%, #2f4050 50%, #1e293b 100%);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: loading-fade-in 0.2s ease-out;
    visibility: visible;
    opacity: 1;
}

body:not(.checking-auth) .loading-screen {
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease-out, visibility 0s 0.2s;
}

@keyframes loading-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.loading-content {
    text-align: center;
}

.loading-logo {
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loading-icon {
    font-size: 4rem;
    color: var(--accent-primary);
    line-height: 1;
    text-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
    animation: loading-icon-pulse 2s ease-in-out infinite;
}

@keyframes loading-icon-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

.loading-logo h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    letter-spacing: -0.01em;
}

.loading-subtitle {
    font-size: 0.875rem;
    color: #a0a0a0;
    margin: 0;
    font-weight: 400;
    text-transform: lowercase;
}

.loading-spinner {
    margin-top: 32px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(148, 163, 184, 0.2);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spinner-rotate 0.8s linear infinite;
    margin: 0 auto 16px auto;
}

.loading-text {
    font-size: 0.875rem;
    color: #94a3b8;
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

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

/* ============================================
   AUTH GATE (Login Screen)
============================================ */

.auth-gate {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e293b 0%, #2f4050 50%, #1e293b 100%); /* Logo blue-grey gradient */
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: auth-fade-in 0.4s ease-out;
    visibility: hidden; /* Hidden by default */
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

/* Show auth gate when body has showing-auth-gate class (exclude maintenance gate) */
body.showing-auth-gate .auth-gate:not(.maintenance-gate) {
    visibility: visible;
    opacity: 1;
}

/* Show maintenance gate when body has showing-maintenance class */
body.showing-maintenance .maintenance-gate {
    visibility: visible;
    opacity: 1;
}

@keyframes auth-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.auth-gate-content {
    text-align: center;
    max-width: 440px;
    padding: 48px 40px;
    background: rgba(47, 64, 80, 0.85); /* Logo blue-grey with transparency */
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.auth-gate-logo {
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* CSS Recreation of Hallmark Sundecks Logo */
.hallmark-logo {
    position: relative;
    display: inline-block;
    padding: 24px 36px;
    background: #2f4050; /* Logo background color */
    border-radius: var(--radius-md);
    animation: auth-logo-fade-in 0.6s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hallmark-logo-lines {
    position: absolute;
    top: 12px;
    right: 28px;
    width: 65px;
    height: 45px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 5px;
}

.hallmark-line {
    height: 2.5px;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 30%, #cbd5e1 60%, #94a3b8 100%);
    box-shadow: 
        0 1px 2px rgba(255, 255, 255, 0.4),
        inset 0 1px 1px rgba(255, 255, 255, 0.2);
    transform-origin: left center;
    border-radius: 1px;
}

.hallmark-line-1 {
    width: 55px;
    transform: rotate(18deg);
    margin-left: 0;
}

.hallmark-line-2 {
    width: 48px;
    transform: rotate(18deg);
    margin-left: 3px;
}

.hallmark-line-3 {
    width: 42px;
    transform: rotate(18deg);
    margin-left: 6px;
}

.hallmark-logo-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    position: relative;
    z-index: 1;
}

.hallmark-main {
    font-family: var(--font-sans);
    font-size: 2.75rem;
    font-weight: 400;
    color: #ffffff;
    text-transform: lowercase;
    letter-spacing: -0.01em;
    line-height: 1.1;
    margin: 0;
    font-style: normal;
}

.hallmark-sub {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 400;
    color: #a0a0a0;
    text-transform: lowercase;
    letter-spacing: 0.02em;
    line-height: 1;
    margin: 0;
    margin-top: 1px;
}

@keyframes auth-logo-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-gate-icon {
    font-size: 4rem;
    color: var(--accent-primary);
    line-height: 1;
    margin-bottom: var(--space-sm);
    text-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
    animation: auth-logo-fade-in 0.6s ease-out;
}

.auth-gate-logo h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    letter-spacing: -0.01em;
    text-transform: lowercase;
    font-family: var(--font-sans);
}

.auth-gate-subtitle {
    font-size: 0.875rem;
    color: #a0a0a0; /* Logo grey */
    margin: 0;
    font-weight: 400;
    text-transform: lowercase;
}

.auth-gate-message {
    margin-bottom: 32px;
}

.auth-gate-message h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0 0 8px 0;
}

.auth-gate-message p {
    font-size: 0.9375rem;
    color: #94a3b8;
    line-height: 1.5;
    margin: 0;
}

.auth-gate-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

/* Sign-in buttons */
.btn-signin {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-signin.btn-google {
    background: #ffffff;
    color: #1f2937;
}

.btn-signin.btn-google:hover {
    background: #f3f4f6;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.15);
}

.btn-signin.btn-microsoft {
    background: #2f2f2f;
    color: #ffffff;
    border: 1px solid #404040;
}

.btn-signin.btn-microsoft:hover {
    background: #404040;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.btn-signin svg {
    flex-shrink: 0;
}

/* FAQ Section */
.auth-gate-info {
    text-align: left;
}

.auth-gate-faq {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.auth-gate-faq summary {
    padding: 12px 16px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auth-gate-faq summary::-webkit-details-marker {
    display: none;
}

.auth-gate-faq summary::after {
    content: '+';
    font-size: 1.25rem;
    color: #64748b;
    transition: transform 0.2s ease;
}

.auth-gate-faq[open] summary::after {
    transform: rotate(45deg);
}

.auth-gate-faq summary:hover {
    color: #e2e8f0;
    background: rgba(148, 163, 184, 0.05);
}

.auth-gate-faq-content {
    padding: 0 16px 16px 16px;
    font-size: 0.8125rem;
    color: #94a3b8;
    line-height: 1.6;
    animation: faq-expand 0.2s ease-out;
}

@keyframes faq-expand {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-gate-faq-content p {
    margin: 0 0 12px 0;
}

.auth-gate-faq-content ul {
    margin: 0 0 12px 0;
    padding-left: 20px;
}

.auth-gate-faq-content li {
    margin-bottom: 4px;
}

.auth-gate-privacy {
    padding: 12px;
    background: rgba(96, 165, 250, 0.1);
    border-radius: 6px;
    border-left: 3px solid #60a5fa;
    margin-bottom: 0 !important;
}

.auth-gate-privacy strong {
    color: #60a5fa;
}

/* Responsive auth gate */
@media (max-width: 480px) {
    .auth-gate-content {
        margin: 16px;
        padding: 32px 24px;
    }
    
    .auth-gate-logo h1 {
        font-size: 1.75rem;
    }
    
    .auth-gate-icon {
        font-size: 3rem;
    }
    
    .btn-signin {
        padding: 12px 20px;
        font-size: 0.9375rem;
    }
}

/* Welcome Screen */
.welcome-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: welcome-fade-in 0.5s ease-out;
}

@keyframes welcome-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.welcome-content {
    text-align: center;
    max-width: 500px;
    padding: 40px;
}

.welcome-logo {
    margin-bottom: 40px;
}

.welcome-icon {
    display: inline-block;
    font-size: 4rem;
    color: var(--accent-primary);
    margin-bottom: 16px;
    animation: welcome-logo-pulse 2s ease-in-out infinite;
}

@keyframes welcome-logo-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.welcome-logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.02em;
}

.welcome-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    margin: 8px 0 0 0;
}

.welcome-message {
    margin-bottom: 40px;
}

.welcome-message h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.welcome-message p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.welcome-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.welcome-actions .btn-lg {
    padding: 16px 32px;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.welcome-actions .btn-sm {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Tutorial highlight pulse animation */
@keyframes tutorial-pulse {
    0%, 100% {
        box-shadow: 
            0 0 0 9999px rgba(0, 0, 0, 0.75),
            0 0 0 4px var(--accent-primary),
            0 0 20px 4px rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 
            0 0 0 9999px rgba(0, 0, 0, 0.75),
            0 0 0 6px var(--accent-primary),
            0 0 30px 8px rgba(99, 102, 241, 0.6);
    }
}

.tutorial-spotlight.pulse {
    animation: tutorial-pulse 1.5s ease-in-out infinite;
}

/* Canvas blank state */
.canvas-blank-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-muted);
    pointer-events: none;
}

.canvas-blank-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.canvas-blank-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
}

.canvas-blank-state p {
    font-size: 0.9375rem;
    margin: 0;
}

/* Hide sidebar when showing welcome screen */
body.showing-welcome .sidebar,
body.showing-welcome .canvas-toolbar,
body.showing-welcome .statistics-panel,
body.showing-welcome .materials-summary-panel,
body.showing-welcome .pricing-display,
body.showing-welcome .canvas-status,
body.showing-welcome .admin-floating-btn {
    opacity: 0;
    pointer-events: none;
}


/* Saved project actions (rename/delete buttons) */
.saved-project-actions {
    display: flex;
    gap: var(--space-xs);
    flex-shrink: 0;
}

.saved-project-rename {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-tertiary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.saved-project-rename:hover {
    color: var(--accent-primary);
    background: rgba(var(--accent-primary-rgb), 0.1);
}

.saved-project-rename svg {
    stroke: currentColor;
}

/* Rename modal */
.rename-modal {
    max-width: 400px;
}

.rename-modal .modal-body {
    padding: var(--space-lg);
}

.rename-modal .project-name-input {
    width: 100%;
}

/* ==================== QUOTE METADATA MODAL ==================== */

.quote-metadata-modal {
    max-width: 480px;
}

.quote-metadata-modal .modal-body {
    padding: var(--space-lg);
    max-height: 65vh;
    overflow-y: auto;
}

/* Collapsible sections */
.quote-metadata-section-divider.collapsible {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    transition: background var(--transition-fast);
    margin-left: calc(var(--space-md) * -1);
    margin-right: calc(var(--space-md) * -1);
    padding-left: var(--space-md);
    padding-right: var(--space-md);
    border-radius: var(--radius-sm);
}

.quote-metadata-section-divider.collapsible:hover {
    background: var(--bg-secondary);
}

.quote-metadata-section-divider.collapsible .collapse-icon {
    transition: transform 0.2s ease;
    color: var(--text-secondary);
}

.quote-metadata-section-divider.collapsible.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.collapsible-content {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.2s ease;
    max-height: 500px;
    opacity: 1;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.quote-metadata-intro {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    line-height: 1.5;
}

.quote-metadata-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.quote-metadata-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.quote-metadata-row.full-width {
    grid-template-columns: 1fr;
}

.quote-metadata-section-divider {
    margin: 20px 0 15px 0;
    padding-top: 15px;
    border-top: 1px solid var(--border-subtle);
}

.quote-metadata-section-divider h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
}

/* Deposit Section Styles */
.deposit-input-group {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.deposit-percentage-input {
    width: 80px !important;
    text-align: center;
    -webkit-user-select: text;
    user-select: text;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

.deposit-suffix {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.deposit-calculated-value {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.deposit-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: var(--space-sm);
}

/* Travel Costs Admin Grid */
.travel-costs-grid {
    margin-bottom: var(--space-md);
}

.travel-costs-table {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
}

.travel-costs-header,
.travel-costs-row {
    display: grid;
    grid-template-columns: 140px repeat(5, 1fr);
    gap: var(--space-xs);
    align-items: center;
}

/* 7 column variant for all time ranges (no stay over) */
.travel-costs-7col .travel-costs-header,
.travel-costs-7col .travel-costs-row {
    grid-template-columns: 140px repeat(7, 1fr);
}

/* 3 column variant for stay over (2hr+ only) */
.travel-costs-3col .travel-costs-header,
.travel-costs-3col .travel-costs-row {
    grid-template-columns: 140px repeat(3, 1fr);
}

.travel-costs-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border-subtle);
}

.travel-costs-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
}

.admin-input-with-prefix.compact {
    max-width: 80px;
}

.admin-input-with-prefix.compact input {
    padding: var(--space-xs);
    font-size: 0.8125rem;
    width: 50px;
}

/* Travel Costs Modal Selection */
.travel-costs-selection {
    padding: var(--space-sm) 0;
}

.travel-costs-toggle-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    padding: var(--space-sm) 0;
}

.travel-costs-toggle-label .toggle-text {
    font-weight: 500;
    color: var(--text-primary);
}

.travel-cost-display {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent-primary);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    text-align: center;
}

.travel-costs-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    margin: var(--space-md) 0;
}

.travel-costs-toggle-row {
    margin-bottom: var(--space-sm);
}

/* Disabled dropdown styling */
.quote-field-input:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Inline hint for disabled fields */
.field-hint-inline {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    font-style: italic;
}

.quote-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.quote-field label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.quote-field label .required {
    color: var(--accent-error, #ef4444);
    margin-left: 2px;
}

.quote-field-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.quote-field-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.quote-field-input::placeholder {
    color: var(--text-tertiary);
}

.quote-field-input.readonly {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: not-allowed;
    border-color: var(--border-subtle);
}

.quote-field-textarea {
    width: 100%;
    min-height: 80px;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.quote-field-textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.quote-field-textarea::placeholder {
    color: var(--text-tertiary);
}

.quote-field-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
}

.quote-metadata-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(54, 54, 57, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: var(--radius-lg);
}

.quote-metadata-loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    color: var(--text-primary);
}

.quote-metadata-loading-spinner .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-default);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.quote-metadata-loading-spinner p {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.quote-metadata-modal {
    position: relative;
}

.quote-metadata-modal .modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
}

.quote-metadata-modal .modal-footer-actions {
    display: flex;
    gap: var(--space-sm);
}

/* ==================== QUOTE MODAL & PRINT STYLES ==================== */

/* Quote Modal - uses flexbox to ensure footer never gets cut off */
.quote-modal {
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.quote-modal .modal-header {
    flex-shrink: 0;
}

.quote-modal .modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0; /* Critical for flexbox scrolling */
    padding: 0;
}

.quote-modal .modal-footer {
    flex-shrink: 0; /* Footer NEVER shrinks - always visible */
}

/* PDF Preview Modal (in-app viewer) */
#pdf-preview-modal {
    z-index: 1200;
}

.pdf-preview-modal {
    max-width: 900px;
    width: 92vw;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

.pdf-preview-modal .modal-body {
    flex: 1 1 auto;
    padding: 0;
    background: var(--bg-secondary);
}

.pdf-preview-pages {
    height: 100%;
    overflow: auto;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.pdf-preview-page {
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: var(--space-sm);
    display: flex;
    justify-content: center;
}

.pdf-preview-page canvas {
    width: 100%;
    height: auto;
}

.pdf-preview-loading {
    padding: var(--space-lg);
    text-align: center;
    color: var(--text-secondary);
}

#quote-content {
    padding: var(--space-lg);
}

/* Quote Header */
.quote-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--border-default);
}

.quote-company {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.quote-company-logo {
    font-size: 2rem;
    color: var(--accent-primary);
}

.quote-company h1 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--text-primary);
}

.quote-company p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.quote-date {
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.quote-date strong {
    display: block;
    font-size: 1rem;
    color: var(--text-primary);
}

/* Quote Design Image */
.quote-design {
    margin-bottom: var(--space-lg);
}

.quote-design h2 {
    font-size: 1.1rem;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.quote-design-image {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    text-align: center;
}

.quote-design-image img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

/* Landscape canvas image - MAXIMUM SIZE for both Sales and Surveyor */
.quote-design-image.landscape-canvas-image {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    border: none;
}

.quote-design-image.landscape-canvas-image img {
    width: 100%;
    max-width: 100%;
    max-height: 80vh;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Surveyor version: Larger diagram */
.quote-caravan-diagram.surveyor-diagram {
    width: 100%;
    margin-bottom: var(--space-lg);
}

.quote-caravan-diagram.surveyor-diagram .caravan-shape-svg {
    min-height: 400px;
}

/* Quote Specifications */
.quote-specs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.quote-spec-group {
    background: var(--bg-tertiary);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
}

.quote-spec-group h3 {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quote-spec-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.quote-heights-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 16px;
    font-size: 0.9rem;
}

.quote-heights-grid span {
    font-weight: 500;
}

/* Caravan Shape Diagram for Quote/PDF - LANDSCAPE */
.quote-caravan-diagram {
    text-align: center;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    width: 100%;
    box-sizing: border-box;
}

.quote-caravan-diagram h3 {
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.caravan-shape-svg {
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
    display: block;
    margin: 0 auto;
    width: 100%;
    max-width: 100%;
    height: auto;
}

.quote-colour-swatch {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    margin-right: 8px;
    vertical-align: middle;
    border: 2px solid #333;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
}

.quote-step-item {
    font-size: 0.85em;
    padding: 2px 0;
}

.quote-steps-info .quote-spec-value {
    font-size: 0.9em;
}

/* Quote Pricing Table */
.quote-pricing {
    margin-bottom: var(--space-lg);
}

.quote-pricing h2 {
    font-size: 1.1rem;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.quote-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.quote-table th,
.quote-table td {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--border-default);
}

.quote-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
}

.quote-table td:last-child {
    text-align: right;
    font-weight: 500;
}

.quote-table tr:last-child td {
    border-bottom: none;
}

.quote-table .subtotal-row td {
    padding-top: var(--space-md);
    border-top: 2px solid var(--border-default);
}

.quote-table .vat-row td {
    color: var(--text-secondary);
}

.quote-table .total-row td {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-primary);
    padding-top: var(--space-md);
    border-top: 2px solid var(--accent-primary);
}

/* Quote Footer */
.quote-footer {
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-default);
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.quote-footer p {
    margin: var(--space-xs) 0;
}

/* Print Button */
#quote-print {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

#quote-print svg {
    stroke: currentColor;
}

/* ==================== PRINT STYLES ==================== */
@media print {
    /* Page setup - LANDSCAPE for larger deck images */
    @page {
        margin: 8mm;
        size: A4 landscape;
    }
    
    /* Prevent blank first page */
    html, body {
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important;
        min-height: 0 !important;
    }
    
    /* Hide everything except quote content */
    body * {
        visibility: hidden;
    }
    
    #quote-modal,
    #quote-modal * {
        visibility: visible;
    }
    
    #quote-modal {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: auto !important;
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
    }
    
    .quote-modal {
        max-width: 100% !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        background: white !important;
        position: static !important;
        transform: none !important;
    }
    
    .quote-modal .modal-header,
    .quote-modal .modal-footer {
        display: none !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* Quote Modal Footer Layout */
.quote-modal .modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--space-md);
    flex-wrap: nowrap;
    min-height: auto;
    padding: var(--space-md) var(--space-lg);
}

#quote-footer-left {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    order: 1;
}

#quote-footer-right {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex: 0 0 auto;
    flex-shrink: 0;
    order: 2;
    margin-left: auto;
}

#quote-request-discount {
    white-space: nowrap;
    font-size: 0.875rem;
    padding: var(--space-xs) var(--space-sm);
}

/* Tablet/iPad optimizations removed - flexbox layout now in base .quote-modal rule */

@media (max-width: 768px) {
    .quote-modal {
        max-width: 98vw !important;
        max-height: 90vh !important;
        width: 98vw !important;
    }
    
    .quote-modal .modal-body {
        max-height: calc(90vh - 100px) !important;
        overflow-y: auto;
        padding: var(--space-xs) !important;
    }
    
    .quote-modal .modal-footer {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        align-items: center !important;
        padding: var(--space-xs) !important;
        gap: var(--space-xs) !important;
    }
    
    #quote-footer-left {
        display: none !important; /* Hide discount button on small screens */
    }
    
    #quote-footer-right {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 4px !important;
        width: 100%;
    }
    
    #quote-footer-right .btn {
        font-size: 0.75rem !important;
        padding: 5px 8px !important;
        flex: 0 0 auto;
        white-space: nowrap;
    }
    
    #quote-content {
        padding: var(--space-xs) !important;
    }
    
    /* Reduce spacing in quote design section for portrait */
    .quote-design h2 {
        margin-bottom: 4px !important;
        font-size: 1rem !important;
    }
    
    .quote-design-image {
        padding: 4px !important;
        margin: 0 !important;
    }
    
    .quote-design-image.landscape-canvas-image img {
        max-height: 40vh !important;
    }
}

/* Discount Request Item Styles */
.discount-request-item {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    background: var(--surface-1);
}

.discount-request-item:hover {
    border-color: var(--border-strong);
}

/* Discount Row in Quote Table */
.commission-row {
    color: var(--text-secondary);
}

.discount-row {
    color: var(--accent-primary);
    font-weight: 500;
}

@media print {
    .quote-modal .modal-body {
        max-height: none !important;
        overflow: visible !important;
        background: white !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    #quote-content {
        padding: 5mm !important;
        background: white !important;
        margin: 0 !important;
    }
    
    /* Ensure quote content starts at top of page */
    .quote-container {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    
    /* Force light mode colors for print - override dark mode */
    #quote-content,
    #quote-content * {
        color: #1a1a1a !important;
        background-color: transparent !important;
    }
    
    .quote-header {
        background: white !important;
        border-bottom: 2px solid #333 !important;
    }
    
    .quote-company h1 {
        color: #1a1a1a !important;
    }
    
    .quote-company p {
        color: #555 !important;
    }
    
    .quote-company-logo {
        color: #2c7a7b !important;
        background: transparent !important;
    }
    
    .quote-date {
        color: #333 !important;
    }
    
    .quote-design h2,
    .quote-pricing h2 {
        color: #1a1a1a !important;
        border-bottom: 1px solid #ddd !important;
        font-size: 14pt !important;
        margin-bottom: 5mm !important;
    }
    
    /* Design section - full page 1 */
    .quote-design {
        margin-bottom: 0 !important;
    }
    
    /* Specs section - page 2, compact to fit with pricing */
    .quote-specs {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 3mm !important;
        margin-bottom: 5mm !important;
        font-size: 10pt !important;
    }
    
    .quote-spec-group {
        padding: 3mm !important;
        flex: 1 1 auto !important;
        min-width: 100px !important;
        background: #f5f5f5 !important;
        border: 1px solid #ddd !important;
    }
    
    .quote-spec-group h3 {
        font-size: 9pt !important;
        margin-bottom: 2mm !important;
        font-weight: bold !important;
    }
    
    .quote-spec-value {
        font-size: 10pt !important;
    }
    
    /* Pricing section - ensure it fits on page 2 */
    .quote-pricing {
        page-break-inside: avoid !important;
    }
    
    /* Ensure colors print - CRITICAL for color swatches */
    .quote-colour-swatch {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
        /* Force background to print */
        border: 2px solid #333 !important;
        width: 24px !important;
        height: 24px !important;
    }
    
    .quote-spec-group {
        background: #f5f5f5 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
    
    .quote-spec-group h3 {
        color: #666 !important;
    }
    
    .quote-spec-value {
        color: #1a1a1a !important;
    }
    
    .quote-step-item {
        color: #333 !important;
        font-size: 12px !important;
    }
    
    /* Caravan shape diagram print styles - LANDSCAPE */
    .quote-caravan-diagram {
        background: #f9f9f9 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
        page-break-inside: avoid;
        margin-bottom: 16px !important;
        padding: 12px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .quote-caravan-diagram h3 {
        color: #111 !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        margin-bottom: 8px !important;
    }
    
    .caravan-shape-svg {
        background: white !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 150px !important;
    }
    
    .caravan-shape-svg .caravan-fill {
        fill: #e5e7eb !important;
        stroke: #1f2937 !important;
        stroke-width: 2 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
    
    .van-dims-text {
        display: none !important;
    }
    
    .quote-table {
        background: white !important;
    }
    
    .quote-table th {
        background: #f5f5f5 !important;
        color: #333 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .quote-table td {
        color: #1a1a1a !important;
        border-bottom: 1px solid #ddd !important;
    }
    
    .quote-table .subtotal-row td,
    .quote-table .vat-row td,
    .quote-table .total-row td {
        color: #1a1a1a !important;
    }
    
    .quote-table .total-row {
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .quote-footer {
        color: #666 !important;
        border-top: 1px solid #ddd !important;
    }
    
    .quote-footer p {
        color: #666 !important;
    }
    
    /* Page break control */
    .quote-pricing {
        page-break-inside: avoid;
    }
    
    .quote-design-image img {
        max-height: 400px;
        object-fit: contain;
    }
    
    /* Landscape canvas image for PDF - FULL PAGE 1, specs on page 2 */
    .quote-design {
        page-break-after: always !important; /* Force specs onto page 2 */
    }
    
    .quote-design-image.landscape-canvas-image {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        page-break-inside: avoid;
        background: transparent !important;
        border: none !important;
    }
    
    .quote-design-image.landscape-canvas-image img {
        max-height: 160mm !important; /* Large - fills page 1 under header */
        width: auto !important;
        max-width: 275mm !important;
        height: auto !important;
        object-fit: contain !important;
        display: block !important;
        margin: 0 auto !important;
        page-break-inside: avoid;
    }
    
    /* Surveyor version: Larger diagram for PDF */
    .quote-caravan-diagram.surveyor-diagram {
        width: 100% !important;
        page-break-inside: avoid;
    }
    
    .quote-caravan-diagram.surveyor-diagram .caravan-shape-svg {
        min-height: 400px !important;
        height: auto !important;
    }
    
    /* Ensure SVG color swatches print correctly */
    .quote-spec-value svg {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
}

/* Get Quote Button */
.get-quote-btn {
    width: 100%;
    margin-top: var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
}

.get-quote-btn svg {
    stroke: currentColor;
}

/* ============================================
   ADMIN PANEL
============================================ */

/* Admin-only elements - hidden by default */
.admin-only {
    display: none !important;
}

/* Sales-only elements - hidden by default, shown for sales staff */
.sales-only {
    display: none !important;
}

/* Show sales-only elements when user is sales staff */
body.is-sales .sales-only {
    display: flex !important;
}

/* Sales header button needs inline-flex, not flex */
body.is-sales .sales-only.sales-header-btn,
body.is-sales .sales-header-btn.sales-only {
    display: inline-flex !important;
}

/* Sales buttons should use inline-flex */
body.is-sales .sales-only.btn,
body.is-sales .btn.sales-only {
    display: inline-flex !important;
}

/* Sales modal overlays stay hidden until opened via JS */
body.is-sales .sales-only.modal-overlay {
    display: none !important;
}

/* When modal has .is-open class, show it */
body.is-sales .sales-only.modal-overlay.is-open {
    display: flex !important;
}

/* Sales header button styling */
.sales-header-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sales-header-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.sales-header-btn svg {
    flex-shrink: 0;
}

/* ===========================================
   MODAL Z-INDEX HIERARCHY
   ===========================================
   Level 1000: Base modals (default .modal-overlay)
   Level 1050: Modals opened FROM base modals (e.g., save-load → delete/rename)
   Level 1100: Modals opened FROM admin-panel (user-role, park-group, admin-delete)
   Level 1200: Top-level generic confirm (can be invoked from anywhere)
   =========================================== */

/* Level 1050: Modals that open from save-load-modal */
#delete-confirm-modal,
#rename-project-modal {
    z-index: 1050 !important; /* Above save-load-modal (z-index: 1000) */
}

/* Level 1100: User Role and Park Group modals - appear above Admin Panel */
#user-role-modal,
#park-group-modal,
#non-partner-park-modal {
    z-index: 1100 !important; /* Above admin panel (z-index: 1000) */
}

/* Level 1100: Admin delete confirmation modals - appear above Admin Panel */
#admin-delete-confirm-modal,
#admin-bulk-delete-confirm-modal {
    z-index: 1100 !important; /* Above admin panel (z-index: 1000) */
}

/* Level 1200: Generic confirm modal - appears above ALL other modals */
#generic-confirm-modal {
    z-index: 1200 !important; /* Above user-role/park-group modals (z-index: 1100) */
}

/* ==================== TEAM PROJECTS MODAL ==================== */
.team-projects-modal {
    width: 95%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.team-projects-modal .modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.team-projects-modal .modal-header h3 {
    display: flex;
    align-items: center;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.team-projects-search-container {
    position: relative;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.team-projects-search-container .search-icon {
    position: absolute;
    left: calc(var(--space-lg) + 12px);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.team-projects-search-container input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.team-projects-search-container input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.team-projects-search-container input::placeholder {
    color: var(--text-muted);
}

.team-projects-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    min-height: 200px;
}

.team-projects-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    color: var(--text-secondary);
    gap: var(--space-md);
}

.team-projects-state .spinner {
    animation: spin 1s linear infinite;
}

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

/* Team Projects User Section */
.team-project-user {
    margin-bottom: var(--space-xl);
}

.team-project-user:last-child {
    margin-bottom: 0;
}

.team-project-user-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.team-project-user-header svg {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.team-project-user-header .user-name {
    font-weight: 600;
    color: var(--text-primary);
}

.team-project-user-header .user-email {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.team-project-user-header .role-badge {
    background: var(--accent-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Team Project Card */
.team-project-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    margin-left: var(--space-lg);
    margin-bottom: var(--space-xs);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.team-project-card:hover {
    border-color: var(--border-default);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.team-project-card:last-child {
    margin-bottom: 0;
}

.team-project-info {
    flex: 1;
    min-width: 0;
}

.team-project-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.team-project-meta span {
    display: inline-flex;
    align-items: center;
}

.team-project-meta span:not(:last-child)::after {
    content: '•';
    margin-left: var(--space-xs);
    color: var(--text-muted);
}

.team-project-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.team-project-actions {
    display: flex;
    gap: var(--space-xs);
    flex-shrink: 0;
}

/* Mobile responsive */
@media (max-width: 640px) {
    .team-projects-modal {
        max-height: 95vh;
        max-width: 100%;
        margin: var(--space-sm);
        border-radius: var(--radius-md);
    }
    
    .team-project-card {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .team-project-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Access Denied Screen */
#access-denied-overlay {
    background: var(--bg-primary);
}

.access-denied-content {
    text-align: center;
    padding: var(--space-xl);
    max-width: 500px;
}

.access-denied-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
}

.access-denied-content h2 {
    color: var(--accent-danger);
    margin-bottom: var(--space-md);
    font-size: 1.75rem;
}

.access-denied-content p {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    line-height: 1.6;
}

.access-denied-content strong {
    color: var(--text-primary);
}

.access-denied-help {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    margin-bottom: var(--space-lg) !important;
}

/* Show admin-only elements when user is admin */
body.is-admin .admin-only {
    display: flex !important;
}

/* Admin header button needs inline-flex, not flex */
body.is-admin .admin-only.admin-header-btn,
body.is-admin .admin-header-btn.admin-only {
    display: inline-flex !important;
}

/* Owner-only elements - hidden from ADMIN */
.owner-only {
    display: none !important;
}

/* Show owner-only elements when user is OWNER */
body.is-owner .owner-only {
    display: flex !important;
}

body.is-owner .owner-only.admin-tab {
    display: flex !important;
}

/* Buttons should use inline-flex - must override general admin-only rule */
body.is-admin .admin-only.btn,
body.is-admin .admin-only.btn-icon,
body.is-admin .admin-only.admin-header-btn,
body.is-admin .admin-header-btn.admin-only,
body.is-admin .btn.admin-only {
    display: inline-flex !important;
}

/* Modal overlays stay hidden until opened via JS */
body.is-admin .admin-only.modal-overlay {
    display: none !important;
}

/* When modal has .is-open class, show it */
body.is-admin .admin-only.modal-overlay.is-open {
    display: flex !important;
}

/* Floating Admin Button (bottom right, above pricing panel) */
.admin-floating-btn {
    position: fixed;
    bottom: 180px;
    right: 20px;
    z-index: 1000;
    display: none; /* Hidden by default, shown via .admin-only rules */
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #000;
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.admin-floating-btn:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5), 0 4px 8px rgba(0, 0, 0, 0.3);
}

.admin-floating-btn:active {
    transform: translateY(0);
}

.admin-floating-btn svg {
    stroke: currentColor;
    flex-shrink: 0;
}

/* Show floating admin button for admins */
body.is-admin .admin-floating-btn {
    display: flex !important;
}

/* Admin header button styling */
.admin-header-btn {
    display: none !important; /* Hidden by default */
    padding: 6px 16px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #000;
    border: none;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    transition: all 0.2s ease;
}

.admin-header-btn:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.admin-header-btn:active {
    transform: translateY(0);
}

/* Show admin header button for admins */
/* Note: Must override .admin-only default hidden state */
body.is-admin .admin-header-btn.admin-only,
body.is-admin .admin-header-btn {
    display: inline-flex !important;
    align-items: center;
}

/* Admin Global Settings Warning */
.admin-global-warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.15) 100%);
    border: 2px solid var(--accent-warning);
    border-radius: 8px;
    color: var(--text-primary);
}

.admin-global-warning svg {
    flex-shrink: 0;
    color: var(--accent-warning);
    margin-top: 2px;
}

.admin-global-warning strong {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-warning);
    margin-bottom: 6px;
}

.admin-global-warning p {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.admin-global-warning p strong {
    display: inline;
    color: var(--accent-warning);
    font-weight: 700;
}

/* Admin Panel Modal */
.admin-panel-modal {
    width: 95%;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.admin-panel-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Admin Tabs (Sidebar) */
.admin-tabs {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    min-width: 160px;
    flex-shrink: 0;
}

.admin-tab {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.admin-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.admin-tab.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.admin-tab svg {
    flex-shrink: 0;
}

/* Admin Tab Panels */
.admin-tab-panels {
    flex: 1;
    padding: var(--space-lg);
    overflow-y: auto;
    min-height: 0;
}

.admin-tab-panel {
    display: none;
    animation: fadeIn 0.2s ease;
}

.admin-tab-panel.active {
    display: block;
}

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

/* Admin Sections */
.admin-section {
    margin-bottom: var(--space-xl);
}

.admin-section:last-child {
    margin-bottom: 0;
}

.admin-section h4 {
    margin: 0 0 var(--space-xs) 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.admin-section-desc {
    margin: 0 0 var(--space-md) 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Admin Textareas */
.admin-textarea {
    width: 100%;
    min-height: 150px;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Space Mono', 'Consolas', 'Monaco', monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

.admin-textarea::placeholder {
    color: var(--text-tertiary);
}

.admin-textarea.admin-json {
    min-height: 350px;
    font-size: 0.75rem;
}

.admin-textarea.has-error {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.admin-json-error {
    margin-top: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid var(--error);
    border-radius: var(--radius-sm);
    color: var(--error);
    font-size: 0.75rem;
    font-family: 'Space Mono', monospace;
    display: none;
}

.admin-json-error.visible {
    display: block;
}

/* Admin Projects Accordion */
.admin-park-header,
.admin-user-header {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    transition: background 0.15s ease;
}

.admin-park-header {
    background: var(--bg-secondary);
    margin-bottom: var(--space-xs);
}

.admin-park-header:hover {
    background: var(--bg-tertiary);
}

.admin-user-header {
    margin-left: var(--space-lg);
    margin-bottom: var(--space-xs);
    background: transparent;
}

.admin-user-header:hover {
    background: var(--bg-secondary);
}

.admin-park-header .accordion-chevron,
.admin-user-header .accordion-chevron {
    width: 16px;
    height: 16px;
    margin-right: var(--space-sm);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.admin-park-header.expanded .accordion-chevron,
.admin-user-header.expanded .accordion-chevron {
    transform: rotate(90deg);
}

.admin-park-header .accordion-title {
    flex: 1;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.admin-user-header .accordion-title {
    flex: 1;
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.accordion-badge {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: var(--space-xs);
    white-space: nowrap;
}

.accordion-role-badge {
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: var(--space-xs);
    background: var(--accent-primary);
    color: white;
    font-weight: 500;
}

.admin-park-body,
.admin-user-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s ease;
}

.admin-park-body.expanded,
.admin-user-body.expanded {
    max-height: none;
}

.admin-park-group {
    margin-bottom: var(--space-sm);
}

.admin-user-group {
    margin-bottom: var(--space-xs);
}

.admin-user-body .admin-project-card {
    margin-left: calc(var(--space-lg) + var(--space-lg));
}

/* Admin Form Editor (user-friendly mode) */
.admin-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-md);
}

.admin-section-header h4 {
    margin: 0;
}

.admin-mode-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.admin-mode-toggle:hover {
    background: var(--bg-elevated);
}

.admin-mode-toggle input {
    cursor: pointer;
}

.admin-form-editor {
    display: grid;
    gap: var(--space-lg);
}

.admin-form-group {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.admin-form-group h5 {
    margin: 0 0 var(--space-md) 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.admin-form-group h5 .unit-hint {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-secondary);
}

/* Collapsible Admin Form Groups */
.admin-form-group.collapsible > h5 {
    cursor: pointer;
    user-select: none;
    padding: var(--space-sm) 0;
    margin: calc(-1 * var(--space-sm)) 0 var(--space-md) 0;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s ease;
}

.admin-form-group.collapsible > h5:hover {
    background: rgba(255, 255, 255, 0.05);
}

.admin-form-group.collapsible > h5::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--text-secondary);
    margin-right: var(--space-sm);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.admin-form-group.collapsible.collapsed > h5 {
    margin-bottom: 0;
}

.admin-form-group.collapsible.collapsed > h5::before {
    transform: rotate(-90deg);
}

.admin-form-group.collapsible > .admin-form-group-content {
    transition: max-height 0.3s ease, opacity 0.2s ease;
    overflow: hidden;
}

.admin-form-group.collapsible.collapsed > .admin-form-group-content {
    max-height: 0;
    opacity: 0;
    padding: 0;
    margin: 0;
}

.admin-form-subgroup {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-subtle);
}

.admin-form-subgroup:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.admin-form-subgroup h6 {
    margin: 0 0 var(--space-sm) 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.admin-form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-xs) 0;
}

.admin-form-row label {
    font-size: 0.8125rem;
    color: var(--text-primary);
    flex: 1;
}

.admin-input-with-prefix,
.admin-input-with-suffix {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    overflow: hidden;
    width: 120px;
}

.admin-input-with-prefix span,
.admin-input-with-suffix span {
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
}

.admin-input-with-prefix input,
.admin-input-with-suffix input {
    flex: 1;
    border: none;
    background: transparent;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.875rem;
    color: var(--text-primary);
    width: 100%;
    min-width: 0;
}

.admin-input-with-prefix input:focus,
.admin-input-with-suffix input:focus {
    outline: none;
}

.admin-input-with-prefix:focus-within,
.admin-input-with-suffix:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Hide number input spinners */
.admin-input-with-prefix input[type="number"]::-webkit-outer-spin-button,
.admin-input-with-prefix input[type="number"]::-webkit-inner-spin-button,
.admin-input-with-suffix input[type="number"]::-webkit-outer-spin-button,
.admin-input-with-suffix input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.admin-input-with-prefix input[type="number"],
.admin-input-with-suffix input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Wide form rows (for text inputs) */
.admin-form-row-wide {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-xs);
}

.admin-form-row-wide label {
    font-weight: 500;
}

/* Text input styling */
.admin-text-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-text-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.admin-text-input::placeholder {
    color: var(--text-tertiary);
}

/* Hint text */
.admin-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0 0 var(--space-sm) 0;
    font-style: italic;
}

.admin-form-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0 0 var(--space-md) 0;
    font-style: italic;
}

/* Dynamic list for admin panel (e.g., groundworks options) */
.admin-dynamic-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.admin-dynamic-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.admin-dynamic-row input[type="text"] {
    flex: 2;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8125rem;
}

.admin-dynamic-row input[type="number"] {
    width: 80px;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8125rem;
    text-align: right;
}

.admin-dynamic-row input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.admin-dynamic-row .btn-icon-remove {
    padding: var(--space-xs);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-dynamic-row .btn-icon-remove:hover {
    background: var(--bg-danger);
    color: var(--danger);
}

.labour-band-row .labour-band-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 90px;
}

.labour-band-row .labour-band-number {
    font-weight: 600;
}

.btn-small {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

/* Groundworks selection in quote modal */
#groundworks-toggle-row {
    margin-bottom: var(--space-md);
}

.groundworks-toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.groundworks-toggle-label:hover {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

.groundworks-toggle-label .toggle-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.groundworks-toggle-label .toggle-input {
    display: none;
}

.groundworks-toggle-label .toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: #9ca3af;
    border-radius: 12px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.groundworks-toggle-label .toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.groundworks-toggle-label .toggle-input:checked + .toggle-slider {
    background: var(--accent-primary);
}

.groundworks-toggle-label .toggle-input:checked + .toggle-slider::after {
    transform: translateX(20px);
}

/* Show Item Prices toggle at bottom of modal */
.show-item-prices-row {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-subtle);
}

.office-copy-toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.office-copy-toggle-label:hover {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

.office-copy-toggle-label .toggle-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.office-copy-toggle-label .toggle-input {
    display: none;
}

.office-copy-toggle-label .toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: #9ca3af;
    border-radius: 12px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.office-copy-toggle-label .toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.office-copy-toggle-label .toggle-input:checked + .toggle-slider {
    background: var(--accent-primary);
}

.office-copy-toggle-label .toggle-input:checked + .toggle-slider::after {
    transform: translateX(20px);
}

.hot-tub-toggle-label {
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-secondary);
}

.hot-tub-toggle-label .toggle-text {
    font-size: 0.85rem;
}

#groundworks-selection-container {
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

#groundworks-selections-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.groundworks-selection-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.groundworks-selection-row select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.groundworks-selection-row select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.groundworks-selection-row .qty-input-group {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.groundworks-selection-row .qty-input-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.groundworks-selection-row input[type="text"],
.groundworks-selection-row input[type="number"] {
    width: 60px;
    padding: var(--space-sm);
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: center;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.groundworks-selection-row input[type="text"]:focus,
.groundworks-selection-row input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.groundworks-selection-row .price-display {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent-primary);
    min-width: 70px;
    text-align: right;
}

.groundworks-selection-row .btn-icon-remove {
    width: 32px;
    height: 32px;
    padding: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.groundworks-selection-row .btn-icon-remove:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

/* Add groundworks button */
#add-groundworks-selection-btn {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-primary);
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition: all var(--transition-fast);
}

#add-groundworks-selection-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

#add-groundworks-selection-btn svg {
    width: 16px;
    height: 16px;
}

/* Groundworks responsive */
@media (max-width: 600px) {
    .groundworks-selection-row {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
    
    .groundworks-selection-row .qty-input-group {
        justify-content: space-between;
        width: 100%;
    }
    
    .groundworks-selection-row .price-display {
        text-align: left;
    }
    
    .groundworks-selection-row .btn-icon-remove {
        position: absolute;
        top: var(--space-xs);
        right: var(--space-xs);
        width: 28px;
        height: 28px;
    }
    
    .groundworks-selection-row {
        position: relative;
        padding-right: 40px;
    }
}

/* Tutorial steps list */
.admin-tutorial-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.admin-tutorial-step {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    border-left: 3px solid var(--accent-primary);
}

.admin-tutorial-step-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.admin-tutorial-step-number {
    background: var(--accent-primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.admin-tutorial-step-id {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.admin-tutorial-step .admin-form-row-wide {
    margin-top: var(--space-sm);
}

.admin-tutorial-step .admin-form-row-wide label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Textarea for descriptions */
.admin-textarea-small {
    width: 100%;
    min-height: 60px;
    padding: var(--space-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8125rem;
    line-height: 1.4;
    resize: vertical;
    font-family: inherit;
}

.admin-textarea-small:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Admin Panel Footer */
.admin-panel-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
    gap: var(--space-md);
}

.admin-status {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    flex: 1;
}

.admin-status.success {
    color: var(--success);
}

.admin-status.error {
    color: var(--error);
}

.admin-status.loading {
    color: var(--accent);
}

.admin-status.loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: var(--space-sm);
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.admin-actions {
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.admin-actions .btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

/* Users panel specific */
#admin-panel-users .admin-section {
    display: flex;
    flex-direction: column;
}

#admin-panel-users .admin-textarea {
    min-height: 180px;
}

/* Notes textarea - taller for more content */
.admin-textarea.admin-notes {
    min-height: 400px;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    white-space: pre-wrap;
}

/* Admin Sub-tabs (for Preferences) */
.admin-subtabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
}

.admin-subtab {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-subtab:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-default);
    color: var(--text-primary);
}

.admin-subtab.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.admin-subtab svg {
    flex-shrink: 0;
}

.admin-subpanel {
    display: none;
}

.admin-subpanel.active {
    display: block;
}

/* ============================================
   ADMIN - ITEMS LIST (Users, Park Groups)
   ============================================ */

.admin-items-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.admin-items-loading {
    padding: var(--space-lg);
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

.admin-items-empty {
    padding: var(--space-lg);
    text-align: center;
    color: var(--text-secondary);
    background: var(--surface-1);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-subtle);
}

.admin-item-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: var(--surface-1);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.admin-item-card:hover {
    border-color: var(--border-default);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.admin-item-info {
    flex: 1;
    min-width: 0;
}

.admin-item-name {
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 2px 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.admin-item-name .badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    text-transform: uppercase;
}

.admin-item-name .badge-owner {
    background: var(--accent-primary);
    color: white;
}

.admin-item-name .badge-admin {
    background: var(--accent-secondary);
    color: white;
}

.admin-item-name .badge-surveyor {
    background: #3b82f6;
    color: white;
}

.admin-item-name .badge-sales-manager {
    background: #8b5cf6;
    color: white;
}

.admin-item-name .badge-sales-staff {
    background: #6b7280;
    color: white;
}

.admin-item-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.admin-item-meta {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.admin-item-value {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.admin-item-value.commission {
    color: var(--accent-success);
}

.admin-item-actions {
    display: flex;
    gap: var(--space-xs);
}

.admin-item-actions .btn-icon {
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.admin-item-actions .btn-icon:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

.admin-item-actions .btn-icon.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-danger);
}

/* Form helpers for modals */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.form-input, .form-select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.15);
}

.form-help {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-top: var(--space-xs);
}

.input-with-suffix {
    display: flex;
    align-items: stretch;
}

.input-with-suffix .form-input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    flex: 1;
}

.input-with-suffix .input-suffix {
    display: flex;
    align-items: center;
    padding: 0 var(--space-md);
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-left: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================
   ADMIN PREFERENCES - COLOR CONFIGURATION
   ============================================ */

.admin-subsection {
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: var(--surface-1);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.admin-subsection-title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin: 0 0 var(--space-md) 0;
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-subtle);
}

/* Collapsible Admin Subsections */
.admin-subsection.collapsible > .admin-subsection-title {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    transition: color 0.15s ease;
}

.admin-subsection.collapsible > .admin-subsection-title:hover {
    color: var(--text-primary);
}

.admin-subsection.collapsible > .admin-subsection-title::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
    margin-right: var(--space-sm);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.admin-subsection.collapsible.collapsed > .admin-subsection-title {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.admin-subsection.collapsible.collapsed > .admin-subsection-title::before {
    transform: rotate(-90deg);
}

.admin-subsection.collapsible > .admin-subsection-content {
    transition: max-height 0.3s ease, opacity 0.2s ease;
    overflow: hidden;
}

.admin-subsection.collapsible.collapsed > .admin-subsection-content {
    max-height: 0;
    opacity: 0;
    padding: 0;
    margin: 0;
}

.admin-colour-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.admin-colour-item {
    display: grid;
    grid-template-columns: 32px 40px 40px 1fr 120px 100px 40px;
    gap: var(--space-sm);
    align-items: center;
    padding: var(--space-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    transition: border-color 0.2s, opacity 0.2s;
    cursor: default;
}

.admin-colour-item:hover {
    border-color: var(--border-default);
}

.admin-colour-item.disabled {
    opacity: 0.5;
}

.admin-colour-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.admin-colour-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    color: var(--text-secondary);
    padding: var(--space-xs);
    transition: color 0.2s;
}

.admin-colour-drag-handle:hover {
    color: var(--text-primary);
}

.admin-colour-drag-handle:active {
    cursor: grabbing;
}

.admin-colour-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-colour-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

.admin-colour-preview {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Pickr color picker button */
.admin-colour-preview .color-picker-btn {
    width: 32px;
    height: 32px;
    border: 2px solid var(--border-default);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.admin-colour-preview .color-picker-btn:hover {
    transform: scale(1.1);
    border-color: var(--accent-primary);
}

/* Pickr overrides for dark theme compatibility */
.pickr {
    width: 32px;
    height: 32px;
}

.pickr .pcr-button {
    width: 32px !important;
    height: 32px !important;
    border: 2px solid var(--border-default) !important;
    border-radius: var(--radius-sm) !important;
    transition: transform 0.2s, border-color 0.2s !important;
}

.pickr .pcr-button:hover {
    transform: scale(1.1);
    border-color: var(--accent-primary) !important;
}

.pickr .pcr-button::after {
    display: none !important;
}

/* Pickr popup styling */
.pcr-app {
    z-index: 10001 !important; /* Above modal (z-index: 10000) */
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
}

.pcr-app .pcr-interaction input {
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-subtle) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm) !important;
}

.pcr-app .pcr-interaction .pcr-save {
    background: var(--accent-primary) !important;
    color: white !important;
    border-radius: var(--radius-sm) !important;
}

.pcr-app .pcr-interaction .pcr-save:hover {
    background: var(--accent-secondary) !important;
}

.pcr-app .pcr-swatches > button {
    border-radius: var(--radius-sm) !important;
}

.admin-colour-name input {
    width: 100%;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.admin-colour-name input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.admin-colour-hex {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    text-align: center;
}

.admin-colour-type select {
    padding: 4px var(--space-sm);
    font-size: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    text-transform: uppercase;
    font-weight: 600;
}

.admin-colour-type select:hover {
    border-color: var(--border-default);
}

.admin-colour-actions {
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-colour-delete {
    background: transparent;
    border: none;
    color: var(--accent-danger);
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.admin-colour-delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

.admin-colour-delete svg {
    width: 16px;
    height: 16px;
}

/* Admin Picket Types */
.admin-picket-types {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.admin-checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.admin-checkbox-label:hover {
    background: var(--surface-1);
    border-color: var(--border-default);
}

.admin-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

.admin-checkbox-label span {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Responsive admin panel */
@media (max-width: 768px) {
    .admin-panel-modal {
        max-height: 95vh;
    }
    
    .admin-panel-content {
        flex-direction: column;
    }
    
    .admin-tabs {
        flex-direction: row;
        overflow-x: auto;
        min-width: 0;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
        padding: var(--space-sm);
        gap: var(--space-xs);
    }
    
    .admin-tab {
        padding: var(--space-xs) var(--space-sm);
        white-space: nowrap;
        font-size: 0.75rem;
    }
    
    .admin-tab svg {
        display: none;
    }
    
    .admin-tab-panels {
        padding: var(--space-md);
    }
    
    .admin-panel-footer {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .admin-status {
        text-align: center;
    }
    
    .admin-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .admin-actions .btn {
        flex: 1;
    }
}

/* ============================================
   ROLE-BASED ACCESS CONTROL (Phase 1)
   ============================================ */

/* Role Toggle Dropdown (Header) */
.role-toggle-select {
    padding: 4px 8px;
    font-size: 0.75rem;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    font-family: var(--font-sans);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.role-toggle-select:hover {
    border-color: var(--accent-primary);
    background: var(--surface-1);
}

.role-toggle-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Role indicator badge */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 2px 8px;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--radius-full);
    background: var(--accent-primary);
    color: white;
}

.role-badge.role-surveyor {
    background: #6366f1; /* Indigo for surveyor */
}

.role-badge.role-sales {
    background: #10b981; /* Green for sales */
}

/* Surveyor Mode Toggle (Survey/Quote toggle for Surveyors) */
.surveyor-mode-select {
    background: var(--bg-elevated);
    border-color: #6366f1; /* Indigo border for surveyor-specific toggle */
}

.surveyor-mode-select option[value="survey"] {
    color: #6366f1; /* Indigo for Survey mode */
}

.surveyor-mode-select option[value="quote"] {
    color: #10b981; /* Green for Quote mode */
}

/* Quote mode indicator - subtle styling when in quote mode */
body.surveyor-quote-mode .surveyor-mode-select {
    background: linear-gradient(135deg, var(--bg-elevated), rgba(16, 185, 129, 0.1));
    border-color: #10b981;
}

/* ============================================
   ROLE-SPECIFIC VISIBILITY CLASSES
   ============================================ */

/* Surveyor-only elements - hidden in Sales mode */
body.sales-mode .surveyor-only {
    display: none !important;
}

/* Hide surveyor-only elements in Quote mode (Surveyor acts like Sales) */
body.surveyor-quote-mode .surveyor-only {
    display: none !important;
}

/* Sales-only elements - hidden in Surveyor mode */
body.surveyor-mode .sales-only {
    display: none !important;
}

/* Step height input group (Surveyor only) */
.step-height-input-group {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.step-height-input-group label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.step-height-input {
    width: 80px;
    padding: 4px 8px;
    font-size: 0.8125rem;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-align: right;
}

.step-height-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.calculated-treads {
    font-size: 0.75rem;
    color: var(--accent-primary);
    font-weight: 600;
}

/* Grid toggle visibility */
body.sales-mode #grid-toggle {
    display: none !important;
}

/* Skirting plank selection visibility */
body.sales-mode .skirting-planks-group {
    display: none !important;
}

/* Cutout dimension inputs visibility */
body.sales-mode .cutout-dimensions-group {
    display: none !important;
}

/* Step control group visibility */
body.sales-mode .step-control-group {
    display: none !important;
}

/* Step width override (Surveyor only) */
body.sales-mode .step-width-override {
    display: none !important;
}

/* Sales defaults indicator */
.sales-default-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    font-size: 0.625rem;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border-radius: var(--radius-sm);
    margin-left: var(--space-sm);
}

/* ============================================
   ADMIN PANEL - CONSTRAINTS SECTION
   ============================================ */

.admin-form-row {
    margin-bottom: var(--space-lg);
}

.admin-form-row:last-child {
    margin-bottom: 0;
}

.admin-form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.admin-select,
.admin-input {
    width: 100%;
    max-width: 300px;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
}

.admin-select:hover,
.admin-input:hover {
    border-color: var(--border-strong);
}

.admin-select:focus,
.admin-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.admin-help-text {
    margin-top: var(--space-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.admin-form-subgroup {
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-md);
}

.admin-form-subgroup:last-child {
    margin-bottom: 0;
}

.admin-form-subgroup-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-form-row-inline {
    display: flex;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.admin-form-field {
    flex: 1;
    min-width: 140px;
}

.admin-form-field .admin-input {
    max-width: 100%;
}

/* ============================================
   CORNER HEIGHTS (Surveyor Only)
   ============================================ */

.corner-heights-section {
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.corner-heights-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}

.corner-height-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.corner-height-input-group label {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.corner-height-input {
    width: 100%;
    padding: 6px 8px;
    font-size: 0.8125rem;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-align: center;
}

.corner-height-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.corner-height-input::placeholder {
    color: var(--text-muted);
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    font-size: 0.625rem;
    background: var(--surface-2);
    color: var(--text-secondary);
    border-radius: 50%;
    margin-left: 4px;
    cursor: help;
}
/* === SCREEN-ONLY FOOTER BUTTON FIX === */
@media screen {
    .quote-modal .modal-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    #quote-footer-left {
        display: flex;
        align-items: center;
    }
    
    #quote-footer-right {
        display: flex;
        gap: var(--space-sm);
        align-items: center;
        margin-left: auto;
    }
}

/* Warning Button (for Park Copy) */
.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
}

/* ===========================================
   DEBUG CONSOLE (for tablet/mobile debugging)
   =========================================== */

/* Debug toggle button - small bug icon in corner */
.debug-toggle-btn {
    position: fixed;
    bottom: 10px;
    left: 10px;
    width: 44px;
    height: 44px;
    background: var(--accent-primary);
    border: 2px solid white;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 99997;
    opacity: 0.9;
    transition: opacity 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.debug-toggle-btn:hover,
.debug-toggle-btn:active {
    opacity: 1;
    transform: scale(1.1);
}

/* On desktop with footer visible, move debug button up */
@media (pointer: fine) {
    .debug-toggle-btn {
        bottom: 40px;
        opacity: 0.5;
        background: var(--bg-secondary);
        border: 1px solid var(--border-default);
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    .debug-toggle-btn:hover {
        opacity: 1;
    }
}

.debug-console {
    position: fixed;
    bottom: 50px;
    left: 10px;
    width: 350px;
    max-height: 250px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-md);
    z-index: 99998;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 11px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* On touch devices, position debug console above footer */
@media (pointer: coarse) {
    .debug-console {
        bottom: 60px;
        width: calc(100vw - 20px);
        max-width: 400px;
    }
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--accent-primary);
    color: white;
    font-weight: 600;
    font-size: 12px;
}

.debug-buttons {
    display: flex;
    gap: 8px;
}

.debug-buttons button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 14px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.debug-buttons button:hover {
    opacity: 1;
}

.debug-log {
    padding: 8px;
    max-height: 200px;
    overflow-y: auto;
    color: #00ff00;
    line-height: 1.4;
}

.debug-log .log-entry {
    margin-bottom: 4px;
    word-break: break-all;
}

.debug-log .log-entry.log-error {
    color: #ff6b6b;
}

.debug-log .log-entry.log-warn {
    color: #ffd93d;
}

.debug-log .log-entry.log-touch {
    color: #6bcfff;
}

/* ===========================================
   TOUCH DEVICE OPTIMIZATIONS
   =========================================== */

/* Touch devices: remove tap highlight, improve button sizes */
@media (pointer: coarse) {
    /* Remove tap highlight on iOS/Android */
    * {
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Larger tap targets for buttons */
    .btn, .btn-icon {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Larger radio/checkbox targets */
    .radio-option, .checkbox-option {
        min-height: 44px;
        padding: var(--space-sm) var(--space-md);
    }
    
    /* Larger form inputs */
    .form-input, .admin-input, select {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    
    /* Larger toolbar buttons */
    .toolbar-btn {
        min-height: 44px;
        padding: var(--space-sm) var(--space-md);
    }
    
    /* Ensure step items in list are easily tappable */
    .step-item, .ramp-item, .project-item {
        min-height: 44px;
    }
    
    /* Workflow step buttons - larger touch target */
    .workflow-step {
        min-height: 44px;
    }
    
    /* Saved projects list items */
    .saved-project-item {
        padding: var(--space-md);
    }
}

/* Touch feedback - subtle scale on active state */
@media (pointer: coarse) {
    .btn:active:not(:disabled),
    .btn-icon:active:not(:disabled),
    .toolbar-btn:active,
    .workflow-step:active {
        transform: scale(0.97);
        transition: transform 0.1s ease;
    }
    
    /* Canvas touch - prevent text selection during gestures */
    #deck-canvas {
        user-select: none;
        -webkit-user-select: none;
    }
}

/* Footer debug mode - makes footer highly visible for troubleshooting */
.app-footer.debug-visible {
    background: #ff0000 !important;
    color: #ffffff !important;
    font-size: 16px !important;
    font-weight: bold !important;
    padding: 20px !important;
    z-index: 99999 !important;
    border: 4px solid #ffff00 !important;
    bottom: 0 !important;
}

/* ==================== Non-Sales Visibility ==================== */
.non-sales-only {
    display: none !important;
}

body.is-owner .non-sales-only,
body.is-admin .non-sales-only,
body.has-extra-features .non-sales-only {
    display: flex !important;
}

body.is-owner .non-sales-only.btn,
body.is-admin .non-sales-only.btn,
body.has-extra-features .non-sales-only.btn {
    display: inline-flex !important;
}

body.is-owner .non-sales-only.admin-tab,
body.is-admin .non-sales-only.admin-tab,
body.has-extra-features .non-sales-only.admin-tab {
    display: flex !important;
}

/* ==================== Pre-book Modal ==================== */
.prebook-modal {
    max-width: 540px;
    width: 90vw;
}

.prebook-dates-list {
    max-height: 360px;
    overflow-y: auto;
    margin: var(--space-md) 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.prebook-date-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}

.prebook-date-row:last-child {
    border-bottom: none;
}

.prebook-date-row:hover {
    background: var(--bg-hover);
}

.prebook-date-row.selected {
    background: var(--accent-primary);
    color: #fff;
}

.prebook-date-row .date-label {
    font-weight: 500;
}

.prebook-date-row .capacity-badge {
    font-size: 0.85em;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.prebook-date-row.selected .capacity-badge {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.prebook-date-row .reserved-badge {
    font-size: 0.8em;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: var(--accent-warning, #f59e0b);
    color: #fff;
    font-weight: 500;
}

.prebook-confirm-details {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin: var(--space-md) 0;
}

.prebook-confirm-details .confirm-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-xs) 0;
    border-bottom: 1px solid var(--border);
}

.prebook-confirm-details .confirm-row:last-child {
    border-bottom: none;
}

.prebook-confirm-details .confirm-label {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.prebook-confirm-details .confirm-value {
    font-weight: 500;
}

.prebook-step-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

#prebook-dates-loading {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    justify-content: center;
    color: var(--text-secondary);
}

#prebook-dates-empty {
    padding: var(--space-lg);
    text-align: center;
    color: var(--text-secondary);
}

/* Integration test result */
.integration-test-ok {
    color: var(--accent-success, #22c55e);
    font-weight: 500;
}

.integration-test-fail {
    color: var(--accent-danger, #ef4444);
    font-weight: 500;
}
