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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f8f9fa; /* Mobile default */
    padding-bottom: 70px; /* Space for bottom navigation on mobile */
    overflow-x: hidden;
    width: 100%;
}

/* Nav Menu (mobile - hidden by default, desktop - shown) */
.nav-menu {
    background: #2c3e50;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: none; /* Hidden on mobile by default */
    align-items: center;
    justify-content: center;
}

.nav-menu ul {
    list-style: none;
    display: flex;
    max-width: 1200px; /* Desktop */
    margin: 0;
}

.nav-menu li {
    margin: 0;
}

.nav-menu a {
    display: block;
    padding: 15px 30px;
    color: white;
    text-decoration: none;
    text-align: center;
    transition: background 0.3s;
    white-space: nowrap;
}

.nav-menu a:hover {
    background: #34495e;
}

.nav-menu a.active {
    background: #3498db;
}

/* Main Container (mobile) */
.container {
    padding: 10px;
    max-width: 100%;
}

/* Page Header (mobile default) */
.page-header {
    background: #3498db;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
}

.page-header h1 {
    color: white;
    margin: 0;
    font-size: 22px;
    white-space: nowrap;
}

.header-date-section {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.header-date-section #header-date-display {
    color: white;
    font-size: 16px;
    font-weight: 500;
}

.header-date-section .change-date-btn {
    background: white;
    color: #3498db;
    padding: 8px 16px;
    font-size: 14px;
    margin: 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.header-date-section .change-date-btn:active {
    background: #f8f9fa;
}

/* Date Picker Popup */
.date-picker-popup {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 15px;
    z-index: 1000;
    top: 100%;
    right: 0;
    margin-top: 8px;
    min-width: 280px; /* Mobile default */
}

.date-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.date-picker-nav {
    background: #3498db;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.date-picker-nav:active {
    background: #2980b9;
}

.date-picker-month {
    font-weight: bold;
    font-size: 15px;
    color: #2c3e50;
}

.date-picker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px; /* Mobile default */
    margin-bottom: 5px;
}

.date-picker-weekday {
    text-align: center;
    font-size: 11px; /* Mobile default */
    font-weight: bold;
    color: #666;
    padding: 4px;
}

.date-picker-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px; /* Mobile default */
}

.date-picker-day {
    text-align: center;
    padding: 8px 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.date-picker-day:active {
    background: #e8f4f8;
}

.date-picker-day.empty {
    cursor: default;
}

.date-picker-day.selected {
    background: #3498db;
    color: white;
}

.date-picker-day.today {
    border: 2px solid #3498db;
}

.date-picker-day.has-consegna {
    background: #2ecc71;
    color: white;
    font-weight: bold;
}

.date-picker-day.has-consegna:active {
    background: #27ae60;
}

.date-picker-day.selected.has-consegna {
    background: #16a085;
}

.date-picker-legend {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #ecf0f1;
    display: flex;
    gap: 12px; /* Mobile default */
    font-size: 10px; /* Mobile default */
    color: #7f8c8d;
}

.date-picker-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.date-picker-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.view-switch-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.view-switch-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.view-switch-btn:active {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0.95);
}

