* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "SF Pro Display",
        "Segoe UI",
        sans-serif;

    background: #f2f2f7;
    color: #1c1c1e;
}


button,
input,
textarea,
select {
    font: inherit;
}


.topbar {
    height: 60px;

    padding: 0 18px;

    background: rgba(255,255,255,.92);

    border-bottom: 1px solid #d1d1d6;

    display: flex;
    align-items: center;
    justify-content: space-between;

    position: sticky;
    top: 0;

    z-index: 50;

    backdrop-filter: blur(18px);
}


.today-link,
.add-button {
    border: 0;
    background: transparent;

    color: #007aff;

    font-size: 17px;

    cursor: pointer;
}


.add-button {
    font-size: 32px;
    font-weight: 300;

    line-height: 1;
}


.brand {
    display: flex;
    flex-direction: column;

    text-align: center;
}

.brand strong {
    font-size: 16px;
}

.brand span {
    font-size: 11px;
    color: #8e8e93;
}


.app-shell {
    max-width: 1180px;

    margin: auto;

    padding: 20px 14px 100px;

    display: grid;
    gap: 18px;
}


.calendar-panel,
.day-panel {
    background: white;

    border-radius: 18px;

    overflow: hidden;

    box-shadow:
        0 1px 3px rgba(0,0,0,.04);
}


.calendar-toolbar {
    padding: 20px;

    display: flex;
    justify-content: space-between;
    align-items: center;
}


.calendar-toolbar h1 {
    margin: 0;

    font-size: 32px;

    letter-spacing: -.8px;
}


.calendar-toolbar span {
    color: #8e8e93;

    font-size: 20px;
}


.calendar-arrows {
    display: flex;

    gap: 16px;
}


.calendar-arrows a {
    text-decoration: none;

    color: #007aff;

    font-size: 35px;

    width: 35px;

    text-align: center;
}


.weekdays,
.month-grid {
    display: grid;

    grid-template-columns: repeat(7, 1fr);
}


.weekdays {
    padding: 0 8px;

    font-size: 10px;

    font-weight: 600;

    color: #8e8e93;

    text-align: center;
}


.month-grid {
    padding: 4px 8px 14px;
}


.day-cell {
    min-height: 62px;

    padding: 5px 2px;

    text-decoration: none;

    color: #1c1c1e;

    display: flex;

    flex-direction: column;

    align-items: center;

    border-radius: 12px;

    position: relative;
}


.day-cell.outside {
    color: #c7c7cc;
}


.day-number {
    width: 32px;
    height: 32px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 50%;

    font-size: 15px;
}


.day-cell.today .day-number {
    background: #ff3b30;

    color: white;
}


.day-cell.selected {
    background: #f2f2f7;
}


.event-dots {
    min-height: 8px;

    display: flex;

    gap: 3px;

    margin-top: 3px;
}


.event-dot {
    width: 5px;
    height: 5px;

    border-radius: 50%;
}


.blue {
    background: #007aff;
}

.red {
    background: #ff3b30;
}

.green {
    background: #34c759;
}

.orange {
    background: #ff9500;
}

.purple {
    background: #af52de;
}


.day-panel {
    padding-bottom: 12px;
}


.day-header {
    padding: 18px 20px;

    border-bottom: 1px solid #efeff4;

    display: flex;

    justify-content: space-between;

    align-items: center;
}


.day-week {
    text-transform: capitalize;

    color: #8e8e93;

    font-size: 13px;
}


.day-header h2 {
    margin: 3px 0 0;

    font-size: 22px;
}


.new-day-event {
    border: 0;

    width: 40px;
    height: 40px;

    border-radius: 50%;

    background: #f2f2f7;

    color: #007aff;

    font-size: 28px;

    cursor: pointer;
}


.events-list {
    padding: 8px 12px;
}


.event-card {
    min-height: 70px;

    display: grid;

    grid-template-columns: 5px 64px 1fr;

    gap: 12px;

    padding: 10px 4px;

    border-bottom: 1px solid #efeff4;

    cursor: pointer;
}


.event-color {
    border-radius: 4px;
}


.event-time {
    font-size: 14px;

    display: flex;

    flex-direction: column;
}


.event-time small {
    color: #8e8e93;

    margin-top: 3px;
}


.event-content {
    display: flex;

    flex-direction: column;

    gap: 3px;
}


.event-content strong {
    font-size: 16px;
}


.event-content span {
    color: #3a3a3c;

    font-size: 14px;
}


.event-content small {
    color: #8e8e93;
}


.empty-state {
    padding: 40px 20px;

    display: flex;

    flex-direction: column;

    align-items: center;

    color: #8e8e93;
}


.empty-icon {
    width: 42px;
    height: 42px;

    margin-bottom: 10px;

    border-radius: 50%;

    background: #f2f2f7;

    display: flex;

    align-items: center;
    justify-content: center;

    color: #34c759;

    font-size: 21px;
}


.empty-state strong {
    color: #1c1c1e;

    margin-bottom: 4px;
}


.modal {
    display: none;

    position: fixed;

    inset: 0;

    z-index: 100;

    background: rgba(0,0,0,.25);

    align-items: flex-end;
}


.modal.open {
    display: flex;
}


.modal-card {
    width: 100%;

    max-height: 92vh;

    overflow: auto;

    background: #f2f2f7;

    border-radius: 18px 18px 0 0;
}


