:root {
    --navy: #052e59;
    --navy-dark: #031d38;
    --navy-soft: #0b416f;
    --green: #159447;
    --green-dark: #0d7437;
    --lime: #8bc53f;
    --white: #ffffff;
    --bg: #f3f7f9;
    --text: #10263b;
    --muted: #718096;
    --border: #e3ebef;
    --shadow: 0 20px 60px rgba(3, 29, 56, .12);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

body {
    min-height: 100vh;
}

button, input, select {
    font: inherit;
}

/* APP */

.app-shell {
    min-height: 100vh;
    display: flex;
}

/* SIDEBAR */

.sidebar {
    width: 270px;
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    color: white;
    background:
        radial-gradient(circle at 10% 0%, rgba(21,148,71,.30), transparent 30%),
        linear-gradient(155deg, #062f59 0%, #031d38 100%);
    box-shadow: 15px 0 50px rgba(0,0,0,.08);
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 45px;
}

.brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 17px;
    letter-spacing: -1px;
    background:
        linear-gradient(145deg, var(--lime), var(--green));
    box-shadow:
        0 0 0 4px rgba(255,255,255,.08),
        0 12px 30px rgba(0,0,0,.25);
}

.brand-name {
    font-weight: 800;
    letter-spacing: .5px;
    font-size: 14px;
}

.brand-sub {
    margin-top: 4px;
    color: rgba(255,255,255,.55);
    font-size: 11px;
    letter-spacing: .5px;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    border: 0;
    background: transparent;
    color: rgba(255,255,255,.67);
    border-radius: 13px;
    padding: 14px 15px;
    text-align: left;
    cursor: pointer;
    transition: .2s;
}

.nav-item span {
    display: inline-block;
    width: 28px;
    color: var(--lime);
}

.nav-item:hover,
.nav-item.active {
    color: white;
    background: rgba(255,255,255,.09);
    transform: translateX(2px);
}

.sidebar-bottom {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,.1);
    padding-top: 20px;
    font-size: 11px;
    color: rgba(255,255,255,.5);
    display: flex;
    align-items: center;
    gap: 9px;
}

.secure-dot {
    width: 8px;
    height: 8px;
    background: var(--lime);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--lime);
}

/* MAIN */

.main {
    width: calc(100% - 270px);
    margin-left: 270px;
    padding: 40px;
}

.topbar {
    max-width: 1500px;
    margin: 0 auto 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 30px;
}

.eyebrow {
    color: var(--green);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 1.8px;
    margin-bottom: 7px;
}

.topbar h1,
.modal-heading h2,
.card-preview-panel h2 {
    margin: 0;
    color: var(--navy);
}

.topbar h1 {
    font-size: clamp(28px, 3vw, 42px);
    letter-spacing: -1.5px;
}

.topbar p,
.modal-heading p {
    color: var(--muted);
    margin: 8px 0 0;
    line-height: 1.6;
}

.primary-btn,
.submit-btn {
    border: 0;
    color: white;
    cursor: pointer;
    font-weight: 800;
    border-radius: 12px;
    background:
        linear-gradient(135deg, var(--green), #20ad59);
    box-shadow: 0 12px 25px rgba(21,148,71,.25);
    transition: .2s;
}

.primary-btn {
    padding: 14px 22px;
}

.submit-btn {
    width: 100%;
    margin-top: 25px;
    padding: 16px;
    letter-spacing: .4px;
}

.primary-btn:hover,
.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(21,148,71,.32);
}

/* STATS */

.stats {
    max-width: 1500px;
    margin: 0 auto 25px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.stat-card {
    min-height: 130px;
    padding: 23px;
    border-radius: 18px;
    background: white;
    border: 1px solid var(--border);
    box-shadow: 0 10px 35px rgba(3,29,56,.05);
    display: flex;
    flex-direction: column;
}

.stat-card span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.stat-card strong {
    margin-top: 8px;
    color: var(--navy);
    font-size: 30px;
}

.stat-card small {
    margin-top: auto;
    color: #9aa7b4;
}

.stat-card.premium {
    color: white;
    border: 0;
    background:
        radial-gradient(circle at 90% 10%, rgba(139,197,63,.45), transparent 32%),
        linear-gradient(135deg, var(--navy), var(--green-dark));
}

.stat-card.premium span,
.stat-card.premium strong,
.stat-card.premium small {
    color: white;
}

/* CONTENT */

.content-card {
    max-width: 1500px;
    margin: auto;
    background: white;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 25px;
}

.section-head h2 {
    margin: 0;
    color: var(--navy);
    font-size: 25px;
}

.search-box input {
    width: 260px;
    padding: 12px 15px;
    border-radius: 11px;
    border: 1px solid var(--border);
    outline: none;
}

.search-box input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(21,148,71,.09);
}

/* CONSULTANT CARDS */

.consultant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

