* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #0f172a;
    color: #e5e7eb;
    font-family: Inter, Arial, sans-serif;
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.25), transparent 35%),
        radial-gradient(circle at bottom right, rgba(168, 85, 247, 0.2), transparent 35%),
        #020617;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 24px;
    padding: 34px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.brand {
    text-align: center;
    margin-bottom: 28px;
}

.brand-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white;
    font-weight: 800;
    font-size: 22px;
}

.brand h1,
.topbar h1,
.panel h2 {
    margin: 0;
}

.brand p,
.topbar p,
.panel p {
    color: #94a3b8;
    margin: 8px 0 0;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

label {
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 600;
}

input,
button {
    font: inherit;
}

input {
    width: 100%;
    padding: 13px 14px;
    border-radius: 12px;
    border: 1px solid #334155;
    background: #020617;
    color: #e5e7eb;
    outline: none;
}

input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

button,
.logout-btn {
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    cursor: pointer;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

button:hover,
.logout-btn:hover {
    transform: translateY(-1px);
    opacity: 0.92;
}

button.danger {
    background: #dc2626;
}

button.secondary {
    background: #334155;
}

.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-weight: 600;
}

.alert.error {
    background: rgba(220, 38, 38, 0.15);
    color: #fecaca;
    border: 1px solid rgba(220, 38, 38, 0.35);
}

.alert.success {
    background: rgba(34, 197, 94, 0.12);
    color: #bbf7d0;
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.topbar {
    padding: 24px 36px;
    background: rgba(2, 6, 23, 0.88);
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(14px);
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 32px auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card,
.panel {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.96));
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 22px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
}

.stat-card {
    padding: 22px;
}

.stat-card span {
    color: #94a3b8;
    font-size: 14px;
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 34px;
}

.stat-card.green strong {
    color: #22c55e;
}

.stat-card.blue strong {
    color: #38bdf8;
}

.stat-card.red strong {
    color: #f87171;
}

.stat-card.orange strong {
    color: #fb923c;
}

.panel {
    padding: 24px;
    margin-bottom: 24px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 22px;
}

.generate-form {
    max-width: 520px;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.inline-form input {
    max-width: 140px;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 16px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    vertical-align: middle;
}

th {
    color: #94a3b8;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

code {
    background: #020617;
    color: #93c5fd;
    padding: 6px 9px;
    border-radius: 8px;
    font-size: 13px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.badge-non-usata {
    color: #bae6fd;
    background: rgba(14, 165, 233, 0.15);
}

.badge-attivata {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.15);
}

.badge-bloccata {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.15);
}

.badge-scaduta {
    color: #fed7aa;
    background: rgba(249, 115, 22, 0.15);
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.actions form {
    margin: 0;
}

.actions button {
    padding: 8px 11px;
    font-size: 13px;
}

.empty {
    text-align: center;
    color: #94a3b8;
    padding: 28px;
}

.muted {
    color: #64748b;
}

pre {
    background: #020617;
    color: #bfdbfe;
    padding: 14px;
    border-radius: 12px;
    overflow-x: auto;
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.small-panel {
    color: #cbd5e1;
}

@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .panel-header,
    .inline-form,
    .topbar {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 520px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}