* { box-sizing: border-box; }
:root {
    --line-color: #cbd5e1;
}
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f1f5f9;
    color: #0f172a;
}
.topbar {
    height: 56px;
    background: #111827;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}
.topbar a { color: white; margin-left: 16px; text-decoration: none; }
.container { max-width: 1180px; margin: 24px auto; padding: 0 16px; }
.card, .report-page {
    background: white;
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .12);
    padding: 20px;
}
.actions, .toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}
.toolbar-spacer {
    flex: 1;
}
.button, button {
    border: 1px solid #cbd5e1;
    background: white;
    padding: 9px 14px;
    border-radius: 8px;
    cursor: pointer;
    color: #111827;
    text-decoration: none;
    display: inline-block;
}
.danger {
    background: #b91c1c;
    border-color: #b91c1c;
    color: white;
}
.primary {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
}
.export {
    background: #0f766e;
    color: white;
    border-color: #0f766e;
}
.small {
    padding: 5px 9px;
    font-size: 12px;
}
.hint {
    color: #64748b;
    font-size: 13px;
}
.eyebrow {
    color: #b91c1c;
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.section-heading {
    align-items: end;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}
.section-heading h2 {
    margin: 4px 0 0;
}
.row-actions {
    align-items: center;
    display: flex;
    gap: 10px;
}
.row-actions form {
    margin: 0;
}
.inline-form {
    display: inline-block;
    margin: 0;
}
.ordini-page {
    display: grid;
    gap: 18px;
}
.ordini-upload-card {
    background: linear-gradient(135deg, #fff7ed 0%, #ffffff 60%, #f8fafc 100%);
    border: 1px solid #fed7aa;
    padding: 16px 18px;
}
.ordini-upload-card h1 {
    font-size: 24px;
    margin: 4px 0 0;
}
.ordini-upload-form {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(220px, 260px) minmax(320px, 1fr) auto;
}
.upload-field {
    background: rgba(255, 255, 255, .92);
    border: 1px dashed #94a3b8;
    border-radius: 12px;
    cursor: pointer;
    display: grid;
    gap: 6px;
    padding: 10px 12px;
}
.upload-field input[type="file"] {
    background: transparent;
    padding: 0;
}
.upload-label {
    color: #0f172a;
    font-size: 12px;
    font-weight: 800;
    padding: 0;
}
.upload-file-name {
    color: #475569;
    font-size: 13px;
    font-weight: 600;
}
.upload-message {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    color: #0f172a;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 12px;
}
.ordini-table-toolbar {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 14px;
    padding: 10px 12px;
}
.select-all-toggle {
    align-items: center;
    display: inline-flex;
    gap: 10px;
    font-size: 14px;
    font-weight: 700;
    padding: 0;
}
.select-all-toggle input,
.ordine-checkbox {
    width: 16px;
    height: 16px;
}
.ordini-table-wrap {
    overflow: auto;
}
.ordini-count {
    color: #475569;
    font-size: 14px;
    font-weight: 700;
}
.link-button {
    background: none;
    border: 0;
    color: #dc2626;
    cursor: pointer;
    font: inherit;
    padding: 0;
}
.edit-card {
    max-width: 520px;
}
table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid #cbd5e1; padding: 8px; text-align: left; }
.report-page {
    max-width: 1050px;
    margin: 0 auto;
    border-radius: 0;
}
.report-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 13px;
}
.logo {
    font-size: 42px;
    letter-spacing: 3px;
    color: #64748b;
}
.logo span { color: #dc2626; }
.logo-image {
    width: 360px;
    max-width: 45%;
    height: auto;
    object-fit: contain;
}
.title-row {
    display: grid;
    grid-template-columns: 1fr 160px;
    border: 1px solid var(--line-color);
    margin-bottom: 12px;
}
.title-row > div {
    text-align: center;
    border-right: 1px solid var(--line-color);
    padding: 8px;
}
.title-row h1 {
    margin: 0;
    font-size: 25px;
}
label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    padding: 6px;
}
.label-it,
.label-en {
    display: block;
}
.label-it {
    line-height: 1.15;
}
.label-en {
    font-size: 11px;
    font-weight: 500;
    line-height: 1.1;
    margin-top: 1px;
}
.lang-it-only .label-en {
    display: none;
}
.lang-en-only .label-it {
    display: none;
}
.lang-en-only .label-en {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.15;
    margin-top: 0;
}
.lang-select {
    align-items: center;
    display: inline-flex;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
}
.lang-select select {
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 6px 28px 6px 10px;
    width: auto;
}
.report-page th .label-it,
.report-page th .label-en {
    text-align: center;
}
input, textarea, select {
    width: 100%;
    border: 0;
    background: #fef3c7;
    font-weight: 700;
    padding: 5px;
    font-family: inherit;
}
textarea { min-height: 55px; resize: vertical; }
.grid {
    display: grid;
    border: 1px solid var(--line-color);
    border-bottom: 0;
}
.grid label { border-right: 1px solid var(--line-color); border-bottom: 1px solid var(--line-color); }
.grid label:last-child { border-right: 0; }
.one { grid-template-columns: 1fr; }
.two { grid-template-columns: 1fr 1fr; }
.three { grid-template-columns: repeat(3, 1fr); }
.six { grid-template-columns: 1.3fr .7fr 1fr 1fr 1fr; }
.order-picker {
    align-items: center;
    border: 1px solid var(--line-color);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 14px;
    padding: 10px;
}
.order-filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1.2fr 1fr .7fr;
    border-bottom: 1px solid var(--line-color);
}
.order-filter-grid label {
    border-right: 1px solid var(--line-color);
}
.order-filter-grid label:last-child {
    border-right: 0;
}
.order-picker-footer {
    align-items: center;
    border-top: 1px solid var(--line-color);
    display: flex;
    justify-content: space-between;
    padding: 8px;
}
.modal-open {
    overflow: hidden;
}
.modal-backdrop {
    align-items: center;
    background: rgba(15, 23, 42, .55);
    bottom: 0;
    display: flex;
    justify-content: center;
    left: 0;
    padding: 24px;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 50;
}
.modal-backdrop[hidden] {
    display: none;
}
.modal-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
    max-height: calc(100vh - 48px);
    max-width: 1080px;
    overflow: hidden;
    width: 100%;
}
.modal-header {
    align-items: center;
    border-bottom: 1px solid var(--line-color);
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
}
.modal-header h2 {
    background: transparent;
    border: 0;
    margin: 0;
    padding: 0;
    text-align: left;
}
.icon-button {
    align-items: center;
    display: inline-flex;
    font-size: 18px;
    height: 34px;
    justify-content: center;
    padding: 0;
    width: 34px;
}
.order-modal-list {
    max-height: min(58vh, 560px);
    overflow: auto;
}
.order-modal-list table {
    min-width: 900px;
}
.order-modal-list th {
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 1;
}
.ordine-row {
    cursor: pointer;
}
.ordine-row:hover {
    background: #f8fafc;
}
.report-page h2 {
    background: #d4d4d8;
    border: 1px solid var(--line-color);
    margin: 12px 0 0 0;
    padding: 6px;
    text-align: center;
    font-size: 16px;
}
.login-shell {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: calc(100vh - 104px);
}
.login-card {
    background: linear-gradient(160deg, #ffffff 0%, #eef2ff 100%);
    border: 1px solid #dbe4ff;
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(15, 23, 42, .14);
    max-width: 430px;
    padding: 32px;
    width: 100%;
}
@media (max-width: 900px) {
    .ordini-upload-form {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .ordini-table-toolbar {
        align-items: flex-start;
        flex-wrap: wrap;
    }
}
.login-brand h1 {
    margin: 0 0 8px 0;
}
.eyebrow {
    color: #dc2626;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .14em;
    margin: 0 0 10px 0;
    text-transform: uppercase;
}
.login-form {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}
.login-form label {
    padding: 0;
}
.login-form input {
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    margin-top: 6px;
    padding: 12px;
}
.login-submit {
    margin-top: 8px;
    width: 100%;
}
.alert {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 10px;
    color: #991b1b;
    margin-top: 18px;
    padding: 12px 14px;
}
.result-table th, .result-table td {
    border: 1px solid var(--line-color);
    text-align: center;
    font-size: 12px;
}
.notes {
    border: 1px solid var(--line-color);
    margin-top: 12px;
}
.notes textarea {
    min-height: 100px;
    background: white;
}
.print-toolbar {
    text-align: center;
    margin: 16px;
}
@media print {
    body { background: white; }
    .topbar, .toolbar, .print-toolbar { display: none !important; }
    .container { margin: 0; padding: 0; max-width: none; }
    .report-page {
        box-shadow: none;
        padding: 0;
        max-width: none;
    }
    input, textarea {
        background: white !important;
    }
}
@media (max-width: 820px) {
    .order-picker {
        align-items: stretch;
        flex-direction: column;
    }
    .order-filter-grid {
        grid-template-columns: 1fr;
    }
    .order-filter-grid label {
        border-right: 0;
        border-bottom: 1px solid var(--line-color);
    }
    .order-filter-grid label:last-child {
        border-bottom: 0;
    }
    .modal-backdrop {
        padding: 10px;
    }
    .modal-panel {
        max-height: calc(100vh - 20px);
    }
}
