/* Stylesheet minimale, nessun framework esterno. */

* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
                 Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: #f5f6f8;
    color: #1f2937;
}
a { color: #1d4ed8; text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: "Consolas", "Monaco", monospace; background: #eef2f7; padding: 1px 5px; border-radius: 3px; }
pre { font-family: "Consolas", "Monaco", monospace; }
.muted { color: #6b7280; }
.small { font-size: 0.85rem; }

/* Layout */
.topbar {
    background: #111827;
    color: #fff;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 30px;
}
.topbar .brand a { color: #fff; font-weight: bold; font-size: 1.2rem; }
/* Fork 2.13.24: versione applicazione accanto al titolo */
.topbar .brand-version {
    color: rgba(255,255,255,0.6); font-size: 0.72rem; margin-left: 6px;
    font-weight: 400; vertical-align: super; letter-spacing: 0.3px;
}
.topbar .nav { display: flex; gap: 18px; }
.topbar .nav-link { color: #d1d5db; }
.topbar .nav-link:hover { color: #fff; }

.container {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 20px;
}
.footer {
    text-align: center;
    padding: 30px 0;
    color: #9ca3af;
}

/* Card / griglia */
.card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 18px 22px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.grid { display: grid; gap: 18px; margin-bottom: 24px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* Bottoni */
.btn {
    display: inline-block;
    background: #e5e7eb;
    color: #1f2937;
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    text-decoration: none;
}
.btn:hover { background: #d1d5db; text-decoration: none; }
.btn-primary { background: #1d4ed8; color: #fff; }
.btn-primary:hover { background: #1e40af; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-link { background: transparent; }
.btn-small { padding: 4px 10px; font-size: 0.85rem; }

/* Form */
fieldset {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 14px;
    margin-bottom: 14px;
    background: #fff;
}
legend { font-weight: bold; padding: 0 6px; color: #374151; }
label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #374151;
}
label.checkbox { display: flex; align-items: center; gap: 8px; }
input[type="text"], input[type="number"], input[type="email"], input[type="password"], select, textarea {
    width: 100%;
    padding: 7px 9px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 0.95rem;
    background: #fff;
    color: #111827;
}
textarea { font-family: inherit; }
.form-grid fieldset.full { grid-column: 1 / -1; }
.form-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
}
.form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.discard-form {
    border-top: 1px solid #e5e7eb;
    margin-top: 24px;
    padding-top: 14px;
}

/* Tabelle */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 20px;
}
.data-table th, .data-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #f1f1f1;
    font-size: 0.9rem;
    vertical-align: top;
}
.data-table th { background: #f9fafb; font-weight: 600; color: #374151; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: #f9fafb; }
.data-table.small th, .data-table.small td { font-size: 0.82rem; padding: 5px 7px; }

/* Badge / chip */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e5e7eb;
    color: #1f2937;
}
.badge-nuovo { background: #dbeafe; color: #1e40af; }
.badge-da_revisionare { background: #fef3c7; color: #92400e; }
.badge-confermato { background: #dcfce7; color: #166534; }
.badge-scartato { background: #fee2e2; color: #991b1b; }

.row-state-confermato td { background: #f0fdf4; }
.row-state-scartato td { color: #9ca3af; text-decoration: line-through; }

.chip {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #d1d5db;
    margin-right: 6px;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: #374151;
}
.chip:hover { text-decoration: none; background: #f9fafb; }
.chip-active { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }

.filter-bar { margin-bottom: 14px; }

/* Alert */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warn { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

.pre-wrap { white-space: pre-wrap; font-family: inherit; margin: 0; }
.log-box {
    background: #0f172a;
    color: #e2e8f0;
    padding: 14px;
    border-radius: 6px;
    overflow: auto;
    max-height: 70vh;
    font-size: 0.82rem;
    line-height: 1.4;
}

ul.counts { list-style: none; padding-left: 0; margin-bottom: 14px; }
ul.counts li { padding: 3px 0; }
.inline { display: inline; }

h1 { font-size: 1.5rem; margin-top: 0; margin-bottom: 18px; color: #111827; }
h3 { font-size: 1.05rem; margin-top: 0; margin-bottom: 10px; color: #1f2937; }