.consultant-card {
    border: 1px solid var(--border);
    border-radius: 17px;
    overflow: hidden;
    background: white;
    transition: .25s;
}

.consultant-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 40px rgba(3,29,56,.11);
}

.consultant-top {
    min-height: 100px;
    padding: 18px;
    position: relative;
    background:
        radial-gradient(circle at 90% 0%, rgba(139,197,63,.22), transparent 30%),
        linear-gradient(135deg, #f7fafb, #edf4f6);
}

.avatar {
    width: 74px;
    height: 74px;
    border-radius: 16px;
    object-fit: cover;
    object-position: center top;
    border: 4px solid white;
    box-shadow: 0 8px 20px rgba(0,0,0,.12);
}

.avatar.placeholder {
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--navy), var(--green));
    color: white;
    font-size: 21px;
    font-weight: 900;
}

.status {
    position: absolute;
    right: 16px;
    top: 18px;
    padding: 6px 9px;
    border-radius: 20px;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .7px;
}

.status.active {
    color: var(--green-dark);
    background: #e6f7ed;
}

.status.inactive {
    color: #8a3940;
    background: #fdebed;
}

.consultant-body {
    padding: 19px;
}

.consultant-body h3 {
    margin: 0;
    color: var(--navy);
    font-size: 20px;
}

.role {
    color: var(--green);
    font-size: 12px;
    font-weight: 800;
    margin: 5px 0 17px;
}

.info-row {
    display: flex;
    gap: 9px;
    margin: 9px 0;
    color: #5f6f7d;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.info-row span {
    color: var(--green);
}

.consultant-actions {
    display: flex;
    gap: 7px;
    padding: 14px 18px 18px;
}

.action-btn {
    flex: 1;
    padding: 9px 8px;
    text-align: center;
    text-decoration: none;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: #f8fafb;
    color: var(--navy);
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.action-btn:hover {
    border-color: var(--green);
}

.action-btn.qr {
    color: var(--green);
}

.premium-action {
    color: white;
    border: 0;
    background: linear-gradient(135deg, var(--navy), var(--green));
}

/* EMPTY */

.empty-state {
    padding: 70px 20px;
    text-align: center;
}

.empty-icon {
    width: 75px;
    height: 75px;
    margin: auto;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: white;
    font-weight: 900;
    background: linear-gradient(135deg, var(--navy), var(--green));
}

.empty-state h3 {
    color: var(--navy);
    margin: 20px 0 5px;
}

.empty-state p {
    color: var(--muted);
    margin-bottom: 22px;
}

/* MODAL */

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(2,18,34,.72);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 25px;
}

.modal.show {
    display: flex;
}

.modal-panel,
.card-preview-panel {
    position: relative;
    width: min(760px, 96vw);
    max-height: 94vh;
    overflow-y: auto;
    background: white;
    border-radius: 24px;
    box-shadow: 0 30px 100px rgba(0,0,0,.35);
}

.modal-panel {
    padding: 35px;
}

.card-preview-panel {
    width: min(1050px, 96vw);
    padding: 38px;
}

.modal-close {
    position: absolute;
    top: 17px;
    right: 20px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #edf2f4;
    color: var(--navy);
    font-size: 22px;
    cursor: pointer;
}

.modal-heading {
    margin-bottom: 25px;
}

/* FORM */

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: var(--navy);
    font-size: 11px;
    font-weight: 800;
}

.form-grid label.full {
    grid-column: 1 / -1;
}

.form-grid input,
.form-grid select {
    width: 100%;
    padding: 13px 14px;
    border-radius: 10px;
    border: 1px solid #dce6ea;
    background: #fbfcfd;
    color: var(--text);
    outline: none;
}

.form-grid input:focus,
.form-grid select:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(21,148,71,.08);
}

.upload-preview {
    margin-top: 5px;
    min-height: 105px;
    border: 1px dashed #c9d7dd;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #8997a3;
    overflow: hidden;
    background: #f8fafb;
}

.upload-preview img {
    width: 100%;
    max-height: 190px;
    object-fit: contain;
}

/* BUSINESS CARD */

.business-card {
    position: relative;
    width: min(850px, 100%);
    aspect-ratio: 85 / 55;
    margin: 28px auto 15px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 31% 45% 24%;
    border-radius: 19px;
    background: white;
    box-shadow:
        0 28px 60px rgba(3,29,56,.23),
        0 0 0 1px rgba(0,0,0,.06);
}

