* {
    box-sizing: border-box;
}


:root {
    --background: #f6f7f9;
    --surface: #ffffff;
    --surface-secondary: #f9fafb;

    --text: #171717;
    --text-secondary: #6b7280;

    --border: #e5e7eb;

    --primary: #111827;
    --primary-hover: #262f3e;

    --sidebar: #ffffff;

    --radius: 12px;

    --shadow:
        0 1px 2px rgba(0, 0, 0, 0.04),
        0 1px 3px rgba(0, 0, 0, 0.03);
}


body {
    margin: 0;

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    background:
        var(--background);

    color:
        var(--text);
}


/* ==============================
   LAYOUT
============================== */

.app-layout {
    display: flex;

    min-height: 100vh;
}


/* ==============================
   SIDEBAR
============================== */

.sidebar {
    position: fixed;

    top: 0;
    left: 0;
    bottom: 0;

    width: 250px;

    display: flex;
    flex-direction: column;

    padding: 24px 16px;

    background:
        var(--sidebar);

    border-right:
        1px solid var(--border);
}


.brand {
    display: flex;
    align-items: center;

    gap: 12px;

    padding:
        0 8px 28px;
}


.brand-icon {
    width: 40px;
    height: 40px;

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

    border-radius: 10px;

    background:
        var(--primary);

    color: white;

    font-size: 20px;
    font-weight: 700;
}


.brand h1 {
    margin: 0;

    font-size: 19px;
}


.brand span {
    display: block;

    margin-top: 2px;

    font-size: 11px;

    color:
        var(--text-secondary);
}


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

    gap: 5px;
}


.nav-item {
    width: 100%;

    display: flex;
    align-items: center;

    gap: 12px;

    margin: 0;

    padding: 11px 12px;

    border: none;

    border-radius: 8px;

    background:
        transparent;

    color:
        var(--text-secondary);

    font-size: 14px;
    font-weight: 500;

    text-align: left;

    cursor: pointer;
}


.nav-item:hover {
    background:
        #f4f4f5;

    color:
        var(--text);
}


.nav-item.active {
    background:
        #f1f2f4;

    color:
        var(--text);

    font-weight: 600;
}


.nav-icon {
    width: 20px;

    text-align: center;

    font-size: 17px;
}


.sidebar-bottom {
    margin-top: auto;
}


.logout-button {
    width: 100%;

    margin: 0;

    padding: 10px 12px;

    border:
        1px solid var(--border);

    border-radius: 8px;

    background:
        white;

    color:
        var(--text-secondary);

    cursor: pointer;
}


.logout-button:hover {
    background:
        #f7f7f7;

    color:
        var(--text);
}


/* ==============================
   MAIN
============================== */

.main-content {
    width:
        calc(100% - 250px);

    margin-left:
        250px;

    padding:
        42px 48px 80px;
}


.page {
    display: none;

    max-width: 1250px;

    margin: 0 auto;
}


.page.active {
    display: block;
}


.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 30px;
}


.page-header h2 {
    margin: 0 0 6px;

    font-size: 28px;

    letter-spacing: -0.5px;
}


.page-header p {
    margin: 0;

    color:
        var(--text-secondary);

    font-size: 14px;
}


/* ==============================
   DASHBOARD
============================== */

.stats-grid {
    display: grid;

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

    gap: 16px;

    margin-bottom: 24px;
}


.stat-card {
    padding: 22px;

    background:
        var(--surface);

    border:
        1px solid var(--border);

    border-radius:
        var(--radius);

    box-shadow:
        var(--shadow);
}


.stat-label {
    display: block;

    margin-bottom: 16px;

    color:
        var(--text-secondary);

    font-size: 13px;
    font-weight: 500;
}


.stat-card strong {
    display: block;

    margin-bottom: 6px;

    font-size: 30px;

    letter-spacing: -1px;
}


.stat-description {
    color:
        var(--text-secondary);

    font-size: 12px;
}


/* ==============================
   PANEL
============================== */

.panel,
.dashboard-panel {
    background:
        var(--surface);

    border:
        1px solid var(--border);

    border-radius:
        var(--radius);

    box-shadow:
        var(--shadow);
}


.panel {
    padding: 26px;
}


.dashboard-panel {
    padding: 26px;
}


.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 24px;
}


.panel-header h3,
.panel-title h3 {
    margin:
        0 0 5px;

    font-size: 17px;
}


.panel-header p,
.panel-title p {
    margin: 0;

    color:
        var(--text-secondary);

    font-size: 13px;
}


.panel-title {
    margin-bottom: 24px;
}


/* ==============================
   PREVENTIVI
============================== */

.content-grid {
    display: grid;

    grid-template-columns:
        minmax(300px, 390px)
        minmax(450px, 1fr);

    gap: 22px;

    align-items: start;
}


.quotes-panel {
    min-height: 400px;
}


/* ==============================
   FORM
============================== */

form {
    display: flex;

    flex-direction: column;

    gap: 18px;
}


