/* ===== LOGIN PAGE ===== */
.login-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
  justify-content: center;
  align-items: center;
}

.login-header {
  text-align: center;
  color: white;
  margin-bottom: 40px;
}

.login-icon {
  font-size: 80px;
  margin-bottom: 20px;
}

.login-header h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
}

.login-header p {
  margin: 8px 0 0 0;
  opacity: 0.9;
  font-size: 14px;
}

.login-form {
  background: white;
  border-radius: 16px;
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.login-form.hidden {
  display: none;
}

.login-divider {
  text-align: center;
  margin: 24px 0;
  color: #999;
  font-size: 13px;
  position: relative;
}

.login-divider::before,
.login-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: #e0e0e0;
}

.login-divider::before {
  left: 0;
}

.login-divider::after {
  right: 0;
}

.login-footer {
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  margin-top: 24px;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif; background: #F2F2F7; color: #1C1C1E; -webkit-font-smoothing: antialiased; }

/* ===== VARIABLES ===== */
:root {
  --blue: #007AFF; --green: #34C759; --red: #FF3B30; --orange: #FF9500;
  --purple: #AF52DE; --teal: #5AC8FA; --yellow: #FFCC00;
  --bg: #F2F2F7; --bg2: #FFFFFF; --bg3: #E5E5EA;
  --text1: #1C1C1E; --text2: #636366; --text3: #8E8E93;
  --sep: #C6C6C8; --card-shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 16px; --radius-sm: 10px;
  --top-h: 56px; --bot-h: 72px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

/* ===== SPLASH ===== */
#splash-screen {
  position: fixed; inset: 0; background: linear-gradient(160deg, #007AFF 0%, #5AC8FA 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; transition: opacity .4s ease;
}
.splash-content { text-align: center; color: #fff; }
.splash-icon { font-size: 72px; margin-bottom: 16px; animation: bounceIn .6s ease; }
.splash-content h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.5px; }
.splash-content p { font-size: 16px; opacity: .85; margin-top: 6px; }
.splash-loader { margin: 28px auto 0; width: 40px; height: 4px; background: rgba(255,255,255,.3); border-radius: 2px; overflow: hidden; }
.splash-loader div { height: 100%; width: 40%; background: #fff; border-radius: 2px; animation: loadBar 1.2s ease infinite; }
@keyframes loadBar { 0%{transform:translateX(-100%)} 100%{transform:translateX(350%)} }
@keyframes bounceIn { 0%{transform:scale(0.5);opacity:0} 80%{transform:scale(1.1)} 100%{transform:scale(1);opacity:1} }

/* ===== APP LAYOUT ===== */
.hidden { display: none !important; }
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }

/* ===== TOP BAR ===== */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  height: calc(var(--top-h) + var(--safe-top));
  padding: calc(var(--safe-top) + 8px) 16px 8px;
  background: rgba(255,255,255,0.9); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--sep); z-index: 100;
  position: sticky; top: 0;
}
.top-bar-title { font-size: 17px; font-weight: 600; }
.icon-btn { background: none; border: none; font-size: 22px; cursor: pointer; padding: 4px 8px; color: var(--blue); line-height: 1; border-radius: 8px; }
.icon-btn:active { background: var(--bg3); }

