/* =========================================================
   RESET
========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: #050505;
}

body {
    min-height: 100vh;
    margin: 0;
}

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

button,
select {
    cursor: pointer;
}

button {
    border: 0;
}

img {
    display: block;
    max-width: 100%;
}

[hidden] {
    display: none !important;
}

/* =========================================================
   VARIABILI
========================================================= */

:root {
    --admin-bg: #070707;
    --admin-bg-soft: #0d0d0d;
    --admin-panel: #111111;
    --admin-panel-soft: #161616;
    --admin-border: rgba(255, 255, 255, 0.1);
    --admin-border-strong: rgba(255, 255, 255, 0.18);

    --admin-text: #f4f4f4;
    --admin-text-soft: #a6a6a6;
    --admin-text-muted: #777777;

    --admin-accent: #e62329;
    --admin-accent-hover: #ff3037;
    --admin-accent-soft: rgba(230, 35, 41, 0.14);

    --admin-success: #29b765;
    --admin-warning: #f5a623;
    --admin-danger: #e04444;

    --admin-sidebar-width: 280px;
    --admin-topbar-height: 76px;

    --admin-radius-small: 8px;
    --admin-radius: 14px;
    --admin-radius-large: 20px;

    --admin-shadow:
        0 24px 70px rgba(0, 0, 0, 0.42);
}

/* =========================================================
   BASE
========================================================= */

.admin-body {
    min-width: 320px;
    min-height: 100vh;
    overflow-x: hidden;
    background:
        radial-gradient(
            circle at top right,
            rgba(230, 35, 41, 0.08),
            transparent 34%
        ),
        var(--admin-bg);
    color: var(--admin-text);
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    line-height: 1.5;
}

.admin-body.is-modal-open,
.admin-body.is-sidebar-open {
    overflow: hidden;
}

.admin-noscript {
    position: fixed;
    inset: 0 0 auto;
    z-index: 9999;
    padding: 14px 20px;
    background: var(--admin-danger);
    color: #ffffff;
    text-align: center;
    font-weight: 700;
}

/* =========================================================
   LOADING
========================================================= */

.admin-loading {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    background: #050505;
    color: #ffffff;
}

.admin-loading p {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.admin-loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.14);
    border-top-color: var(--admin-accent);
    border-radius: 50%;
    animation: admin-spin 0.8s linear infinite;
}

@keyframes admin-spin {
    to {
        transform: rotate(360deg);
    }
}

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

.admin-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 20px;
}

.admin-login-card {
    width: min(100%, 480px);
    padding: 42px;
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-large);
    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.035),
            rgba(255, 255, 255, 0.01)
        ),
        var(--admin-panel);
    box-shadow: var(--admin-shadow);
}

.admin-login-brand {
    margin-bottom: 34px;
}

.admin-login-kicker,
.admin-section-kicker,
.admin-panel-kicker {
    display: inline-block;
    color: var(--admin-accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.admin-login-brand h1 {
    margin: 8px 0 10px;
    font-size: clamp(34px, 8vw, 52px);
    line-height: 1;
    letter-spacing: -0.04em;
}

.admin-login-brand p {
    margin: 0;
    color: var(--admin-text-soft);
    font-size: 15px;
}

.admin-login-form {
    display: grid;
    gap: 20px;
}

.admin-login-submit {
    width: 100%;
    margin-top: 4px;
}

/* =========================================================
   CAMPI
========================================================= */

.admin-field {
    display: grid;
    gap: 8px;
}

.admin-field label {
    color: var(--admin-text);
    font-size: 13px;
    font-weight: 700;
}

.admin-field input,
.admin-field select,
.admin-field textarea,
.admin-gallery-toolbar input,
.admin-gallery-toolbar select {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-small);
    outline: none;
    background: #0b0b0b;
    color: var(--admin-text);
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

.admin-field input,
.admin-field select,
.admin-gallery-toolbar input,
.admin-gallery-toolbar select {
    padding: 0 14px;
}

.admin-field textarea {
    min-height: 120px;
    padding: 13px 14px;
    resize: vertical;
}

.admin-field input::placeholder,
.admin-field textarea::placeholder,
.admin-gallery-toolbar input::placeholder {
    color: var(--admin-text-muted);
}

.admin-field input:focus,
.admin-field select:focus,
.admin-field textarea:focus,
.admin-gallery-toolbar input:focus,
.admin-gallery-toolbar select:focus {
    border-color: var(--admin-accent);
    background: #0f0f0f;
    box-shadow: 0 0 0 3px rgba(230, 35, 41, 0.12);
}

.admin-field input:disabled,
.admin-field select:disabled,
.admin-field textarea:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.admin-field select,
.admin-gallery-toolbar select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #888 50%),
        linear-gradient(135deg, #888 50%, transparent 50%);
    background-position:
        calc(100% - 18px) 20px,
        calc(100% - 13px) 20px;
    background-size: 5px 5px;
    background-repeat: no-repeat;
    padding-right: 40px;
}

.admin-password-wrap {
    position: relative;
}

.admin-password-wrap input {
    padding-right: 86px;
}

.admin-password-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    padding: 6px 8px;
    transform: translateY(-50%);
    background: transparent;
    color: var(--admin-text-soft);
    font-size: 12px;
    font-weight: 700;
}

.admin-password-toggle:hover {
    color: #ffffff;
}

.admin-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    color: var(--admin-text-soft);
    font-size: 13px;
    cursor: pointer;
}

.admin-checkbox input {
    width: 17px;
    height: 17px;
    margin: 2px 0 0;
    flex: 0 0 auto;
    accent-color: var(--admin-accent);
}

