/* ==========================================================================
   NEMVIDEN.DK - MASTER STYLE SHEET (DEFINITIVE 2026 EDITION)
   Theme: Apple iOS Inset Grouped / Liquid Glass (Light Mode Only)
   Contains: Layouts, Calculators, Database UI, Animations
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. ROOT VARIABLES & THEME CONFIGURATION
   -------------------------------------------------------------------------- */
:root {
    /* --- Brand Identity --- */
    --brand-primary: #007AFF;   /* iOS Blue */
    --brand-success: #34C759;   /* iOS Green */
    --brand-danger:  #FF3B30;   /* iOS Red */
    --brand-warning: #FF9500;   /* iOS Orange */
    --brand-purple:  #AF52DE;   /* iOS Purple */
    --brand-dark:    #1C1C1E;

    /* --- System Colors (Fixed Light Theme) --- */
    --bg-body:       #F2F2F7;   /* System Gray 6 */
    --bg-card:       #FFFFFF;   /* Base surface */
    --bg-input:      #E5E5EA;   /* System Gray 5 (Inputs/Tracks) */
    --bg-header:     rgba(255, 255, 255, 0.85);
    
    --text-primary:  #000000;
    --text-secondary:#8E8E93;   /* System Gray */
    --text-tertiary: #C7C7CC;   /* System Gray 2 */
    
    --border-color:  #C6C6C8;   /* Separator */
    --border-faint:  rgba(60, 60, 67, 0.18);

    /* --- Semantic Colors (Backgrounds) --- */
    --state-info-bg:    #E5F2FF;
    --state-success-bg: #E0F8E5;
    --state-warn-bg:    #FFF4E5;
    --state-error-bg:   #FFE5E5;

    /* --- Dimensions & Effects --- */
    --radius-sm:     8px;
    --radius-md:     12px;
    --radius-lg:     16px;      /* Standard Card Radius */
    --radius-xl:     24px;      /* Modals */
    --radius-pill:   999px;
    
    --shadow-sm:     0 1px 2px rgba(0,0,0,0.04);
    --shadow-card:   0 2px 8px rgba(0,0,0,0.04), 0 0 1px rgba(0,0,0,0.1);
    --shadow-float:  0 8px 24px rgba(0,0,0,0.12);
    --shadow-glow:   0 0 15px rgba(0, 122, 255, 0.3);

    --glass-blur:    blur(20px);
    --transition:    all 0.3s cubic-bezier(0.25, 1, 0.5, 1); /* iOS Spring */

    /* --- Z-Index Layers --- */
    --z-dropdown:    100;
    --z-sticky:      500;
    --z-overlay:     900;
    --z-modal:       1000;
    --z-toast:       2000;
}

/* --------------------------------------------------------------------------
   2. GLOBAL RESET & TYPOGRAPHY
   -------------------------------------------------------------------------- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Headings */
h1, h2, h3, h4, h5, h6 { color: var(--text-primary); margin-bottom: 0.5em; letter-spacing: -0.02em; }
h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 24px; }
h2 { font-size: 28px; font-weight: 700; margin-top: 40px; }
h3 { font-size: 22px; font-weight: 600; }

/* Prose / Article Text */
p { font-size: 17px; margin-bottom: 16px; color: var(--text-secondary); }
a { color: var(--brand-primary); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }

/* Utility Classes */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-bold   { font-weight: 600; }
.text-small  { font-size: 13px; }
.text-mute   { color: var(--text-tertiary); }
.hidden      { display: none !important; }

/* --------------------------------------------------------------------------
   3. LAYOUT & GRID SYSTEM
   -------------------------------------------------------------------------- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

main { flex: 1; padding: 40px 0; width: 100%; }

/* Two-Column Calc Layout: [ Calculator Tool ] | [ Explainer Text / Ads ] */
.calc-layout {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 40px;
    align-items: start;
}

