/* NITField Main Styles */
/* Mobile-first, offline-ready PWA design */
/* Futuristic Dark Theme with Cyan Glow Accents */

/* ===== CSS Variables ===== */
:root {
    /* Primary Colors - Futuristic Cyan/Blue */
    --primary: #00d4ff;
    --primary-light: #00ffff;
    --primary-dark: #0099cc;
    --secondary: #0066aa;

    /* Status Colors */
    --success: #00e676;
    --warning: #ffab00;
    --danger: #ff5252;
    --info: #00d4ff;

    /* Dark Theme Backgrounds */
    --bg-darkest: #051020;
    --bg-dark: #0a1628;
    --bg: #0d1f35;
    --bg-secondary: #132840;
    --bg-tertiary: #1a3550;
    --bg-hover: #1a3550;

    /* Text Colors */
    --text: #ffffff;
    --text-light: #a0d4e8;
    --text-secondary: #a0d4e8;
    --text-muted: #6b8fa3;

    /* Borders & Glows */
    --border: rgba(0, 212, 255, 0.2);
    --border-light: rgba(0, 212, 255, 0.15);
    --border-glow: rgba(0, 212, 255, 0.4);
    --glow-color: rgba(0, 212, 255, 0.5);

    /* Shadows */
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.3);
    --shadow: 0 4px 20px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.3);

    /* Input Styling */
    --input-bg: #0d1f35;
    --input-border: rgba(0, 212, 255, 0.3);
    --input-focus: #00d4ff;

    /* Layout */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;

    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    --header-height: 60px;
    --nav-height: 56px;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg-dark);
    min-height: 100vh;
    overflow-x: hidden;

    /* Futuristic CSS-only background pattern with hexagons */
    background-image:
        /* Hexagon pattern using SVG */
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='52'%3E%3Cpath d='M30 0 L60 15 L60 37 L30 52 L0 37 L0 15 Z' fill='none' stroke='%2300d4ff' stroke-width='0.5' opacity='0.12'/%3E%3C/svg%3E"),
        /* Scan lines */
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 3px,
            rgba(0, 212, 255, 0.03) 3px,
            rgba(0, 212, 255, 0.03) 4px
        ),
        /* Corner glow - top left */
        radial-gradient(
            ellipse at 0% 0%,
            rgba(0, 212, 255, 0.18) 0%,
            transparent 50%
        ),
        /* Corner glow - bottom right */
        radial-gradient(
            ellipse at 100% 100%,
            rgba(0, 102, 170, 0.15) 0%,
            transparent 50%
        ),
        /* Center vignette */
        radial-gradient(
            ellipse at 50% 50%,
            transparent 0%,
            rgba(5, 16, 32, 0.5) 100%
        ),
        /* Base gradient */
        linear-gradient(
            135deg,
            var(--bg-darkest) 0%,
            var(--bg-dark) 50%,
            var(--bg) 100%
        );
    background-attachment: fixed;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-glow);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ===== App Container ===== */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
}

/* Ambient glow animation overlay */
.app-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: -1;
    background:
        radial-gradient(
            circle at 20% 80%,
            rgba(0, 212, 255, 0.12) 0%,
            transparent 50%
        ),
        radial-gradient(
            circle at 80% 20%,
            rgba(0, 102, 170, 0.10) 0%,
            transparent 50%
        ),
        radial-gradient(
            circle at 50% 0%,
            rgba(0, 212, 255, 0.06) 0%,
            transparent 30%
        );
    animation: ambientPulse 6s ease-in-out infinite alternate;
}

@keyframes ambientPulse {
    0% { opacity: 0.4; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.05); }
}

/* ===== Header ===== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: linear-gradient(135deg, #0a1628 0%, #132840 50%, #0d1f35 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing);
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0, 212, 255, 0.15);
    border-bottom: 1px solid var(--border-glow);
}

.app-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.app-logo {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--primary-light);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.app-logo-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.5));
}

.app-logo img {
    height: 36px;
    filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.5));
}

/* ===== Sync Status Indicator ===== */
.sync-indicator {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sync-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.sync-indicator.online {
    background: rgba(255,255,255,0.2);
    color: #90EE90;
}
.sync-indicator.online::before {
    background: #90EE90;
}

.sync-indicator.offline {
    background: rgba(220,53,69,0.2);
    color: #ffb3b3;
}
.sync-indicator.offline::before {
    background: #ffb3b3;
}

.sync-indicator.syncing {
    background: rgba(255,193,7,0.2);
    color: #ffe066;
    animation: pulse 1s infinite;
}
.sync-indicator.syncing::before {
    background: #ffe066;
    animation: pulse 1s infinite;
}

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

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-top: var(--header-height);
    padding: var(--spacing);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

/* Full-width mode for builder */
.main-content.full-width {
    max-width: 100%;
    width: 100%;
    padding: 0;
    margin: 0;
    margin-top: var(--header-height);
}

/* ===== View Headers ===== */
.view-header {
    display: flex;
    align-items: center;
    gap: var(--spacing);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing);
    border-bottom: 1px solid var(--border);
}

.view-header h1 {
    flex: 1;
    font-size: 1.5rem;
    font-weight: 600;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.3);
}
.btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-glow);
    color: var(--primary);
}
.btn-secondary:hover:not(:disabled) {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--primary);
}

.btn-danger {
    background: linear-gradient(135deg, #c82333 0%, var(--danger) 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(255, 82, 82, 0.3);
}
.btn-danger:hover:not(:disabled) {
    box-shadow: 0 4px 20px rgba(255, 82, 82, 0.5);
    transform: translateY(-1px);
}

.btn-back {
    background: transparent;
    color: var(--text);
    padding: 8px 12px;
    border: 1px solid var(--border);
}
.btn-back:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-glow);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
}

/* ===== Home View ===== */
.home-view {
    padding-top: var(--spacing);
}

.home-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.home-header h1 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: var(--spacing-xs);
}

.home-header .subtitle {
    color: var(--text-light);
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing);
    margin-bottom: var(--spacing-xl);
}

.action-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.action-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light), var(--primary));
    opacity: 0;
    transition: opacity 0.3s;
}

.action-card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
    transform: translateY(-3px);
}

.action-card:hover::before {
    opacity: 0.8;
}

.action-icon {
    font-size: 2rem;
    margin-bottom: var(--spacing-sm);
}

.action-label {
    font-weight: 600;
    color: var(--text);
}

.action-desc {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: var(--spacing-xs);
}

/* Home Sections (3-column layout) */
.home-sections {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing);
    margin-bottom: var(--spacing-lg);
}

@media (max-width: 600px) {
    .home-sections {
        grid-template-columns: 1fr;
    }
}

.section-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 140px;
    overflow: hidden;
}

.section-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light), var(--primary));
    opacity: 0.8;
}

