@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #f5f5f7;
    --bg-card: #ffffff;
    --bg-card-hover: #ffffff;
    --border-color: #e5e7eb;
    --border-glow: rgba(0, 0, 0, 0.01);
    --text-main: #1d1d1f;
    --text-muted: #86868b;
    --primary: #0071e3;
    --primary-hover: #0077ed;
    --primary-glow: rgba(0, 113, 227, 0.15);
    --accent-emerald: #34c759;
    --accent-indigo: #5856d6;
    --accent-orange: #ff9500;
    --accent-red: #ff3b30;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --sidebar-width: 280px;
    --border-radius-lg: 16px;
    --border-radius-md: 12px;
    --border-radius-sm: 8px;
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ========================================================================= */
/*                              GLOWING BACKGROUND NODES                     */
/* ========================================================================= */
.bg-glow-node {
    position: fixed;
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
}
.bg-glow-node.blue {
    top: -200px;
    right: -200px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.14) 0%, rgba(59, 130, 246, 0) 70%);
    filter: blur(80px);
}
.bg-glow-node.purple {
    bottom: -200px;
    left: -200px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, rgba(139, 92, 246, 0) 70%);
    filter: blur(80px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-sans);
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar navigation */
aside {
    width: var(--sidebar-width);
    background-color: rgba(255, 255, 255, 0.8);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(12px);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent-indigo));
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
    box-shadow: 0 4px 20px var(--primary-glow);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

.logo-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 0.15rem;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--border-radius-md);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.nav-item:hover {
    color: var(--text-main);
    background-color: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.15);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.sync-status-card {
    background-color: #f5f5f7;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1rem;
}

