* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f4f5f7;
    color: #1f2430;
}

.auth-card,
.install-card {
    background: #fff;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.auth-card {
    width: min(360px, calc(100% - 2rem));
    margin: 10vh auto 0;
}

.install-card {
    width: min(560px, calc(100% - 2rem));
    margin: 5vh auto 3rem;
}

.auth-card h1,
.install-card h1 {
    margin: 0 0 0.25rem;
    font-size: 1.5rem;
}

.subtitle {
    margin: 0 0 1.5rem;
    color: #6b7280;
    font-size: 0.9rem;
}

.auth-card form,
.install-card form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.auth-card label,
.install-card label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.75rem;
}

.auth-card input,
.install-card input {
    padding: 0.6rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    width: 100%;
}

.auth-card button,
.install-card button {
    margin-top: 1.5rem;
    padding: 0.7rem;
    border: none;
    border-radius: 8px;
    background: #1f2937;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}

.auth-card button:hover,
.install-card button:hover {
    background: #111827;
}

.install-card fieldset {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-top: 1.25rem;
    padding: 0.25rem 1rem 1rem;
}

.install-card legend {
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0 0.4rem;
}

.install-card .grid-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
}

.app-logo {
    display: block;
    max-height: 56px;
    margin-bottom: 1rem;
}

.app-logo--icon {
    width: 56px;
    height: 56px;
    color: #1f2937;
}

.app-logo--icon svg {
    width: 100%;
    height: 100%;
}

.alert {
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.alert ul {
    margin: 0;
    padding-left: 1.1rem;
}

.alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.topbar .brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: inherit;
    text-decoration: none;
}

a.brand:hover {
    opacity: 0.8;
}

.topbar .brand img,
.topbar .brand svg {
    height: 24px;
    width: 24px;
    flex-shrink: 0;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.topbar nav a {
    color: #374151;
    text-decoration: none;
}

.topbar nav a:hover {
    text-decoration: underline;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #374151;
    text-decoration: none;
}

.user-chip:hover {
    text-decoration: underline;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #1f2937;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.content {
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.capture-btn {
    display: inline-block;
    padding: 0.8rem 1.4rem;
    border-radius: 8px;
    background: #1f2937;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.capture-btn:hover {
    background: #111827;
}

.status {
    color: #6b7280;
    font-size: 0.9rem;
    min-height: 1.2em;
}

.photo-grid {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
}

.photo-grid img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.hero {
    margin: 0.5rem 0 2rem;
}

.hero {
    padding: 1.75rem 2rem;
    border-radius: 16px;
    background: linear-gradient(135deg, #1f2937, #374151);
    color: #fff;
}

.hero h1 {
    margin: 0 0 0.35rem;
    font-size: 1.75rem;
    color: #fff;
}

.hero p {
    margin: 0;
    color: #d1d5db;
}

.guide-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    background: #eef2ff;
    border: 1px solid #e0e7ff;
    border-radius: 12px;
    color: #312e81;
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.5;
    transition: background 0.15s ease;
}

.guide-box:hover {
    background: #e0e7ff;
}

.guide-box strong {
    display: block;
    margin-bottom: 0.15rem;
}

.guide-box-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #fff;
    color: #4338ca;
    display: flex;
    align-items: center;
    justify-content: center;
}

.guide-box-icon svg {
    width: 18px;
    height: 18px;
}

.guide-box-arrow {
    flex-shrink: 0;
    font-size: 1.3rem;
    color: #6366f1;
}

.section-title {
    margin: 2.5rem 0 1rem;
    font-size: 1.05rem;
    color: #374151;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.module-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 1.25rem;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

a.module-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.09);
    border-color: var(--accent, #d1d5db);
}

.module-card--soon {
    opacity: 0.65;
}

.module-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-bg, #f3f4f6);
    color: var(--accent, #1f2937);
}

.module-icon svg {
    width: 22px;
    height: 22px;
}

.module-title {
    font-weight: 700;
    font-size: 1.05rem;
}

.module-desc {
    color: #6b7280;
    font-size: 0.85rem;
    line-height: 1.4;
}

.badge {
    align-self: flex-start;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.badge-live {
    background: #ecfdf5;
    color: #047857;
}

.badge-soon {
    background: #f3f4f6;
    color: #6b7280;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.chart-card {
    padding: 1.1rem 1.25rem;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    text-decoration: none;
    color: inherit;
}

.chart-card h3 {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    color: #374151;
}

.chart-card-body {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.chart-card-body svg {
    flex-shrink: 0;
}

.chart-card-body--bars {
    display: block;
}

.chart-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: #374151;
}

.chart-legend li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.chart-legend .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chart-legend strong {
    margin-left: auto;
    color: #1f2937;
}

.chart-card--kpi {
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chart-card--kpi:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.09);
}

.kpi-number {
    font-size: 2.4rem;
    font-weight: 800;
    color: #1f2937;
    line-height: 1;
}

.kpi-label {
    color: #6b7280;
    font-size: 0.82rem;
    margin-top: 0.35rem;
}

@media (max-width: 640px) {
    .auth-card,
    .install-card {
        padding: 1.5rem;
    }

    .install-card .grid-2 {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-wrap: wrap;
        row-gap: 0.5rem;
        padding: 1rem;
    }

    .topbar nav {
        flex-wrap: wrap;
        row-gap: 0.4rem;
    }

    .content {
        padding: 0 1rem;
        margin: 1.25rem auto;
    }

    .hero {
        padding: 1.25rem 1.4rem;
    }

    .hero h1 {
        font-size: 1.4rem;
    }
}

/* Ricerca globale (Ctrl/Cmd+K) — vedi FastOrder\Support\SideMenu::renderRicercaGlobale() */
.gs-trigger {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: #1f2937;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    z-index: 60;
}

.gs-trigger:hover {
    background: #111827;
}

.gs-trigger svg {
    width: 20px;
    height: 20px;
}

.gs-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.5);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    z-index: 70;
}

/* L'attributo HTML [hidden] e la classe .gs-overlay hanno la stessa
   specificità CSS: senza questa regola esplicita, .gs-overlay {display:flex}
   vince per ordine di dichiarazione e l'overlay resterebbe visibile anche a
   riposo. Va tenuta dopo la regola sopra. */
.gs-overlay[hidden] {
    display: none;
}

.gs-panel {
    background: #fff;
    width: 92%;
    max-width: 560px;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.gs-input {
    width: 100%;
    border: none;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 1.25rem;
    font-size: 1.05rem;
    outline: none;
    box-sizing: border-box;
}

.gs-results {
    max-height: 50vh;
    overflow-y: auto;
}

.gs-result {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1.25rem;
    text-decoration: none;
    color: #1f2937;
    font-size: 0.9rem;
}

.gs-result--active,
.gs-result:hover {
    background: #f3f4f6;
}

.gs-result-tipo {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6b7280;
    background: #f3f4f6;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
}

.gs-result-label {
    flex: 1;
}

.gs-result-sub {
    color: #9ca3af;
    font-size: 0.78rem;
}

.gs-empty {
    padding: 1rem 1.25rem;
    color: #9ca3af;
    font-size: 0.85rem;
    margin: 0;
}

.gs-hint {
    padding: 0.5rem 1.25rem;
    font-size: 0.72rem;
    color: #9ca3af;
    border-top: 1px solid #f3f4f6;
}

@media (max-width: 640px) {
    .gs-trigger {
        right: 1rem;
        bottom: 1rem;
    }

    .gs-overlay {
        padding-top: 4vh;
    }
}
