/* ═══════════════════════════════════════════════════
   ALLOGGIATI WEB HELPER — Modern UI
   Designed for accessibility and ease of use
   ═══════════════════════════════════════════════════ */

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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    min-height: 100vh;
    font-size: 18px;
    line-height: 1.6;
}

/* ── HEADER ── */
header {
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
    color: white;
    padding: 1.25rem 2rem 0;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1300px;
    margin: 0 auto;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.header-icon {
    font-size: 2rem;
    opacity: 0.9;
}
header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
header .subtitle {
    font-size: 0.9rem;
    opacity: 0.6;
    margin-top: 0.1rem;
}
.ocr-badge {
    display: none;
}

nav {
    margin-top: 1rem;
    display: flex;
    gap: 0;
    max-width: 1300px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 1rem;
}
.tab-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.45);
    padding: 1rem 1.8rem;
    font-size: 1.1rem;
    cursor: pointer;
    border-bottom: 4px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
}
.tab-btn:hover { color: rgba(255,255,255,0.8); }
.tab-btn.active { color: white; border-bottom-color: var(--primary); }
.tab-btn i { font-size: 1.3rem; }
.tab-short { display: none; }
.tab-full { display: inline; }

/* ── MAIN ── */
main {
    max-width: 1300px;
    margin: 0 auto;
    padding: 1.5rem;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── CARD ── */
.card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

/* ── SCANNER LAYOUT ── */
.scanner-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 960px) {
    .scanner-layout { grid-template-columns: 1fr; }
}

.upload-panel h2, .results-panel h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-800);
}

/* ── UPLOAD AREA ── */
.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}
.upload-area.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.upload-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}
.upload-text {
    color: var(--gray-500);
    font-size: 1rem;
    margin-bottom: 0.8rem;
}
.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--primary);
    color: white;
    padding: 0.9rem 1.8rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background 0.2s;
    min-height: 52px;
}
.upload-btn:hover { background: var(--primary-dark); }

.upload-hints {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.2rem;
    justify-content: center;
    flex-wrap: wrap;
}
.hint-box {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
    color: var(--gray-600);
    text-align: left;
    line-height: 1.5;
}
.hint-box i {
    font-size: 1.2rem;
    color: var(--primary);
    flex-shrink: 0;
}
.hint-box strong { color: var(--gray-800); }

.preview-area { margin-top: 1rem; text-align: center; }
.preview-area h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
.preview-area img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    object-fit: contain;
}

/* ── RESULTS PANEL ── */
.results-hint {
    font-size: 0.9rem;
    color: var(--gray-500);
    margin: -0.5rem 0 1rem;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    margin: 1.8rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.section-title i { font-size: 1.1rem; }

/* ── FORM FIELDS ── */
.fields-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.field {
    display: flex;
    flex-direction: column;
}
.field label {
    font-size: 1rem;
    color: var(--gray-700);
    margin-bottom: 0.4rem;
    font-weight: 600;
}
.required { color: var(--danger); }

.field input, .field select {
    padding: 0.75rem 0.9rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 1.05rem;
    transition: all 0.2s;
    background: white;
    min-height: 48px;
}
.field input:focus, .field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.field input.mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    letter-spacing: 0.5px;
}

/* Field validation states */
.field input.field-error, .field select.field-error {
    border-color: var(--danger);
    background: var(--danger-light);
}
.field input.field-ok, .field select.field-ok {
    border-color: var(--success);
    background: var(--success-light);
}
.field input.field-warning, .field select.field-warning {
    border-color: var(--warning);
    background: var(--warning-light);
}

.w20 { flex: 0 0 18%; } .w25 { flex: 0 0 23%; } .w30 { flex: 0 0 28%; }
.w35 { flex: 0 0 33%; } .w50 { flex: 0 0 48%; }
@media (max-width: 700px) { .w20,.w25,.w30,.w35,.w50 { flex: 1 1 100%; } }

/* ── BUTTONS ── */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.85rem 1.8rem;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 52px;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary.btn-large { padding: 1rem 2.2rem; font-size: 1.2rem; min-height: 56px; }
.btn-primary.btn-xl { padding: 1.2rem 2.8rem; font-size: 1.3rem; border-radius: 12px; min-height: 60px; }

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
    padding: 0.75rem 1.4rem;
    border-radius: 10px;
    font-size: 1.05rem;
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    min-height: 48px;
}
.btn-secondary:hover { background: var(--gray-200); }

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.btn-link:hover { text-decoration: underline; }

