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

:root {
    --bg-app: #FAFAFA;
    --bg-surface: #FFFFFF;
    --border: #E5E7EB;
    --text-main: #111827;
    --text-muted: #6B7280;
    --accent: #000000;
    --accent-hover: #374151;
    --danger: #EF4444;
    --success: #10B981;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }
body { background-color: var(--bg-app); color: var(--text-main); -webkit-font-smoothing: antialiased; }

/* LAYOUT EDGE-TO-EDGE */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

/* SIDEBAR MINIMALE */
.sidebar { 
    width: 260px; background: var(--bg-surface); border-right: 1px solid var(--border); 
    padding: 2rem 1.5rem; display: flex; flex-direction: column; gap: 0.25rem; 
}
.brand { font-size: 1.25rem; font-weight: 700; margin-bottom: 2.5rem; padding-left: 0.75rem; letter-spacing: -0.03em; color: var(--text-main); }
.nav-item { 
    color: var(--text-muted); text-decoration: none; padding: 0.6rem 0.75rem; 
    border-radius: 6px; font-size: 0.9rem; font-weight: 500; transition: 0.2s; 
}
.nav-item:hover { background: #F3F4F6; color: var(--text-main); }
.nav-item.active { background: #F3F4F6; color: var(--text-main); font-weight: 600; }

/* CONTENUTO */
.main-content { flex: 1; overflow-y: auto; padding: 3rem 4rem; }
.header-action { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2.5rem; }
h1 { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.03em; margin: 0; }

/* BOTTONI PREMIUM SQUADRATI (Forzati per sovrascrivere i vecchi JS) */
.btn-primary, .paga-btn, .add-btn, .stripe-btn, button[type="submit"] { 
    background: var(--accent) !important; color: #FFF !important; border: none; 
    padding: 0.6rem 1.2rem; border-radius: 6px; font-size: 0.85rem; font-weight: 500; 
    cursor: pointer; transition: 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.05); text-decoration: none; display: inline-block; text-align: center;
}
.btn-primary:hover, .paga-btn:hover, .add-btn:hover, .stripe-btn:hover, button[type="submit"]:hover { background: var(--accent-hover) !important; }
.btn-secondary, .logout-btn {
    background: var(--bg-surface); color: var(--text-main); border: 1px solid var(--border);
    padding: 0.6rem 1.2rem; border-radius: 6px; font-size: 0.85rem; cursor: pointer; transition: 0.2s; font-weight: 500;
}
.btn-secondary:hover, .logout-btn:hover { background: #F9FAFB; }
.btn-danger { background: var(--danger) !important; color: white !important; border: none; padding: 0.6rem 1.2rem; border-radius: 6px; font-size: 0.85rem; cursor: pointer; font-weight:500;}
.btn-danger:hover { background: #DC2626 !important; }

/* TABELLE CHIRURGICHE */
.table-card { 
    background: var(--bg-surface); border: 1px solid var(--border); 
    border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.02); margin-bottom: 2rem;
}
table { width: 100%; border-collapse: collapse; text-align: left; }
th { 
    padding: 1rem 1.5rem; font-size: 0.75rem; color: var(--text-muted); 
    text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); 
    background: #F9FAFB; font-weight: 600;
}
td { padding: 1rem 1.5rem; font-size: 0.875rem; border-bottom: 1px solid var(--border); color: var(--text-main); }
tr:last-child td { border-bottom: none; }

/* MODALI E FORM */
.modal { 
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.3); z-index: 1000; align-items: center; justify-content: center; 
    backdrop-filter: blur(2px); 
}
.modal-content { 
    background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; 
    padding: 2rem; width: 100%; max-width: 420px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04); 
}
.form-group { margin-bottom: 1.2rem; text-align: left; }
label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--text-main); margin-bottom: 0.4rem; }
input, select { 
    width: 100%; padding: 0.75rem 1rem; background: var(--bg-surface); border: 1px solid var(--border); 
    border-radius: 6px; font-size: 0.9rem; transition: border-color 0.2s, box-shadow 0.2s; outline: none; color: var(--text-main);
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* BADGES */
.badge { padding: 0.25rem 0.6rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 500; display: inline-block; background: #F3F4F6; color: var(--text-muted); border: 1px solid #E5E7EB; }
.badge-preventivo { background: #F3F4F6; color: #4B5563; border-color: #E5E7EB; }
.badge-fattura { background: #EFF6FF; color: #2563EB; border-color: #BFDBFE; }

/* DASHBOARD CARDS */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.stat-card { background: var(--bg-surface); border: 1px solid var(--border); padding: 1.5rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.02); }
.stat-title { color: var(--text-muted); font-size: 0.8rem; font-weight: 600; margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 2.25rem; font-weight: 700; color: var(--text-main); letter-spacing: -0.03em; }

/* KANBAN */
.kanban-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-top: 1rem; }
.kanban-col { background: #F9FAFB; padding: 1rem; border-radius: 8px; border: 1px solid var(--border); min-height: 500px; }
.kanban-col h3 { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); text-align: center; }
.task-card { background: var(--bg-surface); padding: 1rem; border-radius: 6px; margin-bottom: 1rem; border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.task-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.3rem; }
.task-client { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.8rem; }
.task-actions select { padding: 0.4rem; font-size: 0.8rem; margin-top: 0; }

/* AUTH / LANDING CONTAINERS */
.auth-wrapper { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: var(--bg-app); }
.auth-box { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; padding: 2.5rem; width: 100%; max-width: 400px; box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05); }
.auth-box h1 { margin-bottom: 0.5rem; font-size: 1.75rem; text-align: center; color: var(--text-main); font-weight: 700; letter-spacing: -0.03em; }
.auth-box p { color: var(--text-muted); text-align: center; margin-bottom: 2rem; font-size: 0.95rem; }
.auth-box a { color: var(--text-main); text-decoration: underline; font-weight: 500; }
.auth-form-container input, .auth-form-container select { margin-bottom: 1rem; }
.auth-form-container button { width: 100%; margin-top: 0.5rem; }