/* Light, high-contrast, mobile-first. Office screens up to 1120px; floor page phone-first. */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --fg: #14171c;
  --muted: #5b6270;
  --line: #d9dde3;
  --line-strong: #1f242c;
  --brand: #1c2b4a;
  --brand-fg: #ffffff;
  --accent: #0b5ed7;
  --accent-hover: #094db2;
  --accent-soft: #e7f0fd;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --ok: #17703a;
  --ok-soft: #e6f4ea;
  --warn: #8a5300;
  --warn-soft: #fff4e0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }

.container { max-width: 1120px; margin: 0 auto; padding: 20px 16px 48px; }

/* --- top bar ------------------------------------------------------------ */
.topbar { background: var(--brand); color: var(--brand-fg); }
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 20px; min-height: 60px;
}
.brand { display: flex; flex-direction: column; color: var(--brand-fg); line-height: 1.15; }
.brand:hover { text-decoration: none; }
.brand strong { font-size: 1.05rem; letter-spacing: 0.01em; }
.brand small { opacity: 0.75; font-size: 0.8rem; }
.topnav { display: flex; gap: 4px; flex: 1; }
.topnav a {
  color: var(--brand-fg); opacity: 0.8; padding: 8px 12px; border-radius: 8px; font-weight: 600;
}
.topnav a:hover { opacity: 1; background: rgba(255, 255, 255, 0.1); text-decoration: none; }
.topnav a.active { opacity: 1; background: rgba(255, 255, 255, 0.16); }
.userbox { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; }
.userbox .who { text-align: right; line-height: 1.2; }
.userbox .who small { display: block; opacity: 0.75; }
.userbox form { margin: 0; }
.btn-ghost-light {
  background: transparent; color: var(--brand-fg); border: 1.5px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px; padding: 6px 12px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn-ghost-light:hover { background: rgba(255, 255, 255, 0.12); }

@media (max-width: 640px) {
  .topbar-inner { flex-wrap: wrap; gap: 8px 12px; padding-top: 8px; padding-bottom: 8px; }
  .topnav { order: 3; flex-basis: 100%; }
  .userbox { margin-left: auto; }
  .userbox .who { display: none; }
}

/* --- page header -------------------------------------------------------- */
.page-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 20px;
}
.page-head .title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { display: inline-block; margin-bottom: 8px; font-weight: 600; font-size: 0.9rem; }

/* --- buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 8px 16px;
  border: 1.5px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--fg);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #eef0f3; text-decoration: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(11, 94, 215, 0.35); outline-offset: 1px;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { min-height: 34px; padding: 4px 10px; font-size: 0.875rem; }
.btn-link {
  background: none; border: 0; padding: 4px 6px; color: var(--accent); font: inherit;
  font-weight: 600; cursor: pointer; font-size: 0.875rem;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }

/* --- cards & layout ----------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px;
}
.card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.card-head .meta { color: var(--muted); font-size: 0.9rem; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 2fr 1fr; } }
.grid-2 > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 20px; }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px 24px; margin: 0; }
.facts dt { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.facts dd { margin: 2px 0 0; font-weight: 600; word-break: break-word; }
.facts .wide { grid-column: 1 / -1; }
.facts .wide dd { font-weight: 400; white-space: pre-line; }

/* --- pills -------------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-open, .pill-in_progress { color: var(--accent); background: var(--accent-soft); }
.pill-closed { color: var(--muted); background: #eceef1; }
.pill-todo { color: var(--warn); background: var(--warn-soft); }
.pill-done { color: var(--ok); background: var(--ok-soft); }

/* --- flash & banners ---------------------------------------------------- */
.flash {
  padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 600;
  border: 1px solid transparent;
}
.flash-ok { background: var(--ok-soft); color: var(--ok); border-color: #b7dfc3; }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: #f3c1bc; }
.banner {
  padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-weight: 600;
  background: #eceef1; border: 1px solid var(--line); color: var(--fg);
}
.inline-error { color: var(--danger); font-weight: 600; font-size: 0.9rem; margin: 8px 0 0; }

/* --- forms -------------------------------------------------------------- */
label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.req { color: var(--danger); }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1.5px solid #9aa1ad; border-radius: 8px; background: #fff; color: var(--fg); font: inherit;
}
input:hover, textarea:hover { border-color: var(--line-strong); }
input[type="file"] { padding: 8px; background: #fafbfc; }
textarea { min-height: 96px; resize: vertical; }
.field { margin-bottom: 16px; }
.field .hint { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.field .error { color: var(--danger); font-size: 0.85rem; font-weight: 600; margin-top: 4px; }
.field.has-error input { border-color: var(--danger); }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 20px; }
@media (min-width: 720px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .span-2 { grid-column: 1 / -1; }
}
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }

/* --- toolbar (search + filter) ------------------------------------------ */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar form.search { display: flex; gap: 8px; flex: 1; min-width: 240px; }
.segmented { display: inline-flex; border: 1.5px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.segmented a { padding: 9px 16px; color: var(--fg); font-weight: 600; }
.segmented a + a { border-left: 1.5px solid var(--line-strong); }
.segmented a:hover { background: #eef0f3; text-decoration: none; }
.segmented a.active { background: var(--brand); color: #fff; }

/* --- tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; background: var(--surface); }
table.list th {
  text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); padding: 10px 12px; border-bottom: 1.5px solid var(--line-strong);
}
table.list td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover { background: #f7f9fc; }
table.list .num { font-weight: 700; white-space: nowrap; }
table.list .right { text-align: right; }
table.list .desc { color: var(--muted); font-size: 0.9rem; }

@media (max-width: 720px) {
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { border-bottom: 1px solid var(--line); padding: 10px 4px; }
  table.list td { border: 0; padding: 2px 8px; }
  table.list td[data-label]::before {
    content: attr(data-label) ": "; color: var(--muted); font-size: 0.85rem;
  }
  table.list .right { text-align: left; }
}

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty strong { display: block; color: var(--fg); font-size: 1.05rem; margin-bottom: 4px; }

/* --- parts grid (each row is a form) ------------------------------------ */
.prows { --cols: 56px 1.1fr 1.4fr 1fr 72px 72px 0.7fr 120px 240px; }
.prow {
  display: grid; grid-template-columns: var(--cols); gap: 8px; align-items: center;
  padding: 8px 4px; border-bottom: 1px solid var(--line); margin: 0;
}
.prow.head {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
  font-weight: 700; border-bottom: 1.5px solid var(--line-strong);
}
.prow .pos { font-weight: 800; font-size: 1.05rem; }
.prow .cell-actions { display: flex; gap: 2px; justify-content: flex-end; white-space: nowrap; }
.prow input { min-height: 38px; padding: 6px 8px; }
.prow.editing { background: var(--accent-soft); border-radius: 8px; }
.prow.adding { background: #fafbfc; border: 1.5px dashed #9aa1ad; border-radius: 8px; margin-top: 12px; }
.prow .row-error { grid-column: 1 / -1; color: var(--danger); font-weight: 600; font-size: 0.9rem; }
.prow .m-label { display: none; }

@media (max-width: 960px) {
  .prow.head { display: none; }
  .prow {
    grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 12px;
    border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px;
  }
  .prow .m-label { display: block; color: var(--muted); font-size: 0.75rem; text-transform: uppercase; }
  .prow .pos { grid-column: 1 / -1; }
  .prow .cell-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* --- materials ---------------------------------------------------------- */
.mrow {
  display: grid; grid-template-columns: 1fr 140px 90px; gap: 8px; align-items: center;
  padding: 10px 4px; border-bottom: 1px solid var(--line); margin: 0;
}
.mrow .cost { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.mrow.total { border-bottom: 0; border-top: 1.5px solid var(--line-strong); font-weight: 800; }
.mrow.adding { border: 1.5px dashed #9aa1ad; border-radius: 8px; background: #fafbfc; margin-top: 12px; padding: 8px; }
@media (max-width: 560px) { .mrow { grid-template-columns: 1fr 110px; } .mrow > :last-child { grid-column: 1 / -1; } }

/* --- QR card ------------------------------------------------------------ */
.qr-card { text-align: center; }
.qr-card img { width: 200px; height: 200px; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 8px; }
.qr-card .link {
  display: flex; gap: 6px; margin-top: 12px; align-items: center;
}
.qr-card .link input { font-size: 0.85rem; min-height: 38px; background: #fafbfc; }
.qr-card .hint { color: var(--muted); font-size: 0.9rem; margin: 12px 0 0; }
.pdf-status { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 0.9rem; text-align: left; }

/* --- login -------------------------------------------------------------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-brand { text-align: center; margin-bottom: 20px; }
.auth-brand .logo {
  width: 56px; height: 56px; border-radius: 14px; background: var(--brand); color: #fff;
  display: inline-grid; place-items: center; font-weight: 800; font-size: 1.3rem; margin-bottom: 10px;
}
.auth-card .btn { width: 100%; }

/* --- floor page (phone-first, gloves) ---------------------------------- */
body.floor { background: #eef0f3; font-size: 18px; }
.floor-head { background: var(--brand); color: #fff; padding: 16px; text-align: center; }
.floor-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.75; }
.floor-number { font-size: 2.1rem; font-weight: 800; line-height: 1.1; }
.floor-sub { opacity: 0.85; margin-top: 4px; font-size: 1rem; }
.floor-main { max-width: 560px; margin: 0 auto; padding: 16px 16px 48px; }
.floor .step {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px;
  margin-bottom: 16px; scroll-margin-top: 12px;
}
.floor .step h2 { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; margin-bottom: 12px; }
.floor .step h2 .n {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 0.95rem;
}
.floor .choices { display: grid; grid-template-columns: 1fr; gap: 10px; }
.floor .choice { margin: 0; cursor: pointer; display: block; position: relative; }
.floor .seg label { position: relative; }
/* Real radios stay in the form (keyboard, validation) but are invisible: the span is the button. */
.floor .choice input, .floor .seg input {
  position: absolute; left: 0; top: 0; width: 1px; height: 1px; min-height: 0; padding: 0; opacity: 0; pointer-events: none;
}
.floor .choice span {
  display: flex; flex-direction: column; justify-content: center; min-height: 60px; padding: 10px 16px;
  border: 2px solid var(--line-strong); border-radius: 12px; background: #fff;
  font-weight: 700; font-size: 1.05rem; line-height: 1.2;
}
.floor .choice span small { font-weight: 500; color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.floor .choice input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.floor .choice input:checked + span small { color: rgba(255, 255, 255, 0.85); }
.floor .choice input:focus-visible + span { outline: 3px solid rgba(11, 94, 215, 0.4); outline-offset: 2px; }
.floor .choice.whole span { border-style: dashed; }
@media (min-width: 420px) { #step-part .choices { grid-template-columns: 1fr 1fr; } #step-part .choice.whole { grid-column: 1 / -1; } }

.floor .seg { display: grid; grid-template-columns: 1fr 1fr; border: 2px solid var(--line-strong); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.floor .seg label { margin: 0; cursor: pointer; }
.floor .seg span { display: grid; place-items: center; min-height: 52px; font-weight: 700; }
.floor .seg label + label span { border-left: 2px solid var(--line-strong); }
.floor .seg input:checked + span { background: var(--brand); color: #fff; }

.floor .times { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.floor .times label { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.floor .times input { min-height: 60px; font-size: 1.5rem; font-weight: 700; text-align: center; border-width: 2px; }
.floor .quick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.floor .quick span { width: 100%; color: var(--muted); font-size: 0.9rem; }
.floor .quick button {
  flex: 1; min-height: 52px; border: 2px solid var(--line-strong); border-radius: 12px; background: #fff;
  font: inherit; font-weight: 700; cursor: pointer;
}
.floor .quick button:active { background: var(--accent-soft); }

.floor .ops { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.floor .ops .choice span { min-height: 60px; align-items: center; font-size: 1.4rem; padding: 0; }

.floor input.numero {
  min-height: 72px; font-size: 2.2rem; font-weight: 800; text-align: center; letter-spacing: 0.3em;
  border-width: 2px;
}
.floor .note-label { margin-top: 14px; color: var(--muted); font-weight: 600; }

.floor button.save {
  width: 100%; min-height: 72px; border: 0; border-radius: 14px; background: var(--ok); color: #fff;
  font: inherit; font-size: 1.5rem; font-weight: 800; letter-spacing: 0.05em; cursor: pointer;
  box-shadow: 0 2px 6px rgba(23, 112, 58, 0.35);
}
.floor button.save:active { transform: translateY(1px); }

.floor-ok {
  background: var(--ok); color: #fff; border-radius: 14px; padding: 16px; margin-bottom: 16px; text-align: center;
}
.floor-ok.is-start { background: var(--accent); }
.floor-ok .big { font-size: 1.6rem; font-weight: 800; margin-bottom: 4px; }
.floor-ok .warn { margin-top: 8px; background: rgba(0, 0, 0, 0.2); border-radius: 8px; padding: 6px; font-weight: 700; }
.floor-error {
  background: var(--danger); color: #fff; border-radius: 14px; padding: 16px; margin-bottom: 16px;
  font-size: 1.15rem; font-weight: 800; text-align: center;
}
.floor-closed {
  background: #fff; border: 2px solid var(--line-strong); border-radius: 14px; padding: 32px 16px;
  text-align: center; font-size: 1.6rem; font-weight: 800; margin-top: 24px;
}
.floor-closed small { display: block; font-size: 1rem; font-weight: 500; color: var(--muted); margin-top: 8px; }
.floor .last { margin-top: 28px; }
.floor .last h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px; }
.floor .last ul { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.floor .last li { padding: 12px 16px; font-size: 1rem; }
.floor .last li + li { border-top: 1px solid var(--line); }
.floor .last .muted { color: var(--muted); font-size: 0.9rem; }

/* --- owner ------------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); } }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px;
}
.tile span { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.tile b { font-size: 1.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-wide { grid-column: 1 / -1; }
@media (min-width: 720px) { .tile-wide { grid-column: auto; } }
.tile-bad { border-color: #f3c1bc; background: var(--danger-soft); }
.tile-bad b { color: var(--danger); }
.tile-strong { background: var(--brand); border-color: var(--brand); }
.tile-strong span { color: rgba(255, 255, 255, 0.75); }
.tile-strong b { color: #fff; }
.pill-late { color: var(--danger); background: var(--danger-soft); }

.crow { display: block; padding: 14px 4px; border-bottom: 1px solid var(--line); color: var(--fg); }
.crow:last-child { border-bottom: 0; }
.crow:hover { background: #f7f9fc; text-decoration: none; }
.crow-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.crow-num { font-size: 1.1rem; }
.crow-total { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.crow-sub { color: var(--muted); margin-top: 2px; font-size: 0.95rem; }
.crow-stats { display: flex; gap: 6px 16px; flex-wrap: wrap; margin-top: 6px; font-size: 0.875rem; color: var(--muted); }

.grid-3 { display: grid; grid-template-columns: 1fr; gap: 0 20px; }
@media (min-width: 960px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
table.mini { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.mini th { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; text-align: left; padding: 4px 0; border-bottom: 1.5px solid var(--line-strong); }
table.mini td { padding: 8px 0; border-bottom: 1px solid var(--line); }
table.mini td + td, table.mini th + th { padding-left: 12px; }
table.mini .right { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.erow { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.erow:last-child { border-bottom: 0; }
.erow.flagged { background: var(--warn-soft); border-radius: 8px; padding-left: 10px; padding-right: 10px; }
.erow-main { grid-column: 1; }
.erow-sub { grid-column: 1; color: var(--muted); font-size: 0.9rem; }
.erow-actions { grid-column: 2; grid-row: 1 / span 2; align-self: center; display: flex; gap: 4px; align-items: center; }
.erow-actions form { margin: 0; }
.erow.open { background: var(--accent-soft); border-radius: 8px; padding-left: 10px; padding-right: 10px; }
.card-alert { border-color: #f3c1bc; background: var(--danger-soft); }
.card .hint { color: var(--muted); font-size: 0.9rem; }

.add-worker > summary { list-style: none; display: inline-flex; }
.add-worker > summary::-webkit-details-marker { display: none; }
.add-worker[open] > summary { background: var(--surface); color: var(--fg); border-color: var(--line-strong); }
table.list tr.inactive td { color: var(--muted); }
.default-cost .row { display: flex; gap: 8px; max-width: 360px; }
.default-cost .hint { color: var(--muted); font-size: 0.85rem; margin-top: 6px; }
label.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 1rem; }
label.check input { width: 22px; height: 22px; min-height: 0; }

/* --- nuova commessa from file -------------------------------------------- */
.steps { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; font-weight: 700; font-size: 0.9rem; }
.steps span { padding: 6px 12px; border-radius: 999px; background: #eceef1; color: var(--muted); }
.steps span.on { background: var(--brand); color: #fff; }
.steps span.done { background: var(--ok-soft); color: var(--ok); }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 220px; padding: 24px; border: 2px dashed #9aa1ad; border-radius: 12px; background: #fafbfc;
  cursor: pointer; margin: 0 0 16px; font-weight: 400;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; opacity: 0; }
.dropzone { position: relative; }
.dz-icon { font-size: 2.4rem; }
.dz-title { font-weight: 700; font-size: 1.1rem; }
.dz-hint { color: var(--muted); font-size: 0.9rem; }
.dz-name { font-weight: 700; color: var(--accent); }
.field.needs-check input, .field.needs-check textarea { border-color: var(--warn); background: var(--warn-soft); }
.check-hint { color: var(--warn); font-size: 0.85rem; font-weight: 700; margin-top: 4px; }
.import-parts { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.import-parts.needs-check .meta { color: var(--warn); font-weight: 700; }
table.edit-parts { width: 100%; border-collapse: collapse; min-width: 720px; }
table.edit-parts th { font-size: 0.72rem; text-transform: uppercase; color: var(--muted); text-align: left; padding: 4px; }
table.edit-parts td { padding: 3px 4px; }
table.edit-parts input { min-height: 36px; padding: 4px 8px; font-size: 0.95rem; }
table.edit-parts td:first-child input { width: 60px; font-weight: 700; }

/* --- floor: INIZIA / FINE LAVORO ------------------------------------------- */
.floor .finish-card { border: 2px solid var(--danger); }
.floor .finish-card h2 { color: var(--danger); }
.floor .finish-row { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; }
.floor .finish-row input.numero { min-height: 64px; font-size: 1.8rem; letter-spacing: 0.2em; }
.floor button.finish {
  min-height: 64px; border: 0; border-radius: 12px; background: var(--danger); color: #fff;
  font: inherit; font-size: 1.2rem; font-weight: 800; cursor: pointer;
}
.floor .working { margin-bottom: 16px; }
.floor .working h2 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; }
.floor .working ul { list-style: none; margin: 0; padding: 0; background: var(--accent-soft); border-radius: 12px; }
.floor .working li { padding: 10px 14px; font-size: 1rem; }
.floor .working li + li { border-top: 1px solid #cfe0fb; }
.floor .muted { color: var(--muted); }
.floor .start-title { font-weight: 800; color: var(--accent); margin: 24px 0 10px; letter-spacing: 0.04em; }
.floor .step-hint { color: var(--muted); font-size: 0.9rem; margin: -4px 0 10px; }
.floor .step.missing { border-color: var(--danger); box-shadow: 0 0 0 2px var(--danger-soft); }
.floor button.save { background: var(--accent); box-shadow: 0 2px 6px rgba(11, 94, 215, 0.35); }
.floor .clock-note { text-align: center; color: var(--muted); font-size: 0.9rem; margin: 10px 0 0; }

.floor .confirm-parts { border: 2px solid var(--ok); }
.floor .confirm-parts h2 { color: var(--ok); }
.floor button.part-done {
  width: 100%; min-height: 60px; border: 2px solid var(--ok); border-radius: 12px; background: #fff;
  color: var(--ok); font: inherit; font-size: 1.15rem; font-weight: 800; cursor: pointer;
}
.floor button.part-done:active { background: var(--ok-soft); }
.floor .done-part {
  min-height: 52px; display: flex; align-items: center; padding: 0 16px; border-radius: 12px;
  background: var(--ok-soft); color: var(--ok); font-weight: 800;
}

/* --- notifications -------------------------------------------------------- */
.bell { position: relative; color: #fff; font-size: 1.25rem; padding: 6px 8px; border-radius: 8px; text-decoration: none; }
.bell:hover, .bell.active { background: rgba(255, 255, 255, 0.14); text-decoration: none; }
.bell .badge {
  position: absolute; top: -2px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--danger); color: #fff; font-size: 0.75rem; font-weight: 800; display: grid; place-items: center;
}
@media (max-width: 640px) { .bell { margin-left: auto; } .userbox { margin-left: 0; } }
.device-card .push-status { font-weight: 700; margin: 0 0 12px; }
.device-card .push-status[data-state="on"] { color: var(--ok); }
.device-card .push-status[data-state="denied"], .device-card .push-status[data-state="error"] { color: var(--danger); }
.device-card .hint { margin-top: 12px; }
.nrow { display: block; padding: 12px 4px 12px 14px; border-bottom: 1px solid var(--line); color: var(--fg); border-left: 4px solid transparent; }
.nrow:last-child { border-bottom: 0; }
.nrow:hover { background: #f7f9fc; text-decoration: none; }
.nrow.unread { background: var(--accent-soft); }
.nrow.kind-commessa_finished { border-left-color: var(--ok); }
.nrow.kind-part_finished { border-left-color: #2fa35a; }
.nrow.kind-work_finished { border-left-color: var(--accent); }
.nrow-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.nrow-time { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.nrow-body { color: var(--muted); margin-top: 2px; }
.live-note { color: var(--ok); font-size: 0.85rem; font-weight: 700; margin: -8px 0 12px; }
.floor input.numero.remembered { background: var(--ok-soft); border-color: var(--ok); }
.floor .remember-hint { color: var(--muted); font-size: 0.85rem; margin: 8px 0 0; }
.today { margin-bottom: 8px; }
.today h2, .section-title { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 10px; }
.today .tiles { margin-bottom: 8px; }
.today .hint { color: var(--muted); font-size: 0.85rem; margin: 0 0 20px; }
.page-tag { display: inline-block; font-size: 0.7rem; font-weight: 800; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 1px 6px; margin-right: 6px; vertical-align: middle; }
table.edit-parts .page-cell { font-weight: 800; color: var(--accent); text-align: center; }
table.edit-parts tr.page-2 td { background: #f5f8fd; }