.section-card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
    transform: translateY(-3px);
}

/* PWA Install Card - accent styling */
.section-card.install-card {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.12) 0%, var(--bg-secondary) 100%);
    border-color: var(--primary);
}

.section-card.install-card::before {
    opacity: 1;
}

.section-card.install-card .section-icon {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* iOS Install Instructions Modal */
.ios-install-modal {
    background: var(--bg);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-lg);
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-glow);
}

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

.ios-install-modal .modal-header h3 {
    margin: 0;
    color: var(--primary);
}

.ios-install-modal .modal-body {
    padding: var(--spacing);
}

.ios-install-steps {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ios-install-steps li {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing);
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border);
}

.ios-install-steps li:last-child {
    border-bottom: none;
}

.ios-install-steps .step-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.ios-install-modal .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing);
    padding: var(--spacing);
    border-top: 1px solid var(--border);
}

.section-icon {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-sm);
}

.section-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--spacing-xs);
}

.section-desc {
    font-size: 0.8rem;
    color: var(--text-light);
}

.section-count {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: var(--spacing-sm);
}

.section-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--primary);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
}

/* Utility Links */
.utility-links {
    display: flex;
    justify-content: center;
    gap: var(--spacing);
    padding-top: var(--spacing);
    border-top: 1px solid var(--border);
}

.utility-link {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--spacing-sm) var(--spacing);
    color: var(--text-light);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.utility-link:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-secondary);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-sm);
    background: var(--bg);
    border-radius: var(--radius);
    padding: var(--spacing);
    border: 1px solid var(--border);
}

.stat-item {
    text-align: center;
    padding: var(--spacing-sm);
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
}

.stat-item.pending .stat-value {
    color: var(--warning);
}

/* ===== Forms List ===== */
.forms-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing);
}

.form-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--spacing);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.form-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light), var(--primary));
    opacity: 0.6;
}

.form-card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.form-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-sm);
}

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

.form-version {
    font-size: 0.75rem;
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
    color: var(--text-light);
}

.form-card-meta {
    display: flex;
    gap: var(--spacing);
    font-size: 0.875rem;
    color: var(--text-light);
}

.form-card-action {
    margin-top: var(--spacing-sm);
    text-align: right;
}

.btn-start {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.875rem;
}

/* ===== Inbox List ===== */
.inbox-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing);
}

.inbox-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--spacing);
    cursor: pointer;
    transition: all 0.2s;
}

.inbox-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.inbox-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-sm);
}

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

.prefill-badge {
    font-size: 0.7rem;
    background: var(--info);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 500;
}

.inbox-card-meta {
    display: flex;
    gap: var(--spacing);
    font-size: 0.875rem;
    color: var(--text-light);
}

.inbox-card-meta .due-date {
    color: var(--warning-dark, #856404);
    font-weight: 500;
}

.inbox-card-action {
    margin-top: var(--spacing-sm);
    text-align: right;
}

/* ===== Drafts List ===== */
.drafts-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing);
}

.draft-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--spacing);
    cursor: pointer;
    transition: all 0.2s;
}

.draft-card:hover {
    border-color: var(--primary);
}

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

.draft-card-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.draft-card-form {
    font-size: 0.875rem;
    color: var(--primary);
    margin-bottom: var(--spacing-sm);
}

.draft-card-meta {
    display: flex;
    gap: var(--spacing);
    font-size: 0.75rem;
    color: var(--text-light);
}

.draft-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.draft-card .status-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.draft-card .status-badge.draft {
    background: var(--warning-light, #fef3cd);
    color: var(--warning-dark, #856404);
}

.draft-card .status-badge.submitted {
    background: var(--success-light, #d4edda);
    color: var(--success-dark, #155724);
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-light);
}

.empty-state p {
    margin-bottom: var(--spacing);
}

/* ===== Login Screen ===== */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-darkest) 0%, var(--bg-dark) 100%);
    padding: var(--spacing);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.login-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    width: 100%;
    max-width: 360px;
    box-shadow: var(--shadow-glow);
}

.login-logo {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.login-logo h1 {
    color: var(--primary);
    font-size: 2rem;
    margin: 0;
}

.login-logo p {
    color: var(--text-light);
    margin: var(--spacing-xs) 0 0 0;
    font-size: 0.875rem;
}

.login-form .field {
    margin-bottom: var(--spacing);
}

.login-form .pin-input {
    width: 180px !important;
    max-width: 180px !important;
    font-size: 1.5rem !important;
    text-align: center;
    letter-spacing: 0.3em;
    padding: 12px !important;
    margin: 0 auto;
    display: block;
}

.btn-login {
    width: 100%;
    padding: var(--spacing) !important;
    font-size: 1rem;
}

.btn-seed {
    width: 100%;
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Completion screen (for guest submissions) */
.completion-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-darkest) 0%, var(--bg-dark) 100%);
    padding: var(--spacing);
}

.completion-content {
    text-align: center;
    padding: var(--spacing-xl);
    background: var(--bg-secondary);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glow);
    max-width: 400px;
}

.completion-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--spacing-lg);
    background: linear-gradient(135deg, var(--success) 0%, #00c853 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    box-shadow: 0 0 30px rgba(0, 230, 118, 0.4);
}

.completion-content h2 {
    color: var(--text);
    margin: 0 0 var(--spacing);
    font-size: 1.5rem;
}

.completion-content p {
    color: var(--text-secondary);
    margin: 0 0 var(--spacing-sm);
}

.completion-id {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: var(--spacing-sm);
    border-radius: var(--radius);
    margin-top: var(--spacing);
}

/* Home header with user info */
.home-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.user-name {
    font-size: 0.875rem;
    color: var(--text-light);
}

.btn-logout {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    font-size: 0.75rem;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ===== Loading ===== */
.loading {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-light);
}

