/* ============================================
   Ombrello — Design System
   ============================================
   Palette: steel blue + bianco + glow Chladni
   Ispirato al logo Ha-Line: piastra di Chladni,
   linee luminescenti su sfondo blu-grigio morbido
   Font titoli: serif (Georgia) — come il logo
   Font body: system sans-serif
   ============================================ */

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

:root {
    /* Palette logo Ha-Line */
    --blue-deep: #5a8fa8;
    --blue-mid: #7ba7bc;
    --blue-light: #93bdd0;
    --blue-pale: #aed0e0;
    --blue-wash: #c8e0eb;

    /* Sfondi */
    --bg-primary: #6a9db5;
    --bg-secondary: rgba(255, 255, 255, 0.08);
    --bg-card: rgba(255, 255, 255, 0.1);
    --bg-card-hover: rgba(255, 255, 255, 0.16);
    --bg-input: rgba(255, 255, 255, 0.12);
    --bg-glass: rgba(255, 255, 255, 0.06);

    /* Testo */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.75);
    --text-muted: rgba(255, 255, 255, 0.45);
    --text-on-accent: #ffffff;

    /* Glow Chladni (linee luminescenti bianche) */
    --glow-color: rgba(255, 255, 255, 0.9);
    --glow-soft: rgba(255, 255, 255, 0.15);
    --glow-line: rgba(255, 255, 255, 0.6);

    /* Accent (bianco luminoso per azioni principali) */
    --accent: rgba(255, 255, 255, 0.9);
    --accent-hover: #ffffff;
    --accent-glow: rgba(255, 255, 255, 0.25);
    --accent-soft: rgba(255, 255, 255, 0.1);
    --accent-btn-bg: rgba(255, 255, 255, 0.18);
    --accent-btn-hover: rgba(255, 255, 255, 0.28);

    /* Stato */
    --green: #6ee7a0;
    --green-glow: rgba(110, 231, 160, 0.35);
    --red: #f87171;
    --red-glow: rgba(248, 113, 113, 0.35);
    --yellow: #fbbf24;
    --yellow-glow: rgba(251, 191, 36, 0.35);

    /* Bordi */
    --border: rgba(255, 255, 255, 0.15);
    --border-light: rgba(255, 255, 255, 0.25);

    /* Ombre */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);

    /* Spaziatura */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;

    /* Font */
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-serif: Georgia, 'Times New Roman', 'Palatino Linotype', serif;
    --font-mono: 'SF Mono', 'Fira Code', monospace;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: linear-gradient(160deg, #5a8fa8 0%, #7ba7bc 40%, #8ab5c8 70%, #6a9db5 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.3);
    text-underline-offset: 2px;
}
a:hover {
    text-decoration-color: rgba(255, 255, 255, 0.7);
}

/* ── Layout ── */
.page-center {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    position: relative;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Chladni Background Animation ──
   Rendering matematico su canvas (chladni-bg.js).
   Formula: f(x,y) = cos(p·π·x)·cos(q·π·y) + cos(q·π·x)·cos(p·π·y)
   La "sabbia" bianca si accumula dove |f| < soglia.
── */
.chladni-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.chladni-bg canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Login Card ── */
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-lg), 0 0 60px rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 1;
}

.login-logo {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-logo .logo-text {
    font-family: var(--font-serif);
    font-size: 2.4rem;
    font-weight: 400;
    letter-spacing: 0.18em;
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* Linea glow sotto il logo (stile Chladni arc) */
.login-logo .logo-line {
    display: block;
    width: 120px;
    height: 30px;
    margin: 0.8rem auto 0;
}

.login-logo .logo-line path {
    fill: none;
    stroke: rgba(255, 255, 255, 0.6);
    stroke-width: 1.5;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.4));
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: draw-line 2s ease-out 0.5s forwards;
}

@keyframes draw-line {
    to { stroke-dashoffset: 0; }
}

/* ── Login Card Quadrata ── */
.login-card-square {
    width: 420px;
    max-width: 90vw;
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ── Form ── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font);
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
    outline: none;
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.15);
}