/* ===== SIDEBAR ===== */
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 200; backdrop-filter: blur(2px); transition: opacity .25s; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 300px;
  background: var(--bg2); z-index: 201; overflow-y: auto;
  transform: translateX(-100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
  padding-bottom: calc(var(--safe-bot) + 20px);
  box-shadow: 4px 0 24px rgba(0,0,0,.15);
}
.sidebar.open { transform: translateX(0); }
.sidebar-header { display: flex; align-items: center; gap: 14px; padding: calc(var(--safe-top) + 20px) 20px 20px; background: linear-gradient(135deg, var(--blue) 0%, #5AC8FA 100%); color: #fff; }
.sidebar-logo { font-size: 36px; }
.sidebar-header h2 { font-size: 18px; font-weight: 700; }
.sidebar-sub { font-size: 12px; opacity: .8; margin-top: 2px; }
.sidebar-section { padding: 16px 16px 8px; }
.sidebar-label { font-size: 11px; font-weight: 600; color: var(--text3); letter-spacing: .8px; text-transform: uppercase; margin-bottom: 8px; padding: 0 4px; }
.sidebar-list { list-style: none; }
.sidebar-list li { display: flex; align-items: center; gap: 10px; padding: 12px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 15px; transition: background .15s; }
.sidebar-list li:active, .sidebar-list li:hover { background: var(--bg3); }
.sidebar-list li.active { background: rgba(0,122,255,.12); color: var(--blue); font-weight: 600; }
.progetto-badge { background: rgba(0,122,255,.1); color: var(--blue); font-weight: 600; font-size: 14px; padding: 10px 14px; border-radius: var(--radius-sm); margin-top: 4px; border: 1px solid rgba(0,122,255,.2); }
.sidebar-new-btn { width: 100%; margin-top: 8px; padding: 10px; border: 1.5px dashed var(--blue); background: transparent; color: var(--blue); border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; cursor: pointer; }

/* ===== MAIN CONTENT ===== */
.main-content { flex: 1; overflow: hidden; position: relative; }
.section { display: none; position: absolute; inset: 0; overflow: hidden; }
.section.active { display: flex; flex-direction: column; }
.section-scroll { flex: 1; overflow-y: auto; padding: 12px 16px; padding-bottom: calc(var(--bot-h) + var(--safe-bot) + 16px); -webkit-overflow-scrolling: touch; }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  display: flex; align-items: stretch;
  height: calc(var(--bot-h) + var(--safe-bot));
  padding-bottom: var(--safe-bot);
  background: rgba(255,255,255,.92); backdrop-filter: blur(20px);
  border-top: 1px solid var(--sep); z-index: 100;
}
.nav-btn { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: none; border: none; cursor: pointer; padding: 8px 2px; color: var(--text3); transition: color .15s; }
.nav-btn.active { color: var(--blue); }
.nav-btn:active { opacity: .7; }
.nav-icon { font-size: 22px; line-height: 1; }
.nav-lbl { font-size: 10px; font-weight: 500; letter-spacing: .2px; }

/* ===== CARDS ===== */
.card { background: var(--bg2); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 16px; margin-bottom: 12px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-title { font-size: 15px; font-weight: 600; }
.card-link { background: none; border: none; color: var(--blue); font-size: 13px; font-weight: 500; cursor: pointer; padding: 4px 0; }
.card-link.danger { color: var(--red); }
.card-select { border: none; background: var(--bg3); border-radius: 8px; font-size: 13px; padding: 4px 8px; color: var(--text1); outline: none; }

/* HERO CARD */
.card-hero { background: linear-gradient(135deg, #007AFF 0%, #5AC8FA 100%); color: #fff; }
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.hero-label { font-size: 13px; opacity: .85; font-weight: 500; }
.hero-amount { font-size: 32px; font-weight: 700; letter-spacing: -1px; margin-top: 4px; }
.hero-icon-big { font-size: 40px; opacity: .7; }
.hero-row { display: flex; gap: 0; margin-bottom: 14px; }
.hero-stat { flex: 1; text-align: center; }
.hero-stat-label { font-size: 11px; opacity: .75; margin-bottom: 3px; }
.hero-stat-val { font-size: 15px; font-weight: 700; }
.hero-stat-val.red { color: #FFD0CC; }
.hero-stat-val.green { color: #C3F5D0; }
.hero-stat-val.blue { color: #C0E8FF; }
.budget-bar-wrap { height: 6px; background: rgba(255,255,255,.3); border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.budget-bar-fill { height: 100%; background: #fff; border-radius: 3px; transition: width .6s ease; }
.budget-bar-label { font-size: 12px; opacity: .8; text-align: right; }

/* KPI GRID */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.kpi-card { background: var(--bg2); border-radius: var(--radius-sm); box-shadow: var(--card-shadow); padding: 12px 6px; text-align: center; cursor: pointer; transition: transform .15s; }
.kpi-card:active { transform: scale(.96); }
.kpi-icon { font-size: 22px; margin-bottom: 4px; }
.kpi-val { font-size: 22px; font-weight: 700; color: var(--text1); }
.kpi-val.orange { color: var(--orange); }
.kpi-val.green { color: var(--green); }
.kpi-val.blue { color: var(--blue); }
.kpi-lbl { font-size: 10px; color: var(--text3); margin-top: 2px; font-weight: 500; }

/* CHARTS */
.chart-wrap { position: relative; height: 200px; }

/* CATEGORY PROGRESS */
.cat-progress-item { margin-bottom: 12px; }
.cat-progress-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.cat-progress-name { font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.cat-progress-pct { font-size: 13px; font-weight: 600; color: var(--blue); }
.cat-bar-wrap { height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; }
.cat-bar-fill { height: 100%; border-radius: 4px; transition: width .5s ease; }

/* SCADENZE MINI */
.scadenza-mini { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--bg3); }
.scadenza-mini:last-child { border-bottom: none; }
.scad-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.scad-dot.red { background: var(--red); }
.scad-dot.orange { background: var(--orange); }
.scad-dot.green { background: var(--green); }
.scad-dot.blue { background: var(--blue); }
.scad-info { flex: 1; }
.scad-title { font-size: 13px; font-weight: 500; }
.scad-date { font-size: 11px; color: var(--text3); margin-top: 1px; }
.scad-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.scad-badge.red { background: rgba(255,59,48,.12); color: var(--red); }
.scad-badge.orange { background: rgba(255,149,0,.12); color: var(--orange); }
.scad-badge.green { background: rgba(52,199,89,.12); color: var(--green); }

/* SPESE MINI */
.spesa-mini { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--bg3); }
.spesa-mini:last-child { border-bottom: none; }
.spesa-cat-dot { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.spesa-info { flex: 1; min-width: 0; }
.spesa-desc { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spesa-meta { font-size: 11px; color: var(--text3); margin-top: 1px; }
.spesa-amount { font-size: 15px; font-weight: 700; color: var(--red); white-space: nowrap; }

/* SPESE SUMMARY */
.spese-summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.spese-sum-item { background: var(--bg3); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.spese-sum-label { font-size: 11px; color: var(--text3); margin-bottom: 4px; }
.spese-sum-val { font-size: 17px; font-weight: 700; color: var(--text1); }

/* ===== SEARCH BAR ===== */
.search-bar-wrap { margin-bottom: 10px; }
.search-input { width: 100%; padding: 10px 14px; background: var(--bg2); border: 1px solid var(--bg3); border-radius: var(--radius-sm); font-size: 15px; outline: none; color: var(--text1); }
.search-input:focus { border-color: var(--blue); }

/* ===== FILTER CHIPS ===== */
.filter-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 4px; scrollbar-width: none; }
.filter-chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; padding: 6px 14px; border-radius: 20px; border: 1.5px solid var(--bg3); background: var(--bg2); font-size: 13px; font-weight: 500; color: var(--text2); cursor: pointer; transition: all .15s; }
.chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip:active { opacity: .7; }

/* ===== LAVORI LIST ===== */
.lavoro-card { background: var(--bg2); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 14px 16px; margin-bottom: 10px; cursor: pointer; transition: transform .15s; }
.lavoro-card:active { transform: scale(.99); }
.lavoro-card-top { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.lavoro-card-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.lavoro-card-info { flex: 1; min-width: 0; }
.lavoro-card-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lavoro-card-cat { font-size: 12px; color: var(--text3); margin-top: 2px; }
.lavoro-card-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.stato-badge { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.stato-badge.da_fare { background: rgba(142,142,147,.15); color: var(--text3); }
.stato-badge.in_corso { background: rgba(255,149,0,.15); color: var(--orange); }
.stato-badge.completato { background: rgba(52,199,89,.15); color: var(--green); }
.stato-badge.sospeso { background: rgba(255,59,48,.15); color: var(--red); }
.priorita-dot { width: 8px; height: 8px; border-radius: 50%; }
.priorita-dot.alta { background: var(--red); }
.priorita-dot.normale { background: var(--blue); }
.priorita-dot.bassa { background: var(--green); }
.lavoro-progress-row { display: flex; align-items: center; gap: 8px; }
.lavoro-prog-bar { flex: 1; height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.lavoro-prog-fill { height: 100%; border-radius: 3px; background: var(--blue); transition: width .4s ease; }
.lavoro-prog-pct { font-size: 12px; font-weight: 600; color: var(--blue); min-width: 32px; text-align: right; }
.lavoro-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--bg3); }
.lavoro-preventivo { font-size: 13px; color: var(--text3); }
.lavoro-preventivo strong { color: var(--text1); }
.lavoro-date { font-size: 11px; color: var(--text3); }

/* ===== SPESE LIST ===== */
.spesa-card { background: var(--bg2); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 14px 16px; margin-bottom: 10px; }
.spesa-card-top { display: flex; align-items: center; gap: 12px; }
.spesa-card-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.spesa-card-info { flex: 1; min-width: 0; }
.spesa-card-desc { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spesa-card-meta { font-size: 12px; color: var(--text3); margin-top: 2px; }
.spesa-card-amount { font-size: 18px; font-weight: 700; color: var(--red); white-space: nowrap; }
.spesa-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--bg3); }
.spesa-card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--bg3); color: var(--text2); }
.tag.ricevuta { background: rgba(52,199,89,.15); color: var(--green); }
.spesa-card-actions { display: flex; gap: 8px; }
.action-btn { background: none; border: none; cursor: pointer; font-size: 16px; padding: 4px; border-radius: 6px; }
.action-btn:active { background: var(--bg3); }

/* ===== FORNITORI ===== */
.fornitore-card { background: var(--bg2); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 14px 16px; margin-bottom: 10px; }
.forn-top { display: flex; align-items: center; gap: 12px; }
.forn-avatar { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; background: linear-gradient(135deg, var(--blue), #5AC8FA); color: #fff; font-weight: 700; font-size: 18px; }
.forn-info { flex: 1; }
.forn-nome { font-size: 15px; font-weight: 600; }
.forn-tipo { font-size: 12px; color: var(--text3); margin-top: 2px; }
.forn-actions { display: flex; gap: 6px; }
.forn-contact-btn { padding: 6px 12px; border-radius: 20px; border: 1.5px solid var(--blue); background: transparent; color: var(--blue); font-size: 12px; font-weight: 500; cursor: pointer; }
.forn-rating { display: flex; gap: 2px; margin-top: 8px; }
.forn-star { font-size: 14px; color: var(--bg3); }
.forn-star.on { color: var(--yellow); }
.forn-footer { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--bg3); font-size: 12px; color: var(--text3); }

/* ===== SCADENZE ===== */
.scadenza-card { background: var(--bg2); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 14px 16px; margin-bottom: 10px; border-left: 4px solid var(--blue); }
.scadenza-card.scaduta { border-left-color: var(--red); }
.scadenza-card.oggi { border-left-color: var(--orange); }
.scad-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.scad-card-info { flex: 1; }
.scad-card-title { font-size: 15px; font-weight: 600; }
.scad-card-sub { font-size: 12px; color: var(--text3); margin-top: 3px; }
.scad-card-footer { display: flex; justify-content: space-between; margin-top: 10px; align-items: center; }
.scad-days { font-size: 12px; font-weight: 600; }
.scad-days.red { color: var(--red); }
.scad-days.orange { color: var(--orange); }
.scad-days.green { color: var(--green); }

/* ===== COMPUTO ===== */
.card-import { text-align: center; padding: 32px 20px; border: 2px dashed var(--bg3); background: var(--bg2); }
.card-import.drag-over { border-color: var(--blue); background: rgba(0,122,255,.04); }
.import-icon { font-size: 52px; margin-bottom: 12px; }
.card-import h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.card-import p { font-size: 14px; color: var(--text3); margin-bottom: 16px; }
.import-hint { font-size: 12px; color: var(--text3); margin-top: 12px; margin-bottom: 0 !important; }
.computo-stats-row { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.computo-stat { background: var(--bg3); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.computo-stat strong { display: block; font-size: 18px; font-weight: 700; color: var(--blue); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.computo-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.computo-table th { background: var(--bg3); padding: 8px 10px; text-align: left; font-weight: 600; white-space: nowrap; }
.computo-table td { padding: 8px 10px; border-bottom: 1px solid var(--bg3); white-space: nowrap; }
.computo-table tr:last-child td { border-bottom: none; }
.voce-check-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--bg3); }
.voce-check-item:last-child { border-bottom: none; }
.voce-check-item input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--blue); flex-shrink: 0; }
.voce-check-info { flex: 1; }
.voce-check-name { font-size: 13px; font-weight: 500; }
.voce-check-meta { font-size: 11px; color: var(--text3); margin-top: 2px; }
.voce-check-price { font-size: 14px; font-weight: 600; color: var(--text1); white-space: nowrap; }
.hint-text { font-size: 13px; color: var(--text3); margin-bottom: 10px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text2); margin-bottom: 6px; }
.form-input { width: 100%; padding: 11px 14px; background: var(--bg3); border: 1.5px solid transparent; border-radius: var(--radius-sm); font-size: 15px; color: var(--text1); outline: none; appearance: none; -webkit-appearance: none; transition: border-color .15s; font-family: inherit; }
.form-input:focus { border-color: var(--blue); background: var(--bg2); }
.form-textarea { min-height: 80px; resize: vertical; }
.form-row { display: flex; gap: 10px; }
.form-group.half { flex: 1; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; }
.toggle-row label:first-child { margin-bottom: 0; }
.toggle-switch { position: relative; display: inline-block; width: 51px; height: 31px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--bg3); border-radius: 31px; cursor: pointer; transition: background .2s; }
.toggle-slider::before { content:''; position: absolute; height: 27px; width: 27px; left: 2px; bottom: 2px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 2px 4px rgba(0,0,0,.2); }
.toggle-switch input:checked + .toggle-slider { background: var(--green); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ===== BUTTONS ===== */
.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--blue); color: #fff; border: none; border-radius: var(--radius-sm); padding: 12px 20px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; transition: opacity .15s; }
.btn-primary:active { opacity: .8; }
.btn-outline { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: transparent; color: var(--blue); border: 1.5px solid var(--blue); border-radius: var(--radius-sm); padding: 11px 20px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; }
.btn-outline:active { opacity: .7; }
.btn-danger { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--red); color: #fff; border: none; border-radius: var(--radius-sm); padding: 12px 20px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; }
.btn-danger:active { opacity: .8; }
.full-btn { width: 100%; margin-top: 8px; }
.mt-8 { margin-top: 8px; }

/* ===== MODALI ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 500; display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(4px); }
.modal-overlay.hidden { display: none !important; }
.modal-sheet { background: var(--bg2); border-radius: 20px 20px 0 0; width: 100%; max-width: 600px; max-height: 90vh; display: flex; flex-direction: column; animation: slideUp .3s cubic-bezier(.4,0,.2,1); padding-bottom: var(--safe-bot); }
.modal-sheet-tall { max-height: 95vh; }
.confirm-sheet { border-radius: 20px; margin: auto; width: calc(100% - 40px); max-width: 320px; animation: fadeIn .2s ease; }
@keyframes slideUp { from{transform:translateY(100%)} to{transform:translateY(0)} }
@keyframes fadeIn { from{opacity:0;transform:scale(.95)} to{opacity:1;transform:scale(1)} }
.modal-handle { width: 36px; height: 4px; background: var(--bg3); border-radius: 2px; margin: 10px auto 0; flex-shrink: 0; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 12px; border-bottom: 1px solid var(--bg3); flex-shrink: 0; }
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close { background: var(--bg3); border: none; width: 28px; height: 28px; border-radius: 50%; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text2); }
.modal-body { flex: 1; overflow-y: auto; padding: 16px 20px; -webkit-overflow-scrolling: touch; }
.modal-footer { display: flex; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--bg3); flex-shrink: 0; }
.modal-footer .btn-outline, .modal-footer .btn-primary, .modal-footer .btn-danger { flex: 1; }
.confirm-icon { font-size: 44px; text-align: center; margin-bottom: 12px; }
.confirm-sheet h3 { text-align: center; font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.confirm-sheet p { text-align: center; font-size: 14px; color: var(--text2); }

/* ===== STAR RATING ===== */
.star-rating { display: flex; gap: 6px; font-size: 28px; margin-bottom: 4px; }
.star { cursor: pointer; color: var(--bg3); transition: color .1s; }
.star.on { color: var(--yellow); }

/* ===== DETTAGLIO LAVORO ===== */
.det-lav-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--bg3); }
.det-lav-ico { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 26px; flex-shrink: 0; }
.det-lav-name { font-size: 18px; font-weight: 700; }
.det-lav-cat { font-size: 13px; color: var(--text3); margin-top: 3px; }
.det-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.det-info-item { background: var(--bg3); border-radius: var(--radius-sm); padding: 10px 12px; }
.det-info-label { font-size: 11px; color: var(--text3); margin-bottom: 3px; }
.det-info-val { font-size: 14px; font-weight: 600; }
.det-section-title { font-size: 13px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .6px; margin: 16px 0 8px; }
.det-spese-list .spesa-mini { padding: 8px 0; }
.det-note { background: var(--bg3); border-radius: var(--radius-sm); padding: 12px; font-size: 14px; color: var(--text2); line-height: 1.5; }

/* ===== TOAST ===== */
.toast { position: fixed; bottom: calc(var(--bot-h) + var(--safe-bot) + 16px); left: 50%; transform: translateX(-50%); background: rgba(28,28,30,.9); color: #fff; padding: 10px 20px; border-radius: 20px; font-size: 14px; font-weight: 500; z-index: 9000; white-space: nowrap; backdrop-filter: blur(10px); animation: toastIn .25s ease; }
.toast.hidden { display: none; }
@keyframes toastIn { from{opacity:0;transform:translateX(-50%) translateY(10px)} to{opacity:1;transform:translateX(-50%) translateY(0)} }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text3); }
.empty-state-icon { font-size: 52px; margin-bottom: 12px; }
.empty-state h3 { font-size: 17px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.empty-state p { font-size: 14px; }
.empty-state-small { text-align: center; padding: 16px; color: var(--text3); font-size: 13px; }

/* ===== DETTAGLIO SPESA ===== */
.det-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--bg3); font-size: 14px; }
.det-row:last-child { border-bottom: none; }
.det-row-label { color: var(--text3); }
.det-row-val { font-weight: 500; }

/* ===== MISC ===== */
.full-btn { width: 100%; }
.text-center { text-align: center; }
select.form-input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238E8E93' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

/* ===== RESPONSIVE ===== */
@media (min-width: 480px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 360px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-amount { font-size: 26px; }
}