.btn-delete {
    background: none;
    border: 2px solid var(--gray-200);
    color: var(--danger);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 10px;
    transition: background 0.2s;
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-delete:hover { background: var(--danger-light); border-color: var(--danger); }

.actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

/* ── RAW TEXT ── */
.raw-text-toggle { margin-top: 1rem; }
#rawText {
    margin-top: 0.5rem;
    background: var(--gray-50);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    max-height: 150px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    border: 1px solid var(--gray-200);
    font-family: monospace;
}

/* ── LOADING ── */
#loading {
    text-align: center;
    padding: 4rem 1rem;
}
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
    font-size: 1.1rem;
    color: var(--gray-500);
}

.placeholder {
    text-align: center;
    padding: 4rem 1.5rem;
    color: var(--gray-400);
}
.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--gray-300);
}
.placeholder p {
    font-size: 1.05rem;
    line-height: 1.6;
}

/* ── AUTOCOMPLETE ── */
.autocomplete-dropdown {
    position: absolute;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-height: 220px;
    overflow-y: auto;
    z-index: 1000;
}
.ac-item {
    padding: 0.8rem 1rem;
    font-size: 1.05rem;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-50);
    min-height: 44px;
}
.ac-item:hover { background: var(--primary-light); }
.ac-item:last-child { border-bottom: none; }

/* ── GUEST LIST ── */
.guests-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
    gap: 0.8rem;
}
.guests-header h2 {
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.date-picker {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.1rem;
}
.date-picker label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-600);
    font-weight: 600;
    font-size: 1.1rem;
}
.date-picker input {
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 1.15rem;
    min-height: 52px;
    min-width: 180px;
    cursor: pointer;
}

.guests-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.guest-card {
    background: var(--gray-50);
    border-radius: 10px;
    padding: 1.1rem 1.3rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--gray-200);
    transition: all 0.2s;
}
.guest-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.guest-num {
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
}
.guest-info { flex: 1; }
.guest-name {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--gray-800);
}
.guest-details {
    font-size: 1.05rem;
    color: var(--gray-600);
    margin-top: 0.3rem;
    line-height: 1.6;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-400);
    font-size: 1.05rem;
    line-height: 1.8;
}

/* ── EXPORT ── */
.export-subtitle {
    font-size: 0.95rem;
    color: var(--gray-500);
    margin: -0.5rem 0 1.2rem;
}
.export-date {
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.1rem;
}
.export-date label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--gray-600);
    font-size: 1.1rem;
}
.export-date input {
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 1.15rem;
    min-height: 52px;
    min-width: 180px;
    cursor: pointer;
}

.export-summary {
    background: var(--success-light);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--success);
}
.export-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.export-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.05rem;
}
.export-table th {
    background: var(--gray-50);
    padding: 0.75rem 0.9rem;
    text-align: left;
    font-weight: 700;
    border-bottom: 2px solid var(--gray-200);
    color: var(--gray-700);
    font-size: 0.95rem;
}
.export-table td {
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--gray-100);
}

.export-actions {
    margin: 1.5rem 0;
    text-align: center;
}

.export-info {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--gray-100);
}
.export-info h3 {
    font-size: 1.05rem;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-700);
}
.export-info ol {
    padding-left: 1.5rem;
    font-size: 1rem;
    line-height: 2;
    color: var(--gray-600);
}
.export-info a { color: var(--primary); }

.export-history {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--gray-100);
}
.export-history h3 {
    font-size: 1.05rem;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-700);
}
.date-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 1.05rem;
    gap: 0.8rem;
}

/* ── MODAL ── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-content {
    width: 100%;
    max-width: 780px;
    max-height: 92vh;
    overflow-y: auto;
    position: relative;
    padding: 1.8rem;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}
.modal-header h2 {
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-800);
}
.modal-close {
    font-size: 2rem;
    line-height: 1;
    padding: 0.3rem 0.6rem;
    min-width: 44px;
    min-height: 44px;
}

/* ── GUEST HEADER ACTIONS ── */
.guests-header-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

