/* Application styles on top of Pico CSS. */
:root { --pico-font-size: 100%; --or-accent: #1f4e79; }
body > header.app-header { border-bottom: 1px solid var(--pico-muted-border-color); margin-bottom: 1.5rem; }
body > header.app-header nav { padding-block: .25rem; }
.brand { font-weight: 700; color: var(--or-accent); text-decoration: none; }
nav ul li form { margin: 0; }
nav ul li form button { padding: .35rem .8rem; margin: 0; }
nav a[aria-current="page"] { font-weight: 700; text-decoration: underline; }
.flash { padding: .75rem 1rem; border-radius: var(--pico-border-radius); margin-bottom: 1rem; }
.flash.success { background: #e7f5ec; color: #135c2b; border: 1px solid #9fd5b0; }
.flash.error { background: #fdecec; color: #8a1c1c; border: 1px solid #f0a8a8; }
small.error, .error-text { color: #b3261e; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions form { margin: 0; }
.actions > * { margin-bottom: 0; }
table.summary td:last-child, table.summary th:last-child, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.summary tr.total td { font-weight: 700; border-top: 2px solid var(--pico-muted-border-color); }
table.summary tr.net td { font-weight: 700; font-size: 1.1rem; color: var(--or-accent); }
.muted { color: var(--pico-muted-color); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 1.25rem; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 1100px) { .workspace { grid-template-columns: 1fr; } }
.preview-panel { position: sticky; top: 1rem; }
.preview-frame { width: 100%; height: 80vh; min-height: 520px; border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius); background: #f6f6f6; }
.preview-empty { border: 2px dashed var(--pico-muted-border-color); border-radius: var(--pico-border-radius); padding: 3rem 1rem; text-align: center; color: var(--pico-muted-color); }
/* HTMX loading indicators (htmx's own inline styles are disabled by the CSP). */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-block; }
/* Receipt-only fields hidden when "nota di compenso" is selected (no JS needed). */
form:has(input[name="kind"][value="compensation_note"]:checked) .receipt-only { display: none; }
form:has(input[name="kind"][value="receipt"]:checked) .note-only { display: none; }
.kind-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.kind-choice label { border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius); padding: .9rem 1rem; cursor: pointer; }
.kind-choice label:has(input:checked) { border-color: var(--or-accent); box-shadow: 0 0 0 2px rgba(31,78,121,.25); }
.kind-choice small { display: block; margin-top: .25rem; }
.danger { --pico-background-color: #b3261e; --pico-border-color: #b3261e; }
footer.app-footer { margin-top: 3rem; padding-block: 1rem; font-size: .8rem; color: var(--pico-muted-color); border-top: 1px solid var(--pico-muted-border-color); }
.login { max-width: 420px; margin: 8vh auto; }
.notice { border-left: 4px solid var(--or-accent); padding: .5rem 1rem; background: rgba(31,78,121,.05); margin-bottom: 1rem; }
.notice.warn { border-left-color: #c27c00; background: #fff8e6; }
.grid-4 { display: grid; grid-template-columns: 1fr 2fr 1fr 1.4fr; gap: 0 1.25rem; }
@media (max-width: 640px) { .grid-4 { grid-template-columns: 1fr 1fr; } }
.number-input { display: flex; align-items: baseline; gap: .4rem; }
.number-input input { flex: 1; }
#number-prefix { white-space: nowrap; font-variant-numeric: tabular-nums; }
.sticky-actions { position: sticky; bottom: 0; padding-block: .75rem; background: var(--pico-background-color); border-top: 1px solid var(--pico-muted-border-color); z-index: 2; }
.button-like { display: inline-block; padding: var(--pico-form-element-spacing-vertical) var(--pico-form-element-spacing-horizontal); border: var(--pico-border-width) solid var(--pico-secondary-border); border-radius: var(--pico-border-radius); color: var(--pico-secondary); cursor: pointer; margin: 0; }
.danger.outline { --pico-background-color: transparent; --pico-color: #b3261e; }
label.inline { display: flex; align-items: center; gap: .75rem; margin: 0; }
label.inline select { margin: 0; }
details.browser-data { margin-top: 2rem; }
body.preview-error { padding: 1rem; background: #fff; }
.actions button, .actions [role="button"], .actions .button-like { width: auto; margin-bottom: 0; }
.sticky-actions { gap: .75rem; }
