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

:root {
    --bg-main: #0a0a0d;
    --bg-card: rgba(22, 22, 28, 0.7);
    --bg-card-hover: rgba(29, 29, 38, 0.85);
    --border-glass: rgba(255, 255, 255, 0.07);
    --border-glass-focus: rgba(123, 15, 40, 0.4);
    
    --color-primary: #7b0f28; /* Wine Burgundy */
    --color-primary-light: #9e1b38;
    --color-primary-dark: #4e0717;
    --color-accent: #e6c229; /* Gold */
    --color-accent-dim: #c5a31a;
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #1f2937;
    
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 0 15px rgba(123, 15, 40, 0.3);
    --shadow-gold-glow: 0 0 20px rgba(230, 194, 41, 0.5);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 10% 20%, rgba(123, 15, 40, 0.12) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(230, 194, 41, 0.04) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-light);
}

/* App Header */
header {
    background: rgba(10, 10, 13, 0.8);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border-glass);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo-icon {
    font-size: 1.8rem;
    color: var(--color-accent);
    filter: drop-shadow(0 0 5px rgba(230, 194, 41, 0.3));
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--text-main);
    text-transform: uppercase;
}

.logo-text span {
    color: var(--color-primary-light);
}

/* Nav Menu */
nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-link {
    font-family: var(--font-heading);
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.nav-link:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.nav-link.active {
    color: var(--color-accent);
    background: rgba(123, 15, 40, 0.15);
    border-color: rgba(123, 15, 40, 0.3);
}

.btn-lock {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.btn-lock:hover {
    border-color: var(--color-primary-light);
    color: var(--text-main);
}

.btn-lock.authenticated {
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
    background: rgba(34, 197, 94, 0.05);
}

.btn-lock.authenticated:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

/* Main Layout */
main {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.page-section {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.page-section.active {
    display: block;
}

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

/* Page Titles */
.section-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-title h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-main) 60%, rgba(255, 255, 255, 0.7));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

/* Glassmorphism Cards */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
}

.glass-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.12);
}

/* KPI Summary Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.kpi-icon {
    font-size: 2rem;
    color: var(--color-primary-light);
    background: rgba(123, 15, 40, 0.15);
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(123, 15, 40, 0.25);
    box-shadow: var(--shadow-glow);
}

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

.kpi-val {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-main);
}

.kpi-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dashboard Analytics Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    min-height: 350px;
    display: flex;
    flex-direction: column;
}

.chart-card-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 0.75rem;
}

.chart-container {
    position: relative;
    flex-grow: 1;
    width: 100%;
    height: 100%;
}

.recent-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 480px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.recent-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-smooth);
}

.recent-item:hover {
    background: rgba(123, 15, 40, 0.05);
    border-color: rgba(123, 15, 40, 0.15);
}

.recent-wine-info {
    display: flex;
    flex-direction: column;
}

.recent-wine-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.recent-wine-details {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.recent-wine-time {
    font-size: 0.8rem;
    color: var(--color-accent-dim);
    text-align: right;
}

/* Secondary Dashboard Grid */
.dashboard-grid-sec {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .dashboard-grid-sec {
        grid-template-columns: 1fr;
    }
}

/* Search Layout */
.search-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-input-wrapper {
    position: relative;
    flex-grow: 1;
    min-width: 280px;
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-smooth);
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--color-primary-light);
    box-shadow: 0 0 10px rgba(123, 15, 40, 0.2);
}

.search-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    outline: none;
}

.btn-primary {
    background: var(--color-primary);
    border: 1px solid rgba(123, 15, 40, 0.5);
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    background: var(--color-primary-light);
    box-shadow: 0 0 18px rgba(123, 15, 40, 0.5);
    transform: translateY(-1px);
}

.btn-accent {
    background: rgba(230, 194, 41, 0.1);
    border: 1px solid var(--color-accent);
    color: var(--color-accent);
}