.card-left {
    position: relative;
    overflow: hidden;
    padding: 31px 25px;
    color: white;
    background:
        radial-gradient(circle at 20% 100%, rgba(21,148,71,.8), transparent 42%),
        linear-gradient(145deg, #06345f, #031d38);
}

.card-left::after {
    content: "";
    position: absolute;
    width: 130px;
    height: 600px;
    right: -95px;
    top: -50px;
    transform: rotate(11deg);
    background: linear-gradient(var(--lime), var(--green));
    opacity: .95;
}

.ges-mini {
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 3;
}

.ges-mini b {
    font-size: 31px;
    line-height: .9;
    letter-spacing: -2px;
}

.ges-mini span {
    font-size: 8px;
    letter-spacing: 2px;
    margin-top: 5px;
}

.card-tagline {
    position: absolute;
    bottom: 28px;
    left: 25px;
    z-index: 3;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
    letter-spacing: 1px;
}

.card-tagline strong {
    color: var(--lime);
}

.energy-lines {
    position: absolute;
    width: 210px;
    height: 210px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 50%;
    left: -70px;
    top: 100px;
}

.energy-lines::before,
.energy-lines::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 50%;
}

.energy-lines::before {
    inset: 25px;
}

.energy-lines::after {
    inset: 55px;
}

.card-center {
    padding: 45px 30px 25px;
    position: relative;
}

.fake-name {
    color: var(--navy);
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -.5px;
}

.fake-role {
    color: var(--green);
    margin-top: 5px;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 1.2px;
}

.separator {
    width: 38px;
    height: 3px;
    margin: 15px 0 20px;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--green), var(--lime));
}

.fake-contact {
    color: #667582;
    font-size: 10px;
    margin: 11px 0;
}

.website {
    position: absolute;
    left: 30px;
    bottom: 28px;
    color: var(--navy);
    font-size: 10px;
    font-weight: 900;
}

.card-qr {
    padding: 42px 25px 25px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.qr-placeholder {
    width: 118px;
    height: 118px;
    display: grid;
    place-items: center;
    background:
        repeating-linear-gradient(
            45deg,
            #111 0 4px,
            white 4px 8px
        );
    border: 9px solid white;
    outline: 1px solid #dce3e7;
    color: white;
    font-weight: 900;
    text-shadow: 0 1px 3px black;
}

.card-qr b {
    margin-top: 12px;
    color: var(--navy);
    font-size: 8px;
    letter-spacing: .6px;
}

.card-qr small {
    margin-top: 3px;
    color: #8b98a3;
    font-size: 7px;
}

.size-info {
    text-align: center;
    color: #7d8a95;
    font-size: 11px;
}

/* RESPONSIVE */

@media (max-width: 950px) {

    .sidebar {
        width: 82px;
        padding: 25px 12px;
    }

    .brand > div:last-child,
    .nav-item:not(.active) {
        font-size: 0;
    }

    .brand-mark {
        width: 48px;
        height: 48px;
    }

    .nav-item {
        text-align: center;
        font-size: 0;
    }

    .nav-item span {
        width: auto;
        font-size: 20px;
    }

    .sidebar-bottom {
        display: none;
    }

    .main {
        width: calc(100% - 82px);
        margin-left: 82px;
        padding: 25px;
    }

}

@media (max-width: 700px) {

    .sidebar {
        display: none;
    }

    .main {
        width: 100%;
        margin: 0;
        padding: 18px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .search-box input {
        width: 100%;
    }

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

    .form-grid label.full {
        grid-column: auto;
    }

    .business-card {
        min-width: 0;
        width: 100%;
        max-width: 850px;
        height: auto;
        aspect-ratio: 85 / 55;
    }

    .card-preview-panel {
        overflow-x: auto;
    }

}

/* =====================================================
   GES PREMIUM EXPORT BAR
   ===================================================== */

.premium-download-bar {
    width: min(850px, 100%);
    margin: 25px auto 15px;
    display: grid;
    grid-template-columns: 1.2fr 1.2fr 1fr;
    gap: 12px;
}

.premium-download-bar button {
    min-height: 48px;
    border-radius: 11px;
    border: 0;
    cursor: pointer;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: .4px;
    transition: .2s;
}

.premium-download-bar button:hover {
    transform: translateY(-2px);
}

.download-card-btn {
    color: white;
    background:
        linear-gradient(135deg, #159447, #20ad59);
    box-shadow: 0 10px 24px rgba(21,148,71,.22);
}

.print-card-btn {
    color: white;
    background:
        linear-gradient(135deg, #052e59, #0b416f);
    box-shadow: 0 10px 24px rgba(5,46,89,.20);
}

.vcard-card-btn {
    color: #052e59;
    background: #eef4f6;
    border: 1px solid #dce6ea !important;
}


/* STAMPA BIGLIETTO */

@media print {

    @page {
        size: 85mm 55mm;
        margin: 0;
    }

    body.printing-card * {
        visibility: hidden !important;
    }

    body.printing-card .business-card,
    body.printing-card .business-card * {
        visibility: visible !important;
    }

    body.printing-card .business-card {
        position: fixed;
        left: 0;
        top: 0;
        width: 85mm !important;
        height: 55mm !important;
        min-width: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        margin: 0 !important;
    }

}