.form-input.error {
    border-color: var(--red);
    box-shadow: 0 0 0 3px var(--red-glow);
}

/* ── Bottoni ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.25s ease;
    outline: none;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    width: 100%;
    background: var(--accent-btn-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    backdrop-filter: blur(10px);
}

.btn-primary:hover {
    background: var(--accent-btn-hover);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem 0.8rem;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--accent-soft);
}

.btn-danger {
    background: rgba(248, 113, 113, 0.2);
    color: var(--red);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.3);
}

/* ── Alert / Error ── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    display: none;
    backdrop-filter: blur(10px);
}

.alert.show {
    display: block;
}

.alert-error {
    background: rgba(248, 113, 113, 0.15);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: #fecaca;
}

.alert-success {
    background: rgba(110, 231, 160, 0.15);
    border: 1px solid rgba(110, 231, 160, 0.3);
    color: #bbf7d0;
}

/* ── Top Bar (Dashboard) ── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.5rem;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-brand {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    color: var(--text-primary);
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-user {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ── Dashboard Header ── */
.dashboard-header {
    padding: 2.5rem 0 1.2rem;
}

.dashboard-header h1 {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: 0.04em;
}

.dashboard-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.3rem;
}

/* ── Status Bar (piattaforma) ── */
.platform-status {
    display: flex;
    gap: 1.5rem;
    padding: 0.8rem 1.2rem;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.3s, box-shadow 0.3s;
}

.status-dot.green {
    background: var(--green);
    box-shadow: 0 0 8px var(--green-glow);
}

.status-dot.red {
    background: var(--red);
    box-shadow: 0 0 8px var(--red-glow);
}

.status-dot.yellow {
    background: var(--yellow);
    box-shadow: 0 0 8px var(--yellow-glow);
}

.status-dot.gray {
    background: var(--text-muted);
}

/* ── App Grid ── */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
    padding-bottom: 2rem;
}

/* ── App Card ── */
.app-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Glow line on hover (effetto Chladni) */
.app-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 2px;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.6) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    filter: blur(1px);
}

.app-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
    box-shadow: var(--shadow-md), 0 0 30px rgba(255, 255, 255, 0.05);
    transform: translateY(-3px);
}

.app-card:hover::after {
    opacity: 1;
}

.app-card.offline {
    opacity: 0.5;
    cursor: default;
}

.app-card.offline:hover {
    transform: none;
    box-shadow: none;
}

.app-card.offline:hover::after {
    opacity: 0;
}

.app-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.app-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: var(--accent-soft);
}

.app-card-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.app-card h3 {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
    letter-spacing: 0.02em;
}

.app-card p {
    font-size: 0.825rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.app-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.app-card-role {
    font-size: 0.7rem;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.app-card-arrow {
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: transform 0.3s, color 0.3s;
}

.app-card:hover .app-card-arrow {
    transform: translateX(4px);
    color: var(--text-primary);
}

/* ── Spinner ── */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ── Loading state ── */
.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    padding: 4rem 0;
    color: var(--text-muted);
}

.loading-overlay .spinner {
    width: 28px;
    height: 28px;
    border-color: var(--border);
    border-top-color: var(--text-primary);
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .login-card {
        padding: 2rem 1.5rem;
    }

    .login-logo .logo-text {
        font-size: 2rem;
    }

    .topbar {
        padding: 0.7rem 1rem;
    }

    .platform-status {
        flex-direction: column;
        gap: 0.6rem;
    }

    .app-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-header h1 {
        font-size: 1.3rem;
    }
}

/* ============================================
   ADMIN PANEL
   ============================================ */

/* ── Tabs ── */
.admin-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.3rem;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    overflow-x: auto;
}