/* ── GUEST CARD EDIT BUTTON ── */
.guest-actions {
    display: flex;
    gap: 0.6rem;
    flex-shrink: 0;
}
.btn-edit {
    background: none;
    border: 2px solid var(--gray-200);
    color: var(--primary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 10px;
    transition: background 0.2s;
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-edit:hover { background: var(--primary-light); border-color: var(--primary); }

/* ── OCR FEEDBACK BANNER ── */
.ocr-feedback {
    padding: 1rem 1.2rem;
    border-radius: 10px;
    margin-bottom: 1.2rem;
    font-size: 1.05rem;
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    line-height: 1.5;
}
.ocr-feedback.ocr-warning {
    background: var(--warning-light);
    border: 1px solid var(--warning);
    color: #92400e;
}
.ocr-feedback.ocr-error {
    background: var(--danger-light);
    border: 1px solid var(--danger);
    color: #991b1b;
}
.ocr-feedback i { font-size: 1.2rem; flex-shrink: 0; }

.btn-small {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.btn-small:hover { background: var(--gray-200); border-color: var(--gray-400); }

/* ── TOAST NOTIFICATIONS ── */
.toast-container {
    position: fixed;
    top: 1.2rem;
    right: 1.2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.toast {
    padding: 1rem 1.4rem;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 3.7s forwards;
    max-width: 450px;
}
.toast.toast-success { background: var(--success); color: white; }
.toast.toast-error { background: var(--danger); color: white; }
.toast.toast-warning { background: var(--warning); color: #1f2937; }
.toast i { font-size: 1.1rem; flex-shrink: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-10px); } }

/* ── TAB BADGE ── */
.tab-badge {
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    margin-left: 0.3rem;
    min-width: 1.2rem;
    text-align: center;
    line-height: 1.3;
}

/* ── CUSTOM DATE PICKER ── */
.custom-date-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.2rem;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 1.15rem;
    font-weight: 600;
    background: white;
    cursor: pointer;
    min-height: 52px;
    min-width: 180px;
    transition: all 0.2s;
    color: var(--gray-800);
}
.custom-date-trigger:hover { border-color: var(--primary); }
.custom-date-trigger i { color: var(--primary); font-size: 1.2rem; }
.field .custom-date-trigger { width: 100%; }

.cdp-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.cdp-calendar {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    padding: 1.5rem;
    width: 100%;
    max-width: 420px;
    animation: cdpIn 0.2s ease;
}
@keyframes cdpIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.cdp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.cdp-month-year {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gray-800);
}
.cdp-nav {
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--gray-700);
    transition: all 0.2s;
}
.cdp-nav:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.cdp-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}
.cdp-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.cdp-day {
    width: 100%;
    aspect-ratio: 1;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--gray-800);
    transition: all 0.15s;
}
.cdp-day:hover { background: var(--primary-light); color: var(--primary-dark); }
.cdp-day.today { border: 2px solid var(--primary); font-weight: 700; }
.cdp-day.selected { background: var(--primary); color: white; font-weight: 700; }
.cdp-day.selected:hover { background: var(--primary-dark); color: white; }
.cdp-day.other-month { color: var(--gray-300); cursor: default; }
.cdp-day.other-month:hover { background: none; }
.cdp-footer {
    display: flex;
    gap: 0.8rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}
.cdp-footer button {
    flex: 1;
    padding: 0.8rem;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    min-height: 48px;
    transition: all 0.2s;
}
.cdp-btn-today { background: var(--primary); color: white; }
.cdp-btn-today:hover { background: var(--primary-dark); }
.cdp-btn-cancel { background: var(--gray-100); color: var(--gray-700); border: 2px solid var(--gray-200) !important; }
.cdp-btn-cancel:hover { background: var(--gray-200); }

/* ── RESPONSIVE: Tablet ── */
@media (max-width: 960px) {
    .upload-panel h2, .results-panel h2 { font-size: 1.25rem; }
    .date-picker input, .export-date input {
        padding: 0.7rem;
        font-size: 1.05rem;
        min-height: 48px;
    }
}