/* ===== Form Renderer ===== */
.form-renderer {
    background: var(--bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.form-header {
    display: flex;
    align-items: center;
    gap: var(--spacing);
    padding: var(--spacing);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.form-header .form-title {
    flex: 1;
    font-size: 1.125rem;
    font-weight: 600;
}

.autosave-status {
    font-size: 0.75rem;
    color: var(--text-light);
    padding: 4px 10px;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
}

.autosave-status.saving {
    color: var(--info);
}

.autosave-status.saved {
    color: var(--success);
    background: var(--success-light, #d4edda);
}

.autosave-status.error {
    color: var(--danger);
    background: var(--danger-light, #f8d7da);
}

.form-progress {
    padding: var(--spacing);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.progress-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: var(--spacing-xs);
    text-align: center;
}

/* Page Tabs - replaces progress bar */
.form-page-tabs {
    display: flex;
    gap: 4px;
    padding: var(--spacing);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.form-page-tabs .page-tab {
    flex: 1;
    min-width: 80px;
    padding: 10px 16px;
    border: none;
    background: var(--bg);
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius) var(--radius) 0 0;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

.form-page-tabs .page-tab:hover {
    background: var(--bg-hover, #e9ecef);
}

.form-page-tabs .page-tab.active {
    background: var(--primary);
    color: white;
}

.form-page {
    padding: var(--spacing);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
    color: var(--primary);
}

/* ===== Form Sections ===== */
.form-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: var(--spacing);
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing);
    background: var(--bg-tertiary);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.section-header.collapsible {
    cursor: pointer;
}

.section-header.collapsible::after {
    content: '▾';
    color: var(--text-light);
}

.form-section.collapsed .section-header.collapsible::after {
    content: '▸';
}

.form-section.collapsed .section-content {
    display: none;
}

.section-content {
    padding: var(--spacing);
}

.section-badge {
    font-size: 0.75rem;
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

/* ===== Field Groups ===== */
.field-group {
    margin-bottom: var(--spacing);
}

.field-group-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    margin-bottom: var(--spacing);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-light);
}

/* ===== Form Fields ===== */
.form-field {
    margin-bottom: var(--spacing);
}

.field-label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
}

.required-mark {
    color: var(--danger);
    margin-left: 2px;
}

.form-input {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    background: var(--input-bg);
    color: var(--text);
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

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

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

select.form-input {
    cursor: pointer;
}

.field-hint {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: var(--spacing-xs);
}

/* Checkbox & Radio */
.checkbox-label,
.radio-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    padding: var(--spacing-sm) 0;
}

.form-checkbox,
.form-radio {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* Photo Field */
.photo-field {
    display: flex;
    flex-direction: column;
    gap: var(--spacing);
}

.photo-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: var(--spacing-sm);
}

.photo-preview {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(220,53,69,0.9);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.btn-photo {
    background: var(--bg-secondary);
    color: var(--text);
    border: 2px dashed var(--border);
    padding: var(--spacing);
}

.btn-photo:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Photo Buttons Container (Camera + Gallery) */
.photo-buttons {
    display: flex;
    gap: var(--spacing-sm);
}

.photo-buttons .btn-photo {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing);
}

.btn-gallery {
    border-style: solid;
}

/* Photo Actions Overlay */
.photo-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.photo-preview:hover .photo-actions {
    opacity: 1;
}

.photo-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: white;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-action-btn:hover {
    background: rgba(0,0,0,0.8);
}

.photo-remove-btn:hover {
    background: rgba(220,53,69,0.9);
}

.markup-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: var(--primary);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
}

/* Photo Markup Editor Modal */
.markup-editor {
    background: var(--bg);
    border-radius: var(--radius-lg, 12px);
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.markup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing);
    border-bottom: 1px solid var(--border);
    gap: var(--spacing);
    flex-wrap: wrap;
}

.markup-header > span {
    font-weight: 600;
    font-size: 1.1rem;
}

.markup-tools {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    flex-wrap: wrap;
}

.markup-tool {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.markup-tool.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.markup-tool:hover:not(.active) {
    background: var(--bg-hover, #e9ecef);
}

#markup-color {
    width: 36px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    background: white;
}

#markup-size {
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    cursor: pointer;
}

.markup-canvas-container {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing);
    background: var(--bg-secondary);
    min-height: 300px;
}

#markup-canvas {
    border: 1px solid var(--border);
    touch-action: none;
    max-width: 100%;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.markup-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing);
    padding: var(--spacing);
    border-top: 1px solid var(--border);
}

/* Mobile-friendly markup toolbar */
@media (max-width: 600px) {
    .markup-header {
        flex-direction: column;
        align-items: stretch;
    }

    .markup-tools {
        justify-content: center;
    }

    .markup-tool {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    #markup-color,
    #markup-size {
        height: 40px;
    }
}

