/* COMMERCIAL GRADE APP DESIGN SYSTEM */
:root {
    /* Palette: Brushed Gold Industrial */
    --bg-body: #0A0A0A;
    --bg-surface: rgba(18, 18, 18, 0.93);
    --bg-surface-elevated: rgba(28, 28, 28, 0.9);

    --accent-primary: #D4AF37;
    /* Brushed Gold */
    --accent-glow: rgba(212, 175, 55, 0.6);
    --accent-neon: rgba(212, 175, 55, 0.35);
    --accent-blue: #0A84FF;
    --accent-danger: #FF453a;

    --text-primary: #F0EDE5;
    --text-secondary: #8A8478;
    --text-tertiary: #5A5549;

    --border-subtle: rgba(212, 175, 55, 0.08);
    --glass-bg: rgba(18, 18, 18, 0.85);
    --glass-border: rgba(212, 175, 55, 0.1);

    /* Dimensions */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;

    --header-height: auto;
    --footer-height: 56px;
    --nav-height: calc(64px + env(safe-area-inset-bottom, 0px));
    --shadow-heavy: 0 10px 40px rgba(0, 0, 0, 0.5);
    --glass: rgba(18, 18, 18, 0.9);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body.auth-locked {
    overflow: hidden;
}

body.auth-locked .app-layout {
    filter: blur(8px) grayscale(0.5);
    pointer-events: none;
}

body {
    background-color: var(--bg-body);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    margin: 0;
    font-size: 16px;
    overflow: hidden;
    /* App view */
}

/* --- LAYOUT CONTAINER --- */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 768px;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
    /* Blueprint background — Black with Gold architectural SVG */
    background-color: #0A0A0A;
    background-image: url('blueprint-bg.svg');
    background-size: 600px 600px;
    background-repeat: repeat;
}

.status-bar-spacer {
    height: env(safe-area-inset-top, 0px);
    background: var(--bg-body);
}

/* --- HEADER GLASS --- */
.app-header {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 214, 10, 0.15);
    padding: var(--spacing-sm) var(--spacing-md);
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex-shrink: 1;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    overflow: visible;
}

.header-logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 0;
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.5));
}

.brand-text h1 {
    font-size: clamp(0.75rem, 2.5vw, 1rem);
    font-weight: 800;
    letter-spacing: 1px;
    margin: 0;
    line-height: 1;
    color: var(--accent-primary);
    white-space: nowrap;
}

/* --- HEADER SAVE BUTTON --- */
.btn-save-header {
    background: linear-gradient(135deg, #D4AF37, #B8962E, #D4AF37);
    color: #0D0D0D;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: 0 2px 15px var(--accent-neon);
    transition: transform 0.15s, box-shadow 0.2s;
    letter-spacing: 0.5px;
}

.btn-save-header:active {
    transform: scale(0.95);
    box-shadow: 0 1px 6px rgba(255, 214, 10, 0.3);
}

/* --- RESPONSIVE BRAND TITLE --- */
.brand-short { display: none; }
.brand-full  { display: inline; }

/* On narrow screens, show only 'PIECEWORK', hide 'MASTER' */
@media (max-width: 360px) {
    .brand-full  { display: none; }
    .brand-short { display: inline; }
}

/* Fix flex layout so action buttons never overlap the title */
.brand {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.header-actions {
    flex-shrink: 0;
}
.brand-text .badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: var(--accent-primary);
    letter-spacing: 1px;
    opacity: 0.9;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

.icon-btn:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.95);
}

/* --- BOTTOM NAVIGATION BAR --- */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(13, 13, 13, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(212, 175, 55, 0.15);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 110;
}

.bottom-nav-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0;
    cursor: pointer;
    transition: color 0.25s, transform 0.15s;
    position: relative;
    height: 100%;
}

.bottom-nav-btn span {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.bottom-nav-btn.active {
    color: var(--accent-primary);
}

.bottom-nav-btn.active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: var(--accent-primary);
    border-radius: 0 0 3px 3px;
    box-shadow: 0 0 12px var(--accent-glow), 0 0 25px var(--accent-neon);
}