/* Dashboard Grid for Database Views */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 900px) {
    .calc-layout { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   4. NAVIGATION (FIXED & CLEAN)
   -------------------------------------------------------------------------- */
.site-header {
    background: rgba(255, 255, 255, 0.95); /* High opacity white */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid #E5E5EA;
    position: sticky; top: 0; z-index: 500;
    height: 60px;
}

.header-inner {
    display: flex; justify-content: space-between; align-items: center;
    height: 100%;
    padding: 0 20px; /* Ensure padding on sides */
}

/* Logo */
.logo { display: flex; align-items: center; text-decoration: none; }
.logo img { display: block; height: 32px; width: auto; }

/* Desktop Navigation */
.desktop-nav .nav-links { display: flex; gap: 24px; list-style: none; margin: 0; padding: 0; }
.desktop-nav a { 
    color: #1C1C1E; font-size: 15px; font-weight: 500; text-decoration: none; 
}
.btn-nav-primary {
    background: #007AFF; color: white !important;
    padding: 8px 16px; border-radius: 20px; font-weight: 600;
}

/* --- MOBILE TOGGLE (The "Burger") --- */
.mobile-toggle {
    display: none; /* Hidden on Desktop */
    flex-direction: column; justify-content: center; gap: 5px;
    background: transparent; border: none; cursor: pointer;
    width: 44px; height: 44px; /* Large touch target */
    padding: 0; margin-right: -10px; /* Align to edge */
    z-index: 502;
}

/* The lines inside the burger - FORCED BLACK */
.mobile-toggle .bar {
    display: block;
    width: 24px;
    height: 2px;
    background-color: #000000; /* Force Black */
    border-radius: 2px;
    margin: 0 auto;
}

/* --- MOBILE OVERLAY (The Menu) --- */
.mobile-nav-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
    background: #FFFFFF; /* Solid White */
    z-index: 2000;
    display: flex; flex-direction: column;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Open State */
body.nav-open .mobile-nav-overlay {
    opacity: 1; visibility: visible; pointer-events: auto;
}
body.nav-open { overflow: hidden; }

/* Overlay Header */
.mobile-overlay-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 20px;
    height: 60px;
    border-bottom: 1px solid #E5E5EA;
    background: #FFFFFF;
}

.overlay-title { font-size: 17px; font-weight: 600; color: #8E8E93; }

/* The Close Button (X) */
.mobile-close {
    background: #F2F2F7; /* Light Grey Circle */
    border: none;
    width: 32px; height: 32px;
    border-radius: 50%;
    color: #000000;
    font-size: 18px; font-weight: bold;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* Mobile Links */
.mobile-nav-content {
    padding: 20px;
    display: flex; flex-direction: column; gap: 0;
}

.mobile-nav-content a {
    font-size: 20px; font-weight: 600; color: #000000;
    padding: 16px 0;
    border-bottom: 1px solid #F2F2F7;
    text-decoration: none;
}

.mobile-btn-primary {
    color: #007AFF !important;
    border-bottom: none !important;
    margin-top: 10px;
}

/* --- RESPONSIVE TRIGGER --- */
@media (max-width: 900px) {
    .desktop-nav { display: none; }
    .mobile-toggle { display: flex; } /* Make sure this is FLEX */
}

/* Footer */
.site-footer {
    background: var(--bg-card); color: #8E8E93;
    padding: 30px 0 20px; margin-top: auto;
    padding-bottom: calc(20px + env(safe-area-inset-bottom)); /* Home Indicator safe space */
}
/* Update to existing .logo class to support image */
.logo { 
    display: flex; 
    align-items: center; 
    /* Remove text specific styles if the image contains the text */
    text-decoration: none;
}

.logo img {
    height: 40px; /* Constraints height to fit inside the 60px header */
    width: auto;  /* Maintains aspect ratio */
    display: block;
}

/* --- Footer Specific Extensions --- */

/* layout for the columns */
.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Aligns items horizontally center */
    flex-wrap: wrap;
    gap: 20px;
}

/* Make the logo column smaller and tight */
.footer-col.brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.footer-col.brand p {
    margin: 0;
    font-size: 13px;
    max-width: none;
}

/* Display links in a single row instead of a list */
.footer-links {
    display: flex;
    gap: 24px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-links li {
    margin: 0;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
}

.footer-links a:hover {
    color: var(--brand-primary);
}

/* Copyright text styling */
.footer-copyright {
    margin-top: 0;
    font-size: 13px;
    color: var(--text-tertiary);
}

/* Mobile: Stack them neatly if screen is too small */
@media (max-width: 768px) {
    .footer-inner {
        flex-direction: column;
        text-align: center;
        gap: 24px;
    }
    
    .footer-col.brand {
        flex-direction: column;
        gap: 10px;
    }
    
    .footer-links {
        justify-content: center;
        gap: 16px;
        flex-wrap: wrap;
    }
}

/* --------------------------------------------------------------------------
   5. CALCULATOR COMPONENT SYSTEM (The "Inset Grouped" Look)
   Best Use: All financial tools, forms, and settings pages.
   -------------------------------------------------------------------------- */

/* A. The Card Container */
.ios-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden; /* Clips children corners */
    margin-bottom: 30px;
    border: 1px solid var(--border-faint);
}

/* B. The Header inside a card (Optional) */
.ios-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-body); /* Slightly darker header */
    font-weight: 600;
    font-size: 15px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* C. The Input Row */
.ios-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    min-height: 54px;
    background: var(--bg-card);
    transition: background 0.2s;
}
.ios-row:last-child { border-bottom: none; }
.ios-row:focus-within { background: var(--state-info-bg); } /* Highlight active row */