/* ── RESPONSIVE: Mobile ── */
@media (max-width: 600px) {
    /* Header compatto */
    header { padding: 0.6rem 0.8rem 0; }
    header h1 { font-size: 1.15rem; }
    header .subtitle { display: none; }
    .header-icon { display: none !important; }
    .header-left { gap: 0; }
    .header-content { gap: 0.5rem; }

    /* Logout touch-friendly */
    .btn-logout { font-size: 1.1rem; padding: 0.5rem 0.8rem; }
    .btn-logout span { display: none; }

    /* Tab con testo breve */
    .tab-btn { padding: 0.7rem 0.8rem; font-size: 1rem; gap: 0.4rem; flex: 1; justify-content: center; }
    .tab-btn i { font-size: 1.2rem; }
    .tab-full { display: none; }
    .tab-short { display: inline; }
    nav { margin-top: 0.5rem; }

    /* Main content */
    main { padding: 0.6rem; }
    .card { padding: 1rem; }

    /* Upload compatto */
    .upload-area { padding: 1.2rem 0.8rem; }
    .upload-text { font-size: 0.95rem; }
    .upload-icon i { font-size: 2.5rem; }
    .upload-btn { padding: 0.9rem 1.5rem; font-size: 1.1rem; }
    .upload-hints { gap: 0.5rem; margin-top: 0.8rem; }
    .hint-box { padding: 0.6rem 0.8rem; font-size: 0.9rem; }

    /* Form fields */
    .field input, .field select { font-size: 1.15rem; min-height: 52px; }
    .section-title { font-size: 0.95rem; margin: 1rem 0 0.5rem; }
    .fields-row { gap: 0.5rem; }

    /* Bottoni principali full-width */
    .actions { flex-direction: column; }
    .btn-primary { min-height: 56px; font-size: 1.15rem; width: 100%; }
    .btn-primary.btn-large { width: 100%; }
    .btn-primary.btn-xl { padding: 1rem; font-size: 1.2rem; min-height: 58px; width: 100%; }
    .btn-secondary { min-height: 50px; font-size: 1.05rem; width: 100%; }

    /* Export */
    .export-table { font-size: 0.95rem; }
    .export-table th, .export-table td { padding: 0.5rem 0.6rem; }
    .export-date { flex-wrap: wrap; }
    .export-actions { margin: 1rem 0; }

    /* Guest list */
    .guests-header { flex-direction: column; align-items: stretch; gap: 0.6rem; }
    .guests-header-actions { width: 100%; justify-content: space-between; }
    .guest-card { padding: 0.9rem; gap: 0.8rem; }
    .guest-name { font-size: 1.1rem; }
    .guest-details { font-size: 0.95rem; }

    /* Modal */
    .modal-content { padding: 1rem; max-height: 95vh; }
    .modal-overlay { padding: 0.3rem; }

    /* Toast */
    .toast-container { top: 0.5rem; right: 0.5rem; left: 0.5rem; }
    .toast { max-width: 100%; font-size: 1.05rem; }

    /* Date picker */
    .custom-date-trigger { min-width: 150px; font-size: 1.05rem; }
    .cdp-calendar { padding: 0.8rem; }
    .cdp-day { min-height: 44px; font-size: 1rem; }

    /* Preview */
    .preview-area img { max-height: 200px; }

    /* History dates */
    .export-history .date-row { flex-wrap: wrap; gap: 0.4rem; }
}

/* ── LOGIN PAGE ── */
.login-page {
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 50%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.login-container {
    width: 100%;
    max-width: 480px;
}

.login-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.login-header h1 {
    font-size: 1.6rem;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.login-header p {
    color: var(--gray-500);
    font-size: 1.1rem;
}

.login-error {
    background: var(--danger-light);
    color: var(--danger);
    padding: 1rem 1.25rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-field label {
    display: block;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.4rem;
}

.login-field label i {
    margin-right: 0.4rem;
    color: var(--gray-400);
}

.login-field input {
    width: 100%;
    padding: 0.9rem 1rem;
    font-size: 1.2rem;
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    transition: border-color 0.2s;
}

.login-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.login-submit {
    margin-top: 0.5rem;
    padding: 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    min-height: 56px;
}

.login-submit:hover {
    background: var(--primary-dark);
}

.login-submit i {
    margin-right: 0.5rem;
}

/* ── LOGOUT BUTTON ── */
.btn-logout {
    color: var(--gray-400);
    text-decoration: none;
    font-size: 1rem;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    white-space: nowrap;
}

.btn-logout:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

@media (max-width: 600px) {
    .login-card { padding: 2rem 1.25rem; }
    .login-header h1 { font-size: 1.4rem; }
    .login-field input { font-size: 1.15rem; }
    .login-submit { font-size: 1.15rem; }
}