.form-group {
    display: flex;

    flex-direction: column;

    gap: 7px;
}


.form-row {
    display: grid;

    grid-template-columns:
        1fr 1fr;

    gap: 12px;
}


label {
    font-size: 13px;

    font-weight: 500;

    color:
        #374151;
}


input {
    width: 100%;

    padding: 11px 12px;

    border:
        1px solid #d8dce2;

    border-radius: 8px;

    outline: none;

    background: white;

    font-family: inherit;

    font-size: 14px;

    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}


input:focus {
    border-color:
        #9ca3af;

    box-shadow:
        0 0 0 3px
        rgba(17, 24, 39, 0.06);
}


.primary-button {
    margin-top: 3px;

    padding: 11px 16px;

    border: none;

    border-radius: 8px;

    background:
        var(--primary);

    color: white;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
}


.primary-button:hover {
    background:
        var(--primary-hover);
}


.secondary-button {
    margin: 0;

    padding: 9px 13px;

    border:
        1px solid var(--border);

    border-radius: 8px;

    background: white;

    font-size: 13px;

    cursor: pointer;
}


.secondary-button:hover {
    background:
        #f7f7f7;
}


.form-message {
    min-height: 18px;

    margin:
        12px 0 0;

    font-size: 13px;
}


/* ==============================
   QUOTE CARD
============================== */

.quote-card {
    padding:
        18px 0;

    border-bottom:
        1px solid var(--border);
}


.quote-card:first-child {
    padding-top: 0;
}


.quote-card:last-child {
    padding-bottom: 0;

    border-bottom: none;
}


.quote-card h3 {
    margin:
        0 0 12px;

    font-size: 16px;
}


.quote-card p {
    margin:
        6px 0;

    color:
        #4b5563;

    font-size: 13px;
}


.status-buttons {
    display: flex;

    flex-wrap: wrap;

    gap: 6px;

    margin-top: 14px;
}


.status-buttons button {
    margin: 0;

    padding: 7px 10px;

    border:
        1px solid var(--border);

    border-radius: 7px;

    background: white;

    font-size: 12px;

    cursor: pointer;
}


.status-buttons button:hover {
    background:
        #f5f5f5;
}


/* ==============================
   IMPOSTAZIONI
============================== */

.settings-container {
    max-width: 760px;
}


.setting-row {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 30px;

    padding:
        20px 0;

    border-bottom:
        1px solid var(--border);
}


.setting-row:first-child {
    padding-top: 0;
}


.setting-row strong {
    display: block;

    margin-bottom: 4px;

    font-size: 14px;
}


.setting-row p {
    margin: 0;

    color:
        var(--text-secondary);

    font-size: 12px;
}


.days-input {
    display: flex;

    align-items: center;

    gap: 8px;
}


.days-input input {
    width: 75px;

    text-align: center;
}


.days-input span {
    color:
        var(--text-secondary);

    font-size: 13px;
}


.time-input {
    width: 125px;
}


.settings-actions {
    display: flex;

    justify-content: flex-end;

    margin-top: 24px;
}


/* ==============================
   SWITCH
============================== */

.switch {
    position: relative;

    display: inline-block;

    width: 46px;
    height: 26px;

    flex-shrink: 0;
}


.switch input {
    width: 0;
    height: 0;

    opacity: 0;
}


.slider {
    position: absolute;

    inset: 0;

    border-radius: 999px;

    background:
        #d1d5db;

    cursor: pointer;

    transition: 0.2s;
}


.slider::before {
    content: "";

    position: absolute;

    width: 20px;
    height: 20px;

    left: 3px;
    top: 3px;

    border-radius: 50%;

    background: white;

    transition: 0.2s;

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


.switch input:checked + .slider {
    background:
        var(--primary);
}


.switch input:checked + .slider::before {
    transform:
        translateX(20px);
}


/* ==============================
   EMPTY STATE
============================== */

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

    text-align: center;
}


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

    display: flex;

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

    margin:
        0 auto 15px;

    border-radius: 12px;

    background:
        #f1f2f4;

    font-size: 20px;
}


.empty-state h3 {
    margin:
        0 0 8px;
}


.empty-state p {
    max-width: 400px;

    margin: auto;

    color:
        var(--text-secondary);

    font-size: 13px;

    line-height: 1.6;
}


/* ==============================
   RESPONSIVE
============================== */

@media (max-width: 1000px) {

    .stats-grid {
        grid-template-columns:
            repeat(2, 1fr);
    }


    .content-grid {
        grid-template-columns:
            1fr;
    }
}