.ios-row label {
    font-size: 17px;
    color: var(--text-primary);
    flex: 1;
}

/* D. Inputs (Text, Number, Select) */
.ios-input {
    text-align: right;
    border: none;
    background: transparent;
    font-size: 17px;
    color: var(--brand-primary);
    font-family: inherit;
    font-weight: 500;
    outline: none;
    width: 60%;
    font-variant-numeric: tabular-nums;
}
.ios-input::placeholder { color: var(--text-tertiary); }
select.ios-input { cursor: pointer; appearance: none; direction: rtl; }

/* --- NEW ADDITION: Boxed Input Variant --- */
.ios-input.boxed {
    background: var(--bg-input); /* Light gray background */
    border-radius: 6px;          /* Rounded corners */
    padding: 6px 10px;           /* Inner spacing */
    margin-right: 8px;           /* Space between box and "km" or "dage" */
    width: 100px;                /* Fixed width for alignment */
    text-align: center;          /* Center the number inside the box */
    color: var(--text-primary);  /* Dark text for better contrast */
}

/* Ensure focus state looks good */
.ios-input.boxed:focus {
    background: #FFFFFF;
    box-shadow: 0 0 0 2px var(--brand-primary); /* Blue ring on focus */
}

/* ---> SÆT IND HER: TEXTAREA OVERRIDES <--- */
textarea.ios-input {
    width: 100%;
    text-align: left; /* Tvinger teksten til venstre */
    height: auto;
    padding: 10px 0;
    resize: vertical; /* Gør at brugeren kan trække boksen større */
}

/* E. Input Group (for Suffixes like "DKK" or "%") */
.ios-input-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    width: 60%;
}
.ios-input-group input { width: 100%; text-align: right; }
.ios-suffix { color: var(--text-secondary); font-size: 17px; pointer-events: none; }

/* F. Toggle Switch (Checkbox Replacement) - FIXED & REINFORCED */
.ios-toggle {
    position: relative;
    
    /* FORCE FIXED DIMENSIONS - Cannot be overridden */
    width: 51px !important;
    height: 31px !important;
    min-width: 51px !important;
    min-height: 31px !important;
    
    /* FLEX BEHAVIOR - Don't Grow, Don't Shrink, Fixed Basis */
    flex: 0 0 51px !important;
    
    display: block; /* Better for layout than inline-block */
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: pointer;
}

