/* Reset semplice */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
    color: #1a1b2f;
    overflow-x: hidden;
}

html {
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Background gradient per pagine auth */
.bg-gradient {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #ff9a9e 0, rgba(255, 154, 158, 0) 55%),
                radial-gradient(circle at bottom right, #4c6fff 0, rgba(76, 111, 255, 0) 55%),
                linear-gradient(135deg, #f4f5fb, #e4e7ff);
}

.auth-wrapper {
    width: 100%;
    max-width: 960px;
    padding: 32px 16px;
}

.auth-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 32px 28px;
    margin: 0 auto;
    max-width: 420px;
    box-shadow:
        0 18px 45px rgba(15, 23, 42, 0.18),
        0 2px 6px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.auth-card.large {
    max-width: 900px;
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.auth-logo-img {
    height: 45px;
    width: auto;
    max-width: 260px;
    display: block;
}

.header-logo-img {
    height: 35px;
    width: auto;
    max-width: 240px;
    display: block;
}

.header-admin-sub {
    font-size: 13px;
    color: #94a3b8;
    font-weight: 600;
    white-space: nowrap;
}

.logo-badge {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4c6fff, #7c3aed);
    color: #ffffff;
    font-weight: 700;
    font-size: 18px;
    box-shadow: 0 8px 18px rgba(76, 111, 255, 0.45);
}

.logo-badge.small {
    width: 28px;
    height: 28px;
    font-size: 14px;
    border-radius: 10px;
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: #1e293b;
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #0f172a;
}

.auth-subtitle {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 22px;
}

.alert {
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-error {
    background: rgba(248, 113, 113, 0.08);
    color: #b91c1c;
    border: 1px solid rgba(248, 113, 113, 0.65);
}

.alert-success {
    background: rgba(22, 163, 74, 0.08);
    color: #166534;
    border: 1px solid rgba(34, 197, 94, 0.65);
}

.form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

/* Data/ora in colonna stretta: testo più piccolo così non trabocca */
.form-group-ultimo-rinnovo-compact label {
    font-size: 12px;
}

.form-group-ultimo-rinnovo-compact input[type="datetime-local"] {
    width: 100%;
    min-width: 0;
    font-size: 12px;
    padding: 8px 10px;
}

.form-checkbox-privacy {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
}

.form-checkbox-privacy input[type="checkbox"] {
    margin-top: 4px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
}
.form-checkbox-privacy label {
    cursor: pointer;
    line-height: 2;
}
.form-checkbox-privacy a {
    color: #4c6fff;
    text-decoration: underline;
}

label {
    font-size: 13px;
    color: #475569;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
select {
    width: 100%;
    min-width: 0;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    padding: 9px 11px;
    font-size: 14px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    background-color: #f8fafc;
}

input:focus,
select:focus {
    outline: none;
    border-color: #4c6fff;
    box-shadow: 0 0 0 1px rgba(76, 111, 255, 0.4);
    background-color: #ffffff;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: none;
    font-size: 14px;
    padding: 10px 18px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn-full {
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #4c6fff, #6366f1);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(79, 70, 229, 0.4);
}

.auth-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    font-size: 13px;
    color: #64748b;
}

.auth-links a {
    color: #4c6fff;
    font-weight: 500;
}

.auth-links.small {
    margin-top: 8px;
    justify-content: flex-start;
}

.form-actions {
    margin-top: 10px;
}

.toggle-group {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    background-color: #e5e7eb;
    gap: 3px;
}

.toggle-option {
    position: relative;
}

.toggle-option input {
    display: none;
}

.toggle-option span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    cursor: pointer;
    color: #4b5563;
    transition: background 0.15s ease, color 0.15s ease;
}

.toggle-option input:checked + span {
    background: linear-gradient(135deg, #4c6fff, #818cf8);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.5);
}

/* Layout app principale */
.app-body {
    min-height: 100vh;
    background: radial-gradient(circle at top left, #ff9a9e 0, rgba(255, 154, 158, 0) 50%),
                radial-gradient(circle at bottom right, #4c6fff 0, rgba(76, 111, 255, 0) 55%),
                linear-gradient(120deg, #f8fafc, #e5e7eb);
}

.table-scroll-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(18px);
    color: #e5e7eb;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-center {
    text-align: center;
    flex: 1;
}

.header-store-name {
    font-size: 14px;
    color: #cbd5f5;
    display: none !important;
}

.account-menu {
    /* vuoto: tenuto solo per compatibilità se servisse in futuro */
}

.header-links {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
}

.header-link {
    padding: 6px 10px;
    border-radius: 999px;
    color: #e5e7eb;
    transition: background 0.15s ease, color 0.15s ease;
}

.header-link:hover {
    background: rgba(148, 163, 184, 0.25);
}

.header-link-logout {
    background: rgba(248, 113, 113, 0.18);
    color: #fecaca;
}

.header-link-logout:hover {
    background: rgba(239, 68, 68, 0.6);
    color: #ffffff;
}

.header-link-dashboard {
    background: rgba(96, 165, 250, 0.18);
    color: #bfdbfe;
}
.header-link-dashboard:hover {
    background: rgba(59, 130, 246, 0.65);
    color: #ffffff;
}

/* Transizioni leggere (solo dove attivate via classe) */
.page-fade {
    animation: eppibiFadeIn 140ms ease-out both;
}
@keyframes eppibiFadeIn {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
}

.app-main {
    max-width: 1120px;
    margin: 24px auto 40px;
    padding: 0 16px;
}

/* Indicatore semplice per intestazioni ordinabili */
th[data-sort-key]::after {
    content: ' ⇅';
    font-size: 11px;
    color: #9ca3af;
}

.hero {
    text-align: center;
    margin-bottom: 28px;
}

.hero h1 {
    font-size: 26px;
    margin-bottom: 8px;
    color: #0f172a;
}

.hero p {
    font-size: 14px;
    color: #64748b;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-top: 10px;
}

.app-tile {
    position: relative;
    background: #ffffff;
    border-radius: 24px;
    padding: 18px 16px;
    box-shadow:
        0 16px 45px rgba(15, 23, 42, 0.12),
        0 2px 6px rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.4);
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transform: translateY(0);
    transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.app-tile:hover {
    transform: translateY(-4px);
    box-shadow:
        0 20px 55px rgba(15, 23, 42, 0.18),
        0 6px 12px rgba(15, 23, 42, 0.08);
    border-color: rgba(59, 130, 246, 0.9);
}

.tile-icon {
    font-size: 26px;
}

.app-tile h2 {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.app-tile p {
    font-size: 13px;
    color: #64748b;
}

.tile-dashboard {
    background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 60%), #ffffff;
}

.tile-list {
    background: radial-gradient(circle at top left, rgba(236, 72, 153, 0.18), transparent 60%), #ffffff;
}

.tile-voucher {
    background: radial-gradient(circle at top left, rgba(16, 185, 129, 0.18), transparent 60%), #ffffff;
}

.tile-search {
    background: radial-gradient(circle at top left, rgba(234, 179, 8, 0.2), transparent 60%), #ffffff;
}

.tile-customers {
    background: radial-gradient(circle at top left, rgba(20, 184, 166, 0.18), transparent 60%), #ffffff;
}

.tile-pdf-movimenti {
    background: radial-gradient(circle at top left, rgba(239, 68, 68, 0.14), transparent 60%), #ffffff;
}

/* Campo password con icona occhio mostra/nascondi */
.password-wrap {
    position: relative;
    width: 100%;
}
.password-wrap input {
    width: 100%;
    padding-right: 145px;
}
.pw-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: #64748b;
    border-radius: 10px;
    transition: color 0.15s ease, background 0.15s ease;
}
.pw-toggle:hover {
    color: #4c6fff;
}
.pw-toggle:focus {
    outline: none;
}
.pw-toggle svg {
    width: 20px;
    height: 20px;
    display: block;
}
.pw-icon-hide {
    display: none;
}
.pw-toggle.is-visible .pw-icon-show {
    display: none;
}
.pw-toggle.is-visible .pw-icon-hide {
    display: block;
}

/* Admin: pulsanti Disattiva/Riattiva ed Elimina sulla stessa riga anche su mobile */
.admin-azioni-buttons {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
}
.admin-azioni-buttons form {
    display: inline-block;
}
.admin-azioni-buttons .btn {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    white-space: nowrap;
}
.btn-admin-disattiva {
    background: #fef3c7;
    color: #b45309;
}
.btn-admin-riattiva {
    background: #d1fae5;
    color: #047857;
}
.btn-admin-elimina {
    background: #fee2e2;
    color: #b91c1c;
}
.btn-admin-approva {
    background: #a5f6cd;
    color: #15bb66;
}
.btn-admin-annulla {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-admin-modifica {
    background: #dbeafe;
    color: #1d4ed8;
}

.admin-select-pagamento {
    max-width: 220px;
    font-size: 12px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #0f172a;
}

.admin-input-costo {
    width: 72px;
    font-size: 12px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #0f172a;
}

.admin-abbonamento-form {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Responsive */
@media (max-width: 640px) {
    .auth-card {
        padding: 22px 18px;
        border-radius: 18px;
    }

    .auth-card.large {
        padding: 22px 18px;
    }

    .hero h1 {
        font-size: 22px;
    }
}