/* =========================================================
   BOTTONI
========================================================= */

.admin-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: var(--admin-radius-small);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    transition:
        transform 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        opacity 0.2s ease;
}

.admin-button:hover {
    transform: translateY(-1px);
}

.admin-button:active {
    transform: translateY(0);
}

.admin-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
}

.admin-button-primary {
    background: var(--admin-accent);
    color: #ffffff;
}

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

.admin-button-secondary {
    border-color: var(--admin-border-strong);
    background: rgba(255, 255, 255, 0.035);
    color: var(--admin-text);
}

.admin-button-secondary:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.07);
}

.admin-button-danger {
    border-color: rgba(224, 68, 68, 0.4);
    background: rgba(224, 68, 68, 0.1);
    color: #ff8080;
}

.admin-button-danger:hover {
    border-color: var(--admin-danger);
    background: rgba(224, 68, 68, 0.2);
}

.admin-text-button {
    width: fit-content;
    padding: 0;
    background: transparent;
    color: var(--admin-accent);
    font-size: 13px;
    font-weight: 800;
    text-align: left;
}

.admin-text-button:hover {
    color: var(--admin-accent-hover);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.admin-text-button-danger {
    color: #ff7474;
}

/* =========================================================
   MESSAGGI
========================================================= */

.admin-form-message {
    min-height: 20px;
    margin: 0;
    color: var(--admin-text-soft);
    font-size: 13px;
}

.admin-form-message.is-error {
    color: #ff7070;
}

.admin-form-message.is-success {
    color: #50d98b;
}

/* =========================================================
   STRUTTURA APP
========================================================= */

.admin-app {
    min-height: 100vh;
}

.admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1200;
    width: var(--admin-sidebar-width);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--admin-border);
    background: #090909;
}

