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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0f0f1a;
    color: #e8e8f0;
    min-height: 100vh;
    padding: 24px;
}

/* ── HEADER ─────────────────────────────────────────────────────────────── */
.header {
    text-align: center;
    margin-bottom: 32px;
}
.header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.header p { color: #8888a8; margin-top: 4px; font-size: 0.95rem; }

/* ── LAYOUT ─────────────────────────────────────────────────────────────── */
.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}
@media (max-width: 800px) {
    .layout { grid-template-columns: 1fr; }
}

/* ── PANNELLO LATERALE ───────────────────────────────────────────────────── */
.panel {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 16px;
    padding: 20px;
}
.panel-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #6060a0;
    margin-bottom: 16px;
}
.btn-add {
    width: 100%;
    padding: 9px;
    background: rgba(96, 165, 250, 0.1);
    border: 1px dashed rgba(96, 165, 250, 0.4);
    border-radius: 10px;
    color: #60a5fa;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}
.btn-add:hover { background: rgba(96, 165, 250, 0.2); }

/* ── OMINO ───────────────────────────────────────────────────────────────── */
.persona-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: grab;
    border: 1px solid transparent;
    transition: all 0.2s;
    margin-bottom: 6px;
    user-select: none;
    background: rgba(255,255,255,0.03);
}
.persona-item:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.1); }
.persona-item.dragging { opacity: 0.4; cursor: grabbing; }

/* SVG omino stilizzato */
.omino svg { flex-shrink: 0; }
.persona-label { font-size: 0.9rem; font-weight: 500; flex: 1; }
.persona-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.2s; }
.persona-item:hover .persona-actions { opacity: 1; }
.btn-icon {
    background: none; border: none; cursor: pointer;
    color: #6060a0; font-size: 0.8rem; padding: 2px 5px;
    border-radius: 5px; transition: all 0.15s;
}
.btn-icon:hover { background: rgba(255,255,255,0.1); color: #e8e8f0; }
.btn-icon.danger:hover { color: #f87171; }

/* ── ZONA CENTRALE ───────────────────────────────────────────────────────── */
.main-area { display: flex; flex-direction: column; gap: 20px; }

/* ── MACCHINA ────────────────────────────────────────────────────────────── */
.car-card {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 20px;
    padding: 20px;
    transition: border-color 0.2s;
}
.car-card.drag-over { border-color: #60a5fa; background: rgba(96, 165, 250, 0.05); }

.car-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}
.car-svg-wrap { flex-shrink: 0; }
.car-info { flex: 1; }
.car-name { font-size: 1.1rem; font-weight: 600; }
.car-meta { font-size: 0.8rem; color: #6060a0; margin-top: 2px; }
.car-actions { display: flex; gap: 6px; }

/* Slot passeggeri */
.seats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 60px;
    padding: 12px;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    border: 2px dashed rgba(255,255,255,0.06);
    transition: border-color 0.2s;
}
.car-card.drag-over .seats-grid { border-color: rgba(96,165,250,0.4); }

.seat-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,0.15);
    cursor: grab;
    user-select: none;
    transition: all 0.2s;
}
.seat-chip:hover { filter: brightness(1.15); transform: scale(1.03); }
.seat-chip.dragging { opacity: 0.4; }

.empty-hint {
    color: #3a3a5a;
    font-size: 0.82rem;
    align-self: center;
    padding: 4px;
}

