/* core/app.css */
:root {
    --bg-main: #f4f6f8;
    --glass-bg: rgba(255, 255, 255, 0.94);
    --glass-border: #d8e0ea;
    --text-main: #142033;
    --text-muted: #5b677a;
    --accent-purple: #1d4ed8;
    --accent-purple-hover: #1746a2;
    --accent-orange: #c96b17;
    --danger: #c03245;
    --success: #11845b;
    --shadow-soft: 0 10px 28px rgba(20, 32, 51, 0.07);
    --shadow-md: 0 10px 28px rgba(20, 32, 51, 0.07);
}

body {
    margin: 0;
    padding: 0 0 90px 0; /* Spazio per bottom bar / FAB mobile */
    background: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    line-height: 1.45;
    -webkit-tap-highlight-color: transparent;
}

/* HEADER GLASSMORPHISM (Unificato Apple Style) */
.app-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: var(--glass-bg); /* rgba(255, 255, 255, 0.85) */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 999;
}

/* Contenitore per Titolo e Sottotitolo */
.app-header-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.app-header h1 { 
    margin: 0; 
    font-size: 18px; 
    font-weight: 800; 
    color: var(--text-main); 
}

.app-header p { 
    margin: 2px 0 0 0; 
    font-size: 13px; 
    color: var(--text-muted); 
    font-weight: 600; 
}

/* Pulsante Freccia Indietro Circolare (Apple Style) */
.apple-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ffffff;
    color: var(--accent-purple);
    border: 1px solid rgba(226, 232, 240, 0.7);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    margin-right: 14px;
    text-decoration: none;
    transition: transform 0.15s ease, background-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.apple-back-btn:active {
    transform: scale(0.92);
    background: #f1f5f9;
}

header h1 { margin: 0; font-size: 18px; font-weight: 800; }
header p { margin: 2px 0 0 0; font-size: 13px; color: var(--text-muted); font-weight: 600; }

.btn-back {
    background: #f1f5f9; border: none; width: 36px; height: 36px;
    border-radius: 12px; font-size: 18px; color: var(--text-main);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-weight: bold; text-decoration: none; flex-shrink: 0;
}

/* CARDS E LAYOUT */
.container { padding: 20px; }
.card, .section-card {
    background: #fff; border-radius: 8px; padding: 20px;
    box-shadow: var(--shadow-soft); margin-bottom: 20px;
    border: 1px solid var(--glass-border);
}

/* FORMS E INPUTS */
.form-section-title {
    font-size: 11px; font-weight: 800; color: var(--text-muted);
    text-transform: uppercase; margin: 15px 0 8px;
}
.input-group { display: flex; gap: 10px; margin-bottom: 12px; }
.input-box { flex: 1; }
.input-box label { font-size: 11px; font-weight: bold; color: var(--text-muted); display: block; margin-bottom: 4px; }
.form-control {
    width: 100%; padding: 12px; border: 1px solid #b9c5d4; border-radius: 8px;
    font-family: 'Inter'; font-size: 14px; font-weight: 600; box-sizing: border-box; outline: none; transition: 0.2s;
}
.form-control:focus { border-color: var(--accent-purple); background: #fff; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* BOTTONI E PILLS (Niente Select) */
.btn-save {
    width: 100%; background: var(--accent-purple); color: #fff; border: none;
    padding: 14px; border-radius: 8px; font-weight: 800; font-size: 15px; cursor: pointer;
}
.pill-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pill-btn {
    background: #f1f5f9; border: 1px solid #e2e8f0; padding: 10px 14px;
    border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--text-muted); cursor: pointer; transition: 0.15s;
}
.pill-btn.active { background: var(--text-main); color: #fff; border-color: var(--text-main); }
.pill-btn.active.cat { background: var(--accent-purple); border-color: var(--accent-purple); }

/* BOTTOM SHEETS (Modali Apple Style) */
.sheet-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: 0.2s; z-index: 1000;
}
.sheet-overlay.open { opacity: 1; pointer-events: auto; }
.bottom-sheet {
    position: fixed; bottom: 0; left: 0; right: 0; background: #fff;
    border-radius: 24px 24px 0 0; padding: 20px; box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); z-index: 1001;
    transform: translateY(100%); max-height: 85dvh; overflow-y: auto;
}
.bottom-sheet.open { transform: translateY(0); }
.sheet-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.sheet-header h2 { margin: 0; font-size: 18px; color: var(--text-main); }
.btn-close-sheet {
    background: #f1f5f9; border: none; width: 32px; height: 32px;
    border-radius: 16px; font-size: 18px; color: var(--text-muted);
    cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: bold;
}

/* Step22C — controlli PDF coerenti e automatici */
.invoice-file-name{display:inline-flex;align-items:center;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:900;color:#334155;background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px;padding:8px 10px;}
.invoice-muted-inline{font-size:11px;font-weight:800;color:#94a3b8;}
.invoice-file-label{position:relative;overflow:hidden;display:inline-flex!important;align-items:center;gap:6px;border:1px solid #fed7aa!important;background:#fff7ed!important;color:#c2410c!important;border-radius:12px!important;padding:9px 11px!important;font-size:12px!important;font-weight:900!important;cursor:pointer!important;}
.invoice-file-label input[type="file"]{position:absolute;inset:0;opacity:0;cursor:pointer;}