.admin-sidebar-header {
    min-height: var(--admin-topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    border-bottom: 1px solid var(--admin-border);
}

.admin-brand {
    display: grid;
    gap: 1px;
    color: #ffffff;
    text-decoration: none;
}

.admin-brand-mark {
    color: var(--admin-accent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.18em;
}

.admin-brand-text {
    font-size: 18px;
    font-weight: 800;
}

.admin-sidebar-close {
    display: none;
    padding: 5px;
    background: transparent;
    color: #ffffff;
    font-size: 30px;
    line-height: 1;
}

.admin-navigation {
    display: grid;
    gap: 6px;
    padding: 22px 14px;
}

.admin-nav-item {
    width: 100%;
    min-height: 50px;
    display: grid;
    grid-template-columns: 34px 1fr;
    align-items: center;
    padding: 0 14px;
    border-radius: 9px;
    background: transparent;
    color: var(--admin-text-soft);
    text-align: left;
    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.admin-nav-item:hover {
    background: rgba(255, 255, 255, 0.045);
    color: #ffffff;
}

.admin-nav-item.is-active {
    background: var(--admin-accent-soft);
    color: #ffffff;
}

.admin-nav-index {
    color: var(--admin-text-muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.admin-nav-item.is-active .admin-nav-index {
    color: var(--admin-accent);
}

.admin-sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 18px;
    padding: 22px;
    border-top: 1px solid var(--admin-border);
}

.admin-user {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.admin-user-label {
    color: var(--admin-text-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.admin-user strong {
    overflow: hidden;
    color: var(--admin-text-soft);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
}

.admin-main {
    min-height: 100vh;
    margin-left: var(--admin-sidebar-width);
}

/* =========================================================
   TOPBAR
========================================================= */

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    min-height: var(--admin-topbar-height);
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 30px;
    border-bottom: 1px solid var(--admin-border);
    background: rgba(7, 7, 7, 0.88);
    backdrop-filter: blur(18px);
}

.admin-menu-toggle {
    width: 42px;
    height: 42px;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    background: transparent;
}

.admin-menu-toggle span {
    width: 18px;
    height: 2px;
    background: #ffffff;
}

.admin-topbar-title {
    display: grid;
    gap: 1px;
}

.admin-topbar-title span {
    color: var(--admin-text-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.admin-topbar-title strong {
    font-size: 16px;
}

.admin-site-link {
    margin-left: auto;
    color: var(--admin-text-soft);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.admin-site-link:hover {
    color: #ffffff;
}
/* =========================================================
   CONTENUTO
========================================================= */

.admin-content {
    width: min(100%, 1540px);
    margin: 0 auto;
    padding: 38px 30px 70px;
}

.admin-section {
    animation: admin-section-in 0.28s ease;
}

@keyframes admin-section-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.admin-section-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 520px);
    align-items: end;
    gap: 40px;
    margin-bottom: 34px;
}

.admin-section-heading h1 {
    margin: 8px 0 0;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 0.98;
    letter-spacing: -0.045em;
}

.admin-section-heading > p {
    margin: 0;
    color: var(--admin-text-soft);
    font-size: 15px;
}

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

.admin-overview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.admin-module-card {
    min-height: 290px;
    display: flex;
    flex-direction: column;
    padding: 28px;
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.028),
            transparent 50%
        ),
        var(--admin-panel);
    transition:
        transform 0.25s ease,
        border-color 0.25s ease,
        background-color 0.25s ease;
}

.admin-module-card:hover {
    transform: translateY(-4px);
    border-color: var(--admin-border-strong);
    background-color: var(--admin-panel-soft);
}

.admin-module-number {
    color: var(--admin-accent);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.14em;
}

.admin-module-card h2 {
    margin: 54px 0 12px;
    font-size: 24px;
    line-height: 1.1;
    letter-spacing: -0.025em;
}

.admin-module-card p {
    margin: 0 0 28px;
    color: var(--admin-text-soft);
    font-size: 14px;
}

.admin-module-card .admin-text-button {
    margin-top: auto;
}

/* =========================================================
   PLACEHOLDER
========================================================= */

.admin-placeholder {
    min-height: 320px;
    display: grid;
    place-content: center;
    justify-items: center;
    padding: 40px;
    border: 1px dashed var(--admin-border-strong);
    border-radius: var(--admin-radius);
    background:
        radial-gradient(
            circle at center,
            rgba(230, 35, 41, 0.06),
            transparent 48%
        ),
        var(--admin-panel);
    text-align: center;
}

.admin-placeholder > span {
    color: var(--admin-accent);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.admin-placeholder h2 {
    margin: 10px 0 8px;
    font-size: 30px;
    letter-spacing: -0.03em;
}

.admin-placeholder p {
    width: min(100%, 560px);
    margin: 0;
    color: var(--admin-text-soft);
}

/* =========================================================
   STATISTICHE GALLERY
========================================================= */

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.admin-stat-card {
    min-height: 132px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    background: var(--admin-panel);
}

.admin-stat-label {
    color: var(--admin-text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-stat-value {
    font-size: 38px;
    line-height: 1;
    letter-spacing: -0.04em;
}

.admin-stat-value-small {
    font-size: 17px;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

/* =========================================================
   PANNELLI
========================================================= */

.admin-panel {
    margin-top: 18px;
    padding: 24px;
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.018),
            transparent 45%
        ),
        var(--admin-panel);
}

.admin-panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.admin-panel-heading h2 {
    margin: 6px 0 0;
    font-size: 24px;
    line-height: 1.1;
    letter-spacing: -0.025em;
}

.admin-panel-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 29px;
    padding: 0 10px;
    border: 1px solid rgba(230, 35, 41, 0.3);
    border-radius: 999px;
    background: var(--admin-accent-soft);
    color: #ff6c71;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

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

.admin-gallery-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(260px, 0.7fr);
    gap: 18px;
}

.admin-gallery-layout .admin-panel {
    margin-top: 0;
}

/* =========================================================
   DROPZONE
========================================================= */

.admin-upload-dropzone {
    min-height: 370px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 38px 24px;
    border: 1px dashed rgba(255, 255, 255, 0.22);
    border-radius: var(--admin-radius);
    outline: none;
    background:
        radial-gradient(
            circle at center,
            rgba(230, 35, 41, 0.075),
            transparent 48%
        ),
        #0c0c0c;
    text-align: center;
    transition:
        border-color 0.2s ease,
        background-color 0.2s ease,
        transform 0.2s ease;
}

.admin-upload-dropzone:hover,
.admin-upload-dropzone:focus-visible {
    border-color: var(--admin-accent);
}

.admin-upload-dropzone.is-dragging {
    transform: scale(1.008);
    border-color: var(--admin-accent);
    background:
        radial-gradient(
            circle at center,
            rgba(230, 35, 41, 0.15),
            transparent 52%
        ),
        #101010;
}

.admin-upload-icon {
    width: 66px;
    height: 66px;
    display: grid;
    place-items: center;
    margin-bottom: 20px;
    border: 1px solid rgba(230, 35, 41, 0.35);
    border-radius: 50%;
    background: var(--admin-accent-soft);
    color: var(--admin-accent);
}

.admin-upload-icon span {
    font-size: 34px;
    font-weight: 300;
    line-height: 1;
}

.admin-upload-dropzone h3 {
    margin: 0 0 9px;
    font-size: 22px;
    letter-spacing: -0.025em;
}

.admin-upload-dropzone p {
    max-width: 520px;
    margin: 0 0 22px;
    color: var(--admin-text-soft);
    font-size: 14px;
}

.admin-upload-dropzone small {
    max-width: 570px;
    margin-top: 20px;
    color: var(--admin-text-muted);
    font-size: 11px;
    line-height: 1.6;
}

/* =========================================================
   REGOLE IMMAGINI
========================================================= */

.admin-gallery-rules {
    align-self: stretch;
}

.admin-rules-list {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.admin-rules-list li {
    display: grid;
    gap: 4px;
    padding: 17px 0;
    border-bottom: 1px solid var(--admin-border);
}

.admin-rules-list li:first-child {
    padding-top: 0;
}

.admin-rules-list li:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.admin-rules-list strong {
    font-size: 13px;
}

.admin-rules-list span {
    color: var(--admin-text-soft);
    font-size: 13px;
}

/* =========================================================
   PREVIEW GRID
========================================================= */

.admin-gallery-preview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.admin-gallery-preview-grid:empty::before {
    content: "Nessuna fotografia selezionata.";
    grid-column: 1 / -1;
    min-height: 180px;
    display: grid;
    place-items: center;
    padding: 20px;
    border: 1px dashed var(--admin-border);
    border-radius: var(--admin-radius-small);
    color: var(--admin-text-muted);
    font-size: 13px;
}

.admin-gallery-preview-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--admin-border);
    border-radius: 11px;
    background: #0c0c0c;
}

.admin-gallery-preview-image {
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: #050505;
}

.admin-gallery-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-gallery-preview-status {
    position: absolute;
    top: 10px;
    left: 10px;
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    border: 1px solid rgba(245, 166, 35, 0.4);
    border-radius: 999px;
    background: rgba(5, 5, 5, 0.82);
    color: #ffc15c;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
}

.admin-gallery-preview-status.is-ready {
    border-color: rgba(41, 183, 101, 0.4);
    color: #5adc91;
}

.admin-gallery-preview-info {
    display: grid;
    gap: 3px;
    padding: 13px 13px 10px;
}

.admin-gallery-preview-info strong {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-gallery-preview-info span {
    color: var(--admin-text-muted);
    font-size: 10px;
}

.admin-gallery-preview-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 13px 13px;
}

.admin-gallery-preview-actions .admin-text-button {
    font-size: 11px;
}

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

.admin-gallery-form {
    display: grid;
    gap: 20px;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.admin-gallery-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 4px;
}

/* =========================================================
   TOOLBAR ARCHIVIO
========================================================= */

.admin-gallery-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 220px 190px;
    gap: 12px;
    margin-bottom: 18px;
}

.admin-gallery-toolbar input,
.admin-gallery-toolbar select {
    min-width: 0;
}

/* =========================================================
   ARCHIVIO GALLERY
========================================================= */

.admin-gallery-table {
    display: grid;
    gap: 10px;
}

.admin-gallery-table:empty::before {
    content: "L’archivio è vuoto.";
    min-height: 150px;
    display: grid;
    place-items: center;
    border: 1px dashed var(--admin-border);
    border-radius: var(--admin-radius-small);
    color: var(--admin-text-muted);
    font-size: 13px;
}

.admin-gallery-row {
    min-width: 0;
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr) 160px auto;
    align-items: center;
    gap: 16px;
    padding: 10px;
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    background: #0c0c0c;
    transition:
        border-color 0.2s ease,
        background-color 0.2s ease;
}

.admin-gallery-row:hover {
    border-color: var(--admin-border-strong);
    background: #101010;
}

.admin-gallery-row-image {
    width: 74px;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border-radius: 7px;
    background: #050505;
}

.admin-gallery-row-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-gallery-row-main {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.admin-gallery-row-main strong {
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-gallery-row-main span {
    color: var(--admin-text-soft);
    font-size: 12px;
}

.admin-gallery-row-main small,
.admin-gallery-row-meta small {
    color: var(--admin-text-muted);
    font-size: 10px;
}

.admin-gallery-row-meta {
    display: grid;
    justify-items: start;
    gap: 6px;
}

.admin-status-badge {
    min-height: 25px;
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    border: 1px solid var(--admin-border-strong);
    border-radius: 999px;
    color: var(--admin-text-soft);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-status-badge.is-published {
    border-color: rgba(41, 183, 101, 0.38);
    background: rgba(41, 183, 101, 0.08);
    color: #57d98e;
}

.admin-status-badge.is-draft {
    border-color: rgba(245, 166, 35, 0.38);
    background: rgba(245, 166, 35, 0.08);
    color: #ffc15c;
}

.admin-gallery-row-actions {
    display: flex;
    justify-content: flex-end;
}
/* =========================================================
   MODALI
========================================================= */

.admin-modal {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: grid;
    place-items: center;
    padding: 24px;
}

.admin-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(8px);
}

.admin-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 720px);
    max-height: calc(100vh - 48px);
    overflow: auto;
    border: 1px solid var(--admin-border-strong);
    border-radius: var(--admin-radius-large);
    background: #0d0d0d;
    box-shadow: var(--admin-shadow);
}

.admin-crop-dialog {
    width: min(100%, 1060px);
}

.admin-modal-header,
.admin-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 24px;
}

.admin-modal-header {
    border-bottom: 1px solid var(--admin-border);
}

.admin-modal-footer {
    border-top: 1px solid var(--admin-border);
}

.admin-modal-header h2 {
    margin: 6px 0 0;
    font-size: 24px;
    letter-spacing: -0.025em;
}

.admin-modal-close {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    background: transparent;
    color: #ffffff;
    font-size: 28px;
    line-height: 1;
}

.admin-modal-close:hover {
    border-color: var(--admin-border-strong);
    background: rgba(255, 255, 255, 0.05);
}

.admin-modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* =========================================================
   CROP
========================================================= */

.admin-crop-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 24px;
    padding: 24px;
}

.admin-crop-stage {
    position: relative;
    min-height: 600px;
    overflow: hidden;
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    background:
        linear-gradient(
            45deg,
            #111 25%,
            transparent 25%
        ),
        linear-gradient(
            -45deg,
            #111 25%,
            transparent 25%
        ),
        linear-gradient(
            45deg,
            transparent 75%,
            #111 75%
        ),
        linear-gradient(
            -45deg,
            transparent 75%,
            #111 75%
        ),
        #090909;
    background-position:
        0 0,
        0 12px,
        12px -12px,
        -12px 0;
    background-size: 24px 24px;
    touch-action: none;
    user-select: none;
}

.admin-crop-stage img {
    position: absolute;
    top: 50%;
    left: 50%;
    max-width: none;
    transform-origin: center center;
    user-select: none;
    pointer-events: none;
}

.admin-crop-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(72%, 420px);
    aspect-ratio: 4 / 5;
    transform: translate(-50%, -50%);
    border: 2px solid var(--admin-accent);
    box-shadow:
        0 0 0 9999px rgba(0, 0, 0, 0.62),
        0 0 0 1px rgba(255, 255, 255, 0.25);
    pointer-events: none;
}

