:root {
    --cc-green: #2E7D32;
    --cc-green-dark: #1b5e20;
    --cc-amber: #F9A825;
    --cc-bg: #F0F2F5;
}

body {
    background: var(--cc-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Navbar ── */
.navbar { background: var(--cc-green) !important; }

.app-logo {
    display: inline-block;
    object-fit: contain;
    background: #fff;
    border: 1px solid rgba(255,255,255,.55);
    box-shadow: 0 1px 4px rgba(0,0,0,.16);
}
.app-logo-navbar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    padding: 3px;
    flex: 0 0 34px;
}
.app-logo-sidebar {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    padding: 3px;
    flex: 0 0 38px;
}
.app-logo-login {
    width: 96px;
    height: 96px;
    object-fit: contain;
    border-radius: 16px;
    padding: 8px;
    background: #fff;
    box-shadow: 0 4px 18px rgba(0,0,0,.12);
}

/* ── Main content – offset for fixed navbar ── */
.main-content {
    margin-top: 56px;
    padding-bottom: 80px;
    min-height: calc(100vh - 56px);
}
@media (min-width: 768px) { .main-content { padding-bottom: 24px; } }

/* ── Bottom nav ── */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 62px;
    background: #fff;
    border-top: 1px solid #ddd;
    display: flex;
    z-index: 1040;
    box-shadow: 0 -2px 10px rgba(0,0,0,.1);
}
.bottom-nav-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-decoration: none; color: #888; font-size: 10px; gap: 2px;
    transition: color .2s;
}
.bottom-nav-item i { font-size: 20px; }
.bottom-nav-item.active, .bottom-nav-item:hover { color: var(--cc-green); }
.bottom-nav-logo {
    width: 23px;
    height: 23px;
    object-fit: contain;
    border-radius: 6px;
    padding: 2px;
    background: #fff;
    border: 1px solid #e2e2e2;
}

/* ── Page header ── */
.page-header {
    background: #fff; padding: 14px 16px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid #eee; position: sticky; top: 56px; z-index: 100;
}
.page-header h5 { margin: 0; font-weight: 700; font-size: 1rem; }

/* ── Cards / list items ── */
.cc-card {
    background: #fff; border-radius: 12px;
    box-shadow: 0 1px 6px rgba(0,0,0,.07);
    transition: box-shadow .2s;
}
.cc-card:hover { box-shadow: 0 3px 12px rgba(0,0,0,.12); }

.list-link {
    display: block; text-decoration: none; color: inherit;
    background: #fff; border-radius: 10px; margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    transition: box-shadow .2s, transform .15s;
    overflow: hidden;
}
.list-link:hover { box-shadow: 0 3px 10px rgba(0,0,0,.12); color: inherit; transform: translateY(-1px); }

