:root {
    --bg-main: #050816;
    --bg-elevated: #0b1020;
    --bg-card: #111827;
    --accent: #6366f1;
    --accent-soft: rgba(99, 102, 241, 0.15);
    --accent-strong: #4f46e5;
    --danger: #ef4444;
    --success: #22c55e;
    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
    --border-subtle: #1f2937;
    --radius-xl: 18px;
    --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.55);
    --transition-fast: 0.18s ease-out;
    --font-main: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background: radial-gradient(circle at top left, #1f2937 0, #020617 45%, #000 100%);
    color: var(--text-main);
}

/* LAYOUT BASE APP */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: linear-gradient(180deg, #020617 0%, #020617 40%, #02061700 100%);
    border-right: 1px solid var(--border-subtle);
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: radial-gradient(circle at 30% 0%, #a5b4fc 0, #4f46e5 35%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-soft);
    font-size: 18px;
}

.brand-title {
    display: flex;
    flex-direction: column;
}

.brand-title span:nth-child(1) {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
}

.brand-title span:nth-child(2) {
    font-size: 18px;
    font-weight: 600;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 13px;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.nav-item a:hover {
    background: var(--accent-soft);
    color: var(--text-main);
    transform: translateX(2px);
}

.nav-item-icon {
    width: 18px;
    text-align: center;
}

/* AREA CONTENUTO */

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 18px 22px;
    gap: 16px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.topbar-title {
    display: flex;
    flex-direction: column;
}

.topbar-title h1 {
    font-size: 20px;
    margin: 0;
}

.topbar-title span {
    font-size: 13px;
    color: var(--text-muted);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-pill {
    background: rgba(17, 24, 39, 0.8);
    border-radius: 999px;
    padding: 6px 10px;
    border: 1px solid var(--border-subtle);
    font-size: 13px;
    color: var(--text-muted);
}

.btn-outline {
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-main);
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: border var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.btn-outline:hover {
    border-color: var(--accent);
    background: rgba(15, 23, 42, 0.9);
    transform: translateY(-1px);
}

/* GRID & CARDS */

.grid {
    display: flex;
    flex-direction: column;
    gap: 25px;
}


.card {
    background: radial-gradient(circle at top left, #1f2937 0, #020617 55%);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-soft);
    padding: 16px 18px;
}

.card h2, .card h3 {
    margin: 0 0 10px 0;
}

.card h2 {
    font-size: 18px;
}

.card h3 {
    font-size: 15px;
    color: var(--text-muted);
}

/* TABLE */

.table-wrapper {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    background: rgba(15, 23, 42, 0.9);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th, td {
    padding: 8px 10px;
    text-align: left;
}

th {
    background: rgba(15, 23, 42, 1);
    border-bottom: 1px solid var(--border-subtle);
    font-weight: 500;
    color: var(--text-muted);
}

tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.85);
}

tbody tr:nth-child(odd) {
    background: rgba(15, 23, 42, 0.7);
}

tbody tr:hover {
    background: rgba(55, 65, 81, 0.85);
}

/* BOTTONI E TAG */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 999px;
    padding: 7px 14px;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: white;
    font-size: 13px;
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.55);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 35px rgba(79, 70, 229, 0.75);
    filter: brightness(1.05);
}

.link-muted {
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
}

.link-muted:hover {
    color: var(--accent);
}

/* STATUS PILL */

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 11px;
}

.status-inviato {
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
}

.status-lavorazione {
    background: rgba(251, 191, 36, 0.16);
    color: #fbbf24;
}

.status-completato {
    background: rgba(34, 197, 94, 0.16);
    color: #22c55e;
}

/* FORM */

form label {
    font-size: 13px;
    color: var(--text-muted);
}

input, select {
    font-family: var(--font-main);
    font-size: 13px;
    border-radius: 9px;
    border: 1px solid var(--border-subtle);
    padding: 7px 9px;
    background: rgba(15, 23, 42, 0.95);
    color: var(--text-main);
    outline: none;
    transition: border var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

input:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.4);
    background: rgba(15, 23, 42, 1);
}

.form-row {
    margin-bottom: 12px;
}

.badge-light {
    display: inline-block;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 11px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
}

/* LOGIN LAYOUT */

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: radial-gradient(circle at top, #1f2937 0, #020617 60%, #000 100%);
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-soft);
    padding: 20px 22px 18px;
}

.login-card h2 {
    margin: 0 0 6px 0;
    font-size: 20px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.login-footer {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
}

/* ALERT MESSAGGI */

.alert {
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 13px;
    margin-bottom: 10px;
}

.alert-error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fecaca;
}

.alert-success {
    background: rgba(22, 163, 74, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #bbf7d0;
}

/* RESPONSIVE */

@media (max-width: 900px) {
    .app-shell {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
        padding-bottom: 10px;
    }
    .nav-section-title {
        display: none;
    }
    .nav-list {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .nav-item a {
        font-size: 11px;
        padding: 6px 8px;
    }
    .grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