.admin-crop-frame::before,
.admin-crop-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.admin-crop-frame::before {
    background:
        linear-gradient(
            to right,
            transparent 33.333%,
            rgba(255, 255, 255, 0.22) 33.333%,
            rgba(255, 255, 255, 0.22) calc(33.333% + 1px),
            transparent calc(33.333% + 1px),
            transparent 66.666%,
            rgba(255, 255, 255, 0.22) 66.666%,
            rgba(255, 255, 255, 0.22) calc(66.666% + 1px),
            transparent calc(66.666% + 1px)
        );
}

.admin-crop-frame::after {
    background:
        linear-gradient(
            to bottom,
            transparent 33.333%,
            rgba(255, 255, 255, 0.22) 33.333%,
            rgba(255, 255, 255, 0.22) calc(33.333% + 1px),
            transparent calc(33.333% + 1px),
            transparent 66.666%,
            rgba(255, 255, 255, 0.22) 66.666%,
            rgba(255, 255, 255, 0.22) calc(66.666% + 1px),
            transparent calc(66.666% + 1px)
        );
}

.admin-crop-controls {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.admin-crop-controls input[type="range"] {
    width: 100%;
    accent-color: var(--admin-accent);
}

.admin-crop-help {
    margin: 0;
    color: var(--admin-text-soft);
    font-size: 13px;
    line-height: 1.65;
}

.admin-crop-position {
    display: grid;
    gap: 10px;
}

.admin-crop-position .admin-button {
    width: 100%;
}

/* =========================================================
   MODIFICA FOTO
========================================================= */

.admin-gallery-form[data-gallery-edit-form] {
    padding: 24px;
}

.admin-edit-preview {
    width: min(100%, 260px);
    aspect-ratio: 4 / 5;
    overflow: hidden;
    margin: 0 auto 6px;
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    background: #050505;
}

.admin-edit-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-gallery-form[data-gallery-edit-form] .admin-modal-footer {
    margin: 4px -24px -24px;
}

/* =========================================================
   STATI DI CARICAMENTO
========================================================= */

.admin-upload-dropzone.is-disabled {
    pointer-events: none;
    opacity: 0.55;
}

.admin-gallery-preview-card.is-processing {
    position: relative;
}

.admin-gallery-preview-card.is-processing::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    background: rgba(5, 5, 5, 0.68);
}

