* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f4f5f7;
    color: #222;
}

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

h1 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.card {
    background: #fff;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.field-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.75rem;
}

label {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

input,
select {
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #ccd0d5;
    font-size: 0.95rem;
}

button {
    border-radius: 4px;
    border: none;
    padding: 0.5rem 0.9rem;
    font-size: 0.95rem;
    cursor: pointer;
    margin-top: 0.5rem;
}

button.primary {
    background: #0052cc;
    color: #fff;
}

button.primary:hover {
    background: #0747a6;
}

button.secondary {
    background: #f4f5f7;
    color: #172b4d;
    border: 1px solid #c1c7d0;
}

button.secondary:hover {
    background: #ebecf0;
}

.messages {
    margin-top: 0.75rem;
    white-space: pre-line;
}

.msg {
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.msg-info {
    background: #deebff;
    color: #0747a6;
}

.msg-error {
    background: #ffebe6;
    color: #bf2600;
}

.msg-success {
    background: #e3fcef;
    color: #006644;
}

.hint {
    font-size: 0.85rem;
    color: #5e6c84;
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
}

.data-table th,
.data-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #ebecf0;
}

.data-table th {
    text-align: left;
    background: #f4f5f7;
}

.incongruenze {
    margin-top: 0.75rem;
}

.incongruenza-box {
    border-radius: 4px;
    padding: 0.5rem 0.6rem;
    border: 1px solid #ffe2cc;
    background: #fff7e6;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.incongruenza-header {
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.note {
    font-style: italic;
}

.template-header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.3rem 0.8rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .card {
        padding: 1rem;
    }
}