/* Signature Field */
.signature-field {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.signature-canvas {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
    touch-action: none;
}

.signature-actions {
    display: flex;
    gap: var(--spacing-sm);
}

/* Location Field */
.location-field {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.btn-location {
    background: var(--bg-secondary);
    color: var(--text);
    border: 1px solid var(--border);
}

.location-display {
    font-size: 0.875rem;
    color: var(--text-light);
    font-family: var(--font-mono);
}

/* Static Text */
.static-text {
    padding: var(--spacing);
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
    color: var(--text-light);
}

/* ===== Number with Unit ===== */
.number-with-unit {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.number-with-unit .form-input {
    flex: 1;
}

.number-with-unit .form-input.has-unit {
    border-radius: var(--radius);
}

.unit-prefix,
.unit-suffix {
    color: var(--text-light);
    font-size: 0.9rem;
    white-space: nowrap;
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* ===== Picklist Field ===== */
.picklist-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.picklist-group.columns-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.picklist-group.columns-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
}

.picklist-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.picklist-option:hover {
    background: var(--bg-tertiary);
}

.picklist-option input[type="radio"],
.picklist-option input[type="checkbox"] {
    margin: 0;
    accent-color: var(--primary);
}

.picklist-option .option-text {
    color: var(--text);
}

/* ===== Static Image ===== */
.static-image {
    padding: var(--spacing);
}

.static-image img {
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.static-image .no-image {
    color: var(--text-muted);
    font-style: italic;
}

/* ===== Formula Field ===== */
.formula-field {
    padding: var(--spacing);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: var(--radius);
    border: 1px solid var(--primary);
}

.formula-field .formula-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    text-align: center;
}

.formula-field.readonly {
    pointer-events: none;
}

/* ===== HTML Viewer ===== */
.html-viewer {
    padding: var(--spacing);
    background: var(--bg-secondary);
    border-radius: var(--radius);
    color: var(--text);
    line-height: 1.6;
}

.html-viewer.bordered {
    border: 1px solid var(--border);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.html-viewer h1, .html-viewer h2, .html-viewer h3 {
    color: var(--primary);
    margin-top: var(--spacing);
    margin-bottom: var(--spacing-sm);
}

.html-viewer p {
    margin-bottom: var(--spacing-sm);
}

.html-viewer ul, .html-viewer ol {
    padding-left: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
}

/* Document mode - allows embedded HTML to control styling */
.html-viewer.document-mode {
    background: transparent;
    padding: 0;
    color: inherit;
}

.html-viewer.document-mode * {
    color: inherit;
}

/* ===== Subform Field ===== */
.subform-field {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.subform-items {
    display: flex;
    flex-direction: column;
}

.subform-item {
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

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

.subform-item.completed {
    background: rgba(40, 167, 69, 0.1);
    border-left: 3px solid var(--success, #28a745);
}

.subform-item.collapsed .subform-item-fields {
    display: none;
}

.subform-item-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.subform-item-header .item-number {
    font-weight: 600;
    color: var(--primary);
    flex: 1;
}

.subform-item-header .collapse-btn,
.subform-item-header .remove-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: var(--spacing-xs);
    font-size: 1rem;
}

.subform-item-header .remove-btn:hover {
    color: var(--danger, #dc3545);
}

.subform-item-fields {
    padding: var(--spacing);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.subform-field .subform-field {
    margin: 0;
}

.subform-empty {
    padding: var(--spacing);
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

.add-item-btn {
    width: 100%;
    padding: var(--spacing);
    background: var(--bg-tertiary);
    border: none;
    border-top: 1px solid var(--border);
    color: var(--primary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.add-item-btn:hover {
    background: var(--bg-secondary);
}

/* ===== Property Hints (FormBuilder) ===== */
.property-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

/* ===== Form Navigation ===== */
.form-navigation {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

/* Add padding to form content so it doesn't hide behind fixed nav */
.form-renderer {
    padding-bottom: 80px;
}

.page-dots {
    display: flex;
    gap: var(--spacing-sm);
}

.page-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.page-dot.active {
    background: var(--primary);
}

.page-dot:hover {
    background: var(--primary-light);
}

/* Submit Button - always visible in navigation */
.btn-submit {
    background: var(--success, #28a745);
    color: white;
    border: none;
    padding: var(--spacing-sm) var(--spacing);
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-submit:hover {
    background: #218838;
}

/* ===== Settings ===== */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing);
}

.setting-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--spacing);
}

.setting-item label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
}

.setting-item input[readonly] {
    background: var(--bg-tertiary);
}

/* ===== Builder Notice ===== */
.builder-notice {
    text-align: center;
    padding: var(--spacing-xl);
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.builder-notice p {
    margin-bottom: var(--spacing);
    color: var(--text-light);
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    max-width: 90vw;
    width: 400px;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing);
    background: var(--bg-secondary);
    color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-glow);
    border: 1px solid var(--border-glow);
    border-left: 3px solid var(--primary);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
}

.toast-show {
    opacity: 1;
    transform: translateY(0);
}

.toast-hide {
    opacity: 0;
    transform: translateY(-20px);
}

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

.toast-message {
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.25rem;
    opacity: 0.7;
}

.toast-close:hover {
    opacity: 1;
}

.toast-success {
    border-left-color: var(--success);
    background: var(--bg-secondary);
}
.toast-error {
    border-left-color: var(--danger);
    background: var(--bg-secondary);
}
.toast-warning {
    border-left-color: var(--warning);
    background: var(--bg-secondary);
}
.toast-info {
    border-left-color: var(--info);
    background: var(--bg-secondary);
}

.toast-loading .toast-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .quick-actions {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-navigation {
        flex-wrap: wrap;
        gap: var(--spacing);
    }

    .page-dots {
        order: -1;
        width: 100%;
        justify-content: center;
    }
}

/* ===== PWA Install Prompt ===== */
.install-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--primary);
    color: white;
    padding: var(--spacing);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 200;
    box-shadow: var(--shadow-lg);
}

.install-prompt-text {
    flex: 1;
}

.install-prompt-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.install-prompt .btn {
    padding: 8px 16px;
}

/* ===== Measure Selector ===== */
.measure-selector {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: var(--spacing);
    overflow: hidden;
}

.measure-selector.collapsed .section-content {
    display: none;
}

.measure-selector .section-header {
    background: var(--primary);
    color: white;
}

.measure-selector .section-badge {
    background: rgba(255,255,255,0.2);
    color: white;
}

.info-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--spacing);
    margin-bottom: var(--spacing);
    color: var(--text-light);
    font-size: 0.875rem;
}

.search-box {
    margin-bottom: var(--spacing);
}

.search-box input {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

/* Category Groups */
.category-group {
    margin-bottom: var(--spacing);
}

.category-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    padding: var(--spacing-sm) 0;
    margin-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-light);
}

/* Measure Checklist Grid */
.measures-checklist,
.measure-checklist {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* Individual Measure Item */
.measure-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.measure-item:hover {
    background: var(--bg-tertiary);
}

.measure-item.selected {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--primary);
}

.measure-item.hidden {
    display: none;
}

.measure-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    accent-color: var(--primary);
    cursor: pointer;
}

.measure-item-info {
    flex: 1;
}

.measure-item-code {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--primary);
}

.measure-item-name {
    font-size: 0.75rem;
    color: var(--text-light);
}

.measure-item-count {
    font-size: 0.625rem;
    color: var(--text-light);
    background: var(--border);
    padding: 2px 6px;
    border-radius: 10px;
}

/* Dynamic Sections */
.dynamic-sections {
    display: flex;
    flex-direction: column;
    gap: var(--spacing);
}

.form-section.dynamic {
    border-left: 4px solid var(--primary);
}

.form-section.dynamic .section-header {
    background: linear-gradient(90deg, rgba(0, 212, 255, 0.1), var(--bg-secondary));
}

.section-code {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    background: rgba(0, 212, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: var(--spacing-sm);
}

.btn-remove-section {
    background: transparent;
    border: none;
    color: var(--danger);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-remove-section:hover {
    opacity: 1;
}

/* ===== Form Builder ===== */
#builder-container {
    width: 100%;
    height: calc(100vh - var(--header-height));
}

.form-builder {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
}

.builder-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing) var(--spacing-lg);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    width: 100%;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.form-selector {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.builder-form-title {
    display: flex;
    align-items: center;
    gap: var(--spacing);
    padding: var(--spacing) var(--spacing-lg);
    background: var(--bg-secondary);
    width: 100%;
}

.form-title-input {
    flex: 1;
    font-size: 1.25rem;
    font-weight: 600;
    padding: 8px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
}

.form-title-input:hover,
.form-title-input:focus {
    border-color: var(--border);
    background: var(--bg);
}

.form-version {
    font-size: 0.75rem;
    color: var(--text-light);
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: var(--radius);
}

/* Page Tabs */
.builder-page-tabs {
    display: flex;
    gap: 2px;
    padding: 0 var(--spacing-lg);
    background: var(--bg-tertiary);
    overflow-x: auto;
    width: 100%;
}

.page-tab {
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius) var(--radius) 0 0;
    cursor: pointer;
    font-size: 0.875rem;
    white-space: nowrap;
    color: var(--text);
}

.page-tab:hover {
    background: var(--bg);
}

.page-tab.active {
    background: var(--bg);
    font-weight: 600;
    color: var(--primary);
}

.page-tab-add {
    background: transparent;
    color: var(--primary);
}

.page-tab-wrapper {
    display: flex;
    align-items: stretch;
    position: relative;
}

.page-tab-wrapper.active .page-tab {
    background: var(--bg);
    font-weight: 600;
    color: var(--primary);
}

.page-tab-wrapper .page-tab {
    border-radius: var(--radius) 0 0 0;
    padding-right: 8px;
}

.page-tab-delete {
    padding: 0 8px;
    background: var(--bg-secondary);
    border: none;
    border-radius: 0 var(--radius) 0 0;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s, color 0.2s, background 0.2s;
}

.page-tab-wrapper:hover .page-tab-delete {
    opacity: 1;
}

.page-tab-delete:hover {
    color: var(--danger);
    background: var(--bg);
}

.page-tab-wrapper.active .page-tab-delete {
    background: var(--bg);
}

/* Builder Workspace */
.builder-workspace {
    display: grid;
    grid-template-columns: 240px 1fr 320px;
    flex: 1;
    overflow: hidden;
    min-height: 0; /* Allow flex children to shrink */
    width: 100%;
}

/* Palette */
.builder-palette {
    background: var(--bg);
    border-right: 1px solid var(--border);
    padding: var(--spacing);
    overflow-y: auto;
}

.palette-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    margin-bottom: var(--spacing-sm);
    margin-top: var(--spacing);
}