.admin-gallery-preview-card.is-processing::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 3;
    width: 38px;
    height: 38px;
    margin: -19px 0 0 -19px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--admin-accent);
    border-radius: 50%;
    animation: admin-spin 0.75s linear infinite;
}

.admin-gallery-row.is-loading {
    opacity: 0.55;
    pointer-events: none;
}

/* =========================================================
   PROGRESS BAR
========================================================= */

.admin-progress {
    width: 100%;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.admin-progress-bar {
    width: 0;
    height: 7px;
    border-radius: inherit;
    background: var(--admin-accent);
    transition: width 0.2s ease;
}

.admin-progress-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 8px;
    color: var(--admin-text-muted);
    font-size: 11px;
}

/* =========================================================
   TOAST
========================================================= */

.admin-toast-container {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 6000;
    width: min(calc(100% - 44px), 380px);
    display: grid;
    gap: 10px;
}

.admin-toast {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    padding: 15px 16px;
    border: 1px solid var(--admin-border-strong);
    border-radius: 10px;
    background: rgba(16, 16, 16, 0.96);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(14px);
    animation: admin-toast-in 0.25s ease;
}

.admin-toast.is-success {
    border-color: rgba(41, 183, 101, 0.4);
}

.admin-toast.is-error {
    border-color: rgba(224, 68, 68, 0.5);
}

.admin-toast-message {
    margin: 0;
    color: var(--admin-text);
    font-size: 13px;
}

.admin-toast-close {
    align-self: start;
    padding: 0;
    background: transparent;
    color: var(--admin-text-muted);
    font-size: 18px;
    line-height: 1;
}

@keyframes admin-toast-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================================
   UTILITY
========================================================= */

.admin-empty-state {
    min-height: 180px;
    display: grid;
    place-items: center;
    padding: 28px;
    border: 1px dashed var(--admin-border);
    border-radius: var(--admin-radius-small);
    color: var(--admin-text-muted);
    text-align: center;
}

.admin-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
/* =========================================================
   RESPONSIVE — TABLET
========================================================= */