.bottom-nav-btn.active::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 48px;
    height: 44px;
    background: radial-gradient(ellipse at center top, var(--accent-neon) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
}

.nav-icon-3d {
    width: 30px;
    height: 30px;
    object-fit: contain;
    opacity: 0.4;
    transition: opacity 0.3s, transform 0.2s, filter 0.3s;
    border-radius: 4px;
}

.bottom-nav-btn.active .nav-icon-3d {
    opacity: 1;
    transform: scale(1.15);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.bottom-nav-btn:active {
    transform: scale(0.9);
}


/* --- MAIN SCROLLABLE --- */
/* --- MAIN SCROLLABLE WRAPPER --- */
.app-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    /* Container is just a frame now */
}

.view-panel {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--spacing-md);
    /* Padding bottom removed. Added to ::after to fix sticky positioning */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    /* Prevent pull-to-refresh on body */
}

/* Scroll clearance moved to pseudo-element so sticky positioning works relative to viewport */
.view-panel::after {
    content: '';
    display: block;
    height: 160px;
}

.view-panel.active {
    display: block;
    z-index: 10;
}

/* Animations handled by JS for drag, but these classes used for tap transitions */
.view-panel.transitioning {
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.view-panel.active.slide-left {
    animation: slideInLeft 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-panel.active.slide-right {
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.panel-header {
    margin-bottom: var(--spacing-lg);
}

.panel-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.panel-header p {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* --- CARDS & INPUTS --- */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid rgba(212, 175, 55, 0.1);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.02);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.card:hover {
    border-color: rgba(212, 175, 55, 0.18);
    box-shadow: 0 0 18px rgba(212, 175, 55, 0.08);
}

.card-title {
    font-size: 0.75rem;
    color: var(--accent-primary);
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.input-stack {
    margin-bottom: 8px;
}

.input-row {
    display: flex;
    gap: 12px;
}

.input-col {
    flex: 1;
    position: relative;
}

label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.input-premium,
.select-premium {
    width: 100%;
    background: var(--bg-surface-elevated);
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--text-primary);
    padding: 12px 14px;
    font-size: 1rem;
    font-family: 'JetBrains Mono', monospace;
    /* Tech feel for numbers */
    outline: none;
    transition: 0.2s;
}

.input-premium:focus,
.select-premium:focus {
    border-color: var(--accent-primary);
    background: #222;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12), 0 0 18px rgba(212, 175, 55, 0.08);
}

/* Currency Wrapper */
.currency-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.currency-symbol {
    position: absolute;
    left: 12px;
    color: var(--text-tertiary);
    font-size: 1rem;
    font-weight: 500;
    pointer-events: none;
    z-index: 1;
    /* Ensure visible over input bg */
}

/* Adjust input padding when inside currency wrapper */
.currency-wrapper .input-premium {
    padding-left: 28px;
    /* Space for symbol */
}

@keyframes flashUpdate {
    0% {
        background-color: var(--accent-primary);
        color: #000;
    }

    100% {
        background-color: var(--bg-surface-elevated);
        color: var(--text-primary);
    }
}

.flash-update {
    animation: flashUpdate 1s ease-out;
}

.input-unit {
    position: absolute;
    right: 12px;
    top: 38px;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* Select Custom Wrapper */
.select-wrapper {
    position: relative;
}

.select-premium {
    appearance: none;
    padding-right: 30px;
    font-family: 'Inter', sans-serif;
}

.select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

/* Grid Inputs */
.grid-inputs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.input-tiny input {
    padding: 10px;
    font-size: 0.95rem;
    text-align: center;
}

/* Component List (Framing) */
.component-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.component-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 10px;
    align-items: center;
    min-width: 0;
}

.component-row>* {
    min-width: 0;
}

.component-row .input-premium,
.component-row .select-premium {
    padding: 10px 8px;
    font-size: 0.9rem;
    min-width: 0;
    text-align: center;
    box-sizing: border-box;
}



.component-row.grid-3-col {
    grid-template-columns: 1fr 1fr 1fr;
}

.component-row.header {
    margin-bottom: 5px;
}

.component-row.header span {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    font-weight: 700;
    text-transform: uppercase;
}

.component-row label {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.95rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* Summary in Section */
.summary-card {
    background: rgba(212, 175, 55, 0.06);
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.08), inset 0 0 30px rgba(212, 175, 55, 0.02);
}

/* Sticky Total Bar for specific tabs */
.sticky-total {
    position: sticky;
    bottom: calc(var(--nav-height) + var(--footer-height) + 12px); /* Just above the floating footer and bottom nav */
    z-index: 20;
    
    /* Solid background to prevent scrolling content from showing through */
    background: #121212; 
    
    /* Clearance: extra space above the card so the last item is fully visible when scrolled to the bottom */
    margin-top: 80px; 
    
    /* Enhanced border and shadow for the floating effect */
    border: 1px solid rgba(212, 175, 55, 0.4);
    box-shadow: 0 -8px 25px rgba(0, 0, 0, 0.85);
}


.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-row.small {
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.summary-row.highlight {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-shadow: 0 0 12px rgba(212, 175, 55, 0.4);
}

.summary-row.highlight span:last-child {
    color: #32D74B;
    text-shadow: 0 0 12px rgba(50, 215, 75, 0.4);
}



.text-tertiary {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
}

/* --- FOOTER GLASS (Total Bar) --- */
.app-footer {
    position: absolute;
    bottom: var(--nav-height);
    /* Above bottom nav + safe area */
    left: 0;
    right: 0;
    height: 56px;
    background: linear-gradient(180deg, rgba(13, 13, 13, 0.0) 0%, rgba(13, 13, 13, 0.97) 35%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(212, 175, 55, 0.08);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 var(--spacing-lg);
    z-index: 100;
}

.total-display {
    display: flex;
    align-items: center;
    gap: 12px;
}

.total-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-tertiary);
    font-weight: 700;
    letter-spacing: 1.5px;
}

.total-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    color: #32D74B;
    text-shadow: 0 0 10px rgba(50, 215, 75, 0.3);
}

.btn-action {
    background: var(--accent-blue);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 40px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.3);
}

.btn-action:active {
    transform: scale(0.96);
}

/* --- SETTINGS LIST --- */
.settings-list h3 {
    margin-top: 20px;
    color: var(--accent-primary) !important;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(212, 175, 55, 0.15);
    padding-bottom: 8px;
}

.settings-list .price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    margin-bottom: 2px;
    transition: background 0.2s;
}