.palette-header:first-child {
    margin-top: 0;
}

.palette-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.palette-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    cursor: grab;
    transition: all 0.2s;
}

.palette-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px);
}

.palette-item:active {
    cursor: grabbing;
}

.palette-icon {
    font-size: 1rem;
    width: 24px;
    text-align: center;
}

.palette-label {
    font-size: 0.75rem;
}

.palette-actions {
    margin-top: var(--spacing);
}

/* Canvas */
.builder-canvas {
    background: var(--bg-dark);
    background-image:
        radial-gradient(circle at 1px 1px, rgba(0, 212, 255, 0.08) 1px, transparent 0);
    background-size: 20px 20px;
    padding: var(--spacing);
    overflow-y: auto;
}

.canvas-page-header {
    display: flex;
    align-items: center;
    gap: var(--spacing);
    padding: var(--spacing);
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: var(--spacing);
}

.canvas-page-header label {
    font-size: 0.875rem;
    white-space: nowrap;
}

.canvas-page-header input[type="text"] {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.canvas-sections {
    display: flex;
    flex-direction: column;
    gap: var(--spacing);
    min-height: 200px;
}

.canvas-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-light);
}

.canvas-section {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.canvas-section.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.2);
}

.canvas-section-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing);
    background: var(--bg-secondary);
    cursor: pointer;
}

.canvas-section-header .section-key {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--primary);
    background: rgba(0, 212, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.canvas-section-header .section-name {
    flex: 1;
    font-weight: 500;
}

.canvas-section-header .section-mode {
    font-size: 0.625rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-tertiary);
}

.canvas-section-header .section-mode.selectable {
    background: var(--info);
    color: white;
}

.canvas-section-header .section-mode.conditional {
    background: var(--warning);
    color: var(--text);
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    font-size: 1rem;
    color: var(--text-light);
    opacity: 0.5;
}

.btn-icon:hover {
    opacity: 1;
    color: var(--danger);
}

.canvas-section-fields {
    padding: var(--spacing);
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 50px;
}

.canvas-field {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    cursor: pointer;
    border: 2px solid transparent;
}

.canvas-field:hover {
    background: var(--bg-tertiary);
}

.canvas-field.selected {
    border-color: var(--primary);
    background: rgba(0, 212, 255, 0.05);
}

.canvas-field .field-icon {
    font-size: 0.875rem;
    width: 20px;
    text-align: center;
}

.canvas-field .field-label {
    flex: 1;
    font-size: 0.875rem;
}

.canvas-field .field-type {
    font-size: 0.625rem;
    color: var(--text-light);
}

.canvas-field .field-required {
    color: var(--danger);
    font-weight: bold;
}

/* Hidden field indicator */
.canvas-field.field-is-hidden {
    opacity: 0.6;
}

.canvas-field .field-hidden-indicator {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-left: 4px;
    cursor: help;
}

/* Section hidden/conditional indicators */
.canvas-section.section-is-hidden {
    opacity: 0.6;
    border-style: dashed;
}

.section-hidden-indicator,
.section-condition-indicator {
    font-size: 0.7rem;
    margin-left: 4px;
    cursor: help;
}

.section-hidden-indicator {
    color: var(--text-muted);
}

.section-condition-indicator,
.section-rules-indicator {
    color: var(--warning, #f0ad4e);
}

.section-rules-indicator {
    background: var(--warning, #f0ad4e);
    color: var(--bg-primary);
    padding: 1px 5px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: bold;
}

/* Section visibility rules styling */
.section-visibility-rules {
    border-top: 1px solid var(--border);
    padding-top: var(--spacing);
    margin-top: var(--spacing);
}

.section-visibility-rules .properties-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.btn-add-rule {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-add-rule:hover {
    background: var(--primary-hover);
}

.rule-item {
    background: var(--bg-tertiary);
    padding: 8px;
    margin-bottom: 8px;
    border-radius: 4px;
    position: relative;
    border: 1px solid var(--border);
}

.rule-item:hover {
    border-color: var(--primary);
}

.btn-delete-rule {
    position: absolute;
    top: 4px;
    right: 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 2px 4px;
}

.btn-delete-rule:hover {
    color: var(--danger, #dc3545);
}

.no-rules-message {
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 8px;
    text-align: center;
    font-style: italic;
}

/* Hidden section styling in FormRenderer */
.form-section.hidden-section {
    display: none !important;
}

/* Section required indicator */
.required-mark.section-required {
    color: var(--warning, #f0ad4e);
}

/* Dragging field feedback */
.canvas-field.dragging {
    opacity: 0.5;
    border: 2px dashed var(--primary);
}

/* Section collapse toggle button */
.btn-collapse {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-right: var(--spacing-sm);
}

.btn-collapse:hover {
    color: var(--primary);
}

/* Field count badge in section header */
.field-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: auto;
    margin-right: var(--spacing);
}

/* Collapsed section styling */
.canvas-section.collapsed .canvas-section-header {
    border-bottom: none;
    border-radius: var(--radius);
}

/* Drop position indicators for reordering */
.canvas-field.drop-above {
    border-top: 3px solid var(--primary);
}

.canvas-field.drop-below {
    border-bottom: 3px solid var(--primary);
}

/* Form Renderer - Section collapse toggle */
.form-section .section-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section .btn-collapse {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.form-section .btn-collapse:hover {
    color: var(--primary);
}

.form-section .field-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: auto;
}

.form-section.collapsed .section-header {
    border-bottom: none;
}

.field-drop-zone,
.canvas-drop-zone {
    height: 40px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--spacing-sm);
}

.field-drop-zone.drag-over,
.canvas-drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(26, 95, 42, 0.05);
    color: var(--primary);
}

/* Properties Panel */
.builder-properties {
    background: var(--bg);
    border-left: 1px solid var(--border);
    padding: var(--spacing);
    overflow-y: auto;
}

.properties-header {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--spacing);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border);
}