/* Barra posti */
.seats-bar {
    display: flex;
    gap: 4px;
    margin-top: 10px;
    align-items: center;
}
.seat-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 1.5px solid rgba(255,255,255,0.2);
    transition: all 0.2s;
}
.seat-dot.occupied { background: #60a5fa; border-color: #60a5fa; }
.seat-dot.over { background: #f87171; border-color: #f87171; }
.seats-label { font-size: 0.75rem; color: #6060a0; margin-left: 6px; }

/* ── PARCHEGGIO ──────────────────────────────────────────────────────────── */
.parking-zone {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 20px;
    padding: 20px;
    transition: border-color 0.2s;
}
.parking-zone.drag-over { border-color: #a78bfa; background: rgba(167,139,250,0.05); }
.parking-header {
    display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.parking-header svg { flex-shrink: 0; }
.parking-title { font-size: 1rem; font-weight: 600; color: #a78bfa; }
.parking-hint { font-size: 0.78rem; color: #6060a0; }
.parking-chips {
    display: flex; flex-wrap: wrap; gap: 8px;
    min-height: 48px;
}

/* ── NOTE ────────────────────────────────────────────────────────────────── */
.notes-section {
    max-width: 1200px;
    margin: 24px auto 0;
}
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.note-card {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.note-author {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.82rem; font-weight: 600;
}
.note-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.note-textarea {
    width: 100%;
    min-height: 72px;
    resize: vertical;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: #e8e8f0;
    font-size: 0.82rem;
    padding: 8px;
    font-family: inherit;
    transition: border-color 0.2s;
}
.note-textarea:focus { outline: none; border-color: rgba(167,139,250,0.5); }
.note-save {
    align-self: flex-end;
    padding: 5px 14px;
    background: rgba(167,139,250,0.15);
    border: 1px solid rgba(167,139,250,0.3);
    border-radius: 20px;
    color: #a78bfa;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
}
.note-save:hover { background: rgba(167,139,250,0.3); }

/* ── LINK STYLES ─────────────────────────────────────────────────────────── */
button.link-filter {
    padding: 10px;
    border-radius: 20px;
    border: 1px solid #2a2a4a;
    background: transparent;
    color: #fdfdfd;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}
.link-filter:hover, .link-filter.active {
    background: rgba(96,165,250,0.15);
    border-color: rgba(96,165,250,0.4);
    color: #60a5fa;
}
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.link-card {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: border-color 0.2s, transform 0.15s;
}
.link-card:hover { border-color: #3a3a6a; transform: translateY(-1px); }
.link-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    margin-top: 1px;
}
.link-body { flex: 1; min-width: 0; }
.link-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #60a5fa;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
.link-title:hover { text-decoration: underline; }
.link-url {
    font-size: 0.72rem;
    color: #4a4a7a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    margin-top: 2px;
}
.link-meta { font-size: 0.72rem; color: #5a5a8a; margin-top: 4px; }
.link-actions { display: flex; gap: 4px; flex-shrink: 0; }
 
/* ── SPESA STYLES ────────────────────────────────────────────────────────── */
.spesa-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    margin-bottom: 8px;
    transition: all 0.2s;
}
.spesa-item.acquistato { opacity: 0.5; }
.spesa-item.acquistato .spesa-nome { text-decoration: line-through; color: #4ade80; }
.spesa-check {
    width: 22px; height: 22px;
    border-radius: 6px;
    border: 1.5px solid #3a3a6a;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s;
    color: transparent;
}
.spesa-check.checked { background: #4ade80; border-color: #4ade80; color: #0f0f1a; }
.spesa-nome { flex: 1; font-size: 0.9rem; font-weight: 500; }
.spesa-qty {
    font-size: 0.75rem;
    color: #a78bfa;
    background: rgba(167,139,250,0.12);
    border-radius: 10px;
    padding: 2px 8px;
}
.spesa-chi-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.spesa-by { font-size: 0.72rem; color: #5a5a8a; }




/* ── MODAL ───────────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 20px;
    padding: 28px;
    width: 360px;
    max-width: 90vw;
}
.modal h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 20px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 0.8rem; color: #8888a8; margin-bottom: 5px; }
.form-row input[type=text],
.form-row input[type=number] {
    width: 100%;
    padding: 9px 12px;
    background: rgba(0,0,0,0.3);
    border: 1px solid #2a2a4a;
    border-radius: 10px;
    color: #e8e8f0;
    font-size: 0.9rem;
}
.form-row input:focus { outline: none; border-color: #60a5fa; }
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type=color] { width: 40px; height: 36px; border-radius: 8px; border: none; cursor: pointer; }
.modal-btns { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }
.btn-cancel {
    padding: 8px 18px; background: transparent;
    border: 1px solid #2a2a4a; border-radius: 10px;
    color: #8888a8; cursor: pointer; font-size: 0.88rem;
}
.btn-cancel:hover { background: rgba(255,255,255,0.05); }
.btn-ok {
    padding: 8px 18px; background: rgba(96,165,250,0.2);
    border: 1px solid rgba(96,165,250,0.4); border-radius: 10px;
    color: #60a5fa; cursor: pointer; font-size: 0.88rem;
}
.btn-ok:hover { background: rgba(96,165,250,0.35); }

.toast {
    position: fixed; bottom: 24px; right: 24px;
    background: #1a1a2e; border: 1px solid #2a2a4a;
    border-radius: 12px; padding: 12px 18px;
    font-size: 0.85rem; color: #e8e8f0;
    z-index: 2000; opacity: 0;
    transform: translateY(10px);
    transition: all 0.25s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-color: rgba(74,222,128,0.4); color: #4ade80; }
.toast.error   { border-color: rgba(248,113,113,0.4); color: #f87171; }