.settings-list .price-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.settings-list .price-row label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
    flex: 1;
    margin: 0;
}

/* Rate currency wrapper in settings */
.rate-currency {
    width: 100px;
    flex-shrink: 0;
}

.rate-currency .currency-symbol {
    left: 8px;
    font-size: 0.85rem;
    color: var(--accent-primary);
    opacity: 0.7;
}

.rate-currency .price-edit {
    padding: 8px 8px 8px 22px !important;
    text-align: right;
    font-size: 0.9rem;
    background: var(--bg-surface-elevated);
    border: 1px solid rgba(212, 175, 55, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    width: 100%;
}

.rate-currency .price-edit:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.12);
    background: rgba(28, 28, 28, 0.95);
}

/* --- BACK BUTTON --- */
.btn-back {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(212, 175, 55, 0.15);
    color: var(--accent-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-back:active {
    background: rgba(212, 175, 55, 0.15);
    transform: scale(0.92);
}


/* Units Feed */
.units-feed .unit-item {
    background: var(--bg-surface-elevated);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- Swipe Actions (Mobile First) --- */
.swipe-container {
    position: relative;
    overflow: hidden;
    /* Hide actions until swiped */
    background: var(--bg-surface-elevated);
    /* Cover actions */
    transition: transform 0.2s ease-out;
    z-index: 2;
    /* Above actions */
    border-radius: 8px;
    /* Match project/card radius */
}

/* Container for the buttons behind the content */
.swipe-actions {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 140px;
    /* Width of 2 buttons */
    display: flex;
    z-index: 1;
    /* Behind content */
    border-radius: 0 8px 8px 0;
    overflow: hidden;
}

.swipe-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
}

.action-edit {
    background-color: #3b82f6;
    /* Vibrant Blue */
}

.action-edit:active {
    background-color: #2563eb;
}

.action-delete {
    background-color: #ef4444;
    /* Vibrant Red */
}

.action-delete:active {
    background-color: #dc2626;
}

/* Adjust Project Header for Swipe */
.project-header {
    /* Ensure header takes full click for toggle, but swipe overrides */
    position: relative;
    background: var(--bg-surface-elevated);
    z-index: 2;
}

.btn-primary {
    background: var(--accent-primary);
    color: #000;
    border: none;
    border-radius: 8px;
    padding: 0 16px;
    font-weight: 700;
    cursor: pointer;
}

.btn-text-danger {
    background: none;
    border: none;
    width: 100%;
    color: var(--accent-danger);
    padding: 15px;
    font-size: 0.9rem;
    cursor: pointer;
}

.btn-secondary {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 12px 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}

/* --- CLEAR QUANTITIES BUTTON --- */
.btn-clear-quantities {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    margin-bottom: 14px;
    background: rgba(212, 175, 55, 0.06);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: var(--radius-md);
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 0.88rem;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
}

.btn-clear-quantities:hover {
    background: rgba(212, 175, 55, 0.12);
    box-shadow: 0 0 14px rgba(212, 175, 55, 0.12);
}

.btn-clear-quantities:active {
    transform: scale(0.97);
    background: rgba(212, 175, 55, 0.18);
}


.btn-icon {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-icon:active {
    transform: scale(0.95);
}

/* --- MODAL --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-content {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 16px;
    max-width: 400px;
    width: 100%;
    border: 1px solid var(--glass-border);
}

.modal-content h3 {
    margin: 0 0 20px;
    font-size: 1.2rem;
    color: var(--text-primary);
}

/* --- UNIT CARDS (Expandable) --- */
.unit-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    border: none;
    overflow: hidden;
    transition: background-color 0.2s ease;
}

.unit-card.selected {
    background: rgba(212, 175, 55, 0.05);
    /* Slight yellow tint */
}

/* Inline Checkbox */
.custom-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-tertiary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    margin-right: 12px;
    transition: all 0.2s;
}

.custom-checkbox i,
.custom-checkbox svg {
    color: #000;
    font-size: 12px;
    width: 12px;
    height: 12px;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s;
}

.custom-checkbox.checked {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.custom-checkbox.checked i,
.custom-checkbox.checked svg {
    opacity: 1;
    transform: scale(1);
}

.unit-header {
    display: flex;
    align-items: center;
    padding: 16px;
    cursor: pointer;
}

@media (hover: hover) {
    .unit-header:hover {
        background: var(--bg-surface-elevated);
    }
}

.unit-header:active {
    background: var(--bg-surface-elevated);
}

.unit-name {
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

.unit-total {
    font-family: 'JetBrains Mono', monospace;
    color: #32D74B;
    font-weight: 700;
    flex-shrink: 0;
}

.unit-details {
    display: none;
    padding: 0 16px 16px;
    border-top: 1px solid var(--border-subtle);
}

.units-feed {
    padding-bottom: 80px;
    /* Safe space for floating elements */
}

.unit-card.expanded .unit-details {
    display: block;
}

.unit-section {
    margin-bottom: 12px;
}

.unit-section-title {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.unit-item-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 4px 0;
}

.unit-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 15px;
    border-top: 1px solid var(--border-subtle);
    padding-top: 12px;
}

.btn-icon-small {
    padding: 6px 10px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    width: 100%;
}

.btn-icon-small:active {
    transform: scale(0.96);
}

/* Specific Action Colors */
.btn-edit {
    background: rgba(10, 132, 255, 0.15);
    color: #4da3ff;
}

.btn-rename {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.btn-delete {
    background: rgba(255, 69, 58, 0.15);
    color: var(--accent-danger);
}

.btn-duplicate {
    background: rgba(212, 175, 55, 0.15);
    color: var(--accent-primary);
}

.btn-refresh {
    background: transparent;
    color: var(--accent-primary);
    border: 1px solid rgba(255, 214, 10, 0.3);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-refresh:hover {
    background: rgba(255, 214, 10, 0.1);
    border-color: var(--accent-primary);
}

.btn-text-danger {
    background: transparent;
    color: var(--accent-danger);
    border: none;
    padding: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    width: 100%;
    margin-top: 20px;
    margin-bottom: 40px;
    /* Space for scroll */
}

/* Danger Active State (Floating Button) */
.btn-text-danger.danger-active {
    position: fixed;
    /* Fixed to viewport or acts sticky if container allows */
    bottom: calc(var(--footer-height) + 20px);
    /* Above footer */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: var(--accent-danger);
    color: #fff;
    font-weight: 700;
    border-radius: 50px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(255, 69, 58, 0.4);
    z-index: 100;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* AUTH OVERLAY STYLES */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(30, 30, 30, 0.9) 0%, #000 100%);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: calc(40px + env(safe-area-inset-top, 0px)) 20px calc(20px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    backdrop-filter: blur(5px);
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.auth-overlay.hidden {
    display: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.auth-card {
    background: var(--bg-surface);
    width: 100%;
    max-width: 400px;
    margin: auto 0;
    padding: 40px 30px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-heavy);
    text-align: center;
}

.auth-header {
    margin-bottom: 30px;
}

.app-logo-large {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    overflow: hidden;
    box-shadow: 0 0 30px var(--accent-neon), 0 0 60px rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.auth-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 14px;
}

.auth-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 5px;
}

.auth-header p {
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.input-group-auth {
    text-align: left;
    margin-bottom: 15px;
}

.input-group-auth label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-full {
    width: 100%;
    padding: 14px;
    font-weight: 700;
    margin-top: 5px;
    font-family: 'Outfit', sans-serif;
}

.auth-divider {
    margin: 25px 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-divider::before {
    content: "";
    position: absolute;
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.auth-divider span {
    background: var(--bg-surface);
    padding: 0 15px;
    color: var(--text-tertiary);
    font-size: 0.7rem;
    font-weight: 700;
    position: relative;
}

.btn-google {
    background: #fff;
    color: #000;
    border: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.2s, background 0.2s;
    height: 48px;
    width: 100%;
    margin-bottom: 10px;
}

.btn-google:hover {
    background: #f1f1f1;
}

.btn-apple {
    background: #fff;
    color: #000;
    border: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.2s, background 0.2s;
    height: 48px;
    width: 100%;
    margin-bottom: 10px;
}

.btn-apple:hover {
    background: #f1f1f1;
}

.btn-facebook {
    background: #1877F2;
    color: #fff;
    border: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.2s, background 0.2s;
    height: 48px;
    width: 100%;
    margin-bottom: 10px;
}

.btn-facebook:hover {
    background: #166FE5;
}

.btn-google:active, .btn-apple:active, .btn-facebook:active {
    transform: scale(0.98);
}

.btn-google img {
    width: 18px;
}

.auth-status-msg {
    margin-top: 20px;
    font-size: 0.85rem;
    min-height: 1.2rem;
    font-weight: 600;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(5px);
    word-break: break-word;
    overflow-wrap: break-word;
}

.auth-status-msg.error {
    color: #ff4d4d;
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid rgba(255, 77, 77, 0.3);
    opacity: 1;
    transform: translateY(0);
}

.auth-status-msg.success {
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    opacity: 1;
    transform: translateY(0);
}

/* --- SETTINGS MODAL --- */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.settings-modal.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.settings-content {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 280px;
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-heavy);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.settings-modal.active .settings-content {
    transform: scale(1);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.settings-header h3 {
    margin: 0;
    font-size: 0.95rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.user-info .user-email {
    font-size: 0.9rem;
    color: var(--text-primary);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}

.user-info .user-role {
    font-size: 0.75rem;
    color: var(--accent-primary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.settings-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.btn-settings {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.95rem;
    text-align: left;
    transition: background 0.2s;
}

.btn-settings:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-settings.danger {
    color: var(--accent-danger);
    background: rgba(255, 69, 58, 0.1);
}

.btn-settings.danger:hover {
    background: rgba(255, 69, 58, 0.2);
}

.btn-settings.danger-zone {
    color: #ff453a;
    background: rgba(255, 69, 58, 0.1);
    border: 1px solid rgba(255, 69, 58, 0.3);
}

.btn-settings.danger-zone:hover {
    background: rgba(255, 69, 58, 0.2);
    border-color: rgba(255, 69, 58, 0.6);
}

/* --- TIME SHEET FEATURE --- */

/* Selection Bar */
.selection-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1c1c1e;
    border: 1px solid var(--glass-border);
    padding: 12px 24px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    z-index: 200;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.selection-bar.active {
    transform: translateX(-50%) translateY(0);
}

#selectionCount {
    font-weight: 700;
    color: #fff;
    min-width: 80px;
    font-size: 0.9rem;
}

.btn-primary-small {
    background: var(--accent-primary);
    color: #000;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(255, 214, 10, 0.3);
}

/* Checkboxes in Unit Cards */
.unit-card {
    position: relative;
    /* For checkbox positioning */
    transition: border 0.2s, transform 0.2s;
    border: 1px solid transparent;
}

.unit-card.selected {
    border: 1px solid var(--accent-primary);
    background: rgba(255, 214, 10, 0.05);
}

.unit-select-wrapper {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
}

.unit-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--text-tertiary);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.unit-checkbox:checked {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.unit-checkbox:checked::after {
    content: '✓';
    position: absolute;
    color: #000;
    font-weight: 900;
    font-size: 16px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Time Sheet Paper & Modal */
.time-sheet-paper {
    background: #fff;
    color: #000;
    padding: 40px;
    border-radius: 4px;
    font-family: 'Helvetica', sans-serif;
    /* Standard font for PDF */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    max-height: 60vh;
    overflow-y: auto;
}

.ts-header {
    margin-bottom: 20px;
    text-align: left;
}

.ts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ts-item {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed #eee;
    padding-bottom: 8px;
    font-size: 0.95rem;
}

.ts-item span:first-child {
    font-weight: 500;
}

.ts-item span:last-child {
    font-weight: 700;
}

/* Loading State */
.loading-spinner {
    text-align: center;
    padding: 16px;
    font-style: italic;
    color: var(--text-tertiary);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}

/* --- CALCULATOR MODAL --- */
.calculator-modal {
    max-width: 280px;
}

.calc-display {
    background: var(--bg-surface-elevated);
    padding: 16px;
    font-size: 2rem;
    font-family: 'JetBrains Mono', monospace;
    text-align: right;
    border-radius: 8px;
    margin-bottom: 5px;
    color: var(--accent-primary);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.calc-screen {
    /* New container style */
    background: var(--bg-surface-elevated);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: right;
}

.calc-history {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    min-height: 1.2em;
    margin-bottom: 5px;
    display: flex;
    flex-wrap: wrap;
    /* Allow wrapping to next line */
    justify-content: flex-end;
    /* Align to right */
    gap: 5px;
    /* Space between items if we were using spans, but it's textContent usually. keeping for safety */
    word-break: break-all;
    /* Ensure long numbers wrap */
}

/* Project Actions */
.project-actions {
    display: flex;
    gap: 15px;
    margin-right: 15px;
}

.project-actions i {
    cursor: pointer;
    color: var(--text-tertiary);
    transition: color 0.2s;
}

.project-actions i:hover {
    color: var(--text-primary);
}

.project-actions .fa-trash:hover {
    color: var(--accent-danger);
}

.calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.calc-btn {
    height: 72px;
    font-size: 1.6rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: 0.2s;
    font-family: 'JetBrains Mono', monospace;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calc-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.calc-btn:active {
    transform: scale(0.95);
}

.calc-btn.calc-operator {
    background: rgba(255, 214, 10, 0.1);
    color: var(--accent-primary);
    border-color: rgba(255, 214, 10, 0.3);
}

.calc-btn.calc-operator:hover {
    background: rgba(255, 214, 10, 0.2);
}

.calc-btn.calc-equals {
    background: var(--accent-primary);
    color: #000;
    font-weight: 700;
    border-color: var(--accent-primary);
}

.calc-btn.calc-equals:hover {
    background: #FFE74C;
}

.calc-btn.calc-clear {
    background: rgba(255, 69, 58, 0.1);
    color: var(--accent-danger);
    border-color: rgba(255, 69, 58, 0.3);
}

.calc-btn.calc-clear:hover {
    background: rgba(255, 69, 58, 0.2);
}

.calc-btn.calc-action {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.calc-btn.calc-action:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Project Header Toggle Styles */
.project-header:hover>div {
    background: var(--bg-surface-elevated) !important;
}

.project-header i {
    transition: transform 0.3s ease;
}

/* Header Actions Alignment Fix */
.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

/* --- Save Modal Round 3 Refinements --- */
#newProjectNameContainer {
    margin-top: 10px;
}

#newProjectNameInput {
    width: 100%;
    padding: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--accent-primary);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

#newProjectNameInput:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* Accordion Styling */
#toggleHourTracker {
    transition: background-color 0.2s;
    cursor: pointer;
}

#toggleHourTracker:hover {
    background-color: var(--bg-surface-hover) !important;
}

#hourTrackerDetails {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fix for "purple +" if it was a default link style */
a#toggleHourTracker {
    text-decoration: none;
}

/* --- CALCULATOR HISTORY ENTRIES --- */
.calc-history-entry {
    padding: 2px 0;
    font-size: 0.85rem;
    color: var(--text-tertiary);
    opacity: 0.7;
    line-height: 1.4;
    animation: historyFadeIn 0.2s ease-out;
}

.calc-history-entry.calc-history-current {
    opacity: 1;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Webkit scrollbar for history */
.calc-history::-webkit-scrollbar {
    width: 3px;
}

.calc-history::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 3px;
}

.calc-history::-webkit-scrollbar-track {
    background: transparent;
}

@keyframes historyFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 0.7;
        transform: translateY(0);
    }
}

/* ============================================
   SPLASH SCREEN
   ============================================ */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #1a1a1a 0%, #0D0D0D 50%, #000000 100%);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.splash-screen.fade-out {
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}

.splash-content {
    text-align: center;
    animation: splashFadeIn 0.8s ease-out;
}

.splash-logo {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 24px;
    border: 2px solid rgba(212, 175, 55, 0.4);
    box-shadow:
        0 0 40px rgba(212, 175, 55, 0.3),
        0 0 80px rgba(212, 175, 55, 0.15),
        0 0 120px rgba(212, 175, 55, 0.08);
    animation: splashLogoPulse 2s ease-in-out infinite;
    margin-bottom: 12px;
}

.splash-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent-primary);
    letter-spacing: 4px;
    margin: 0;
    text-shadow: 0 0 30px rgba(212, 175, 55, 0.5);
}

.splash-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 8px 0 0;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.splash-loader {
    width: 160px;
    height: 3px;
    background: rgba(212, 175, 55, 0.15);
    border-radius: 3px;
    margin: 32px auto 0;
    overflow: hidden;
}

.splash-loader-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #B8962E, #D4AF37, #C9A84C);
    border-radius: 3px;
    animation: splashLoading 2s ease-in-out forwards;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

@keyframes splashFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes splashLogoPulse {

    0%,
    100% {
        box-shadow:
            0 0 40px rgba(212, 175, 55, 0.3),
            0 0 80px rgba(212, 175, 55, 0.15);
    }

    50% {
        box-shadow:
            0 0 50px rgba(212, 175, 55, 0.5),
            0 0 100px rgba(212, 175, 55, 0.25);
    }
}

@keyframes splashLoading {
    0% {
        width: 0%;
    }

    30% {
        width: 40%;
    }

    60% {
        width: 70%;
    }

    100% {
        width: 100%;
    }
}

/* --- SELECTION BAR (Hidden by default) --- */
.selection-bar {
    display: none !important;
}

/* --- RESPONSIVE: Fix collapsed hidden sections on small screens --- */
.component-row .input-premium,
.component-row .select-premium {
    min-width: 0;
    box-sizing: border-box;
}

.component-row label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 420px) {
    .component-row {
        grid-template-columns: 1.2fr 1fr 1fr;
        gap: 6px;
    }

    .component-row .input-premium {
        padding: 10px 8px;
        font-size: 0.9rem;
    }

    .component-row label {
        font-size: 0.82rem;
    }

    .component-row.grid-3-col {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 6px;
    }
}

/* --- HEADER LOGO STYLES --- */
.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 12px;
    background: #000;
    border: 1px solid rgba(212, 175, 55, 0.4);
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    flex-shrink: 0;
    /* Force clipping in Safari */
    -webkit-mask-image: -webkit-radial-gradient(white, black);
}

.header-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* Zoom in by 18% to crop out the baked-in gold border and black corners of the original image */
    transform: scale(1.18);
}
/* --- Interactive Tour Styles --- */
.tour-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    transition: opacity 0.3s ease, clip-path 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.tour-overlay.hidden {
    display: none;
    opacity: 0;
}

/* 
   We add this class dynamically to the target element in JS 
   to bring it above the dark overlay.
*/
.tour-highlight {
    position: relative !important;
    z-index: 10001 !important;
    box-shadow: 0 0 0 4px var(--accent-primary), 0 0 40px rgba(212, 175, 55, 0.9) !important;
    border-radius: inherit;
    background-color: var(--bg-surface) !important;
    pointer-events: none !important; /* Block clicks on the highlighted element during tour */
}

/* Add this to elements that the user MUST click to proceed */
.tour-highlight.tour-clickable {
    pointer-events: auto !important;
}

/* The floating tooltip */
.tour-tooltip {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 320px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--accent-primary);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85), 0 0 20px rgba(212, 175, 55, 0.25);
    z-index: 10002;
    transition: top 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.2s ease;
}

