:root {
  --bg: #f6f7f9; --fg: #1d2330; --muted: #667085; --line: #e3e6eb; --brand: #1f4e78;
  --ok: #1a7f37; --ko: #b42318; --card: #fff; --ue: #eef4ff; --extra: #fff4e5; --sdi: #f2f4f7;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--fg); }
main { padding: 16px 24px 48px; max-width: 1500px; margin: 0 auto; }
h1 { font-size: 22px; margin: 8px 0 12px; }
h2 { font-size: 17px; margin: 20px 0 8px; }
a { color: var(--brand); }
.topbar { display: flex; gap: 24px; align-items: center; padding: 10px 24px; background: var(--brand); color: #fff; flex-wrap: wrap; }
.topbar a { color: #fff; text-decoration: none; margin-right: 16px; }
.topbar .who { margin-left: auto; display: flex; gap: 12px; align-items: center; }
button { background: var(--brand); color: #fff; border: 0; border-radius: 6px; padding: 6px 12px; cursor: pointer; font: inherit; }
button.link { background: none; color: inherit; text-decoration: underline; padding: 0; }
input, select { font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; max-width: 100%; }
.inline { display: inline; }
.hint, .muted { color: var(--muted); }
.muted { font-size: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.filters { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 12px; }
.filters label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.filters .count { margin-left: auto; color: var(--muted); }
.grid { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); }
.grid th, .grid td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.grid th { background: #fafbfc; font-size: 12px; text-transform: uppercase; color: var(--muted); }
.grid .num { text-align: right; white-space: nowrap; }
.grid .empty { text-align: center; color: var(--muted); padding: 24px; }
tr.kind-ue td:first-child { box-shadow: inset 4px 0 0 #4f7cff; }
tr.kind-extra_ue td:first-child { box-shadow: inset 4px 0 0 #f79009; }
tr.kind-it_sdi td:first-child, tr.kind-scontrino td:first-child { box-shadow: inset 4px 0 0 #98a2b3; }
tr.done { opacity: .6; }
tr.dragover { outline: 2px dashed var(--brand); outline-offset: -2px; background: #f0f6ff; }
.upload { display: flex; flex-direction: column; gap: 4px; min-width: 220px; }
.stack { display: flex; flex-direction: column; gap: 4px; min-width: 240px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.small { font-size: 12px; color: var(--muted); }
.badge { display: inline-block; font-size: 11px; background: #fef0c7; color: #93370d; border-radius: 10px; padding: 0 6px; }
.ok { color: var(--ok); }
.ko { color: var(--ko); font-weight: 600; }
.flash { padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; }
.flash-success { background: #ecfdf3; color: #05603a; }
.flash-error { background: #fef3f2; color: #912018; }
.flash-info { background: #eff8ff; color: #175cd3; }
.login { max-width: 360px; margin: 10vh auto; background: #fff; padding: 24px; border-radius: 8px; border: 1px solid var(--line); }
.login form { display: flex; flex-direction: column; gap: 12px; }
.login label { display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 900px) {
  main { padding: 12px 16px; }
  .grid thead { display: none; }
  .grid, .grid tbody, .grid tr, .grid td { display: block; width: 100%; }
  .grid tr { border-bottom: 2px solid var(--line); }
  .grid td { border: 0; padding: 4px 8px; }
  .grid .num { text-align: left; }
}
button.secondary { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
button.danger { background: var(--ko); }
.flash-password { background: #fffaeb; color: #93370d; border: 1px solid #fedf89; font-weight: 600; }
.profile { max-width: 560px; }
.profile form { display: flex; flex-direction: column; gap: 10px; }
.profile label { display: flex; flex-direction: column; gap: 4px; }
.profile dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.profile dt { color: var(--muted); }
.profile dd { margin: 0; }
.topbar .who a { color: #fff; margin-right: 0; text-decoration: underline; }
a.button { display: inline-block; background: var(--brand); color: #fff; border-radius: 6px; padding: 8px 14px; text-decoration: none; text-align: center; }
a.button.google { display: block; background: #fff; color: var(--fg); border: 1px solid var(--line); font-weight: 600; }
.login .separator { text-align: center; margin: 16px 0 8px; }