.modal-header {
    height: 58px;

    padding: 0 18px;

    background: rgba(255,255,255,.95);

    border-bottom: 1px solid #d1d1d6;

    display: grid;

    grid-template-columns: 1fr auto 1fr;

    align-items: center;
}


.modal-header button {
    border: 0;

    background: transparent;

    color: #007aff;

    text-align: left;

    padding: 0;
}


.form-section {
    margin: 16px 12px;

    background: white;

    border-radius: 12px;

    overflow: hidden;
}


.form-section input,
.form-section textarea,
.form-section select {
    width: 100%;

    border: 0;

    outline: none;

    padding: 14px 16px;

    background: white;

    border-bottom: 1px solid #efeff4;
}


.form-section textarea {
    resize: vertical;
}


.form-section label {
    display: grid;

    grid-template-columns: 110px 1fr;

    align-items: center;

    padding-left: 16px;

    color: #3a3a3c;
}


.form-section label input,
.form-section label select {
    border-bottom: 0;
}


.title-input {
    font-size: 20px;
    font-weight: 600;
}


.save-button {
    width: calc(100% - 24px);

    margin: 4px 12px 24px;

    border: 0;

    border-radius: 12px;

    padding: 14px;

    background: #007aff;

    color: white;

    font-weight: 600;

    cursor: pointer;
}


.event-detail {
    margin: 16px 12px;

    padding: 18px;

    background: white;

    border-radius: 12px;
}


.event-detail h2 {
    margin-top: 0;

    font-size: 26px;
}


.event-detail p {
    line-height: 1.45;
}


.audit-box {
    margin-top: 28px;

    padding: 14px;

    border-radius: 10px;

    background: #f2f2f7;

    color: #8e8e93;

    font-size: 12px;
}


.audit-box strong {
    color: #3a3a3c;
}


.audit-box hr {
    border: 0;

    border-top: 1px solid #d1d1d6;

    margin: 10px 0;
}


@media (min-width: 760px) {

    .app-shell {
        grid-template-columns: 1.35fr .65fr;

        padding-top: 32px;
    }

    .modal {
        align-items: center;
        justify-content: center;
    }

    .modal-card {
        max-width: 520px;

        border-radius: 18px;
    }

    .day-cell {
        min-height: 82px;
    }

}


/* =========================================================
   LOGIN
   ========================================================= */

.login-body {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    background:
        linear-gradient(
            180deg,
            #f7f7fa 0%,
            #eeeeF4 100%
        );
}


.login-shell {
    width: 100%;
    max-width: 390px;

    text-align: center;
}


.login-logo {
    margin-bottom: 18px;

    display: flex;
    justify-content: center;
}


.calendar-icon {
    width: 82px;
    height: 82px;

    overflow: hidden;

    border-radius: 18px;

    background: white;

    box-shadow:
        0 8px 28px rgba(0,0,0,.10);

    display: flex;
    flex-direction: column;
}


.calendar-icon span {
    padding: 7px 0;

    background: #ff3b30;

    color: white;

    font-size: 10px;
    font-weight: 700;

    letter-spacing: .08em;
}


.calendar-icon strong {
    flex: 1;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 27px;

    color: #1c1c1e;
}


.login-shell h1 {
    margin: 0;

    font-size: 34px;

    letter-spacing: -.8px;
}


.login-shell > p {
    margin: 4px 0 26px;

    color: #8e8e93;
}


.login-form {
    overflow: hidden;

    border-radius: 14px;

    background: white;

    box-shadow:
        0 1px 3px rgba(0,0,0,.05);
}


.login-form input {
    width: 100%;

    border: 0;

    border-bottom: 1px solid #efeff4;

    outline: none;

    padding: 16px;

    background: white;

    font-size: 16px;
}


.login-form button {
    width: calc(100% - 24px);

    margin: 12px;

    border: 0;

    border-radius: 11px;

    padding: 14px;

    background: #007aff;

    color: white;

    font-size: 16px;
    font-weight: 600;
}


.login-error {
    margin-bottom: 14px;

    padding: 11px 14px;

    border-radius: 10px;

    background: #ffe9e8;

    color: #c72b20;

    font-size: 14px;
}


.login-note {
    margin-top: 18px;

    padding: 0 20px;

    color: #8e8e93;

    font-size: 12px;

    line-height: 1.4;
}


/* =========================================================
   UTENTE
   ========================================================= */

.user-area {
    display: flex;

    align-items: center;

    gap: 9px;
}


.user-name {
    display: none;

    color: #8e8e93;

    font-size: 13px;
}


.logout-link {
    color: #007aff;

    text-decoration: none;

    font-size: 13px;
}


@media (min-width: 760px) {

    .user-name {
        display: block;
    }

}


.event-actions {
    margin-top: 24px;

    display: flex;

    gap: 10px;
}


.event-actions form {
    flex: 1;
}


.edit-event-button,
.delete-event-button {
    width: 100%;

    border: 0;

    border-radius: 10px;

    padding: 12px;

    font-weight: 600;

    cursor: pointer;
}


.edit-event-button {
    flex: 1;

    background: #007aff;

    color: white;
}


.delete-event-button {
    background: #ffe9e8;

    color: #ff3b30;
}