.tour-tooltip.hidden {
    display: none;
    opacity: 0;
    transform: translateY(10px);
}

.tour-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.tour-tooltip p {
    margin: 10px 0 16px 0;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--text-primary);
}

.tour-tooltip-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.btn-tour-secondary {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 8px;
    flex: 1;
    text-align: center;
}

.btn-tour-primary {
    background: linear-gradient(135deg, var(--accent-primary), #e6b800);
    color: #000;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    flex: 1;
    text-align: center;
    box-shadow: 0 4px 10px rgba(212, 175, 55, 0.3);
}




/* --- RESPONSIVE PAYWALL (PHASE 4) --- */
#paywallOverlay {
    padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(24px, env(safe-area-inset-bottom, 0px)) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

.paywall-card {
    max-width: 420px;
    width: 100%;
    padding: clamp(20px, 3vh, 32px) clamp(16px, 4vw, 24px) !important;
    position: relative;
    margin: auto 0;
}

.paywall-icon-wrap {
    width: clamp(52px, 7.5vh, 68px) !important;
    height: clamp(52px, 7.5vh, 68px) !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto clamp(8px, 1.4vh, 14px) !important;
}

.paywall-icon-wrap svg {
    width: clamp(26px, 3.8vh, 34px);
    height: clamp(26px, 3.8vh, 34px);
}

#paywallTitle {
    font-size: clamp(1.15rem, 2.2vh, 1.35rem) !important;
    margin-bottom: clamp(4px, 0.8vh, 8px) !important;
}

#paywallSubtitle {
    font-size: clamp(0.8rem, 1.5vh, 0.9rem) !important;
    line-height: 1.45 !important;
}

.plan-card {
    padding: clamp(10px, 1.8vh, 16px) clamp(8px, 2vw, 14px) !important;
}

.plan-card div:last-child {
    font-size: clamp(1.25rem, 2.4vh, 1.5rem) !important;
}