@media (max-width: 720px) {

    .sidebar {
        position: static;

        width: 100%;

        min-height: auto;
    }


    .app-layout {
        display: block;
    }


    .navigation {
        flex-direction: row;

        overflow-x: auto;
    }


    .nav-item {
        width: auto;

        white-space: nowrap;
    }


    .sidebar-bottom {
        margin-top: 15px;
    }


    .main-content {
        width: 100%;

        margin-left: 0;

        padding:
            28px 18px 60px;
    }


    .stats-grid {
        grid-template-columns:
            1fr;
    }


    .form-row {
        grid-template-columns:
            1fr;
    }


    .setting-row {
        align-items:
            flex-start;

        flex-direction:
            column;
    }
}

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

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

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

    margin: 0;

    padding: 40px 20px;

    background:
        #f6f7f9;
}


.login-container {
    width: 100%;
    max-width: 430px;
}


.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 10px;

    margin-bottom: 28px;
}


.login-logo {
    width: 38px;
    height: 38px;

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

    border-radius: 10px;

    background:
        var(--primary);

    color: white;

    font-size: 19px;
    font-weight: 700;
}


.login-brand-text {
    font-size: 21px;
    font-weight: 700;

    letter-spacing: -0.4px;
}


.login-card {
    padding: 36px;

    background:
        var(--surface);

    border:
        1px solid var(--border);

    border-radius: 16px;

    box-shadow:
        0 8px 30px
        rgba(0, 0, 0, 0.05);
}


.login-header {
    margin-bottom: 28px;

    text-align: center;
}


.login-header h1 {
    margin:
        0 0 8px;

    font-size: 25px;

    letter-spacing: -0.5px;
}


.login-header p {
    max-width: 320px;

    margin:
        0 auto;

    color:
        var(--text-secondary);

    font-size: 13px;

    line-height: 1.6;
}


.login-card form {
    gap: 18px;
}


.login-card input {
    min-height: 44px;
}


.login-password-label {
    display: flex;

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


.login-button {
    width: 100%;

    min-height: 44px;

    margin-top: 4px;

    padding: 11px 16px;

    border: none;

    border-radius: 8px;

    background:
        var(--primary);

    color: white;

    font-family: inherit;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background 0.15s,
        transform 0.05s;
}


.login-button:hover {
    background:
        var(--primary-hover);
}


.login-button:active {
    transform:
        translateY(1px);
}


.login-message {
    min-height: 18px;

    margin:
        18px 0 0;

    text-align: center;

    font-size: 13px;
}


.login-footer {
    display: flex;

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

    gap: 7px;

    margin-top: 22px;

    color:
        var(--text-secondary);

    font-size: 11px;
}


.login-footer-dot {
    color:
        #c5c8ce;
}


@media (max-width: 500px) {

    .login-page {
        padding:
            24px 16px;
    }


    .login-card {
        padding:
            28px 22px;
    }


    .login-footer {
        flex-direction: column;

        gap: 3px;

        text-align: center;
    }


    .login-footer-dot {
        display: none;
    }
}

/* ==============================
   DASHBOARD - ATTIVITÀ RECENTE
============================== */

.recent-quote {
    display: flex;

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

    gap: 20px;

    padding: 16px 0;

    border-bottom:
        1px solid var(--border);
}


.recent-quote:first-child {
    padding-top: 0;
}


.recent-quote:last-child {
    padding-bottom: 0;

    border-bottom: none;
}


.recent-quote-info,
.recent-quote-right {
    display: flex;

    flex-direction: column;

    gap: 4px;
}


.recent-quote-right {
    align-items: flex-end;
}


.recent-quote-info strong,
.recent-quote-right strong {
    font-size: 14px;
}


.recent-quote-info span,
.quote-status {
    color:
        var(--text-secondary);

    font-size: 12px;
}


/* ==============================
   FOLLOW-UP
============================== */

.followup-list {
    width: 100%;
}


.followup-row {
    display: grid;

    grid-template-columns:
        minmax(180px, 2fr)
        minmax(100px, 1fr)
        minmax(160px, 1fr)
        auto;

    align-items: center;

    gap: 20px;

    padding: 18px 0;

    border-bottom:
        1px solid var(--border);
}


.followup-row:first-child {
    padding-top: 0;
}


.followup-row:last-child {
    padding-bottom: 0;

    border-bottom: none;
}


.followup-main {
    display: flex;

    flex-direction: column;

    gap: 4px;
}


.followup-main strong {
    font-size: 14px;
}


.followup-main span,
.followup-number,
.followup-date {
    color:
        var(--text-secondary);

    font-size: 12px;
}


.followup-status {
    display: inline-block;

    padding: 6px 9px;

    border-radius: 999px;

    background:
        #f3f4f6;

    font-size: 11px;

    font-weight: 600;
}


.status-inviato {
    background:
        #ecfdf3;

    color:
        #067647;
}


.status-programmato {
    background:
        #eff6ff;

    color:
        #1d4ed8;
}


.status-errore {
    background:
        #fef2f2;

    color:
        #b42318;
}


.status-annullato {
    background:
        #f3f4f6;

    color:
        #667085;
}


@media (max-width: 800px) {

    .followup-row {
        grid-template-columns:
            1fr;

        gap: 8px;
    }


    .recent-quote {
        align-items:
            flex-start;
    }
}