.properties-empty {
    color: var(--text-light);
    font-size: 0.875rem;
    text-align: center;
    padding: var(--spacing-xl);
}

.property-group {
    margin-bottom: var(--spacing);
}

.property-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 4px;
}

.property-group input[type="text"],
.property-group input[type="number"],
.property-group select,
.property-group textarea {
    width: 100%;
    padding: 8px;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.property-group textarea {
    resize: vertical;
    min-height: 80px;
}

.property-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
}

/* Rules Editor */
.rules-editor {
    margin-top: var(--spacing-lg);
    border-top: 1px solid var(--border);
    padding-top: var(--spacing);
}

.rules-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing);
    font-weight: 600;
    font-size: 0.875rem;
}

.rules-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing);
}

.rule-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--spacing);
}

.rule-condition {
    margin-bottom: var(--spacing-sm);
}

.rule-condition label,
.rule-actions > label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.rule-condition select {
    width: 100%;
    padding: 6px 8px;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.rule-actions {
    margin-bottom: var(--spacing-sm);
}

.rule-action {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.rule-action select {
    flex: 1;
    padding: 6px 8px;
    font-size: 0.813rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.rule-action .btn-icon {
    padding: 4px 8px;
    font-size: 1rem;
}

.no-rules {
    color: var(--text-muted);
    font-size: 0.813rem;
    font-style: italic;
    padding: var(--spacing);
    text-align: center;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

/* Target Selector - Centered Modal Popup */
.target-selector {
    position: relative;
    flex: 1;
}

.target-selector-btn {
    width: 100%;
    text-align: left;
    padding: 6px 10px;
    font-size: 0.813rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 120px;
}

.target-selector-btn:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

/* Backdrop overlay */
.target-selector-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    display: none;
}

.target-selector-backdrop.open {
    display: block;
}

/* Centered modal */
.target-selector-dropdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 450px;
    max-width: 90vw;
    max-height: 70vh;
    background: var(--bg-primary);
    border: 2px solid var(--accent);
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.3);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.target-selector-dropdown.open {
    display: flex;
}

/* Modal header */
.target-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.target-modal-header h4 {
    margin: 0;
    color: var(--accent);
    font-size: 0.9rem;
}

.target-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.target-modal-close:hover {
    color: var(--danger);
}

/* Scrollable content */
.target-checkbox-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Custom scrollbar */
.target-checkbox-list::-webkit-scrollbar {
    width: 6px;
}

.target-checkbox-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.target-checkbox-list::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

/* Page headers - sticky */
.target-page-header {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    padding: 10px 16px;
    font-weight: bold;
    color: var(--accent);
    font-size: 0.8rem;
    border-bottom: 1px solid var(--border);
    z-index: 1;
}

/* Item base styles */
.target-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s;
}

.target-item:hover {
    background: var(--bg-secondary);
}

.target-item input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}

/* Section rows */
.target-section {
    background: rgba(0, 212, 255, 0.08);
    border-left: 3px solid var(--accent);
    padding-left: 13px;
}

.target-section:hover {
    background: rgba(0, 212, 255, 0.15);
}

.target-section strong {
    flex: 1;
    color: var(--text);
}

.target-field-count {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Field rows */
.target-field {
    padding-left: 40px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.target-field:hover {
    color: var(--text);
}

/* FormRenderer - Apply custom field background color via CSS variable */
.form-field {
    background: var(--field-bg, transparent);
}

.form-field .form-input {
    background: var(--field-bg, var(--bg));
}

/* Preview Header */
.preview-header {
    display: flex;
    align-items: center;
    gap: var(--spacing);
    padding: var(--spacing);
    background: var(--warning);
    color: var(--text);
}

.preview-header h2 {
    flex: 1;
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 900px) {
    .builder-workspace {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }

    .builder-palette {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .builder-properties {
        border-left: none;
        border-top: 1px solid var(--border);
    }

    .palette-items {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .palette-item {
        flex: 0 0 auto;
    }
}

/* ===== Admin Panel ===== */
.admin-view {
    padding-bottom: var(--spacing-xl);
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing);
    margin-bottom: var(--spacing-lg);
}

.stat-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--spacing);
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
}

.collectors-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing);
}

.collector-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--spacing);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing);
}

.collector-card.inactive {
    opacity: 0.6;
    background: var(--bg-tertiary);
}

.collector-info {
    flex: 1;
}

.collector-name {
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.collector-details {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 4px;
    display: flex;
    gap: var(--spacing);
}

.role-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: 500;
}

.role-badge.admin {
    background: var(--primary);
    color: white;
}

.status-badge.inactive {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--danger);
    color: white;
    text-transform: uppercase;
    font-weight: 500;
}

.collector-actions {
    display: flex;
    gap: var(--spacing-sm);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--spacing);
}

.modal-box {
    background: var(--bg);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    line-height: 1;
}

.btn-close:hover {
    color: var(--text);
}

#collector-form {
    padding: var(--spacing);
}

.form-group {
    margin-bottom: var(--spacing);
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text);
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
}

.modal-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing);
    border-top: 1px solid var(--border);
}

/* Small buttons */
.btn-small {
    padding: 6px 12px;
    font-size: 0.75rem;
}

/* ===== Submitted Forms View ===== */
.submitted-view {
    padding: var(--spacing);
}

.submissions-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing);
}

.submission-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.submission-card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.submission-card.synced {
    border-left: 3px solid var(--success);
}

.submission-card.pending {
    border-left: 3px solid var(--warning);
}

.submission-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-sm);
}

.submission-card-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text);
}

.sync-status {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.sync-status.synced {
    background: rgba(0, 230, 118, 0.15);
    color: var(--success);
}

.sync-status.pending,
.sync-status.submitted {
    background: rgba(255, 171, 0, 0.15);
    color: var(--warning);
}

.submission-card-meta {
    display: flex;
    gap: var(--spacing);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing);
}

.dispatch-tag {
    background: rgba(0, 212, 255, 0.15);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.submission-card-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

/* ===== Submission View (Read-only) ===== */
.submission-view {
    padding: var(--spacing);
}

.submission-info {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing);
    margin-bottom: var(--spacing-lg);
    border: 1px solid var(--border);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-light);
}

.info-row:last-child {
    border-bottom: none;
}

.info-row span:first-child {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.submission-data {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing);
    border: 1px solid var(--border);
}

.view-page {
    margin-bottom: var(--spacing-lg);
}

.view-page h3 {
    color: var(--primary);
    font-size: 1rem;
    margin-bottom: var(--spacing);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border);
}