/* Bottom Navigation (mobile only) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 2px solid #ddd;
    display: flex;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
}

.bottom-nav-item {
    flex: 1;
    padding: 12px 8px;
    text-align: center;
    font-size: 11px;
    color: #7f8c8d;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bottom-nav-item.active {
    color: #3498db;
    background: #ebf5fb;
}

.bottom-nav-icon {
    font-size: 24px;
    display: block;
    margin-bottom: 4px;
}

/* Section Movimenti - Always Open */
.section-movimenti {
    background: white;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.section-header-movimenti {
    padding: 18px;
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
    font-weight: bold;
    font-size: 16px;
}

.section-content-movimenti {
    padding: 18px;
    background: white;
}

/* Accordion */
.accordion-item {
    background: white;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.accordion-header {
    padding: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
}

.accordion-header.cassa {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.accordion-header.partecipanti {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.accordion-arrow {
    font-size: 20px;
    transition: transform 0.3s;
}

.accordion-arrow.expanded {
    transform: rotate(90deg);
}

.accordion-content {
    padding: 18px;
    background: white;
    display: none;
}

.accordion-content.show {
    display: block;
}

/* Smart Override Input */
.input-group {
    margin-bottom: 18px; /* Mobile default */
}

.input-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 14px;
}

.smart-input {
    width: 100%;
    padding: 16px; /* Mobile default */
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
    cursor: text;
}

/* State: AUTO (readonly appearance but clickable) */
.smart-input.auto {
    background: #f0f0f0;
    color: #7f8c8d;
    border-color: #ddd;
}

.smart-input.auto::placeholder {
    color: #95a5a6;
}

/* State: MANUAL (editing) */
.smart-input.manual {
    background: #fff5f5;
    color: #2c3e50;
    border: 2px solid #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.smart-input:focus {
    outline: none;
}

/* Badge */
.mode-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    transition: all 0.3s;
}

.mode-badge.auto {
    background: #d1ecf1;
    color: #0c5460;
}

.mode-badge.manual {
    background: #f8d7da;
    color: #721c24;
}

/* Participant Collapsed Card */
.participant-collapsed {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.participant-collapsed:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.participant-collapsed.has-data {
    border-left: 5px solid #2ecc71;
    background: #f0fff4;
}

.participant-collapsed.new-entry {
    border-left: 5px solid #ffc107;
    background: #fffef0;
}

.participant-info {
    flex: 1;
}

.participant-name-collapsed {
    font-weight: bold;
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 4px;
}

.participant-status {
    font-size: 12px;
    color: #6c757d;
}

.participant-saldo-collapsed {
    font-size: 16px;
    font-weight: bold;
    padding: 8px 14px;
    border-radius: 20px;
    margin-left: 10px;
}

.saldo-credito {
    background: #d4edda;
    color: #155724;
}

.saldo-debito {
    background: #f8d7da;
    color: #721c24;
}

.saldo-pari {
    background: #d1ecf1;
    color: #0c5460;
}

/* Participant Expanded Card */
.participant-expanded {
    background: white;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 3px solid #3498db;
}

.participant-expanded.has-data {
    border-color: #2ecc71;
}

.participant-expanded.new-entry {
    border-color: #ffc107;
}

.participant-header-expanded {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 3px solid #ecf0f1;
}

.participant-name-expanded {
    font-weight: bold;
    font-size: 18px;
    color: #2c3e50;
}

.participant-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}

.participant-section-title {
    font-weight: 600;
    font-size: 13px;
    color: #495057;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-field {
    width: 100%;
    padding: 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

.input-field:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Buttons (mobile specific - big-btn) */
.big-btn {
    width: 100%;
    padding: 16px;
    margin: 8px 0;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transition: all 0.2s;
}

.big-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.big-btn-success {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
}

.big-btn-secondary {
    background: white;
    color: #6c757d;
    border: 2px solid #ddd;
}

.big-btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.collapse-btn {
    background: #ecf0f1;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #7f8c8d;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
}

.collapse-btn:hover {
    background: #d5d8dc;
}

/* Participant Card Flow (for selected participant form) */
.participant-card-flow {
    background: white;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 3px solid #3498db;
}

.participant-card-flow.new-entry {
    border-color: #ffc107;
}

.flow-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 3px solid #ecf0f1;
}

.participant-name {
    font-weight: bold;
    font-size: 18px;
    color: #2c3e50;
}

.saldo-info {
    font-size: 14px;
    font-weight: bold;
    padding: 8px 14px;
    border-radius: 20px;
}

.saldo-info.saldo-credito {
    background: #d4edda;
    color: #155724;
}

.saldo-info.saldo-debito {
    background: #f8d7da;
    color: #721c24;
}

.saldo-info.saldo-pari {
    background: #d1ecf1;
    color: #0c5460;
}

.flow-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 12px;
}

.flow-section.flow-credito {
    background: #d4edda;
}

.flow-section.flow-debito {
    background: #f8d7da;
}

.flow-section-title {
    font-weight: 700;
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 12px;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.flow-section .form-group {
    margin-bottom: 10px;
}

.flow-section .form-group:last-child {
    margin-bottom: 0;
}

.flow-section .row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 0;
}

.flow-section .row .form-group {
    margin-bottom: 0;
}

.flow-section input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    box-sizing: border-box;
}

.flow-section input[type="text"]:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 8px;
}

.checkbox-group label {
    font-size: 14px;
    color: #2c3e50;
    cursor: pointer;
}

.form-group {
    margin-bottom: 12px; /* Mobile default */
}