.sync-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.sync-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.sync-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Main Content Area */
main {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2.5rem;
    min-height: 100vh;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.tab-content.active {
    display: block;
}

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

header.section-header {
    margin-bottom: 2.5rem;
}

.badge-tag {
    display: inline-block;
    background-color: rgba(139, 92, 246, 0.1);
    color: var(--primary-hover);
    border: 1px solid rgba(139, 92, 246, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

h1 {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 800px;
    font-weight: 400;
}

/* General Layout Cards */
.grid-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.75rem;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
}

.card:hover {
    border-color: #d2d2d7;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Hero Progress Card */
.progress-card {
    background: linear-gradient(135deg, #ffffff, #f1f5f9);
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.percentage-text {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(to right, var(--primary), var(--accent-emerald));
    width: 0%;
    border-radius: 9999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Checklist Styling */
.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
    user-select: none;
}

.checklist-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.checklist-item input[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.checklist-item input[type="checkbox"]::after {
    content: "✓";
    font-size: 0.75rem;
    font-weight: 900;
    color: white;
    display: none;
}

.checklist-item input[type="checkbox"]:checked {
    background-color: var(--accent-emerald);
    border-color: var(--accent-emerald);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.checklist-item input[type="checkbox"]:checked::after {
    display: block;
}

.checklist-text {
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.4;
    transition: var(--transition-smooth);
}

.checklist-item.checked .checklist-text {
    color: var(--text-muted);
    text-decoration: line-through;
}

/* Alert styles */
.alert-box {
    background-color: rgba(245, 158, 11, 0.05);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--border-radius-md);
    padding: 1rem 1.25rem;
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.alert-box.info {
    background-color: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.2);
}

.alert-icon {
    width: 20px;
    height: 20px;
    color: var(--warning);
    flex-shrink: 0;
}

.alert-box.info .alert-icon {
    color: var(--accent-indigo);
}

.alert-content {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.alert-content strong {
    color: var(--text-main);
}

/* Tab Headers */
.tab-headers {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: var(--transition-smooth);
}

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

.tab-btn.active {
    color: var(--primary-hover);
    font-weight: 600;
}

.tab-btn.active::after {
    content: "";
    position: absolute;
    bottom: -0.65rem;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Inventory Forms & Table */
.inventory-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent-indigo));
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.btn-secondary {
    background-color: #f5f5f7;
    border: 1px solid #d2d2d7;
    color: var(--primary);
}

.btn-secondary:hover {
    background-color: #e8e8ed;
    border-color: #86868b;
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.2);
    border-color: var(--accent-red);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

input, select, textarea {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.65rem 0.85rem;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
    background-color: #ffffff;
}

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

/* Beautiful Table */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    background-color: var(--bg-card);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

th {
    background-color: rgba(241, 245, 249, 0.8);
    font-weight: 600;
    color: var(--text-muted);
}

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

tr:hover td {
    background-color: rgba(255, 255, 255, 0.01);
}

.badge-2fa {
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-2fa.yes {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-2fa.no {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Modal Styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    position: relative;
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

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

/* Action Area */
.actions-cell {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-smooth);
}

.btn-icon:hover {
    color: var(--text-main);
    background-color: var(--bg-card-hover);
}

.btn-icon.delete:hover {
    color: var(--accent-red);
}

/* Timeline vertical for Roadmap */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 2rem 0;
    padding-left: 2rem;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 0;
    width: 2px;
    height: 100%;
    background-color: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-marker {
    position: absolute;
    left: -2rem;
    top: 0.25rem;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--bg-main);
    border: 3px solid var(--border-color);
    transition: var(--transition-smooth);
}

.timeline-item.active .timeline-marker {
    border-color: var(--primary);
    background-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.timeline-item.completed .timeline-marker {
    border-color: var(--accent-emerald);
    background-color: var(--accent-emerald);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.timeline-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1.25rem;
}

.timeline-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.timeline-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.timeline-item.active .timeline-badge {
    background-color: rgba(139, 92, 246, 0.15);
    color: var(--primary-hover);
}

.timeline-item.completed .timeline-badge {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
}

/* Master Document Generator */
.master-form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.master-form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.section-subtitle {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-hover);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Print View Layout (Hidden on Screen) */
#print-preview-container {
    display: none;
}

/* Media Query for Print (A4 Formatting) */
@media print {
    body {
        background-color: white !important;
        color: black !important;
        font-family: 'Inter', -apple-system, sans-serif !important;
        display: block !important;
        overflow: visible !important;
    }
    
    aside, main > :not(#print-preview-container), .nav-links, .sidebar-footer, header, .tab-headers {
        display: none !important;
    }

    main {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    #print-preview-container {
        display: block !important;
        width: 100% !important;
        color: black !important;
        background-color: white !important;
    }

    .print-doc {
        padding: 2.5cm !important;
        font-size: 11pt !important;
        line-height: 1.6 !important;
    }

    .print-header {
        text-align: center;
        border-bottom: 3px double #333;
        padding-bottom: 1.5rem;
        margin-bottom: 2.5rem;
    }

    .print-header h1 {
        color: black !important;
        -webkit-text-fill-color: initial !important;
        background: none !important;
        font-size: 24pt !important;
        margin-bottom: 0.5rem;
        font-weight: 700;
    }

    .print-header p {
        font-style: italic;
        color: #555;
    }

    .print-section {
        margin-bottom: 2rem;
        page-break-inside: avoid;
    }

    .print-section-title {
        font-size: 14pt !important;
        font-weight: 700;
        border-bottom: 1px solid #666;
        padding-bottom: 0.3rem;
        margin-bottom: 1rem;
        color: black !important;
    }

    .print-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .print-field {
        margin-bottom: 0.75rem;
    }

    .print-label {
        font-weight: 700;
        font-size: 9pt;
        text-transform: uppercase;
        color: #444;
        margin-bottom: 0.15rem;
    }

    .print-value {
        font-size: 11pt;
        border-bottom: 1px dashed #ccc;
        min-height: 1.5rem;
        padding-bottom: 2px;
    }

    .print-alert {
        border: 2px solid black;
        padding: 1rem;
        background-color: #f9f9f9;
        margin-bottom: 1.5rem;
        font-weight: bold;
    }

    .print-table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 1rem;
    }

    .print-table th, .print-table td {
        border: 1px solid black !important;
        color: black !important;
        padding: 6px 10px !important;
        font-size: 9.5pt !important;
        background: none !important;
    }

    .print-table th {
        font-weight: bold;
        background-color: #eee !important;
    }
}

/* ========================================================================= */
/*                              RESPONSIVE DESIGN                            */
/* ========================================================================= */

/* Mobile Header (Hidden on Desktop) */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background-color: rgba(17, 24, 39, 0.95);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 40;
    backdrop-filter: blur(12px);
}

.hamburger-btn {
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-smooth);
}

.hamburger-btn:hover {
    background-color: var(--bg-card-hover);
    color: var(--primary-hover);
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 45;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Media Query: Tablets & Small Desktops (< 1024px) */
@media (max-width: 1024px) {
    .grid-container {
        grid-template-columns: repeat(12, 1fr);
    }
    
    .card {
        grid-column: span 6 !important;
    }

    /* Exceptions for specific full-width cards if needed */
    .progress-card {
        grid-column: span 12 !important;
    }

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

/* Media Query: Mobile Phones (< 768px) */
@media (max-width: 768px) {
    /* Show mobile header */
    .mobile-header {
        display: flex;
    }

    /* Adjust main content */
    main {
        margin-left: 0;
        padding: 5rem 1rem 2rem 1rem; /* Top padding accounts for mobile header */
    }

    /* Hide Sidebar by default, slide in when .open */
    aside {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 50;
        width: 80%;
        max-width: 300px;
        box-shadow: 10px 0 30px rgba(0,0,0,0.8);
    }

    aside.open {
        transform: translateX(0);
    }

    /* Stack grid completely */
    .card {
        grid-column: span 12 !important;
    }

    /* Text resizing */
    h1 {
        font-size: 1.75rem;
    }

    .percentage-text {
        font-size: 2.25rem;
    }

    /* Stack buttons in modals and inventory controls */
    .inventory-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .inventory-controls > div {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    
    .inventory-controls button {
        width: 100%;
    }

    /* Tab headers scrollable */
    .tab-headers {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 0.75rem;
        -webkit-overflow-scrolling: touch;
    }

    /* Table adjustments */
    th, td {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
}

/* ========================================================================= */
/*                              LANDING OVERLAY STYLES                       */
/* ========================================================================= */

.landing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, rgba(248, 250, 253, 0.95), rgba(241, 245, 249, 0.99));
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow-y: auto;
}

.landing-card {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 580px;
    padding: 3rem;
    box-shadow: 0 25px 70px rgba(15, 23, 42, 0.06),
                inset 0 1px 0px rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    animation: zoomIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.landing-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo-icon-large {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--accent-indigo));
    color: white;
    font-size: 2.25rem;
    font-weight: 800;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem auto;
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.35);
}

.landing-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.landing-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.landing-options {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.landing-option-btn {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.landing-option-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.landing-option-btn.recuperar:hover {
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.05), 0 0 1px rgba(239, 68, 68, 0.3);
}

.landing-option-btn.actualizar:hover {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.05), 0 0 1px rgba(59, 130, 246, 0.3);
}

.landing-option-btn .option-title {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.landing-option-btn.recuperar .option-title {
    color: #ef4444;
}

.landing-option-btn.actualizar .option-title {
    color: #3b82f6;
}

.landing-option-btn .option-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Password Step */
.landing-password-step {
    animation: fadeIn 0.4s ease-out;
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 1.5rem;
    padding: 0;
    transition: color 0.2s ease;
}

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

.landing-password-step h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.password-step-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

#master-password-input {
    width: 100%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-main);
    font-size: 1.1rem;
    outline: none;
    text-align: center;
    letter-spacing: 0.25em;
    transition: border-color 0.2s ease;
}

#master-password-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
}

.password-error-msg {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 0.75rem;
    text-align: center;
}

/* Shake Animation on Password Error */
.shake {
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

/* ========================================================================= */
/*                              MODE-BASED VISIBILITY                        */
/* ========================================================================= */

/* When not logged in, hide all main content elements */
body.not-logged-in {
    overflow: hidden;
}

body.not-logged-in #main-sidebar,
body.not-logged-in main,
body.not-logged-in .mobile-header {
    display: none !important;
}

/* Recuperar Legado Mode */
body.mode-recuperar .actualizar-only {
    display: none !important;
}

/* Hide Inventory write elements in Recuperar mode */
body.mode-recuperar .inventory-controls button,
body.mode-recuperar table th:last-child,
body.mode-recuperar table td:last-child {
    display: none !important;
}

/* Actualizar Legado Mode */
body.mode-actualizar .recuperar-only {
    display: none !important;
}

/* UI/UX Enhancements: Smooth Card Transitions & Focus Styles */
.card, .summary-card, .timeline-item {
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.card:hover, .summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.btn-primary:focus-visible, .btn-secondary:focus-visible, .nav-item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

tbody tr {
    transition: background-color 0.15s ease;
}

tbody tr:hover {
    background-color: rgba(0, 113, 227, 0.04);
}

/* ========================================================================= */
/*       MOBILE-FIRST REDESIGN: BOTTOM BAR, BENTO CARDS & FORM RESILIENCE     */
/* ========================================================================= */

.mobile-bottom-bar {
    display: none;
}

body.not-logged-in .mobile-bottom-bar {
    display: none !important;
}

@media (max-width: 768px) {
    /* Kill Desktop Sidebar on Mobile */
    aside#main-sidebar {
        display: none !important;
    }
    .mobile-header .hamburger-btn {
        display: none !important;
    }
    .sidebar-overlay {
        display: none !important;
    }

    /* Zero horizontal scrollbar on viewport */
    html, body {
        overflow-x: hidden !important;
        width: 100%;
        max-width: 100vw;
    }

    main {
        margin-left: 0 !important;
        padding: 4.5rem 1rem 5.5rem 1rem !important;
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Fixed Modern Bottom Navigation Bar */
    .mobile-bottom-bar {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 62px;
        background: rgba(16, 23, 38, 0.94);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid var(--border-color);
        z-index: 1000;
        justify-content: space-around;
        align-items: center;
        padding: 0 0.35rem;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.45);
    }

    .bottom-nav-btn {
        background: none;
        border: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        color: var(--text-muted);
        cursor: pointer;
        padding: 6px 4px;
        border-radius: 8px;
        flex: 1;
        min-height: 48px;
        transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
        outline: none;
        -webkit-tap-highlight-color: transparent;
    }

    .bottom-nav-btn svg {
        stroke: currentColor;
        transition: transform 0.2s ease, stroke 0.2s ease;
    }

    .bottom-nav-btn span {
        font-size: 0.68rem;
        font-weight: 500;
        letter-spacing: 0.01em;
        line-height: 1.1;
    }

    .bottom-nav-btn:active {
        transform: scale(0.94);
    }

    .bottom-nav-btn.active {
        color: var(--primary) !important;
        font-weight: 600;
    }

    .bottom-nav-btn.active svg {
        stroke: var(--primary) !important;
        transform: translateY(-2px);
    }

    /* Modo Familiar (Emergencia) acento rojo */
    body.mode-recuperar .bottom-nav-btn.active {
        color: #f87171 !important;
    }

    body.mode-recuperar .bottom-nav-btn.active svg {
        stroke: #f87171 !important;
    }

    /* Mobile Bento Card Aesthetics */
    .card {
        background: rgba(22, 30, 49, 0.7) !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        border-radius: 14px !important;
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25) !important;
        backdrop-filter: blur(10px) !important;
        padding: 1.25rem 1rem !important;
        margin-bottom: 0.5rem;
    }

    /* Form & Settings rows resilience - prevent overflow and squished labels */
    .form-row, .setting-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }

    .form-group, .setting-info, .setting-control {
        width: 100% !important;
        max-width: 100% !important;
    }

    select, input[type="text"], input[type="password"], input[type="file"], textarea {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        min-height: 44px;
        font-size: 0.9rem;
    }

    select {
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
    }

    /* Table responsive scrolling */
    .table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
        max-width: 100%;
    }

    /* Section Header stack */
    .section-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.85rem !important;
    }

    .section-header .btn {
        width: 100%;
        justify-content: center;
    }
}
