:root {
    --bg: #0f1117;
    --surface: #181b24;
    --surface-2: #1f2330;
    --border: #2c3140;
    --text: #e8eaf0;
    --text-muted: #9aa0b0;
    --primary: #e4572e;
    --primary-hover: #f0693f;
    --success: #3fb46a;
    --warning: #d9a03f;
    --danger: #d95757;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 2rem; margin: 0 0 .5rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .75rem; }
h3 { margin: 0 0 .5rem; }

/* Nav */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.brand { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.brand span { color: var(--primary); }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 1.25rem; }
.nav-links a { color: var(--text); }

/* Layout */
.container { max-width: 1100px; width: 100%; margin: 0 auto; padding: 2rem; flex: 1; }
.container.narrow { max-width: 640px; }
.page-header { margin-bottom: 1rem; }
.footer { padding: 1.5rem 2rem; border-top: 1px solid var(--border); color: var(--text-muted); font-size: .9rem; }

/* Hero */
.hero { text-align: center; padding: 4rem 1rem 3rem; }
.hero h1 { font-size: 2.6rem; line-height: 1.2; }
.lead { color: var(--text-muted); font-size: 1.1rem; max-width: 42rem; margin: .5rem auto 0; }
.hero-actions { margin-top: 2rem; display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    padding: 2rem 0 3rem;
}
.feature {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}
.feature p { color: var(--text-muted); margin: 0; }

/* Buttons */
.btn {
    display: inline-block;
    padding: .55rem 1.1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--text-muted); }
.btn-lg { padding: .8rem 1.6rem; font-size: 1.05rem; }
.btn-sm { padding: .3rem .7rem; font-size: .85rem; }
.btn-link { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; padding: 0; }
.btn-link:hover { color: var(--text); }
.inline { display: inline; }

/* Forms */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    margin: 1rem 0;
}
.form label { display: block; margin: 1rem 0 .3rem; font-weight: 600; }
.form input, .form textarea, .form select {
    width: 100%;
    padding: .6rem .75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
}
.form input:focus, .form textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }
.form h2 { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.form h2:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.form button[type="submit"] { margin-top: 1.5rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
fieldset { border: 1px solid var(--border); border-radius: 8px; margin: 1rem 0; padding: 1rem; }
legend { font-weight: 600; padding: 0 .5rem; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .4rem; }
.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 400 !important; margin: 0 !important; }
.checkbox input { width: auto; }
.field-error { color: var(--danger); font-size: .85rem; margin: .25rem 0 0; }

/* Alerts */
.alert {
    padding: .8rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    margin: 1rem 0;
}
.alert-success { border-color: var(--success); color: var(--success); }
.alert-error { border-color: var(--danger); color: var(--danger); }

/* Tables & panels */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.25rem 0;
}
.panel h2 { margin-top: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-muted); font-weight: 600; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; }
.table tr:last-child td { border-bottom: none; }
.actions { display: flex; gap: .5rem; }
.empty { color: var(--text-muted); font-style: italic; }
.muted { color: var(--text-muted); }

/* Badges (stati) */
.badge {
    display: inline-block;
    padding: .15rem .6rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.badge-received { border-color: var(--text-muted); color: var(--text); }
.badge-in_review { border-color: var(--warning); color: var(--warning); }
.badge-proposed, .badge-reserved { border-color: var(--warning); color: var(--warning); }
.badge-accepted, .badge-confirmed, .badge-free { border-color: var(--success); color: var(--success); }
.badge-rejected, .badge-declined, .badge-cancelled { border-color: var(--danger); color: var(--danger); }
.badge-booked { border-color: var(--primary); color: var(--primary); }
.badge-completed { border-color: var(--text-muted); color: var(--text-muted); }
.badge-pending { border-color: var(--warning); color: var(--warning); }
.badge-approved { border-color: var(--success); color: var(--success); }

/* Page header con azione e statistiche */
.page-header.with-action { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.stats { display: flex; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .75rem 1.25rem;
    display: flex;
    flex-direction: column;
}
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--primary); line-height: 1.2; }
.stat-label { color: var(--text-muted); font-size: .85rem; }

/* Barra filtri e form inline */
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.filter-bar, .slot-form {
    display: flex;
    align-items: end;
    gap: .75rem;
    flex-wrap: wrap;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .75rem 1rem;
    margin: .75rem 0 1rem;
}
.filter-field { display: flex; flex-direction: column; }
.filter-field label { font-size: .8rem; color: var(--text-muted); margin-bottom: .25rem; }
.filter-bar input, .filter-bar select, .slot-form input {
    padding: .4rem .6rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: .9rem;
    min-width: 8.5rem;
    font-family: inherit;
}
.filter-actions { display: flex; gap: .5rem; align-items: end; }
.row-form { display: inline-flex; gap: .4rem; align-items: center; }
.row-form select {
    padding: .3rem .5rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: .85rem;
    max-width: 11rem;
}
.small { font-size: .82rem; }
.fee-input {
    padding: .3rem .5rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: .85rem;
    width: 11rem;
}
button:disabled { opacity: .5; cursor: not-allowed; }

/* Scelta locale (candidatura) */
.venue-list { display: flex; flex-direction: column; gap: .75rem; }
.venue-card { display: flex; justify-content: space-between; align-items: center; padding: 1.25rem 1.5rem; margin: 0; }
.venue-card h3 { margin: 0; }
.checkbox-grid.slots { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* Ricerca indirizzo (OpenStreetMap) */
.geo-search { display: flex; gap: .5rem; }
.geo-search input { flex: 1; }
.geo-search .btn { white-space: nowrap; }
.geo-results { list-style: none; margin: .5rem 0 0; padding: 0; }
.geo-results li + li { margin-top: .25rem; }
.geo-result {
    width: 100%;
    text-align: left;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: .5rem .75rem;
    font-size: .9rem;
    cursor: pointer;
}
.geo-result:hover { border-color: var(--primary); }
.geo-hint { color: var(--text-muted); font-size: .9rem; padding: .25rem 0; }
.geo-selected { color: var(--success); }

/* Riepilogo serata */
.badge-lg { font-size: 1rem; padding: .35rem 1rem; }
.breadcrumb { margin: 0 0 .5rem; }
.quote {
    margin: 0;
    padding: .75rem 1rem;
    border-left: 3px solid var(--primary);
    background: var(--surface-2);
    border-radius: 0 8px 8px 0;
    color: var(--text-muted);
    font-style: italic;
}

/* Profile */
.profile { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.5rem; margin: 0; }
.profile dt { color: var(--text-muted); font-weight: 600; }
.profile dd { margin: 0; }
.links { margin: 0; padding-left: 1.2rem; }