/* Hide the actual checkbox completely off-flow */
.ios-toggle input { 
    position: absolute;
    opacity: 0; 
    width: 0; 
    height: 0; 
    margin: 0;
    padding: 0;
    pointer-events: none;
}

/* The background track */
.ios-slider {
    position: absolute; 
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--bg-input); /* Default Gray */
    border-radius: 34px;
    transition: 0.4s;
}

/* The white circle knob */
.ios-slider:before {
    position: absolute; 
    content: "";
    height: 27px !important; 
    width: 27px !important;
    left: 2px !important; 
    bottom: 2px !important;
    background-color: white;
    border-radius: 50%;
    transition: 0.4s cubic-bezier(0.3, 1.5, 0.7, 1); /* Bounce effect */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Checked State - Green Background */
.ios-toggle input:checked + .ios-slider { 
    background-color: var(--brand-success); 
}

/* Checked State - Move Knob */
.ios-toggle input:checked + .ios-slider:before { 
    transform: translateX(20px); 
}

/* G. Segmented Control (Tabs) */
/* Best Use: Switching between Modes (e.g., Monthly vs Yearly) */
.ios-segment {
    display: flex;
    background: var(--bg-input);
    padding: 2px;
    border-radius: 9px;
    margin: 0 20px 16px; /* Inside card padding */
}
.ios-segment input { display: none; }
.ios-segment label {
    flex: 1;
    text-align: center;
    padding: 8px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 7px;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s;
}
.ios-segment input:checked + label {
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-weight: 600;
}

/* H. Range Slider Row */
.ios-range-row {
    display: block;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.ios-range-header { display: flex; justify-content: space-between; margin-bottom: 10px; }
.range-val { color: var(--brand-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
input[type=range].ios-range {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}
input[type=range].ios-range::-webkit-slider-runnable-track {
    width: 100%; height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
}
input[type=range].ios-range::-webkit-slider-thumb {
    height: 28px; width: 28px;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    margin-top: -11px;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

/* I. Buttons (Action) */
.btn-primary {
    display: block; width: 100%;
    padding: 16px;
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 17px; font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s;
}
.btn-primary:active { transform: scale(0.98); opacity: 0.9; }

.btn-secondary {
    display: block; width: 100%;
    padding: 14px;
    background: transparent;
    color: var(--brand-primary);
    border: none;
    font-size: 16px; font-weight: 500;
    cursor: pointer;
    margin-top: 8px;
}

/* --------------------------------------------------------------------------
   6. RESULTS & DATA VISUALIZATION
   Best Use: Showing calculation outputs, stats, and database entries.
   -------------------------------------------------------------------------- */

/* A. Result Highlight Card */
.result-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    border: 1px solid var(--border-faint);
    animation: fadeUp 0.5s ease;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.res-big { font-size: 36px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.02em; display: block; }
.res-sub { font-size: 14px; color: var(--text-secondary); text-transform: uppercase; font-weight: 600; letter-spacing: 0.05em; }

/* B. Progress Bars */
.progress-bar {
    height: 10px;
    background: var(--bg-input);
    border-radius: 5px;
    overflow: hidden;
    margin: 10px 0;
}
.progress-fill {
    height: 100%;
    background: var(--brand-primary);
    width: 0%;
    transition: width 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.progress-fill.green { background: var(--brand-success); }
.progress-fill.red { background: var(--brand-danger); }

/* C. Database Tables (Admin/List Views) */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}
.db-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    font-size: 14px;
}
.db-table th {
    background: var(--bg-body);
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.db-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}
.db-table tr:last-child td { border-bottom: none; }
.db-table tr:hover { background: var(--state-info-bg); }

/* D. Status Badges */
.badge {
    display: inline-flex; align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase;
}
.badge-success { background: var(--state-success-bg); color: var(--brand-success); }
.badge-warn    { background: var(--state-warn-bg); color: var(--brand-warning); }
.badge-error   { background: var(--state-error-bg); color: var(--brand-danger); }
.badge-info    { background: var(--state-info-bg); color: var(--brand-primary); }

/* --------------------------------------------------------------------------
   7. INTERACTIVE FEEDBACK & ALERTS
   Best Use: Errors, Warnings, Loading States, Modals.
   -------------------------------------------------------------------------- */

/* A. Alerts / Callouts */
.alert {
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex; gap: 12px;
    font-size: 15px;
    line-height: 1.4;
}
.alert-info { background: var(--state-info-bg); color: #004085; border-left: 4px solid var(--brand-primary); }
.alert-warn { background: var(--state-warn-bg); color: #856404; border-left: 4px solid var(--brand-warning); }

/* B. Skeleton Loading (Anti-Layout Shift) */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-body) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    opacity: 0.6;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* C. Toast Notification */
.toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    z-index: var(--z-toast);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-float);
    display: none; /* Toggled by JS */
}
.toast.show { display: block; animation: fadeUp 0.3s; }

/* D. Modal Overlay */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
    background: var(--bg-card);
    width: 90%; max-width: 500px;
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-float);
    transform: scale(0.9); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.modal-overlay.open .modal { transform: scale(1); }

/* --------------------------------------------------------------------------
   8. CONTENT ELEMENTS (Stepper, Accordion, Tooltips)
   -------------------------------------------------------------------------- */

/* Stepper (Wizard) */
.stepper { display: flex; justify-content: space-between; margin-bottom: 30px; position: relative; }
.stepper::before { content:''; position: absolute; top: 14px; left: 0; right: 0; height: 2px; background: var(--bg-input); z-index: 0; }
.step { position: relative; z-index: 1; text-align: center; background: var(--bg-body); padding: 0 10px; }
.step-dot { width: 30px; height: 30px; background: var(--bg-input); border-radius: 50%; margin: 0 auto 5px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: bold; color: var(--text-secondary); border: 2px solid var(--bg-body); }
.step.active .step-dot { background: var(--brand-primary); color: white; }

/* Accordion (Details/Summary) */
details.ios-details {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    overflow: hidden;
}
summary.ios-summary {
    padding: 16px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex; justify-content: space-between; align-items: center;
}
summary.ios-summary::after { content: "+"; font-size: 20px; color: var(--brand-primary); }
details[open] summary.ios-summary::after { content: "-"; }
.ios-details-content { padding: 0 16px 16px; color: var(--text-secondary); font-size: 15px; }

/* Tooltip (CSS Only) */
[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]:hover::before {
    content: attr(data-tooltip);
    position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
    background: #333; color: white;
    padding: 6px 10px; border-radius: 6px; font-size: 12px;
    white-space: nowrap; margin-bottom: 8px;
    z-index: 100;
}

/* ---> SÆT IND HER: WHEEL & CONFETTI (Specifik for Tal Generator) <--- */
.wheel-area {
    margin: 20px auto;
    width: 100%;
    max-width: 320px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.wheel-canvas-wrapper {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 50%;
    box-shadow: var(--shadow-float);
    overflow: hidden;
}
.wheel-canvas { width: 100%; height: 100%; }
.wheel-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0; height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-bottom: 25px solid var(--brand-primary);
    z-index: 10;
}
.confetti-canvas {
    pointer-events: none;
    position: fixed;
    left: 0; top: 0; width: 100%; height: 100%;
    z-index: var(--z-toast);
}

/* --------------------------------------------------------------------------
   9. PRINT STYLES (For Reports/PDFs)
   -------------------------------------------------------------------------- */
@media print {
    body { background: white; color: black; }
    .site-header, .site-footer, .no-print, .btn-primary, .ios-toggle { display: none !important; }
    .ios-card { box-shadow: none; border: 1px solid #000; break-inside: avoid; }
    .container { max-width: 100%; padding: 0; }
    a { text-decoration: underline; color: black; }
}

/* --------------------------------------------------------------------------
   10. MOBILE OPTIMIZATION & SAFE AREA OVERRIDES
   -------------------------------------------------------------------------- */

/* A. Global Mobile Typography & Spacing */
@media (max-width: 768px) {
    h1 { font-size: 28px; margin-bottom: 20px; }
    h2 { font-size: 24px; margin-top: 30px; }
    
    .container { padding: 0 16px; } /* Tighter edges on mobile */
    main { padding: 24px 0; }
    
    /* Stack the Calculator Layout */
    .calc-layout { grid-template-columns: 1fr; gap: 30px; }
    
    /* Result box fills width on mobile */
    .result-box { margin: 0 -16px; border-radius: 0; border-left: none; border-right: none; }
    
    /* Stepper dots get smaller */
    .step-dot { width: 24px; height: 24px; font-size: 11px; }
    .stepper::before { top: 11px; }
}

/* --- REPLACE THIS SECTION IN style.css --- */
@media (max-width: 480px) {
    
    /* 1. Prevent Auto-Zoom on inputs */
    .ios-input, .ios-input-group input, select.ios-input {
        font-size: 16px !important; 
    }

    /* 2. Touch Target Sizing & Text Wrapping */
    .ios-row {
        min-height: 56px;
        height: auto; /* Allow row to grow if text wraps */
        padding: 12px 16px;
        align-items: center; /* Vertically center */
    }
    
    /* 3. Handle Long Labels - ALLOW WRAPPING */
    .ios-row label {
        flex: 1;
        font-size: 15px; /* Slightly smaller text */
        white-space: normal; /* ALLOW TEXT TO WRAP to next line */
        overflow: visible;
        text-overflow: clip; 
        margin-right: 10px;
        line-height: 1.3;
    }
    
    /* 4. Fix Boxed Input Size on Mobile */
    .ios-input.boxed {
        width: 75px; /* Smaller width to fit on screen */
        padding: 6px;
        text-align: center;
    }

    /* 5. Ensure Input Group doesn't shrink or disappear */
    .ios-input-group { 
        width: auto; 
        flex-shrink: 0; /* Force input to stay visible */
    }

    /* 6. Fix Modal/Container widths */
    .ios-card {
        border-radius: 12px; /* Slightly less round on mobile */
        margin-left: -10px; /* Pull card slightly to edges for more space */
        margin-right: -10px;
    }
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
        overflow-x: hidden; /* Prevent horizontal scroll */
    }
}

/* C. Safe Area Insets (iPhone X / 11 / 12 / 13 / 14 / 15 support) */
/* Ensures content isn't hidden behind the notch or home bar */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    body {
        min-height: calc(100vh + env(safe-area-inset-bottom));
    }
    .site-footer {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
    .toast {
        bottom: calc(30px + env(safe-area-inset-bottom));
    }
}

/* D. Database Table Mobile View (Card Stack) */
/* Converts complex tables into readable cards on mobile */
@media (max-width: 600px) {
    .db-table, .db-table thead, .db-table tbody, .db-table th, .db-table td, .db-table tr { 
        display: block; 
    }
    
    /* Hide headers */
    .db-table thead tr { position: absolute; top: -9999px; left: -9999px; }
    
    .db-table tr { 
        border: 1px solid var(--border-color); 
        margin-bottom: 16px; 
        border-radius: var(--radius-md);
        background: var(--bg-card);
        padding: 10px;
    }
    
    .db-table td { 
        border: none;
        position: relative;
        padding-left: 50%; 
        text-align: right;
        padding-top: 6px; padding-bottom: 6px;
    }
    
    .db-table td:before { 
        /* Behave like a table header */
        position: absolute; top: 6px; left: 10px; width: 45%; 
        padding-right: 10px; white-space: nowrap;
        text-align: left; font-weight: 600; color: var(--text-secondary);
        content: attr(data-label); /* Requires HTML: <td data-label="Price"> */
    }
}