.view-section {
    margin-bottom: var(--spacing);
    padding: var(--spacing);
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.view-section h4 {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: var(--spacing-sm);
}

.view-field {
    display: flex;
    flex-direction: column;
    margin-bottom: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.view-field-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.view-field-value {
    font-size: 0.875rem;
    color: var(--text);
}

.view-photos {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.view-photo-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 2px solid var(--border);
    transition: all 0.2s ease;
}

.view-photo-thumb:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

.signature-indicator {
    color: var(--success);
    font-weight: 500;
}

/* ===== Photo Fullscreen Modal ===== */
.photo-fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-fullscreen-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.photo-fullscreen-img {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.photo-fullscreen-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.photo-fullscreen-close:hover {
    background: var(--danger);
    border-color: var(--danger);
}

/* ===== Missing Fields Modal ===== */
.missing-fields-modal .modal-box {
    max-width: 420px;
}

.missing-fields-intro {
    color: var(--text-light);
    margin-bottom: 16px;
    font-size: 0.875rem;
}

.missing-page-group {
    margin-bottom: 16px;
}

.missing-page-title {
    font-weight: 600;
    font-size: 0.8rem;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-bottom: 8px;
    color: var(--primary);
}

.missing-field-item {
    display: flex;
    align-items: center;
    padding: 12px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s;
    border: 1px solid transparent;
    margin-bottom: 4px;
}

.missing-field-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
}

.missing-field-icon {
    font-size: 1.25rem;
    margin-right: 12px;
    flex-shrink: 0;
}

.missing-field-info {
    flex: 1;
    min-width: 0;
}

.missing-field-label {
    display: block;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.missing-field-section {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.missing-field-arrow {
    color: var(--text-muted);
    font-size: 1.25rem;
    margin-left: 8px;
    transition: transform 0.2s;
}

.missing-field-item:hover .missing-field-arrow {
    transform: translateX(4px);
    color: var(--primary);
}

/* ===== Field Highlight Animation ===== */
.form-field.highlight-missing {
    animation: highlightPulse 2.5s ease-out;
    position: relative;
}

.form-field.highlight-missing::before {
    content: '';
    position: absolute;
    inset: -4px;
    border: 2px solid var(--danger);
    border-radius: var(--radius);
    animation: highlightBorder 2.5s ease-out;
    pointer-events: none;
}

@keyframes highlightPulse {
    0% { background: rgba(255, 82, 82, 0.2); }
    100% { background: transparent; }
}

@keyframes highlightBorder {
    0%, 70% { opacity: 1; }
    100% { opacity: 0; }
}

/* ===== Camera Session Modal - Modern Native-style Camera ===== */
.camera-session-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    animation: cameraFadeIn 0.2s ease-out;
}

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

.camera-session-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #000;
    overflow: hidden;
}

/* Floating header with glassmorphism */
.camera-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    padding-top: max(16px, env(safe-area-inset-top));
    background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
    z-index: 10;
}

.camera-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    display: none; /* Hide title for cleaner look */
}

.photo-counter {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-close-camera {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-close-camera:hover {
    background: rgba(255, 82, 82, 0.8);
    transform: scale(1.05);
}

/* Full-screen video preview */
.camera-video-container {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
}

#camera-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* iOS portrait mode fix - rotate video preview 90deg CW to show correct orientation */
/* This is purely visual - capture still reads original stream */
@supports (-webkit-touch-callout: none) {
    /* iOS only */
    @media (orientation: portrait) {
        #camera-preview.ios-rotate {
            transform: rotate(90deg);
            /* Swap width/height and scale to fill container */
            width: 100vh;
            height: 100vw;
            max-width: none;
            max-height: none;
            object-fit: cover;
        }
    }
}

/* Loading spinner */
.camera-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.camera-loading::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error state */
.camera-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    padding: 24px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    max-width: 300px;
}

.camera-error p {
    margin-bottom: 16px;
    color: #ff6b6b;
    font-size: 15px;
}

.camera-error .btn {
    background: white;
    color: #000;
}

/* Flash effect */
.camera-flash {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    animation: flashAnimation 0.15s ease-out;
    pointer-events: none;
}

@keyframes flashAnimation {
    0% { opacity: 0.9; }
    100% { opacity: 0; }
}

/* Captured photos filmstrip */
.camera-captured-photos {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    min-height: 76px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.camera-captured-photos::-webkit-scrollbar {
    display: none;
}

.camera-captured-photos:empty::before {
    content: 'Photos will appear here';
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: center;
}

.session-photo-thumb {
    position: relative;
    flex-shrink: 0;
    animation: thumbPop 0.2s ease-out;
}

@keyframes thumbPop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.session-photo-thumb img {
    height: 52px;
    width: 52px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.btn-delete-session-photo {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ff4757;
    color: white;
    border: 2px solid #000;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: transform 0.15s;
}

.btn-delete-session-photo:hover {
    transform: scale(1.15);
}

/* Modern Camera Controls Bar */
.camera-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px 20px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.7) 70%, transparent 100%);
    position: relative;
}

/* Large capture button with ring */
.btn-capture {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: white;
    color: #000;
    border: 4px solid rgba(255, 255, 255, 0.3);
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), inset 0 0 0 3px rgba(0,0,0,0.1);
    position: relative;
}

.btn-capture::before {
    content: '';
    position: absolute;
    width: 86px;
    height: 86px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

.btn-capture:hover:not(.disabled) {
    transform: scale(1.05);
}

.btn-capture:active:not(.disabled) {
    transform: scale(0.92);
    background: #e0e0e0;
}

.btn-capture.disabled {
    background: rgba(128, 128, 128, 0.5);
    border-color: rgba(128, 128, 128, 0.3);
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
}

.btn-capture.disabled::before {
    border-color: rgba(128, 128, 128, 0.3);
}

/* Done button - modern pill style */
.btn-done {
    position: absolute;
    right: 20px;
    padding: 12px 20px;
    font-size: 15px;
    background: #00d47e;
    color: #000;
    border: none;
    border-radius: 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 12px rgba(0, 212, 126, 0.4);
}

.btn-done:hover {
    background: #00ff96;
    transform: scale(1.03);
}

.btn-done:active {
    transform: scale(0.97);
}

/* Feature buttons (torch, switch camera) - left side */
.camera-feature-buttons {
    position: absolute;
    left: 20px;
    display: flex;
    gap: 12px;
}

.btn-camera-feature {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-camera-feature:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.btn-camera-feature:active {
    transform: scale(0.95);
}

.btn-camera-feature.active {
    background: rgba(255, 214, 0, 0.9);
    color: #000;
    border-color: rgba(255, 214, 0, 1);
}

/* Zoom Controls - bottom of video */
.camera-zoom-container {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 10px 18px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.zoom-slider {
    width: 140px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    outline: none;
}

.zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s;
}

.zoom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.zoom-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.zoom-label {
    color: white;
    font-size: 13px;
    font-weight: 600;
    min-width: 36px;
    text-align: center;
    opacity: 0.9;
}

/* ===== Sync Status Badges ===== */
.sync-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    margin-left: 8px;
    vertical-align: middle;
}

.sync-badge.synced {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.sync-badge.failed {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    cursor: pointer;
}

.sync-badge.pending {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    animation: spin 2s linear infinite;
}

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

/* Warning button for retry */
.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
}

/* ===== Login Loading State ===== */
.login-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    color: var(--text-secondary);
}