@media (max-width: 1180px) {
    .admin-gallery-preview-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .admin-gallery-layout {
        grid-template-columns: 1fr;
    }

    .admin-gallery-rules {
        order: -1;
    }

    .admin-rules-list {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 14px;
    }

    .admin-rules-list li {
        padding: 0;
        border-bottom: 0;
    }

    .admin-crop-workspace {
        grid-template-columns: 1fr;
    }

    .admin-crop-controls {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(220px, 0.8fr);
        align-items: start;
    }

    .admin-crop-position {
        grid-column: 1 / -1;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* =========================================================
   RESPONSIVE — SIDEBAR MOBILE
========================================================= */

@media (max-width: 960px) {
    :root {
        --admin-sidebar-width: 290px;
    }

    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        box-shadow: 20px 0 60px rgba(0, 0, 0, 0.45);
    }

    .admin-body.is-sidebar-open .admin-sidebar {
        transform: translateX(0);
    }

    .admin-sidebar-close,
    .admin-menu-toggle {
        display: flex;
    }

    .admin-main {
        margin-left: 0;
    }

    .admin-topbar {
        padding: 0 22px;
    }

    .admin-content {
        padding-inline: 22px;
    }

    .admin-section-heading {
        grid-template-columns: 1fr;
        align-items: start;
        gap: 18px;
    }

    .admin-overview-grid {
        grid-template-columns: 1fr;
    }

    .admin-module-card {
        min-height: 220px;
    }

    .admin-module-card h2 {
        margin-top: 34px;
    }

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

    .admin-gallery-toolbar {
        grid-template-columns: 1fr 1fr;
    }

    .admin-gallery-toolbar input {
        grid-column: 1 / -1;
    }

    .admin-gallery-row {
        grid-template-columns: 64px minmax(0, 1fr) auto;
    }

    .admin-gallery-row-image {
        width: 64px;
    }

    .admin-gallery-row-meta {
        justify-items: end;
    }

    .admin-gallery-row-actions {
        grid-column: 2 / -1;
        justify-content: flex-start;
    }
}

/* =========================================================
   RESPONSIVE — MOBILE
========================================================= */

@media (max-width: 720px) {
    .admin-login-card {
        padding: 30px 22px;
    }

    .admin-topbar {
        min-height: 68px;
        padding: 0 16px;
    }

    .admin-topbar-title span {
        display: none;
    }

    .admin-site-link {
        font-size: 11px;
    }

    .admin-content {
        padding: 28px 16px 56px;
    }

    .admin-section-heading {
        margin-bottom: 26px;
    }

    .admin-section-heading h1 {
        font-size: 38px;
    }

    .admin-section-heading > p {
        font-size: 14px;
    }

    .admin-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .admin-stat-card {
        min-height: 112px;
        padding: 16px;
    }

    .admin-stat-value {
        font-size: 31px;
    }

    .admin-stat-value-small {
        font-size: 14px;
    }

    .admin-panel {
        padding: 18px;
    }

    .admin-panel-heading {
        align-items: center;
    }

    .admin-panel-heading h2 {
        font-size: 21px;
    }

    .admin-upload-dropzone {
        min-height: 320px;
        padding: 30px 18px;
    }

    .admin-rules-list {
        grid-template-columns: 1fr 1fr;
    }

    .admin-gallery-preview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .admin-form-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .admin-gallery-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .admin-gallery-actions .admin-button {
        width: 100%;
    }

    .admin-gallery-toolbar {
        grid-template-columns: 1fr;
    }

    .admin-gallery-toolbar input {
        grid-column: auto;
    }

    .admin-gallery-row {
        grid-template-columns: 64px minmax(0, 1fr);
        align-items: start;
        gap: 12px;
    }

    .admin-gallery-row-meta,
    .admin-gallery-row-actions {
        grid-column: 2;
        justify-items: start;
        justify-content: flex-start;
    }

    .admin-modal {
        padding: 0;
    }

    .admin-modal-dialog {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border: 0;
        border-radius: 0;
    }

    .admin-modal-header,
    .admin-modal-footer {
        padding: 18px;
    }

    .admin-modal-header h2 {
        font-size: 21px;
    }

    .admin-crop-workspace {
        padding: 18px;
    }

    .admin-crop-stage {
        min-height: 480px;
    }

    .admin-crop-frame {
        width: min(80%, 340px);
    }

    .admin-crop-controls {
        display: grid;
        grid-template-columns: 1fr;
    }

    .admin-crop-position {
        grid-template-columns: 1fr;
    }

    .admin-modal-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-modal-actions {
        width: 100%;
    }

    .admin-modal-actions .admin-button {
        flex: 1;
    }

    .admin-gallery-form[data-gallery-edit-form] {
        padding: 18px;
    }

    .admin-gallery-form[data-gallery-edit-form] .admin-modal-footer {
        margin: 4px -18px -18px;
    }
}

/* =========================================================
   RESPONSIVE — PICCOLI SCHERMI
========================================================= */

@media (max-width: 480px) {
    .admin-sidebar {
        width: min(88vw, 310px);
    }

    .admin-topbar-title strong {
        font-size: 14px;
    }

    .admin-site-link {
        max-width: 86px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

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

    .admin-gallery-preview-grid {
        grid-template-columns: 1fr;
    }

    .admin-panel-badge {
        display: none;
    }

    .admin-rules-list {
        grid-template-columns: 1fr;
    }

    .admin-gallery-row {
        grid-template-columns: 58px minmax(0, 1fr);
    }

    .admin-gallery-row-image {
        width: 58px;
    }

    .admin-modal-actions {
        flex-direction: column-reverse;
    }

    .admin-modal-actions .admin-button {
        width: 100%;
    }

    .admin-crop-stage {
        min-height: 420px;
    }

    .admin-crop-frame {
        width: min(84%, 300px);
    }

    .admin-toast-container {
        right: 14px;
        bottom: 14px;
        width: calc(100% - 28px);
    }
}

/* =========================================================
   ACCESSIBILITÀ
========================================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: more) {
    :root {
        --admin-border: rgba(255, 255, 255, 0.22);
        --admin-border-strong: rgba(255, 255, 255, 0.42);
        --admin-text-soft: #d0d0d0;
        --admin-text-muted: #aaaaaa;
    }
}

/* =========================================================
   STAMPA
========================================================= */

@media print {
    .admin-sidebar,
    .admin-topbar,
    .admin-button,
    .admin-text-button,
    .admin-gallery-actions,
    .admin-gallery-toolbar {
        display: none !important;
    }

    .admin-main {
        margin: 0;
    }

    .admin-content {
        width: 100%;
        padding: 0;
    }

    .admin-panel,
    .admin-stat-card,
    .admin-module-card {
        break-inside: avoid;
        border-color: #999999;
        background: #ffffff;
        color: #000000;
        box-shadow: none;
    }
}

/* =========================================================
   PARTECIPAZIONI
========================================================= */

.admin-participations-panel {
    overflow: hidden;
}

.admin-participations-toolbar {
    display: grid;
    grid-template-columns: minmax(170px, 220px) minmax(190px, 240px) minmax(260px, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.admin-participations-list {
    display: grid;
    gap: 16px;
    margin-top: 8px;
}

.admin-participation-card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(230px, 0.85fr) minmax(300px, 1.4fr) minmax(210px, 0.75fr);
    align-items: center;
    gap: 24px;
    min-height: 180px;
    padding: 26px 28px;
    border: 1px solid var(--admin-border);
    border-left: 5px solid var(--admin-accent);
    border-radius: var(--admin-radius);
    background:
        linear-gradient(135deg, rgba(230, 35, 41, 0.055), transparent 42%),
        #0b0b0b;
    transition: border-color 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

.admin-participation-card:hover {
    transform: translateY(-2px);
    border-color: var(--admin-border-strong);
}

.admin-participation-room {
    margin: 0;
    color: #ffffff;
    font-size: clamp(30px, 3.5vw, 52px);
    font-weight: 950;
    line-height: 0.95;
    letter-spacing: -0.045em;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.admin-participation-person {
    min-width: 0;
    display: grid;
    gap: 10px;
}

.admin-participation-name {
    margin: 0;
    color: var(--admin-text);
    font-size: clamp(24px, 2.4vw, 38px);
    font-weight: 850;
    line-height: 1.05;
    letter-spacing: -0.035em;
    overflow-wrap: anywhere;
}

.admin-participation-datetime {
    margin: 0;
    color: var(--admin-text-soft);
    font-size: 15px;
    font-weight: 700;
}

.admin-participation-contact {
    display: grid;
    justify-items: start;
    gap: 14px;
}

.admin-participant-phone {
    color: #ffffff;
    font-size: clamp(18px, 1.8vw, 25px);
    font-weight: 800;
    line-height: 1.1;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.admin-participant-phone:hover {
    color: var(--admin-accent-hover);
}

.admin-participation-photo {
    display: grid;
    gap: 6px;
}

.admin-participation-photo-label {
    color: var(--admin-text-muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* =========================================================
   ANALYTICS
========================================================= */

.admin-analytics-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 24px;
    padding: 4px;
    border: 1px solid var(--admin-border);
    border-radius: 999px;
    background: #080808;
}

.admin-analytics-tab {
    min-height: 42px;
    padding: 9px 18px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--admin-text-soft);
    font: inherit;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
}

.admin-analytics-tab.is-active {
    background: var(--admin-accent);
    color: #ffffff;
}

.admin-analytics-toolbar {
    display: grid;
    grid-template-columns: minmax(210px, 1fr) repeat(3, minmax(160px, 0.72fr));
    align-items: end;
    gap: 14px;
    margin-bottom: 14px;
    padding: 18px;
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-small);
    background: #0b0b0b;
}

.admin-analytics-custom-date[hidden] { display: none; }

.admin-analytics-field-label {
    color: var(--admin-text);
    font-size: 13px;
    font-weight: 700;
}

.admin-analytics-actions {
    display: flex;
    grid-column: 1 / -1;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-analytics-export-note {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-left: 3px solid var(--admin-accent);
    border-radius: 0 8px 8px 0;
    background: rgba(230, 35, 41, 0.08);
    color: var(--admin-text-soft);
    font-size: 12px;
    line-height: 1.55;
}

.admin-analytics-export-note strong {
    color: #ffffff;
}

.admin-analytics-status {
    min-height: 22px;
    margin: 0 0 16px;
    color: var(--admin-text-soft);
    font-size: 13px;
    font-weight: 750;
}

.admin-analytics-status.is-success { color: #6ee4a0; }
.admin-analytics-status.is-error { color: #ff8b8b; }

.admin-analytics-view-heading {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 0 0 14px;
}

.admin-analytics-view-heading span {
    color: var(--admin-accent);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.admin-analytics-view-heading h2 {
    margin: 0;
    color: #ffffff;
    font-size: clamp(22px, 2.2vw, 32px);
    letter-spacing: -0.025em;
}

.admin-analytics-kpis {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.admin-analytics-kpi {
    display: grid;
    align-content: space-between;
    gap: 16px;
    min-height: 126px;
    padding: 18px;
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-small);
    background: linear-gradient(145deg, #121212, #090909);
}

.admin-analytics-kpi span,
.admin-analytics-card-heading span {
    color: var(--admin-text-muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.admin-analytics-kpi strong {
    color: #ffffff;
    font-size: clamp(21px, 2vw, 32px);
    font-weight: 950;
    line-height: 1.04;
    letter-spacing: -0.035em;
    overflow-wrap: anywhere;
}

.admin-analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.admin-analytics-card {
    min-width: 0;
    padding: 22px;
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-small);
    background: #0b0b0b;
}

.admin-analytics-card-full { grid-column: 1 / -1; }

.admin-analytics-card-heading {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.admin-analytics-card-heading h2 {
    margin: 5px 0 0;
    color: #ffffff;
    font-size: clamp(20px, 2vw, 28px);
    line-height: 1.08;
    letter-spacing: -0.025em;
}

.admin-analytics-bars { display: grid; gap: 13px; }
.admin-analytics-bar-row { display: grid; gap: 6px; }

.admin-analytics-bar-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--admin-text-soft);
    font-size: 13px;
    font-weight: 750;
}

.admin-analytics-bar-header strong { color: #ffffff; }

.admin-analytics-bar-track {
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #262626;
}

.admin-analytics-bar-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--admin-accent), #ff5b60);
}

.admin-analytics-demographics {
    display: grid;
    grid-template-columns: 1.4fr 0.8fr;
    gap: 28px;
}

.admin-analytics-demographics h3 {
    margin: 0 0 14px;
    color: var(--admin-text-soft);
    font-size: 12px;
    text-transform: uppercase;
}

.admin-analytics-table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

.admin-analytics-matrix {
    width: 100%;
    min-width: 720px;
    border-collapse: separate;
    border-spacing: 5px;
}

.admin-analytics-matrix th,
.admin-analytics-matrix td {
    padding: 10px 9px;
    border-radius: 7px;
    text-align: center;
    font-size: 12px;
    font-weight: 850;
}

.admin-analytics-matrix thead th {
    color: var(--admin-text-muted);
    font-size: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.admin-analytics-matrix tbody th {
    color: #ffffff;
    text-align: left;
    white-space: nowrap;
}

.admin-analytics-matrix td {
    background: #171717;
    color: var(--admin-text-soft);
}

.admin-analytics-matrix td.has-value {
    background: rgba(230, 35, 41, calc(0.12 + var(--analytics-intensity) * 0.7));
    color: #ffffff;
}

.admin-analytics-matrix td.is-total {
    background: #242424;
    color: #ffffff;
}

.admin-analytics-replay-summary {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 20px;
}

.admin-analytics-replay-summary strong {
    color: #ffffff;
    font-size: 38px;
    font-weight: 950;
}

.admin-analytics-replay-summary span {
    color: var(--admin-text-soft);
    font-size: 13px;
}

.admin-analytics-note,
.admin-analytics-empty,
.admin-analytics-chart-empty {
    color: var(--admin-text-soft);
    font-size: 12px;
    line-height: 1.55;
}

.admin-analytics-note { margin: 18px 0 0; }

.admin-analytics-empty {
    padding: 40px 20px;
    border: 1px dashed var(--admin-border-strong);
    border-radius: var(--admin-radius-small);
    text-align: center;
}

@media (max-width: 1250px) {
    .admin-analytics-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .admin-analytics-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-analytics-actions { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
    .admin-analytics-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        border-radius: 18px;
    }
    .admin-analytics-tab { padding-inline: 12px; }
    .admin-analytics-toolbar,
    .admin-analytics-grid,
    .admin-analytics-demographics { grid-template-columns: 1fr; }
    .admin-analytics-actions { display: grid; grid-template-columns: 1fr; }
    .admin-analytics-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-analytics-kpi { min-height: 112px; }
    .admin-analytics-card-full { grid-column: auto; }
}

@media (max-width: 480px) {
    .admin-analytics-tabs { grid-template-columns: 1fr; }
    .admin-analytics-kpis { grid-template-columns: 1fr; }
}

.admin-participation-discovery-value {
    margin: 0;
    color: var(--admin-text);
    font-size: 14px;
    font-weight: 750;
    line-height: 1.35;
}

.admin-participation-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 112px;
    min-height: 40px;
    padding: 7px 14px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 950;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.admin-participation-badge.is-yes {
    border-color: rgba(41, 183, 101, 0.45);
    background: rgba(41, 183, 101, 0.15);
    color: #6ee4a0;
}

.admin-participation-badge.is-no {
    border-color: rgba(224, 68, 68, 0.45);
    background: rgba(224, 68, 68, 0.15);
    color: #ff8b8b;
}

.admin-participations-empty {
    padding: 42px 20px;
    border: 1px dashed var(--admin-border-strong);
    border-radius: var(--admin-radius-small);
    color: var(--admin-text-soft);
    text-align: center;
}

.admin-participation-card.is-new {
    animation: admin-participation-new 3.2s ease;
}

@keyframes admin-participation-new {
    0%, 45% {
        border-color: var(--admin-accent);
        background-color: rgba(230, 35, 41, 0.14);
        box-shadow: 0 0 0 3px rgba(230, 35, 41, 0.15);
    }

    100% {
        border-color: var(--admin-border);
        background-color: #0b0b0b;
        box-shadow: none;
    }
}

@media (max-width: 1100px) {
    .admin-participation-card {
        grid-template-columns: minmax(200px, 0.8fr) minmax(250px, 1.2fr);
    }

    .admin-participation-contact {
        grid-column: 1 / -1;
        grid-template-columns: minmax(200px, 1fr) auto;
        align-items: end;
    }
}

@media (max-width: 820px) {
    .admin-participations-toolbar {
        grid-template-columns: 1fr;
    }

    .admin-participation-card {
        grid-template-columns: 1fr;
        gap: 18px;
        min-height: 0;
        padding: 22px 20px;
    }

    .admin-participation-contact {
        grid-column: auto;
        grid-template-columns: 1fr;
        align-items: start;
    }

    .admin-participation-room {
        font-size: clamp(34px, 11vw, 52px);
    }

    .admin-participation-name {
        font-size: clamp(27px, 8vw, 38px);
    }
}

@media print {
    .admin-participation-card {
        break-inside: avoid;
        border: 1px solid #999999;
        border-left: 5px solid #000000;
        background: #ffffff;
        color: #000000;
        box-shadow: none;
    }

    .admin-participation-room,
    .admin-participation-name,
    .admin-participant-phone {
        color: #000000;
    }
}


/* =========================================================
   MODULI ESTERNI
========================================================= */

.admin-nav-item-external {
    text-decoration: none;
    cursor: pointer;
}

.admin-nav-item-external:visited {
    color: var(--admin-text-soft);
}

.admin-nav-item-external:hover {
    color: #ffffff;
}

a.admin-text-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.admin-external-mark {
    font-size: 0.9em;
    line-height: 1;
    opacity: 0.75;
}

.admin-module-card-finance {
    background:
        linear-gradient(
            145deg,
            rgba(230, 35, 41, 0.045),
            rgba(255, 255, 255, 0.01)
        ),
        var(--admin-panel);
}

.admin-module-card-finance:hover {
    border-color: rgba(230, 35, 41, 0.38);
}