.btn-accent:hover {
    background: var(--color-accent);
    color: var(--bg-main);
    box-shadow: var(--shadow-gold-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    color: #ef4444;
}

.btn-danger:hover {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

/* Cellar View Split Layout */
.cellar-split {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 1100px) {
    .cellar-split {
        grid-template-columns: 1fr;
    }
}

/* Wine Table Container */
.table-container {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
}

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

thead th {
    background: rgba(10, 10, 13, 0.4);
    position: sticky;
    top: 0;
    padding: 0.9rem 1rem;
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-glass);
    z-index: 10;
}

tbody tr {
    border-bottom: 1px solid var(--border-glass);
    transition: var(--transition-smooth);
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

tbody tr.highlighted {
    background: rgba(230, 194, 41, 0.08) !important;
    border-left: 3px solid var(--color-accent);
}

tbody td {
    padding: 0.9rem 1rem;
    font-size: 0.9rem;
    vertical-align: middle;
}

.wine-row-winery {
    font-weight: 600;
    color: var(--text-main);
}

.wine-row-variety {
    color: var(--text-muted);
}

.wine-tag {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(123, 15, 40, 0.15);
    color: var(--color-primary-light);
    border: 1px solid rgba(123, 15, 40, 0.2);
}

.coords-tag {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(230, 194, 41, 0.1);
    color: var(--color-accent);
    border: 1px solid rgba(230, 194, 41, 0.2);
}

.no-wines {
    text-align: center;
    padding: 3rem !important;
    color: var(--text-muted);
    font-style: italic;
}

/* Cellar Map Visualizer */
.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 0.75rem;
}

.rack-selector {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    color: var(--text-main);
    padding: 0.5rem 1rem;
    outline: none;
    font-family: var(--font-heading);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.rack-selector:focus {
    border-color: var(--color-primary-light);
}

.rack-grid-wrapper {
    overflow-x: auto;
    padding: 1rem 0.5rem;
}

.rack-legend {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid var(--border-glass);
}

.legend-dot.empty { background: rgba(255, 255, 255, 0.03); }
.legend-dot.occupied { background: var(--color-primary-light); box-shadow: 0 0 5px rgba(158, 27, 56, 0.5); }
.legend-dot.selected { background: var(--color-accent); box-shadow: var(--shadow-gold-glow); }

.grid-rack {
    display: grid;
    gap: 6px;
    margin: 0 auto;
    width: max-content;
}

.grid-cell {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    user-select: none;
}

.grid-cell.label-cell {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    cursor: default;
}

.grid-cell.occupied {
    background: var(--color-primary);
    border-color: rgba(123, 15, 40, 0.5);
    color: #fff;
    font-weight: 500;
    box-shadow: 0 0 8px rgba(123, 15, 40, 0.4);
}

.grid-cell.occupied:hover {
    background: var(--color-primary-light);
    transform: scale(1.1);
    z-index: 10;
}

.grid-cell.empty:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.grid-cell.selected {
    background: var(--color-accent) !important;
    border-color: #fff !important;
    color: var(--bg-main) !important;
    font-weight: bold;
    box-shadow: var(--shadow-gold-glow);
    animation: pulseSelected 1.5s infinite alternate;
    z-index: 20;
}

@keyframes pulseSelected {
    from { transform: scale(1); box-shadow: 0 0 8px rgba(230, 194, 41, 0.4); }
    to { transform: scale(1.15); box-shadow: 0 0 20px rgba(230, 194, 41, 0.8); }
}

/* Tooltips */
.cell-tooltip {
    visibility: hidden;
    background: rgba(10, 10, 13, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass-focus);
    color: #fff;
    text-align: left;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    position: absolute;
    z-index: 50;
    bottom: 135%;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    box-shadow: var(--shadow-premium);
    opacity: 0;
    transition: opacity 0.2s ease-in-out, visibility 0.2s;
    pointer-events: none;
}

.cell-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(10, 10, 13, 0.95) transparent transparent transparent;
}

.grid-cell:hover .cell-tooltip {
    visibility: visible;
    opacity: 1;
}

.tooltip-wine-name {
    font-weight: bold;
    color: var(--color-accent);
    font-size: 0.85rem;
    line-height: 1.3;
}

.tooltip-wine-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Sync Settings and Setup */
.sync-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .sync-grid {
        grid-template-columns: 1fr;
    }
}

.sync-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-weight: 500;
}

.sync-status-indicator.success {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.sync-status-indicator.failure {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.setup-instructions {
    margin-top: 1.5rem;
}

.setup-instructions h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.setup-instructions ol {
    margin-left: 1.25rem;
    margin-bottom: 1.25rem;
}

.setup-instructions li {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.setup-instructions strong {
    color: var(--text-main);
}

.code-block-wrapper {
    position: relative;
    margin-top: 0.75rem;
}

.btn-copy {
    position: absolute;
    right: 0.75rem;
    top: 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-copy:hover {
    background: var(--color-primary-light);
    color: #fff;
}

pre {
    background: #060608 !important;
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 1.25rem;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    color: #c9d1d9;
    max-height: 300px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

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

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
}

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

.btn-close-modal:hover {
    color: #ef4444;
}

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

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

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

.form-control {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-smooth);
}

.form-control:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--color-primary-light);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-glass);
    padding-top: 1.25rem;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 2000;
}

.toast {
    background: rgba(22, 22, 28, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    padding: 1rem 1.25rem;
    border-radius: 10px;
    box-shadow: var(--shadow-premium);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.toast.success { border-left: 4px solid #22c55e; }
.toast.error { border-left: 4px solid #ef4444; }
.toast.info { border-left: 4px solid var(--color-accent); }

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

.toast-success-icon { color: #22c55e; }
.toast-error-icon { color: #ef4444; }
.toast-info-icon { color: var(--color-accent); }

.toast-content {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Footer */
footer {
    border-top: 1px solid var(--border-glass);
    padding: 2rem 0;
    text-align: center;
    margin-top: 4rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

footer a {
    color: var(--color-accent);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Mobile Touch & Layout Optimizations */
@media (max-width: 768px) {
    body {
        font-size: 0.95rem;
    }
    
    main {
        margin: 1rem auto;
        padding: 0 1rem;
    }

    .header-container {
        flex-direction: column;
        align-items: center;
        gap: 0.85rem;
        padding: 1rem 1.25rem;
    }
    
    nav {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .nav-link {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .btn-lock {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
        width: 100%;
        justify-content: center;
    }
    
    .section-header {
        margin-bottom: 1.5rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .section-header .btn {
        width: 100%;
    }
    
    .section-title h1 {
        font-size: 1.8rem;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .kpi-card {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .kpi-icon {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }
    
    .kpi-val {
        font-size: 1.4rem;
    }
    
    .dashboard-grid, 
    .dashboard-grid-sec, 
    .sync-grid, 
    .cellar-split {
        grid-template-columns: 1fr !important;
        gap: 1.25rem;
    }
    
    .chart-card {
        min-height: 300px;
    }
    
    .search-controls {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .search-controls .btn {
        width: 100%;
    }
    
    .table-container {
        max-height: 400px;
    }
    
    tbody td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
    
    thead th {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }
    
    /* Toast settings on mobile */
    .toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
    
    .toast {
        min-width: unset;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    .modal-content {
        padding: 1.25rem 1rem;
        width: 95%;
    }
}