.login-loading p {
    margin-top: 16px;
    font-size: 0.875rem;
}

.login-loading .app-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Offline warning on login */
.offline-warning {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    text-align: center;
    font-size: 0.875rem;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.offline-warning span {
    margin-right: 8px;
}

/* ===== Report Builder (PDFME) ===== */
.report-builder {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    background: var(--bg-dark);
}

.report-builder-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
}

.report-builder-loading .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

.report-builder-error {
    padding: 40px;
    text-align: center;
    color: var(--danger);
}

.report-builder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-wrap: wrap;
}

.report-builder-header .header-left,
.report-builder-header .header-center,
.report-builder-header .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.report-builder-header .report-name-input {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 12px;
    font-size: 1rem;
    font-weight: 500;
    min-width: 200px;
}

.report-builder-header .report-name-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

.report-builder-header .form-select {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 12px;
    font-size: 0.875rem;
    min-width: 180px;
}

.report-builder-body {
    display: grid;
    grid-template-columns: 320px 1fr;
    flex: 1;
    overflow: hidden;
}

.report-builder-sidebar {
    background: var(--bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.report-builder-sidebar h3 {
    padding: 12px 16px;
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.report-builder-sidebar .sidebar-search {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.report-builder-sidebar .sidebar-search input {
    width: 100%;
    padding: 8px 12px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.85rem;
}

.report-builder-sidebar .sidebar-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.15);
}

.report-builder-sidebar .sidebar-search input::placeholder {
    color: var(--text-muted);
}

.report-builder-sidebar .sidebar-hint {
    padding: 12px 16px;
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
}

.report-builder-sidebar .fields-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.report-builder-sidebar .field-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    font-size: 0.8rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.report-builder-sidebar .field-item:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
    transform: translateX(4px);
}

.report-builder-sidebar .field-item:active {
    transform: translateX(2px);
    background: var(--primary);
    color: white;
}

.report-builder-sidebar .field-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--primary);
}

.report-builder-sidebar .field-name {
    flex: 1;
    color: var(--text);
}

.report-builder-sidebar .field-key {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: monospace;
}

.report-builder-sidebar .no-form {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

.report-builder-designer {
    flex: 1;
    overflow: hidden;
    background: #1a1a2e;
    position: relative;
}

.report-builder-designer .designer-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
}

/* PDFME Designer overrides */
.report-builder-designer > div {
    height: 100% !important;
}

/* Old toolbar styles for backward compatibility */
.report-builder-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-wrap: wrap;
}

.report-builder-toolbar .toolbar-left,
.report-builder-toolbar .toolbar-center,
.report-builder-toolbar .toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.report-builder-toolbar .report-name-input {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 12px;
    font-size: 1rem;
    font-weight: 500;
    min-width: 200px;
}

.report-builder-toolbar .report-name-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

.report-builder-toolbar .form-select {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 12px;
    font-size: 0.875rem;
    min-width: 180px;
}

.report-builder-workspace {
    display: grid;
    grid-template-columns: 220px 1fr 280px;
    flex: 1;
    overflow: hidden;
}

/* Palette (Left Panel) */
.report-builder-palette {
    background: var(--bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.palette-header {
    padding: 12px 16px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    color: var(--primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.palette-fields {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.palette-empty {
    padding: 24px 16px;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.875rem;
}

.palette-section {
    margin-bottom: 8px;
}

.palette-section-header {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.palette-section-header::before {
    content: '▼';
    font-size: 0.6rem;
    transition: transform 0.2s;
}

.palette-section-header.collapsed::before {
    transform: rotate(-90deg);
}

.palette-section-fields {
    padding: 4px 0;
}

.palette-section-fields.collapsed {
    display: none;
}

.palette-field {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin: 2px 0;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    cursor: grab;
    font-size: 0.8rem;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.palette-field:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    transform: translateX(4px);
}

.palette-field:active {
    cursor: grabbing;
}

.palette-field .field-icon {
    font-size: 1rem;
}

.palette-field .field-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Canvas (Center Area) */
.report-builder-canvas-container {
    display: flex;
    flex-direction: column;
    background: var(--bg-darkest);
    overflow: hidden;
}

.canvas-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
}

.canvas-controls label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-secondary);
}

.canvas-controls input[type="checkbox"] {
    accent-color: var(--primary);
}

.canvas-controls .zoom-select {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 4px 8px;
    font-size: 0.8rem;
}

.canvas-scroll-area {
    flex: 1;
    overflow: auto;
    padding: 24px;
    display: flex;
    justify-content: center;
}

.canvas-paper {
    position: relative;
    background: white;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.canvas-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
    font-size: 0.9rem;
    text-align: center;
    pointer-events: none;
}

.canvas-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.canvas-page-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Properties Panel (Right) - Old Report Builder (now using PDFME) */
.report-builder-properties {
    background: var(--bg);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.properties-header {
    padding: 12px 16px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    color: var(--primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.properties-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.properties-empty {
    padding: 24px 16px;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.875rem;
}

.property-group {
    margin-bottom: 16px;
}

.property-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.property-group .form-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 12px;
    font-size: 0.875rem;
}

.property-group .form-input:focus {
    outline: none;
    border-color: var(--primary);
}

.property-group .form-input.small {
    width: calc(50% - 4px);
    padding: 6px 10px;
}

.property-row {
    display: flex;
    gap: 8px;
}

.property-hint {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.property-actions {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Status Bar */
.report-builder-statusbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 8px 16px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Reports List View */
.reports-view {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--spacing);
}

.reports-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: all 0.2s;
}

.report-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.report-card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.report-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.report-card-actions {
    display: flex;
    gap: 8px;
}

/* Responsive */
@media (max-width: 1024px) {
    .report-builder-workspace {
        grid-template-columns: 180px 1fr 240px;
    }
}

@media (max-width: 768px) {
    .report-builder-workspace {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }

    .report-builder-palette {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 200px;
    }

    .report-builder-properties {
        border-left: none;
        border-top: 1px solid var(--border);
        max-height: 250px;
    }

    .report-builder-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .report-builder-toolbar .toolbar-left,
    .report-builder-toolbar .toolbar-center,
    .report-builder-toolbar .toolbar-right {
        justify-content: center;
    }
}

/* ===== Dark Mode Support (future) ===== */
@media (prefers-color-scheme: dark) {
    /* TODO: Add dark mode styles */
}