.admin-tab {
    padding: 0.55rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: var(--font);
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.admin-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.admin-tab.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* ── Panels ── */
.admin-panel {
    display: none;
    animation: fadeIn 0.2s ease;
}

.admin-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.panel-toolbar h2 {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 400;
    color: var(--text-primary);
}

/* ── Table ── */
.admin-table-wrap {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: 2rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.825rem;
}

.admin-table thead {
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    text-align: left;
    padding: 0.7rem 1rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    white-space: nowrap;
}

.admin-table td {
    padding: 0.65rem 1rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.admin-table tr.row-inactive td {
    opacity: 0.5;
}

.admin-table td strong {
    color: var(--text-primary);
    font-weight: 500;
}

.admin-table code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
}

.admin-table .truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-json {
    max-width: 200px;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.empty-row {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 1rem !important;
}

/* ── Badges ── */
.badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.badge-admin {
    background: rgba(168, 130, 255, 0.2);
    color: #c4a8ff;
}

.badge-green {
    background: rgba(110, 231, 160, 0.15);
    color: var(--green);
}

.badge-red {
    background: rgba(248, 113, 113, 0.15);
    color: var(--red);
}

.badge-yellow {
    background: rgba(251, 191, 36, 0.15);
    color: var(--yellow);
}

/* ── Button sizes ── */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn-xs {
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    text-transform: none;
    letter-spacing: normal;
}

/* ── Text helpers ── */
.text-red { color: var(--red) !important; }
.text-green { color: var(--green) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-sm { font-size: 0.85rem; }

/* ── Checkbox label ── */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--blue-light);
    width: 16px;
    height: 16px;
}

/* ── Select (dropdown) ── */
select.form-input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='rgba(255,255,255,0.5)' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    padding-right: 2rem;
}

select.form-input option {
    background: #4a7d94;
    color: white;
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-card {
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    background: rgba(80, 130, 155, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-primary);
}

.modal-close {
    font-size: 1.4rem;
    line-height: 1;
    padding: 0.2rem 0.5rem !important;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-body .form-group {
    margin-bottom: 1rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

/* ── Admin responsive ── */
@media (max-width: 768px) {
    .admin-tabs {
        gap: 0.15rem;
        padding: 0.2rem;
    }

    .admin-tab {
        padding: 0.45rem 0.7rem;
        font-size: 0.7rem;
    }

    .admin-table {
        font-size: 0.75rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.5rem 0.6rem;
    }

    .panel-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* ── Filter Bar ── */
.filter-bar {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.6rem 0.8rem;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.filter-bar select,
.filter-bar input[type="text"] {
    padding: 0.4rem 0.7rem;
    font-size: 0.78rem;
    font-family: var(--font);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    outline: none;
    min-width: 120px;
    transition: border-color 0.2s;
}

.filter-bar select:focus,
.filter-bar input[type="text"]:focus {
    border-color: rgba(255, 255, 255, 0.5);
}

.filter-bar select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='rgba(255,255,255,0.5)' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    padding-right: 1.8rem;
}

.filter-bar select option {
    background: #4a7d94;
    color: white;
}

.filter-bar label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── App Badges (cella permessi utente) ── */
.app-badges {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    cursor: pointer;
    min-height: 24px;
    align-items: center;
}

.app-badges:hover {
    opacity: 0.8;
}

.badge-app {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(110, 231, 160, 0.2);
    color: var(--green);
    line-height: 1;
}

.badge-app-empty {
    font-size: 0.7rem;
    color: var(--text-muted);
    cursor: pointer;
}

/* ── App Picker Popup (inside modal) ── */
.app-picker-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.app-picker-list li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.15s;
}

.app-picker-list li:last-child {
    border-bottom: none;
}

.app-picker-list li:hover {
    background: rgba(255, 255, 255, 0.04);
}

.app-picker-list label {
    font-size: 0.88rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.app-picker-list input[type="checkbox"] {
    accent-color: var(--green);
    width: 16px;
    height: 16px;
}

/* ── Flash feedback ── */
@keyframes flashGreen {
    0% { background: rgba(110, 231, 160, 0.3); }
    100% { background: transparent; }
}
@keyframes flashRed {
    0% { background: rgba(248, 113, 113, 0.3); }
    100% { background: transparent; }
}
.flash-ok { animation: flashGreen 0.8s ease; }
.flash-err { animation: flashRed 0.8s ease; }

/* ── Utility ── */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