.form-group label {
    display: block;
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 6px;
    font-weight: 500;
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Info badge */
.info-badge {
    background: #d1ecf1;
    border-left: 4px solid #17a2b8;
    padding: 12px;
    border-radius: 8px;
    margin: 12px 0;
    font-size: 13px;
    color: #0c5460;
    line-height: 1.5;
}

/* Saldi Collapsed/Expanded */
.saldo-card-collapsed {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.saldo-card-collapsed:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.saldo-card-collapsed.has-credito {
    border-left: 5px solid #2ecc71;
    background: #f0fff4;
}

.saldo-card-collapsed.has-debito {
    border-left: 5px solid #e74c3c;
    background: #fff5f5;
}

.saldo-card-collapsed.is-pari {
    border-left: 5px solid #3498db;
    background: #ebf5fb;
}

.saldo-info-left {
    flex: 1;
}

.saldo-name {
    font-weight: bold;
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 4px;
}

.saldo-last-date {
    font-size: 12px;
    color: #6c757d;
}

.saldo-amount-badge {
    font-size: 18px;
    font-weight: bold;
    padding: 8px 16px;
    border-radius: 20px;
    margin-left: 10px;
}

.saldo-card-expanded {
    background: white;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 3px solid #3498db;
}

.saldo-card-expanded.has-credito {
    border-color: #2ecc71;
}

.saldo-card-expanded.has-debito {
    border-color: #e74c3c;
}

.saldo-header-expanded {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 3px solid #ecf0f1;
}

.saldo-edit-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}

.saldo-edit-title {
    font-weight: 600;
    font-size: 13px;
    color: #495057;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Storico (mobile-specific card styles) */
.storico-consegna-card {
    background: white;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.storico-consegna-card.expanded {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.storico-consegna-header {
    padding: 16px 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.storico-consegna-header:active {
    background: linear-gradient(135deg, #5568d3 0%, #653a8a 100%);
}

.storico-consegna-date {
    font-weight: bold;
    font-size: 14px;
    color: white;
}

.storico-arrow {
    font-size: 18px;
    color: white;
}

.storico-consegna-content {
    padding: 18px;
    background: white;
}

/* Sezione Cassa (mobile) */
.storico-cassa-section {
    background: white;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    border: 2px solid #e9ecef;
}

.storico-cassa-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f3f5;
}

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

.storico-cassa-label {
    font-size: 11px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.storico-cassa-value {
    font-size: 16px;
    font-weight: bold;
    color: #000;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Sezione Movimenti (mobile) */
.storico-movimenti-section {
    margin-top: 16px;
}

.storico-movimenti-title {
    font-size: 13px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    border-radius: 8px;
    color: white;
}

/* Participant Cards in Storico (mobile) */
.storico-participant-card {
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    border-left: 4px solid;
}

.storico-participant-card.credito {
    background: #d4edda;
    border-left-color: #28a745;
}

.storico-participant-card.debito {
    background: #f8d7da;
    border-left-color: #dc3545;
}

.storico-participant-card.pari {
    background: #d1ecf1;
    border-left-color: #17a2b8;
}

.storico-participant-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.storico-participant-name {
    font-weight: bold;
    font-size: 14px;
    color: #2c3e50;
}

.storico-saldo-badge {
    font-weight: bold;
    font-size: 14px;
    padding: 4px 10px;
    border-radius: 12px;
}

.storico-saldo-badge.credito {
    background: #28a745;
    color: white;
}

.storico-saldo-badge.debito {
    background: #dc3545;
    color: white;
}

.storico-saldo-badge.pari {
    background: #17a2b8;
    color: white;
}

.storico-participant-details {
    font-size: 12px;
    color: #6c757d;
    line-height: 1.5;
}

/* Override indicator (mobile) */
.override-indicator {
    display: inline-block;
    background: #e74c3c;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

/* Status Messages (common) */
.status {
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: none;
}

.status.success {
    background: #d4edda;
    color: #155724;
    display: block;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
    display: block;
}

.status-indicator {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 6px;
}

.status-saved {
    background: #d4edda;
    color: #155724;
}

.status-new {
    background: #fff3cd;
    color: #856404;
}

/* Calendar Styles (common) */
.calendar {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 20px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-header h3 {
    color: #2c3e50;
    font-size: 18px;
}

.calendar-nav {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.calendar-nav:hover {
    background: #2980b9;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.calendar-weekday {
    text-align: center;
    font-weight: bold;
    color: #7f8c8d;
    font-size: 14px;
    padding: 8px 0;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.calendar-day:not(.empty):not(.other-month):hover {
    background: #ecf0f1;
}

.calendar-day.empty {
    cursor: default;
}

.calendar-day.other-month {
    color: #bdc3c7;
    cursor: default;
}

.calendar-day.today {
    border-color: #3498db;
    font-weight: bold;
}

.calendar-day.selected {
    background: #3498db;
    color: white;
    font-weight: bold;
}

.calendar-day.has-consegna {
    background: #2ecc71;
    color: white;
    font-weight: bold;
}

.calendar-day.has-consegna:hover {
    background: #27ae60;
}

.calendar-day.selected.has-consegna {
    background: #16a085;
}

.calendar-day.no-consegna {
    color: #95a5a6;
}

/* Hide elements (common) */
.hidden {
    display: none !important;
}

/* ========================================================= */
/*                   DESKTOP STYLES (min-width: 769px)       */
/* ========================================================= */

@media (min-width: 769px) {
    body {
        background: #f5f5f5; /* Desktop background */
        padding-bottom: 0; /* No bottom navigation */
    }

    .nav-menu {
        display: flex; /* Show on desktop */
    }

    .bottom-nav {
        display: none; /* Hide bottom navigation on desktop */
    }

    .container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 20px;
    }

    .page-header {
        /* Reset mobile-specific header background and padding */
        background: #3498db;
        padding: 15px 25px;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .header-date-section #header-date-display {
        font-size: 16px;
    }

    .header-date-section .change-date-btn {
        padding: 8px 16px;
        font-size: 14px;
        border: none;
        border-radius: 4px;
        background: white;
    }

    .date-picker-popup {
        min-width: 300px; /* Larger for desktop */
    }

    .date-picker-weekday {
        font-size: 12px; /* Larger for desktop */
    }

    .date-picker-legend {
        gap: 15px; /* Larger gap for desktop */
        font-size: 11px; /* Larger font for desktop */
    }

    /* General desktop sections */
    .section {
        background: white;
        padding: 20px;
        border-radius: 8px;
        margin-bottom: 20px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .section h2 {
        color: #34495e;
        margin-bottom: 15px;
        font-size: 18px;
    }

    .section h3 {
        color: #34495e;
        margin-bottom: 15px;
        margin-top: 20px;
        font-size: 16px;
    }

    /* Form elements */
    .form-group {
        margin-bottom: 15px;
    }

    label {
        display: block;
        margin-bottom: 5px;
        color: #555;
        font-weight: 500;
    }

    input[type="text"],
    input[type="number"],
    input[type="date"] {
        width: 100%;
        padding: 10px;
        border: 1px solid #ddd;
        border-radius: 4px;
        font-size: 16px;
    }

    input[type="checkbox"] {
        width: 20px;
        height: 20px;
        margin-right: 10px;
    }

    .checkbox-group {
        display: flex;
        align-items: center;
        margin-bottom: 10px;
    }

    select {
        width: 100%;
        padding: 10px;
        border: 1px solid #ddd;
        border-radius: 4px;
        font-size: 16px;
        background: white;
        cursor: pointer;
    }

    select:focus {
        outline: none;
        border-color: #3498db;
    }

    /* Generic buttons (desktop) */
    button {
        background: #3498db;
        color: white;
        padding: 12px 24px;
        border: none;
        border-radius: 4px;
        font-size: 16px;
        cursor: pointer;
        margin-right: 10px;
    }

    button:hover {
        background: #2980b9;
    }

    button:disabled {
        background: #bdc3c7;
        cursor: not-allowed;
    }

    .btn-save {
        background: #27ae60;
    }

    .btn-save:hover {
        background: #229954;
    }

    .btn-delete {
        background: #e74c3c;
    }

    .btn-delete:hover {
        background: #c0392b;
    }

    .btn-add {
        background: #f39c12;
    }

    .btn-add:hover {
        background: #e67e22;
    }

    /* Tables (desktop) */
    table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 10px;
    }

    thead {
        background: #34495e;
        color: white;
    }

    th, td {
        padding: 12px;
        text-align: left;
        border-bottom: 1px solid #ddd;
    }

    tbody tr:hover {
        background: #f8f9fa;
    }

    td input {
        padding: 6px;
        border: 1px solid #ddd;
        border-radius: 3px;
        width: 100%;
    }

    /* Movimenti Table (desktop) */
    .movimenti-table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 15px;
    }

    .movimenti-table thead {
        background: #34495e;
        color: white;
    }

    .movimenti-table th,
    .movimenti-table td {
        padding: 12px;
        text-align: left;
        border-bottom: 1px solid #ddd;
    }

    .movimenti-table .text-right {
        text-align: right;
    }

    .movimenti-table tbody tr:hover {
        background: #f8f9fa;
    }

    /* Participant Cards (desktop version of flow) */
    .participant-card {
        background: #f8f9fa;
        padding: 15px;
        border-radius: 6px;
        margin-bottom: 15px;
        border-left: 4px solid #3498db;
    }

    .participant-name {
        font-weight: 600;
        color: #2c3e50;
        margin-bottom: 10px;
        font-size: 16px;
    }

    .saldo-info {
        font-size: 14px;
        color: #7f8c8d;
        margin-bottom: 10px;
    }

    .saldo-debito { color: #e74c3c; }
    .saldo-credito { color: #27ae60; }

    /* Flow Layout desktop specific */
    .participant-card-flow {
        background: white;
        padding: 20px;
        border-radius: 8px;
        margin-bottom: 20px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        border-left: 4px solid #3498db;
    }

    .flow-header {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        gap: 15px;
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 2px solid #ecf0f1;
    }

    .flow-section {
        background: #f8f9fa;
        padding: 15px;
        border-radius: 6px;
        margin-bottom: 15px;
    }

    .flow-section-title {
        font-weight: 600;
        color: #2c3e50;
        margin-bottom: 10px;
        font-size: 14px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .flow-credito {
        background: #e8f5e9;
        border-left: 3px solid #27ae60;
    }

    .flow-debito {
        background: #ffebee;
        border-left: 3px solid #e74c3c;
    }

    /* Storico Desktop Styles */
    .storico-section {
        background: #ecf0f1 !important;
        margin-bottom: 20px;
    }

    .storico-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 15px;
    }

    .storico-date {
        margin: 0;
        color: #2c3e50;
        display: inline;
    }

    .storico-info-table thead tr {
        background: #34495e;
        color: white;
    }

    .storico-info-table tbody tr {
        background: #E3F2FD;
    }

    .storico-movimenti-title {
        margin-top: 20px;
        margin-bottom: 10px;
        color: #2c3e50;
    }

    .storico-movimenti-table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 10px;
    }

    .storico-movimenti-table thead {
        background: #34495e;
        color: white;
    }

    .storico-movimenti-table th,
    .storico-movimenti-table td {
        padding: 12px;
        text-align: left;
        border-bottom: 1px solid #ddd;
    }

    .storico-movimenti-table tbody tr:nth-child(even) {
        background: #E3F2FD;
    }

    .storico-movimenti-table tbody tr:nth-child(odd) {
        background: #FFFFFF;
    }

    .storico-movimenti-table tbody tr:hover {
        background: #f8f9fa;
    }

    /* Reset some mobile specific styles for desktop */
    .big-btn {
        width: auto;
        padding: 12px 24px;
        margin: 0 10px 0 0;
        box-shadow: none;
    }

    .big-btn:active {
        transform: none;
        box-shadow: none;
    }

    .collapse-btn {
        width: auto;
    }
}
/* Authentication UI */
.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 10px;
}

.header-top h1 {
    margin: 0;
    font-size: 20px;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.user-name {
    font-size: 12px;
    color: white;
    white-space: nowrap;
    display: none; /* Hide on very small screens */
}

.logout-btn {
    padding: 6px 12px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

.logout-btn:hover {
    background: #d32f2f;
}

.logout-btn:active {
    background: #c62828;
}

@media (min-width: 400px) {
    .user-name {
        display: inline; /* Show user name on larger mobile screens */
    }
}

@media (min-width: 768px) {
    .header-top h1 {
        font-size: 24px;
    }
    
    .user-name {
        font-size: 14px;
    }
    
    .logout-btn {
        font-size: 14px;
        padding: 8px 16px;
    }
}

/* App Footer */
.app-footer {
    text-align: center;
    padding: 15px 10px 80px 10px;
    color: #999;
    font-size: 12px;
}

/* Closed Consegna State */
.consegna-closed .input-field:not([readonly]),
.consegna-closed select,
.consegna-closed textarea {
    pointer-events: none;
    opacity: 0.6;
}

.consegna-closed .big-btn-success {
    display: none !important;
}

.closed-badge {
    display: inline-block;
    padding: 8px 16px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    border-radius: 4px;
    margin-bottom: 10px;
    font-weight: 500;
}

/* Close/Reopen button styles */
#close-consegna-btn {
    width: 100%;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

#close-consegna-btn:hover {
    opacity: 0.9;
}

/* Admin Badge */
.admin-badge {
    display: inline-block;
    background: #9b59b6;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
}
