/* FoodSicuro HACCP - stile applicazione (estratto da app.html nella V107) */
:root {
      --ink: #18242f;
      --text: #18242f;
      --muted: #687887;
      --line: #d9e2e8;
      --bg: #eef4f6;
      --panel: #ffffff;
      --green: #174f3f;
      --green-2: #1d7a57;
      --blue: #176f93;
      --amber: #a45f00;
      --red: #ad3939;
      --soft-green: #e6f4ee;
      --soft-blue: #e7f2f8;
      --soft-amber: #fff1d6;
      --soft-red: #fae7e7;
      --shadow: 0 16px 38px rgba(17, 36, 43, .09);
      --shadow-soft: 0 8px 22px rgba(17, 36, 43, .06);
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      font-family: Arial, Helvetica, sans-serif;
      color: var(--ink);
      background:
        radial-gradient(circle at 16% 10%, rgba(116, 214, 164, .20), transparent 28%),
        radial-gradient(circle at 86% 12%, rgba(23, 111, 147, .15), transparent 30%),
        linear-gradient(135deg, rgba(23, 79, 63, .08), transparent 34%),
        linear-gradient(315deg, rgba(23, 111, 147, .09), transparent 36%),
        var(--bg);
    }

    button, input, select, textarea { font: inherit; }

    .app {
      min-height: 100vh;
      display: grid;
      grid-template-columns: 230px 1fr;
    }

    aside {
      background:
        linear-gradient(180deg, #0e2832, #12343e 56%, #0e2832);
      color: #fff;
      padding: 20px 14px;
      display: flex;
      flex-direction: column;
      gap: 20px;
      box-shadow: 10px 0 28px rgba(10, 27, 34, .14);
    }

    .brand {
      display: grid;
      grid-template-columns: 42px 1fr;
      gap: 10px;
      align-items: center;
    }

    .logo {
      width: 42px;
      height: 42px;
      display: grid;
      place-items: center;
      background: linear-gradient(145deg, #ffffff, #e6fff4);
      color: var(--green);
      border-radius: 8px;
      font-weight: 800;
      border: 2px solid rgba(255,255,255,.55);
      box-shadow: inset 0 -8px 16px rgba(23, 79, 63, .14), 0 8px 18px rgba(0,0,0,.16);
      overflow: hidden;
      padding: 3px;
    }
    .logo img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      border-radius: 6px;
    }

    .brand strong { display: block; font-size: 18px; }
    .brand span { color: #bdd0d8; font-size: 13px; }

    nav {
      display: grid;
      gap: 7px;
    }

    nav button {
      border: 0;
      background: transparent;
      color: #deebef;
      text-align: left;
      padding: 12px 12px;
      border-radius: 8px;
      cursor: pointer;
      min-height: 44px;
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
    }

    .nav-ico {
      flex: none;
      width: 22px;
      text-align: center;
      font-size: 16px;
      line-height: 1;
    }

    nav button.active,
    nav button:hover {
      background: linear-gradient(135deg, rgba(255,255,255,.16), rgba(255,255,255,.08));
      color: #fff;
      box-shadow: inset 4px 0 0 #74d6a4;
    }

    .side-note {
      margin-top: auto;
      background: #24434f;
      border-radius: 8px;
      padding: 12px;
      font-size: 13px;
      line-height: 1.4;
      color: #d9e8ee;
    }

    main {
      min-width: 0;
      padding: 22px;
    }

    header {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 14px;
      margin-bottom: 16px;
    }

    h1 {
      margin: 0 0 5px;
      font-size: 25px;
      line-height: 1.15;
    }

    .sub {
      margin: 0;
      color: var(--muted);
      font-size: 14px;
    }

    .actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    .actions select {
      width: auto;
      min-width: 170px;
      flex: 0 1 auto;
    }

    .btn {
      min-height: 38px;
      border: 1px solid var(--line);
      background: #fff;
      color: var(--ink);
      border-radius: 8px;
      padding: 9px 12px;
      cursor: pointer;
      font-weight: 800;
      box-shadow: 0 4px 12px rgba(17, 36, 43, .04);
    }

    .btn.primary {
      border-color: var(--green);
      background: linear-gradient(135deg, var(--green), var(--green-2));
      color: #fff;
    }

    .btn.blue {
      border-color: var(--blue);
      background: var(--blue);
      color: #fff;
    }

    .btn.danger {
      border-color: var(--red);
      color: var(--red);
      background: #fffafa;
    }

    .btn.small {
      min-height: 40px;
      padding: 8px 12px;
      font-size: 13px;
    }

    .cards {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 12px;
      margin-bottom: 16px;
    }

    .card,
    .panel {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 8px;
      box-shadow: var(--shadow-soft);
    }

    .card {
      padding: 15px;
      display: grid;
      gap: 6px;
      position: relative;
      overflow: hidden;
    }

    .card::before {
      content: "";
      position: absolute;
      inset: 0 auto 0 0;
      width: 5px;
      background: linear-gradient(180deg, var(--green-2), var(--blue));
    }

    .card span {
      color: var(--muted);
      font-size: 13px;
    }

    .card strong {
      font-size: 26px;
    }

    .layout {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 360px;
      gap: 14px;
      align-items: start;
    }

    .layout.wide {
      grid-template-columns: 1fr;
    }

    .panel {
      padding: 15px;
      min-width: 0;
      overflow-x: auto;
    }

    .panel-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 12px;
    }

    h2 {
      margin: 0;
      font-size: 18px;
    }

    .form {
      display: grid;
      gap: 11px;
    }

    .field {
      display: grid;
      gap: 6px;
    }

    label {
      color: var(--muted);
      font-size: 13px;
      font-weight: 700;
    }

    .field-help {
      color: var(--muted);
      font-size: 12px;
      line-height: 1.35;
    }

    .reading-status {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 15px;
      line-height: 1.4;
      margin-top: 8px;
      font-weight: 600;
    }
    .reading-status.loading { color: var(--blue, #0c6ca8); }
    .reading-status.ok { color: var(--green, #158a57); }
    .reading-status.bad { color: var(--red, #c0392b); }

    .reading-spinner {
      width: 22px;
      height: 22px;
      flex: none;
      border: 3px solid rgba(12, 108, 168, 0.25);
      border-top-color: var(--blue, #0c6ca8);
      border-radius: 50%;
      animation: reading-spin 0.8s linear infinite;
    }
    @keyframes reading-spin { to { transform: rotate(360deg); } }
    @media (prefers-reduced-motion: reduce) {
      .reading-spinner { animation-duration: 2s; }
    }

    .notice {
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 10px 12px;
      background: #f7fafb;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.4;
    }

    .notice.ok {
      background: var(--soft-green);
      border-color: #bfe8d1;
      color: var(--green);
    }

    .notice.warn {
      background: var(--soft-amber);
      border-color: #f2d68a;
      color: var(--amber);
    }

    .notice.bad {
      background: var(--soft-red);
      border-color: #f3b4b4;
      color: var(--red);
    }

    input, select, textarea {
      width: 100%;
      min-height: 40px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fff;
      color: var(--ink);
      padding: 9px 10px;
    }

    textarea {
      min-height: 72px;
      resize: vertical;
    }

    .split {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      gap: 10px;
    }

    .temperature-shell {
      display: grid;
      gap: 14px;
    }

    .temperature-hero {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      padding: 16px;
      border: 1px solid #cfe0e7;
      border-radius: 8px;
      background: linear-gradient(135deg, #f7fbfd, #eaf5f7);
    }

    .temperature-hero h2 {
      font-size: 24px;
      margin-bottom: 4px;
    }

    .temperature-hero p {
      margin: 0;
      color: var(--muted);
      font-weight: 700;
    }

    .temperature-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      justify-content: flex-end;
      align-items: center;
    }

    .quick-control-select {
      min-width: 230px;
      height: 42px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fff;
      color: var(--ink);
      font-weight: 800;
      padding: 0 12px;
    }

    .temp-machine-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(210px, 1fr));
      gap: 14px;
    }

    .temp-machine-grid.simple-control-list {
      display: grid;
      grid-template-columns: 1fr;
      gap: 8px;
    }

    .simple-control-row {
      display: grid;
      grid-template-columns: 58px minmax(0, 1fr) auto auto;
      gap: 12px;
      align-items: center;
      padding: 10px 12px;
      border: 1px solid var(--line);
      border-left: 6px solid #9fb2bc;
      border-radius: 8px;
      background: #fff;
      box-shadow: var(--shadow-soft);
      cursor: pointer;
      transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
    }

    .simple-control-row:hover {
      transform: translateY(-1px);
      border-color: #a9cad7;
      box-shadow: 0 12px 30px rgba(15, 43, 55, .1);
    }

    .simple-control-row.ok { border-left-color: var(--green); }
    .simple-control-row.warn { border-left-color: var(--amber); }
    .simple-control-row.bad { border-left-color: var(--red); }
    .simple-control-row.idle { border-left-color: #9fb2bc; }

    .simple-control-icon {
      width: 48px;
      height: 48px;
      border-radius: 8px;
      display: grid;
      place-items: center;
      background: #eef7fa;
      color: #0e607d;
      font-size: 18px;
      font-weight: 900;
      overflow: hidden;
    }

    .simple-control-icon img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .simple-control-main {
      display: grid;
      gap: 3px;
      min-width: 0;
    }

    .simple-control-main strong {
      font-size: 17px;
      line-height: 1.15;
      color: var(--ink);
    }

    .simple-control-main small {
      color: var(--muted);
      font-weight: 700;
    }

    .history-drawer {
      padding: 0;
      overflow: hidden;
    }

    .history-drawer summary {
      cursor: pointer;
      padding: 14px 16px;
      font-size: 18px;
      font-weight: 900;
      color: var(--ink);
      list-style: none;
    }

    .history-drawer summary::-webkit-details-marker {
      display: none;
    }

    .history-drawer summary::after {
      content: "Apri";
      float: right;
      color: var(--blue);
      font-size: 13px;
      padding: 5px 10px;
      border-radius: 999px;
      background: #e7f5fb;
    }

    .history-drawer[open] summary::after {
      content: "Chiudi";
    }

    .history-drawer-body {
      padding: 0 16px 16px;
      border-top: 1px solid var(--line);
    }

    .control-entry-card:not(.hidden) {
      position: fixed;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      width: min(560px, calc(100vw - 28px));
      max-height: min(760px, calc(100vh - 28px));
      overflow: auto;
      z-index: 90;
      box-shadow: 0 24px 70px rgba(15, 43, 55, .28);
      border-color: #b9d6df;
    }

    .control-entry-card:not(.hidden)::before {
      content: "";
      position: fixed;
      inset: -100vmax;
      background: rgba(10, 35, 45, .42);
      z-index: -1;
    }

    .temp-keypad-modal {
      position: fixed;
      inset: 0;
      z-index: 95;
      display: none;
      place-items: center;
      padding: 18px;
      background: rgba(10, 35, 45, .46);
    }

    .temp-keypad-modal.show {
      display: grid;
    }

    .temp-keypad-box {
      width: min(420px, calc(100vw - 28px));
      background: #fff;
      border-radius: 12px;
      border: 1px solid #cfe0e7;
      box-shadow: 0 24px 70px rgba(15, 43, 55, .32);
      padding: 18px;
      display: grid;
      gap: 14px;
    }

    .temp-keypad-title {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
    }

    .temp-keypad-title strong {
      font-size: 20px;
      color: var(--ink);
    }

    .temp-keypad-display {
      min-height: 86px;
      border-radius: 12px;
      background: #eaf5f7;
      border: 1px solid #cfe0e7;
      display: grid;
      place-items: center;
      color: #0e607d;
      font-size: clamp(44px, 10vw, 66px);
      font-weight: 950;
      line-height: 1;
    }

    .temp-picker-wrap {
      position: relative;
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      padding: 4px 0;
    }

    .temp-picker-wrap::after {
      content: "";
      position: absolute;
      left: 0;
      right: 0;
      top: 50%;
      height: 52px;
      transform: translateY(-50%);
      border: 2px solid #8fcab1;
      border-radius: 10px;
      pointer-events: none;
    }

    .temp-wheel {
      height: 190px;
      overflow-y: auto;
      scroll-snap-type: y mandatory;
      border: 1px solid #cfe0e7;
      border-radius: 10px;
      background: linear-gradient(#edf7f9, #fff 42%, #fff 58%, #edf7f9);
      padding: 69px 0;
      overscroll-behavior: contain;
    }

    .temp-wheel button {
      width: 100%;
      height: 52px;
      border: 0;
      background: transparent;
      color: #6d7b86;
      font-size: 24px;
      font-weight: 900;
      scroll-snap-align: center;
      cursor: pointer;
    }

    .temp-wheel button.active {
      color: var(--green);
      font-size: 34px;
    }

    .temp-picker-actions {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }

    @media (max-width: 760px) {
      .simple-control-row {
        grid-template-columns: 48px minmax(0, 1fr);
      }

      .simple-control-row .temp-status,
      .simple-control-row .btn,
      .quick-control-select {
        grid-column: 2;
        justify-self: start;
        width: 100%;
      }
    }

    .temp-machine-card {
      display: grid;
      gap: 12px;
      padding: 14px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fff;
      box-shadow: var(--shadow-soft);
      min-height: 245px;
      position: relative;
      overflow: hidden;
    }

    .temp-machine-card::before {
      content: "";
      position: absolute;
      inset: 0 0 auto;
      height: 5px;
      background: #b9c7ce;
    }

    .temp-machine-card.ok::before { background: var(--green); }
    .temp-machine-card.warn::before { background: var(--amber); }
    .temp-machine-card.bad::before { background: var(--red); }
    .temp-machine-card.idle::before { background: #9fb2bc; }

    .temp-card-art {
      min-height: 98px;
      border-radius: 8px;
      background: #eaf5fb;
      display: grid;
      place-items: center;
      color: #0e607d;
      font-size: 52px;
      font-weight: 900;
    }

    .temp-card-art.freezer { background: #e8f1ff; color: #164b84; }
    .temp-card-art.abbattitore { background: #eef5f0; color: #1f6b4b; }

    .control-card-art {
      min-height: 98px;
      border-radius: 8px;
      background: #edf8f0;
      display: grid;
      place-items: center;
      color: #17613f;
      font-size: 46px;
      font-weight: 900;
      overflow: hidden;
    }

    .control-card-art img,
    .camera-thumb img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .device-illu {
      width: 112px;
      height: 82px;
      position: relative;
    }

    .device-body {
      position: absolute;
      inset: 6px 18px 0;
      border: 3px solid currentColor;
      border-radius: 8px;
      background: rgba(255,255,255,.72);
      box-shadow: inset 0 -10px 0 rgba(0,0,0,.05);
    }

    .device-door {
      position: absolute;
      top: 18px;
      bottom: 12px;
      left: 50%;
      width: 2px;
      background: currentColor;
      opacity: .35;
    }

    .device-temp {
      position: absolute;
      right: 5px;
      bottom: 4px;
      min-width: 42px;
      border-radius: 999px;
      background: #fff;
      border: 2px solid currentColor;
      font-size: 14px;
      line-height: 1;
      padding: 7px 8px;
      text-align: center;
      box-shadow: 0 8px 20px rgba(15, 43, 55, .12);
    }

    .device-illu.freezer .device-body {
      inset: 25px 4px 8px;
      border-radius: 14px 14px 8px 8px;
    }

    .device-illu.freezer .device-body::before {
      content: "";
      position: absolute;
      top: -12px;
      left: 14px;
      right: 14px;
      height: 10px;
      border: 3px solid currentColor;
      border-bottom: 0;
      border-radius: 12px 12px 0 0;
      background: rgba(255,255,255,.65);
    }

    .device-illu.vetrinetta .device-body {
      inset: 14px 4px 6px;
      border-radius: 14px;
      background: rgba(255,255,255,.78);
    }

    .device-illu.vetrinetta .device-body::before {
      content: "";
      position: absolute;
      left: 9px;
      right: 9px;
      top: 12px;
      height: 16px;
      border-radius: 999px;
      background: rgba(14, 96, 125, .18);
    }

    .device-illu.abbattitore .device-body::before,
    .device-illu.abbattitore .device-body::after {
      content: "";
      position: absolute;
      width: 18px;
      height: 18px;
      border: 3px solid currentColor;
      border-radius: 50%;
      top: 22px;
      opacity: .35;
    }

    .device-illu.abbattitore .device-body::before { left: 16px; }
    .device-illu.abbattitore .device-body::after { right: 16px; }

    .temp-card-top {
      display: flex;
      justify-content: space-between;
      gap: 10px;
      align-items: flex-start;
    }

    .temp-card-title {
      display: grid;
      gap: 3px;
    }

    .temp-card-title strong {
      font-size: 19px;
    }

    .temp-card-title small,
    .temp-last small {
      color: var(--muted);
      font-weight: 700;
    }

    .temp-status {
      border-radius: 999px;
      padding: 5px 9px;
      font-size: 12px;
      font-weight: 900;
      white-space: nowrap;
      background: #eef2f4;
      color: #566872;
    }

    .temp-status.ok { background: var(--soft-green); color: var(--green); }
    .temp-status.warn { background: var(--soft-amber); color: var(--amber); }
    .temp-status.bad { background: var(--soft-red); color: var(--red); }

    .temp-last {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }

    .temp-last strong {
      display: block;
      font-size: 22px;
      margin-top: 2px;
    }

    .temperature-detail-grid {
      display: grid;
      grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
      gap: 14px;
      align-items: start;
    }

    .temp-history-panel.hidden,
    .temp-entry-card.hidden,
    .temp-manage-panel.hidden,
    .control-entry-card.hidden,
    .control-history-panel.hidden { display: none !important; }

    .temp-history-filters {
      display: grid;
      grid-template-columns: repeat(4, minmax(130px, 1fr)) auto;
      gap: 10px;
      align-items: end;
      margin-bottom: 12px;
    }

    .temp-manage-row {
      display: grid;
      grid-template-columns: minmax(150px, 1.5fr) minmax(110px, 1fr) repeat(2, 90px) minmax(90px, .8fr) auto;
      gap: 8px;
      align-items: end;
    }

    .config-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(240px, 1fr));
      gap: 14px;
      align-items: start;
    }

    .config-row {
      display: grid;
      grid-template-columns: 1fr 130px 110px 110px;
      gap: 8px;
      align-items: end;
    }

    .config-disabled-list {
      margin-top: 10px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fbfcfd;
      overflow: hidden;
    }

    .config-disabled-list summary {
      cursor: pointer;
      padding: 12px 14px;
      font-weight: 800;
      color: var(--muted);
      background: #f3f7f8;
    }

    .config-disabled-list table {
      margin: 0;
      border: 0;
    }

    .control-action-wrap.hidden { display: none !important; }

    .camera-thumbs {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
      gap: 8px;
      margin-top: 12px;
      max-height: 170px;
      overflow: auto;
    }

    .camera-thumb {
      position: relative;
      height: 92px;
      border: 1px solid var(--line);
      border-radius: 8px;
      overflow: hidden;
      background: #f5f8f9;
    }

    .camera-thumb button {
      position: absolute;
      right: 5px;
      top: 5px;
      min-height: 28px;
      border: 0;
      border-radius: 999px;
      background: rgba(147, 31, 31, .9);
      color: #fff;
      font-weight: 900;
      cursor: pointer;
    }

    @media (max-width: 1100px) {
      .temp-machine-grid { grid-template-columns: repeat(2, minmax(210px, 1fr)); }
      .temperature-detail-grid { grid-template-columns: 1fr; }
      .temp-history-filters { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
      .temp-manage-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    }

    @media (max-width: 720px) {
      .temperature-hero { align-items: stretch; flex-direction: column; }
      .temperature-actions { justify-content: stretch; }
      .temperature-actions .btn { flex: 1 1 160px; }
      .temp-machine-grid,
      .temp-history-filters,
      .temp-manage-row { grid-template-columns: 1fr; }
    }

    table {
      width: 100%;
      border-collapse: collapse;
      border: 1px solid var(--line);
      border-radius: 8px;
      overflow: hidden;
      background: #fff;
    }

    th, td {
      padding: 10px;
      border-bottom: 1px solid var(--line);
      text-align: left;
      vertical-align: top;
      font-size: 14px;
    }

    th {
      background: #f6f9fa;
      color: var(--muted);
      font-size: 12px;
      text-transform: uppercase;
    }

    tr:last-child td { border-bottom: 0; }

    .file-preview {
      display: inline-grid;
      gap: 5px;
      color: var(--blue);
      text-decoration: none;
      max-width: 130px;
    }

    .file-preview img {
      width: 84px;
      height: 84px;
      object-fit: cover;
      border-radius: 8px;
      border: 1px solid var(--line);
      background: #f6f9fa;
    }

    .file-preview span,
    .file-link span {
      font-size: 12px;
      line-height: 1.25;
      word-break: break-word;
    }

    .file-link {
      display: inline-grid;
      gap: 2px;
      color: var(--blue);
      text-decoration: none;
      font-weight: 700;
    }

    .pill {
      display: inline-grid;
      place-items: center;
      min-height: 25px;
      border-radius: 999px;
      padding: 4px 9px;
      font-size: 12px;
      font-weight: 700;
      white-space: nowrap;
    }

    .pill.ok { color: var(--green); background: var(--soft-green); }
    .pill.info { color: var(--blue); background: var(--soft-blue); }
    .pill.warn { color: var(--amber); background: var(--soft-amber); }
    .pill.bad { color: var(--red); background: var(--soft-red); }

    .tablet-hero {
      display: flex;
      flex-direction: column;
      gap: 16px;
    }

    .status-board {
      background:
        radial-gradient(circle at 85% 0%, rgba(116, 214, 164, .3), transparent 42%),
        linear-gradient(120deg, #176f93, #174f3f 65%, #0e2832);
      color: #fff;
      border-radius: 8px;
      padding: 16px 20px;
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 14px 22px;
      box-shadow: var(--shadow);
      position: sticky;
      top: 18px;
      z-index: 2;
      transition: background .3s ease;
    }

    .status-board.state-ok {
      background:
        radial-gradient(circle at 85% 0%, rgba(120,220,170,.35), transparent 42%),
        linear-gradient(120deg, #12805e, #0f6e56 65%, #0b4a3a);
    }
    .status-board.state-warn {
      background:
        radial-gradient(circle at 85% 0%, rgba(250,200,110,.32), transparent 42%),
        linear-gradient(120deg, #b9781a, #8f5a10 65%, #5f3c08);
    }
    .status-board.state-bad {
      background:
        radial-gradient(circle at 85% 0%, rgba(240,150,150,.32), transparent 42%),
        linear-gradient(120deg, #a83232, #7f2222 65%, #571616);
    }

    .status-board-brand {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .home-logo {
      width: 46px;
      height: 46px;
      border-radius: 12px;
      object-fit: contain;
      background: rgba(255,255,255,.92);
      padding: 4px;
      flex: 0 0 auto;
    }

    .status-board-clock {
      display: flex;
      align-items: baseline;
      gap: 8px;
    }

    .status-board-summary {
      flex: 1 1 160px;
      color: rgba(255,255,255,.85);
    }

    .status-board-actions {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-left: auto;
    }

    .status-hide {
      border-color: rgba(255,255,255,.38);
      color: #fff;
      background: rgba(255,255,255,.12);
      padding: 8px 12px;
      min-height: 36px;
    }

    #showStatusBoard {
      display: none;
      margin-bottom: 12px;
      width: fit-content;
    }

    #home.status-panel-hidden #showStatusBoard {
      display: inline-flex;
    }

    #home.status-panel-hidden .status-board {
      display: none;
    }

    .status-board .time {
      font-size: 22px;
      font-weight: 800;
      line-height: 1;
    }

    .status-ring {
      width: 40px;
      height: 40px;
      border: 3px solid rgba(255,255,255,.38);
      border-radius: 999px;
      display: grid;
      place-items: center;
      text-align: center;
      font-weight: 800;
      font-size: 13px;
      flex: 0 0 auto;
    }

    .status-board small { color: rgba(255,255,255,.78); }

    .today-checks {
      display: grid;
      gap: 8px;
      margin-top: 12px;
    }

    .today-check {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 13px 14px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fff;
      font-size: 14px;
      box-shadow: 0 4px 14px rgba(17, 36, 43, .04);
    }

    .today-check strong {
      color: var(--text);
      font-size: 14px;
    }

    .today-check small {
      color: var(--muted);
      display: block;
      margin-top: 2px;
    }

    .tablet-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(180px, 1fr));
      gap: 18px;
    }

    .quick-actions {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 12px;
      margin-bottom: 16px;
    }

    .quick-action {
      min-height: 74px;
      border: 1px solid rgba(198, 215, 224, .9);
      background: linear-gradient(145deg, #fff, #f6fbfd);
      border-radius: 8px;
      padding: 13px;
      display: flex;
      align-items: center;
      gap: 12px;
      cursor: pointer;
      color: var(--ink);
      text-align: left;
      box-shadow: var(--shadow-soft);
    }

    .quick-action:hover {
      border-color: #90c8b0;
      box-shadow: var(--shadow);
      transform: translateY(-1px);
    }

    .quick-action span {
      width: 44px;
      height: 44px;
      border-radius: 8px;
      display: grid;
      place-items: center;
      background: var(--soft-green);
      color: var(--green);
      font-weight: 900;
      flex: 0 0 auto;
    }

    .quick-action strong,
    .quick-action small {
      display: block;
    }

    .quick-action strong {
      font-size: 15px;
      line-height: 1.1;
    }

    .quick-action small {
      margin-top: 3px;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.2;
    }

    .tile-button {
      border: 1px solid rgba(188, 207, 216, .95);
      background:
        linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,251,253,.96)),
        #fff;
      border-radius: 8px;
      min-height: 210px;
      padding: 13px;
      display: grid;
      align-content: start;
      justify-items: start;
      gap: 10px;
      cursor: pointer;
      color: var(--ink);
      text-align: left;
      box-shadow: var(--shadow-soft);
      position: relative;
      overflow: hidden;
      touch-action: manipulation;
    }

    .tile-button:hover {
      border-color: #90c8b0;
      background: #ffffff;
      transform: translateY(-2px);
      box-shadow: var(--shadow);
    }

    .tile-icon {
      width: 100%;
      height: 138px;
      border-radius: 8px;
      display: block;
      background:
        radial-gradient(circle at 72% 24%, rgba(255,255,255,.92), transparent 28%),
        linear-gradient(145deg, #dff2ff, #f8fcff);
      color: #10639d;
      font-size: 42px;
      font-weight: 800;
      position: relative;
      overflow: hidden;
      isolation: isolate;
    }

    .tile-icon img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .tile-button strong {
      position: absolute;
      left: 24px;
      right: 24px;
      top: 116px;
      min-height: 42px;
      display: grid;
      place-items: center;
      text-align: center;
      font-size: 16px;
      line-height: 1.1;
      padding: 9px 12px;
      color: #fff;
      background: linear-gradient(135deg, #17303b, var(--green));
      border-radius: 8px;
      box-shadow: 0 10px 22px rgba(16, 44, 54, .2);
      z-index: 2;
    }

    .tile-button small {
      color: var(--muted);
      line-height: 1.25;
      padding: 38px 4px 2px;
      font-weight: 700;
      min-height: 62px;
    }

    .tile-badge {
      position: absolute;
      top: 18px;
      right: 18px;
      min-width: 34px;
      min-height: 28px;
      padding: 5px 9px;
      display: grid;
      place-items: center;
      border-radius: 999px;
      color: #fff;
      background: var(--green-2);
      font-weight: 900;
      font-size: 13px;
      box-shadow: 0 8px 18px rgba(16, 44, 54, .2);
      z-index: 3;
    }

    .tile-badge.warn { background: var(--amber); }
    .tile-badge.bad { background: var(--red); }

    .tile-button.urgent .tile-icon { background: var(--soft-amber); color: var(--amber); }
    .tile-button.good .tile-icon { background: var(--soft-green); color: var(--green); }
    .tile-button.bad .tile-icon { background: var(--soft-red); color: var(--red); }

    .pest-menu {
      display: grid;
      gap: 12px;
      margin-bottom: 16px;
    }

    .pest-menu button {
      min-height: 92px;
      border: 1px solid #c9dce4;
      border-radius: 8px;
      background: #f8fcfd;
      color: var(--ink);
      display: grid;
      grid-template-columns: 58px minmax(0, 1fr) auto;
      align-items: center;
      gap: 14px;
      padding: 14px;
      text-align: left;
      cursor: pointer;
      box-shadow: var(--shadow-soft);
    }

    .pest-icon {
      width: 58px;
      height: 58px;
      border-radius: 8px;
      display: grid;
      place-items: center;
      background: #e9f1f4;
      color: var(--ink);
      font-size: 26px;
      font-weight: 900;
    }

    .pest-menu strong,
    .pest-menu small {
      display: block;
    }

    .pest-menu strong {
      font-size: 21px;
      line-height: 1.1;
    }

    .pest-menu small {
      margin-top: 4px;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.25;
    }

    .pest-panel.hidden {
      display: none;
    }

    .pest-panel:not(.hidden) {
      position: fixed;
      z-index: 94;
      left: 50%;
      top: 50%;
      width: min(760px, calc(100vw - 24px));
      max-height: calc(100vh - 32px);
      overflow-y: auto;
      transform: translate(-50%, -50%);
      padding: 18px;
      box-shadow: 0 24px 70px rgba(15, 43, 55, .32);
    }

    .pest-panel:not(.hidden)::before {
      content: "";
      position: fixed;
      inset: -100vmax;
      background: rgba(10, 35, 45, .42);
      z-index: -1;
    }

    .pest-summary {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
      margin-bottom: 16px;
    }

    .pest-summary div {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fff;
      padding: 14px;
      box-shadow: var(--shadow-soft);
    }

    .pest-summary span {
      color: var(--muted);
      display: block;
      font-size: 13px;
      margin-bottom: 4px;
    }

    .pest-summary strong {
      font-size: 28px;
      line-height: 1;
    }

    .dashboard-alerts {
      display: grid;
      gap: 8px;
    }

    .dashboard-alert {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 12px 14px;
      border-radius: 8px;
      border: 1px solid var(--line);
      background: #fff;
      font-weight: 800;
    }

    .dashboard-alert.ok { background: var(--soft-green); border-color: #bfe7ce; color: #126a44; }
    .dashboard-alert.warn { background: var(--soft-amber); border-color: #f2d28c; color: #8a5300; }
    .dashboard-alert.bad { background: var(--soft-red); border-color: #f2b8b2; color: #a73028; }

    .tile-status {
      margin-top: 4px;
      display: inline-flex;
      justify-content: center;
      border-radius: 999px;
      padding: 6px 10px;
      font-size: 12px;
      font-weight: 900;
      background: var(--soft-green);
      color: var(--green);
    }

    .tile-status.bad,
    .tile-status.todo {
      background: var(--soft-red);
      color: var(--red);
    }

    .doc-toolbar {
      display: grid;
      grid-template-columns: minmax(220px, 1fr) auto;
      gap: 12px;
      align-items: end;
      margin-bottom: 14px;
    }

    .doc-filter-row {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-bottom: 14px;
    }

    .doc-filter-row .btn.active {
      background: var(--green);
      color: #fff;
      border-color: var(--green);
    }

    .doc-category {
      border: 1px solid #c7dcec;
      border-radius: 8px;
      overflow: hidden;
      background: #fff;
      margin-bottom: 10px;
    }

    .doc-category-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 12px 14px;
      background: #eaf5ff;
      color: #10639d;
      font-weight: 800;
      border-bottom: 1px solid #c7dcec;
      cursor: pointer;
      width: 100%;
      border-left: 0;
      border-right: 0;
      border-top: 0;
      text-align: left;
    }

    .doc-category-head span {
      display: inline-flex;
      align-items: center;
      gap: 9px;
    }

    .doc-list-title {
      padding: 9px 14px;
      background: #fbfdff;
      border-bottom: 1px solid var(--line);
      color: var(--muted);
      font-size: 12px;
      font-weight: 800;
    }

    .doc-row {
      display: grid;
      grid-template-columns: 38px 92px minmax(0, 1fr) auto auto 26px;
      align-items: center;
      gap: 10px;
      min-height: 42px;
      padding: 8px 12px;
      border-bottom: 1px solid var(--line);
      color: var(--ink);
      text-decoration: none;
    }

    .doc-row:last-child { border-bottom: 0; }

    .doc-row:hover { background: #f6fbff; }

    .doc-icon { color: var(--green); font-weight: 800; }
    .doc-date { font-weight: 700; font-size: 13px; color: #314653; }
    .doc-title { min-width: 0; }
    .doc-title strong { display: block; font-size: 13px; }
    .doc-title small { color: var(--muted); }
    .doc-arrow { color: var(--muted); font-size: 20px; text-align: right; }
    .doc-delete {
      min-height: 28px;
      padding: 4px 8px;
      font-size: 12px;
    }

    .doc-card {
      display: grid;
      gap: 8px;
      padding: 12px;
      border-bottom: 1px solid var(--line);
      background: #fff;
    }

    .doc-card:last-child { border-bottom: 0; }

    .doc-card-head {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      align-items: start;
    }

    .doc-card-head strong { font-size: 16px; }
    .doc-card-head small { color: var(--muted); display: block; margin-top: 3px; }

    .doc-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .doc-drop-zone {
      border: 2px dashed #b8ceda;
      border-radius: 8px;
      padding: 18px;
      text-align: center;
      background: #f8fbfd;
      color: var(--muted);
      font-weight: 800;
    }

    .doc-drop-zone.dragging {
      border-color: var(--green);
      background: var(--soft-green);
      color: var(--green);
    }

    .doc-file-name {
      color: var(--muted);
      font-size: 13px;
      font-weight: 800;
      min-height: 18px;
    }

    .doc-modal-actions {
      display: flex;
      flex-wrap: wrap;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 8px;
    }

    @media (max-width: 760px) {
      .doc-toolbar {
        grid-template-columns: 1fr;
      }

      .doc-row {
        grid-template-columns: 22px 78px minmax(0, 1fr) auto;
      }

      .doc-row .pill { display: none; }
      .doc-arrow { display: none; }
    }

    .label-preview {
      border: 2px dashed #8aa1ad;
      background: #fff;
      border-radius: 8px;
      padding: 14px;
      display: grid;
      gap: 7px;
      min-height: 210px;
    }

    .lot {
      font-family: "Courier New", monospace;
      font-size: 19px;
      font-weight: 800;
    }

    .empty {
      color: var(--muted);
      padding: 18px;
      text-align: center;
      border: 1px dashed var(--line);
      border-radius: 8px;
      background: #fbfcfd;
    }

    .photo-modal {
      position: fixed;
      inset: 0;
      display: none;
      place-items: center;
      background: rgba(8, 22, 30, .72);
      z-index: 20;
      padding: 20px;
    }

    .photo-modal.show { display: grid; }

    .responsible-pick-list {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
    }
    .responsible-pick-list .responsible-option {
      min-height: 46px;
      padding: 10px 18px;
      font-size: 15px;
    }

    .photo-box {
      width: min(920px, 96vw);
      max-height: 92vh;
      background: #fff;
      border-radius: 8px;
      padding: 12px;
      display: grid;
      gap: 10px;
      box-shadow: 0 18px 44px rgba(0,0,0,.3);
    }

    .photo-zoom-wrap {
      overflow: auto;
      max-height: 74vh;
      display: grid;
      place-items: center;
      -webkit-overflow-scrolling: touch;
      touch-action: pan-x pan-y;
    }

    #photoModalImage {
      max-width: 100%;
      max-height: 72vh;
      object-fit: contain;
      margin: auto;
      cursor: zoom-in;
      user-select: none;
    }
    #photoModalImage.zoom-2 {
      max-width: none;
      max-height: none;
      width: 200%;
      height: auto;
      object-fit: initial;
    }
    #photoModalImage.zoom-3 {
      max-width: none;
      max-height: none;
      width: 330%;
      height: auto;
      object-fit: initial;
      cursor: zoom-out;
    }

    .label-print-modal {
      position: fixed;
      inset: 0;
      display: none;
      place-items: center;
      padding: 16px;
      background: rgba(7, 19, 26, .72);
      z-index: 40;
    }

    .label-print-modal.show { display: grid; }

    .label-print-box {
      width: min(680px, 96vw);
      max-height: 94vh;
      overflow: auto;
      background: #fff;
      border-radius: 8px;
      box-shadow: 0 18px 44px rgba(0,0,0,.32);
      padding: 14px;
      display: grid;
      gap: 12px;
    }

    .label-print-preview-wrap {
      display: grid;
      place-items: center;
      min-height: 210px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: #eef4f7;
      padding: 16px;
      overflow: auto;
    }

    .label-print-preview {
      display: grid;
      align-content: center;
      background: #fff;
      color: #000;
      border: 1px solid #111;
      overflow: hidden;
      font-family: Arial, sans-serif;
      box-shadow: 0 10px 24px rgba(24, 36, 47, .16);
    }

    .label-print-preview strong {
      line-height: 1.05;
      text-transform: uppercase;
    }

    .label-print-preview span { line-height: 1.05; }

    .label-print-preview .lot { font-weight: 900; }

    .label-print-preview .label-code {
      border: 1px solid #111;
      display: inline-block;
      font-family: "Arial Narrow", Arial, sans-serif;
      font-weight: 900;
      letter-spacing: .04em;
      padding: .35mm .5mm;
      text-align: center;
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .label-print-preview .full-info {
      white-space: normal;
      overflow: hidden;
    }

    .label-print-preview .back-info,
    .label-print-preview .back-storage,
    .label-print-preview .back-address {
      line-height: 1.02;
      overflow: hidden;
    }

    .label-print-preview .back-title {
      font-weight: 900;
      text-transform: uppercase;
      border-bottom: 1px solid #111;
      padding-bottom: .4mm;
    }

    .label-print-preview .allergens {
      font-weight: 900;
      text-transform: uppercase;
      border: 1px solid #111;
      padding: .8mm;
      line-height: 1.02;
    }

    .label-print-preview.polono-small {
      width: 40mm;
      height: 30mm;
      padding: 1.4mm;
      gap: .45mm;
      align-content: start;
    }

    .label-print-preview.polono-small strong { font-size: 7.2pt; }
    .label-print-preview.polono-small span { font-size: 5.5pt; }
    .label-print-preview.polono-small .lot { font-size: 6.5pt; }
    .label-print-preview.polono-small .business,
    .label-print-preview.polono-small .type,
    .label-print-preview.polono-small .made,
    .label-print-preview.polono-small .creator,
    .label-print-preview.polono-small .full-info,
    .label-print-preview.polono-small .address,
    .label-print-preview.polono-small .weight,
    .label-print-preview.polono-small .storage { display: none; }
    .label-print-preview.polono-small .allergens { font-size: 4.8pt; padding: .55mm; }
    .label-print-preview.polono-small .back-title { font-size: 5.4pt; }
    .label-print-preview.polono-small .back-info,
    .label-print-preview.polono-small .back-storage,
    .label-print-preview.polono-small .back-address { font-size: 5.1pt; }

    .label-print-preview.polono-medium {
      width: 50mm;
      height: 30mm;
      padding: 2mm;
      gap: .75mm;
      align-content: start;
    }

    .label-print-preview.polono-medium strong { font-size: 8.8pt; }
    .label-print-preview.polono-medium span { font-size: 6.2pt; }
    .label-print-preview.polono-medium .lot { font-size: 7.8pt; }
    .label-print-preview.polono-medium .creator,
    .label-print-preview.polono-medium .full-info,
    .label-print-preview.polono-medium .address { display: none; }
    .label-print-preview.polono-medium .allergens { font-size: 5.8pt; padding: .65mm; }
    .label-print-preview.polono-medium .back-title { font-size: 6.2pt; }
    .label-print-preview.polono-medium .back-info,
    .label-print-preview.polono-medium .back-storage,
    .label-print-preview.polono-medium .back-address { font-size: 6.1pt; }

    .label-print-preview.polono-wide {
      width: 50mm;
      height: 40mm;
      padding: 2.4mm;
      gap: .9mm;
      align-content: start;
    }

    .label-print-preview.polono-wide strong { font-size: 10pt; }
    .label-print-preview.polono-wide span { font-size: 6.8pt; }
    .label-print-preview.polono-wide .lot { font-size: 8.8pt; }
    .label-print-preview.polono-wide .creator,
    .label-print-preview.polono-wide .full-info,
    .label-print-preview.polono-wide .address { display: none; }
    .label-print-preview.polono-wide .allergens { font-size: 6.2pt; padding: .7mm; }
    .label-print-preview.polono-wide .back-title { font-size: 6.8pt; }
    .label-print-preview.polono-wide .back-info,
    .label-print-preview.polono-wide .back-storage,
    .label-print-preview.polono-wide .back-address { font-size: 6.4pt; }

    .label-print-preview.polono-large {
      width: 80mm;
      height: 50mm;
      padding: 4mm;
      gap: 2.5mm;
    }

    .label-print-preview.polono-large strong { font-size: 17pt; }
    .label-print-preview.polono-large span { font-size: 10.5pt; }
    .label-print-preview.polono-large .lot { font-size: 15pt; }

    .hidden,
    [data-role-hidden="true"] { display: none !important; }

    .role-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 10px;
      margin: 10px 0 14px;
    }

    .role-card {
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 10px;
      background: #f8fbfc;
      cursor: pointer;
      transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
    }

    .role-card strong {
      display: block;
      color: var(--ink);
      margin-bottom: 4px;
    }

    .role-card small {
      display: block;
      color: var(--muted);
      line-height: 1.35;
    }

    .role-card.active {
      border-color: rgba(21, 138, 87, .45);
      background: #e9f7ef;
      box-shadow: inset 0 0 0 1px rgba(21, 138, 87, .16);
    }

    .role-card.readonly {
      background: #fff8e8;
      border-color: rgba(185, 122, 20, .28);
    }

    .role-help {
      color: var(--muted);
      font-size: 13px;
      line-height: 1.45;
    }

    .user-admin-shell {
      display: grid;
      gap: 12px;
    }

    .user-stats {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 10px;
    }

    .user-stat {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: linear-gradient(135deg, #fff, #f4fafb);
      padding: 12px;
      display: grid;
      gap: 5px;
    }

    .user-stat small {
      color: var(--muted);
      font-weight: 900;
      text-transform: uppercase;
      font-size: 11px;
      letter-spacing: .03em;
    }

    .user-stat strong {
      font-size: 22px;
      line-height: 1;
    }

    .operator-cards {
      display: grid;
      grid-template-columns: repeat(2, minmax(260px, 1fr));
      gap: 12px;
    }

    .operator-card {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fff;
      padding: 13px;
      display: grid;
      gap: 10px;
      box-shadow: var(--shadow-soft);
    }

    .operator-card.active-user {
      border-color: rgba(21, 138, 87, .42);
      box-shadow: inset 0 0 0 1px rgba(21, 138, 87, .12), var(--shadow-soft);
    }

    .operator-card-head {
      display: grid;
      grid-template-columns: 42px minmax(0, 1fr) auto;
      gap: 10px;
      align-items: center;
    }

    .operator-avatar {
      width: 42px;
      height: 42px;
      border-radius: 8px;
      display: grid;
      place-items: center;
      background: #eef7fa;
      color: var(--green);
      font-weight: 900;
      border: 1px solid #d6e7ed;
    }

    .operator-card strong {
      display: block;
      font-size: 17px;
      line-height: 1.15;
      overflow-wrap: anywhere;
    }

    .operator-card small {
      display: block;
      color: var(--muted);
      font-weight: 700;
      overflow-wrap: anywhere;
    }

    .operator-card-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 7px;
    }

    .operator-modal-grid {
      display: grid;
      gap: 11px;
    }

    @media (max-width: 760px) {
      .role-grid { grid-template-columns: 1fr; }
      .user-stats,
      .operator-cards { grid-template-columns: 1fr; }
    }

    .lock-screen {
      position: fixed;
      inset: 0;
      display: none;
      place-items: center;
      padding: 22px;
      background: rgba(15, 35, 45, .82);
      backdrop-filter: blur(8px);
      z-index: 80;
    }

    .lock-screen.show { display: grid; }

    .lock-box {
      width: min(420px, 100%);
      background: #fff;
      border-radius: 8px;
      padding: 22px;
      box-shadow: 0 24px 70px rgba(0,0,0,.28);
    }

    .online-login-box {
      width: min(520px, 100%);
    }
    #loginFormFields.hidden,
    #loginConnectionProblem.hidden {
      display: none !important;
    }

    .product-template-list {
      display: grid;
      gap: 8px;
    }

    .product-template-row {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 10px;
      align-items: center;
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 10px;
      background: #fff;
    }

    .product-template-row small {
      color: var(--muted);
      display: block;
      margin-top: 3px;
    }

    .lot-ingredient-box {
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 12px;
      background: #f8fbff;
      margin: 4px 0 6px;
    }

    .lot-ingredient-box h3 {
      margin: 0;
      font-size: 15px;
    }

    .lot-ing-list { display: flex; flex-direction: column; gap: 8px; }

    .lot-ingredient-row {
      display: flex;
      flex-direction: column;
      gap: 8px;
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: #fff;
    }

    .lot-ing-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }

    .lot-ing-head strong { font-size: 15px; }

    .lot-ing-remove {
      border: 1px solid var(--line);
      background: #fff;
      color: var(--red, #c0392b);
      border-radius: 8px;
      width: 34px;
      height: 34px;
      font-size: 15px;
      cursor: pointer;
      flex: none;
    }

    .lot-ingredient-row .lot-ing-lotto { width: 100%; }

    .lot-ing-photo {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 10px;
    }

    .lot-ing-photo-btn { min-height: 44px; padding: 8px 16px; font-size: 14px; }

    .lot-ing-photo-state { font-size: 13px; font-weight: 600; }
    .lot-ing-photo-state.ok { color: var(--green, #158a57); }
    .lot-ing-photo-state.pending { color: #b8860b; }

    .lot-ing-thumb {
      width: 46px;
      height: 46px;
      object-fit: cover;
      border-radius: 8px;
      border: 1px solid var(--line);
    }

    .lot-ing-add {
      display: flex;
      gap: 8px;
      margin-top: 12px;
      flex-wrap: wrap;
    }

    .lot-ing-add input { flex: 1 1 180px; }
    .lot-ing-add .btn { min-height: 44px; }

    .toast {
      position: fixed;
      right: 18px;
      bottom: 18px;
      max-width: min(360px, calc(100vw - 36px));
      background: #17303b;
      color: #fff;
      border-radius: 8px;
      padding: 12px 14px;
      box-shadow: 0 14px 35px rgba(24, 36, 47, .25);
      z-index: 20;
      opacity: 0;
      transform: translateY(10px);
      pointer-events: none;
      transition: opacity .2s ease, transform .2s ease;
      font-weight: 700;
    }

    .toast.show {
      opacity: 1;
      transform: translateY(0);
    }

    .toast.ok {
      background: #18794e;
    }

    .print-register {
      display: none;
    }

    @media print {
      body * { visibility: hidden; }
      body.print-label .print-label-sheet,
      body.print-label .print-label-sheet * {
        visibility: visible;
      }

      body.print-label .print-label-sheet {
        display: grid;
        gap: 7px;
        position: fixed;
        left: 12mm;
        top: 12mm;
        width: 80mm;
        min-height: auto;
        border: 1px solid #000;
        border-radius: 0;
        padding: 8mm;
        box-shadow: none;
        background: #fff;
        color: #000;
      }

      body.print-polono .print-label-sheet,
      body.print-polono .print-label-sheet * {
        visibility: visible;
      }

      body.print-polono .print-label-sheet {
        display: grid;
        gap: 2.5mm;
        position: fixed;
        left: 0;
        top: 0;
        width: 80mm;
        height: 50mm;
        border: 0;
        border-radius: 0;
        padding: 4mm;
        box-shadow: none;
        background: #fff;
        color: #000;
        font-family: Arial, Helvetica, sans-serif;
        overflow: hidden;
      }

      body.print-polono .print-label-sheet strong {
        font-size: 17pt;
        line-height: 1.05;
        text-transform: uppercase;
      }

      body.print-polono .print-label-sheet span {
        font-size: 10.5pt;
        line-height: 1.05;
      }

      body.print-polono .print-label-sheet .lot {
        font-size: 15pt;
        font-weight: 900;
      }

      body.print-polono .print-label-sheet .allergens {
        font-weight: 900;
        text-transform: uppercase;
        border: 1px solid #111;
        padding: .8mm;
        line-height: 1.02;
      }

      body.print-polono .print-label-sheet .back-title {
        font-weight: 900;
        text-transform: uppercase;
        border-bottom: 1px solid #111;
        padding-bottom: .4mm;
      }

      body.print-polono.polono-small .print-label-sheet {
        width: 40mm;
        height: 30mm;
        padding: 1.4mm;
        gap: .45mm;
        align-content: start;
      }

      body.print-polono.polono-small .print-label-sheet strong {
        font-size: 7.2pt;
      }

      body.print-polono.polono-small .print-label-sheet span {
        font-size: 5.5pt;
      }

      body.print-polono.polono-small .print-label-sheet .lot {
        font-size: 6.5pt;
      }

      body.print-polono.polono-small .print-label-sheet .allergens {
        font-size: 4.8pt;
        padding: .55mm;
      }

      body.print-polono.polono-small .print-label-sheet .back-title {
        font-size: 5.4pt;
      }

      body.print-polono.polono-small .print-label-sheet .back-info,
      body.print-polono.polono-small .print-label-sheet .back-storage,
      body.print-polono.polono-small .print-label-sheet .back-address {
        font-size: 5.1pt;
      }

      body.print-polono.polono-small .print-label-sheet .business,
      body.print-polono.polono-small .print-label-sheet .type,
      body.print-polono.polono-small .print-label-sheet .made,
      body.print-polono.polono-small .print-label-sheet .creator,
      body.print-polono.polono-small .print-label-sheet .full-info,
      body.print-polono.polono-small .print-label-sheet .address,
      body.print-polono.polono-small .print-label-sheet .weight,
      body.print-polono.polono-small .print-label-sheet .storage {
        display: none;
      }

      body.print-polono.polono-medium .print-label-sheet {
        width: 50mm;
        height: 30mm;
        padding: 2mm;
        gap: .75mm;
        align-content: start;
      }

      body.print-polono.polono-medium .print-label-sheet strong {
        font-size: 8.8pt;
      }

      body.print-polono.polono-medium .print-label-sheet span {
        font-size: 6.2pt;
      }

      body.print-polono.polono-medium .print-label-sheet .lot {
        font-size: 7.8pt;
      }

      body.print-polono.polono-medium .print-label-sheet .allergens {
        font-size: 5.8pt;
        padding: .65mm;
      }

      body.print-polono.polono-medium .print-label-sheet .back-title {
        font-size: 6.2pt;
      }

      body.print-polono.polono-medium .print-label-sheet .back-info,
      body.print-polono.polono-medium .print-label-sheet .back-storage,
      body.print-polono.polono-medium .print-label-sheet .back-address {
        font-size: 6.1pt;
      }

      body.print-polono.polono-medium .print-label-sheet .creator,
      body.print-polono.polono-medium .print-label-sheet .full-info,
      body.print-polono.polono-medium .print-label-sheet .address {
        display: none;
      }

      body.print-polono.polono-wide .print-label-sheet {
        width: 50mm;
        height: 40mm;
        padding: 2.4mm;
        gap: .9mm;
        align-content: start;
      }

      body.print-polono.polono-wide .print-label-sheet strong {
        font-size: 10pt;
      }

      body.print-polono.polono-wide .print-label-sheet span {
        font-size: 6.8pt;
      }

      body.print-polono.polono-wide .print-label-sheet .lot {
        font-size: 8.8pt;
      }

      body.print-polono.polono-wide .print-label-sheet .allergens {
        font-size: 6.2pt;
        padding: .7mm;
      }

      body.print-polono.polono-wide .print-label-sheet .creator,
      body.print-polono.polono-wide .print-label-sheet .full-info,
      body.print-polono.polono-wide .print-label-sheet .address {
        display: none;
      }

      body.print-polono.polono-large .print-label-sheet {
        width: 62mm;
        height: 30mm;
        padding: 2mm;
        gap: .6mm;
        align-content: start;
      }

      body.print-polono.polono-large .print-label-sheet strong {
        font-size: 9.6pt;
      }

      body.print-polono.polono-large .print-label-sheet span {
        font-size: 6.4pt;
      }

      body.print-polono.polono-large .print-label-sheet .lot {
        font-size: 8.2pt;
      }

      body.print-polono.polono-large .print-label-sheet .allergens {
        font-size: 5.8pt;
        padding: .6mm;
      }

      body.print-polono.polono-large .print-label-sheet .creator,
      body.print-polono.polono-large .print-label-sheet .full-info,
      body.print-polono.polono-large .print-label-sheet .address {
        display: none;
      }

      body.print-register-mode .print-register,
      body.print-register-mode .print-register * {
        visibility: visible;
      }

      body.print-register-mode .print-register {
        display: block;
        position: fixed;
        inset: 0;
        color: #000;
        background: #fff;
        font-size: 11pt;
        line-height: 1.35;
        font-family: Arial, Helvetica, sans-serif;
      }

      body.print-register-mode.print-report-landscape .print-register {
        width: 100%;
        min-height: auto;
      }

      body.print-register-mode.print-report-portrait .print-register {
        width: 100%;
        min-height: auto;
      }

      body.print-register-mode .report-header {
        display: grid;
        gap: 3px;
        padding-bottom: 8px;
        border-bottom: 2px solid #111;
        margin-bottom: 10px;
      }

      body.print-register-mode .report-header h1 {
        margin: 0;
        font-size: 18pt;
      }

      body.print-register-mode .report-section {
        break-before: page;
        page-break-before: always;
      }

      body.print-register-mode .report-section:first-of-type {
        break-before: auto;
        page-break-before: auto;
      }

      body.print-register-mode .report-section h2 {
        margin: 0 0 8px;
        font-size: 14pt;
      }

      body.print-register-mode .print-register table {
        width: 100%;
        border-collapse: collapse;
        table-layout: fixed;
        margin-bottom: 8mm;
      }

      body.print-register-mode .print-register th,
      body.print-register-mode .print-register td {
        border: 1px solid #000;
        padding: 2mm;
        color: #000;
        vertical-align: top;
        word-break: break-word;
        overflow-wrap: anywhere;
      }

      body.print-register-mode .print-register th {
        background: #f1f1f1;
        font-weight: 900;
      }

      body.print-register-mode .print-register thead {
        display: table-header-group;
      }

      body.print-register-mode .print-register tr {
        break-inside: avoid;
        page-break-inside: avoid;
      }

      @page {
        size: A4 portrait;
        margin: 12mm;
      }
    }

    @media (max-width: 980px) {
      .app { grid-template-columns: 1fr; }
      aside { min-height: auto; }
      nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .cards, .layout, .split { grid-template-columns: 1fr; }
      .status-board { flex-direction: column; align-items: stretch; }
      .status-board-actions { margin-left: 0; }
      .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .tablet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      header { flex-direction: column; }
      .actions { justify-content: flex-start; }
    }

    @media (max-width: 560px) {
      .quick-actions { grid-template-columns: 1fr; }
      .tablet-grid { grid-template-columns: 1fr; }
      .tile-button { min-height: 120px; }
    }

/* ============================================================ */
/* === Tutorial guidato (tour passo-passo stile coach-mark) === */
/* ============================================================ */
#tourOverlay {
  position: fixed;
  inset: 0;
  z-index: 75;
  display: none;
}
#tourOverlay.show { display: block; }
#tourOverlay.tour-center { background: rgba(10, 28, 38, .62); }

.tour-highlight {
  position: fixed;
  border-radius: 12px;
  box-shadow: 0 0 0 200vmax rgba(10, 28, 38, .62), 0 0 0 4px rgba(255, 255, 255, .85), 0 0 22px rgba(0, 0, 0, .45);
  transition: top .28s ease, left .28s ease, width .28s ease, height .28s ease;
  pointer-events: none;
}
#tourOverlay.tour-center .tour-highlight { display: none; }

.tour-tooltip {
  position: fixed;
  width: min(320px, calc(100vw - 32px));
  background: #10222c;
  color: #fff;
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
  transition: top .28s ease, left .28s ease;
}
.tour-tooltip::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: #10222c;
  transform: rotate(45deg);
  top: 22px;
  left: -6px;
}
#tourOverlay.tour-center .tour-tooltip::before,
.tour-tooltip.tour-arrow-none::before { display: none; }
.tour-tooltip.tour-arrow-top::before { top: -6px; left: 26px; }

.tour-tooltip strong {
  display: block;
  font-size: 17px;
  margin-bottom: 6px;
}
.tour-tooltip p {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.45;
  color: #d7e5ec;
}
.tour-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tour-step-count {
  margin-right: auto;
  font-size: 12px;
  font-weight: 800;
  color: #9fc0cf;
}
.tour-actions .btn.tour-skip {
  background: transparent;
  color: #cfe1ea;
  border: 1px solid rgba(255, 255, 255, .35);
}
.tour-actions .btn.tour-next {
  background: var(--green, #1f9d61);
  color: #fff;
  border: none;
}

/* Tastierino numerico per le date (scadenza) - grande e pulito */
.numpad-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 36, 43, .38);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 4000;
}
.numpad-overlay[hidden] { display: none; }
.numpad {
  background: var(--panel, #fff);
  width: 100%;
  max-width: 440px;
  border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 34px rgba(17, 36, 43, .22);
}
.numpad-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.numpad-title { font-weight: 700; color: var(--muted, #687887); font-size: 14px; }
.numpad-close {
  border: none;
  background: transparent;
  color: var(--muted, #687887);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}
.numpad-display {
  font-size: 30px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 3px;
  padding: 6px 0 16px;
  color: var(--ink, #18242f);
  font-variant-numeric: tabular-nums;
}
.numpad-display .numpad-placeholder { color: var(--line, #c7d2d8); font-weight: 700; letter-spacing: 2px; }
.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.numpad-grid button {
  font-size: 26px;
  font-weight: 700;
  padding: 20px 0;
  border: 1px solid var(--line, #d9e2e8);
  border-radius: 14px;
  background: #f6faf8;
  color: var(--ink, #18242f);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.numpad-grid button:active { background: var(--soft-green, #e6f4ee); transform: translateY(1px); }
.numpad-grid button.numpad-ok {
  background: linear-gradient(135deg, var(--green, #174f3f), var(--green-2, #1d7a57));
  color: #fff;
  border-color: var(--green, #174f3f);
}
.numpad-grid button.numpad-back { font-size: 24px; }

/* Kiosk tablet: quando un modale e' aperto, blocca lo scroll dello sfondo */
body.modal-open { overflow: hidden; }
.temp-keypad-modal, .photo-modal, .label-print-modal,
.doc-modal, .operator-modal, .lot-camera-modal { overscroll-behavior: contain; }