/* ── Stat cards on dashboard ── */
.stat-card { border: none; border-radius: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.stat-card-link {
    color: inherit;
    text-decoration: none;
    transition: transform .15s, box-shadow .2s;
}
.stat-card-link:hover {
    color: inherit;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; font-size: 22px;
}

/* ── FAB ── */
.fab {
    position: fixed; bottom: 74px; right: 18px;
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--cc-green); color: #fff; border: none;
    font-size: 26px; z-index: 1050;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,.25);
    transition: background .2s, transform .15s;
}
.fab:hover { background: var(--cc-green-dark); color: #fff; transform: scale(1.06); }
@media (min-width: 768px) { .fab { bottom: 24px; } }

/* ── Forms ── */
.form-control, .form-select {
    border-radius: 8px; border: 1.5px solid #ddd;
}
.form-control:focus, .form-select:focus {
    border-color: var(--cc-green);
    box-shadow: 0 0 0 .2rem rgba(46,125,50,.15);
}

/* ── Buttons ── */
.btn-primary { background: var(--cc-green); border-color: var(--cc-green); }
.btn-primary:hover, .btn-primary:focus { background: var(--cc-green-dark); border-color: var(--cc-green-dark); }
.btn-outline-primary { color: var(--cc-green); border-color: var(--cc-green); }
.btn-outline-primary:hover { background: var(--cc-green); border-color: var(--cc-green); }

/* ── Badge states ── */
.badge-confermata  { background: #1565C0 !important; }
.badge-completata  { background: #2E7D32 !important; }
.badge-cancellata  { background: #B71C1C !important; }
.badge-attiva      { background: #2E7D32 !important; }
.badge-ritirata    { background: #F57C00 !important; }
.badge-terminata   { background: #546E7A !important; }

/* ── Calendar ── */
#calendar { background: #fff; border-radius: 12px; padding: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.fc .fc-button-primary { background-color: var(--cc-green) !important; border-color: var(--cc-green) !important; }
.fc .fc-button-primary:hover { background-color: var(--cc-green-dark) !important; }
.fc-event-compact-title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.15;
}
.area-badge {
    border-radius: 999px;
    font-weight: 600;
    padding: .42rem .6rem;
}

@media (max-width: 767.98px) {
    .page-header {
        padding: 10px 12px;
    }
    .page-header h5 {
        font-size: .95rem;
    }
    .sgambatoi-header h5 .bi {
        font-size: .95rem;
        margin-right: .35rem !important;
    }
    .sgambatoi-header-actions {
        gap: .4rem !important;
    }
    .sgambatoi-header-actions .btn {
        width: 34px;
        height: 34px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .sgambatoi-header-actions .btn i {
        font-size: 1rem;
    }
    .sgambatoi-page {
        padding-left: .5rem !important;
        padding-right: .5rem !important;
        padding-top: .5rem !important;
    }
    .sgambatoi-legend {
        gap: .35rem !important;
        margin-bottom: .5rem !important;
        padding: 0 .15rem;
    }
    .area-badge {
        font-size: .68rem;
        padding: .3rem .45rem;
    }
    #calendar {
        border-radius: 8px;
        padding: 6px;
        box-shadow: 0 1px 5px rgba(0,0,0,.08);
    }
    .fc .fc-toolbar.fc-header-toolbar {
        margin-bottom: .45rem;
        display: grid;
        grid-template-columns: 34px 1fr 34px;
        align-items: center;
        gap: .25rem;
    }
    .fc .fc-toolbar-title {
        font-size: .98rem;
        line-height: 1.15;
        text-align: center;
        white-space: nowrap;
    }
    .fc .fc-button {
        min-width: 34px;
        min-height: 32px;
        padding: .22rem .35rem !important;
        font-size: .76rem !important;
        line-height: 1 !important;
        border-radius: 7px !important;
    }
    .fc .fc-button .fc-icon {
        font-size: 1rem;
        line-height: .85;
    }
    .fc .fc-timegrid-slot {
        height: 2.05rem;
    }
    .fc .fc-timegrid-slot-label,
    .fc .fc-col-header-cell-cushion {
        font-size: .72rem;
    }
    .fc .fc-event {
        border-radius: 5px;
        padding: 1px 2px;
    }
    .fc-event-compact-title {
        font-size: .68rem;
    }
    .fab {
        width: 50px;
        height: 50px;
        right: 14px;
        bottom: 72px;
        font-size: 23px;
    }
}

/* ── Offcanvas sidebar ── */
.offcanvas-nav .nav-link {
    color: #ccc; padding: 14px 20px; border-radius: 0;
    display: flex; align-items: center; gap: 12px; font-size: .95rem;
}
.offcanvas-nav .nav-link:hover, .offcanvas-nav .nav-link.active {
  color: #fff; background: rgba(255,255,255,.1);
}
.offcanvas-nav .nav-link i { font-size: 18px; width: 22px; }

/* Customer documents */
.document-generator { max-width: 760px; }
.document-choice {
    align-items: flex-start;
    border: 1px solid #d8dde3;
    border-radius: 8px;
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
    padding: 12px;
}
.document-choice input { flex: 0 0 auto; margin-top: 4px; }
.document-choice span { display: grid; gap: 2px; }
.document-choice small { color: #667085; }
.document-detail { max-width: 980px; }
.print-sheet {
    background: #fff;
    color: #111827;
    font-family: Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    margin: 0 auto;
    max-width: 210mm;
    min-height: 270mm;
    padding: 18mm 17mm;
}
.print-sheet h1 {
    font-size: 25px;
    font-weight: 700;
    margin: 0 0 12px;
}
.print-sheet h2 {
    font-size: 17px;
    font-weight: 700;
    margin: 18px 0 6px;
}
.print-sheet ol { padding-left: 21px; }
.document-heading {
    border-bottom: 2px solid #2e7d32;
    margin-bottom: 20px;
    padding-bottom: 14px;
}
.document-heading p {
    color: #2e7d32;
    font-weight: 700;
    margin: 0 0 4px;
    text-transform: uppercase;
}
.document-signature {
    align-items: end;
    display: grid;
    gap: 28px;
    grid-template-columns: minmax(220px, 1fr) 140px;
    margin-top: 42px;
}
.document-signature-label {
    color: #344054;
    font-size: 13px;
    margin-bottom: 6px;
}
.document-signature-line,
.document-signature-date {
    border-bottom: 1px solid #111827;
    height: 58px;
}
.document-signature-date { height: 36px; padding-top: 7px; }
.document-signature img {
    border-bottom: 1px solid #111827;
    display: block;
    height: 72px;
    max-width: 100%;
    object-fit: contain;
    object-position: left bottom;
}
.signature-touch { display: none; }
.signature-canvas {
    background: #fff;
    border: 1px solid #98a2b3;
    border-radius: 8px;
    display: block;
    height: 210px;
    touch-action: none;
    width: 100%;
}
.document-print-body {
    background: #e9edf2;
    margin: 0;
    padding: 24px;
}
.print-sheet-standalone { box-shadow: 0 4px 22px rgba(0,0,0,.16); }
.document-print-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
}
.document-print-actions button {
    background: #2e7d32;
    border: 0;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    font: inherit;
    padding: 10px 16px;
}
@media (max-width: 1024px), (pointer: coarse) {
    .signature-touch { display: block; }
    .print-sheet {
        min-height: 0;
        padding: 22px 18px;
    }
    .document-signature {
        gap: 18px;
        grid-template-columns: 1fr;
    }
}
@media print {
    @page { margin: 12mm; }
    body,
    .document-print-body {
        background: #fff;
        margin: 0;
        padding: 0;
    }
    .document-print-actions { display: none; }
    .print-sheet,
    .print-sheet-standalone {
        box-shadow: none;
        max-width: none;
        min-height: auto;
        padding: 0;
    }
}
