/* L'app sul computer (js/pc.js). Tutto vale solo da 1000 px in su: sul telefono non cambia niente. */
#pc-menu, #pc-cerca-apri { display: none; }

#pc-cerca { position: fixed; inset: 0; z-index: 80; background: rgba(8, 18, 30, .45); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
#pc-cerca .pc-box { width: 100%; max-width: 640px; max-height: 76vh; display: flex; flex-direction: column; background: var(--card); border-radius: 16px; box-shadow: 0 30px 70px rgba(0,0,0,.35); overflow: hidden; }
#pc-cerca input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 20px; font: inherit; font-size: 17px; background: transparent; color: var(--text); outline: none; width: 100%; }
#pc-cerca .pc-ris { overflow: auto; padding: 6px 8px; }
#pc-cerca .pc-ris p { padding: 8px 12px; }
#pc-cerca h4 { margin: 10px 12px 4px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
#pc-cerca button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text); font: inherit; padding: 9px 12px; border-radius: 10px; cursor: pointer; }
#pc-cerca button.on { background: var(--info-bg); }
#pc-cerca button .ic { width: 19px; height: 19px; color: var(--brand); flex: none; }
#pc-cerca button span { display: flex; flex-direction: column; min-width: 0; }
#pc-cerca button b { font-weight: 600; font-size: 14px; }
#pc-cerca button small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pc-cerca .pc-aiuto { border-top: 1px solid var(--line); padding: 8px 20px; font-size: 12px; color: var(--muted); }

@media (min-width: 1000px) {
  /* menu laterale completo al posto della barra in basso */
  body:has(#pc-menu) .bottomnav { display: none; }
  #pc-menu { display: block; position: fixed; z-index: 20; top: 61px; bottom: 0; left: 0; width: 240px; overflow-y: auto; overscroll-behavior: contain; background: var(--card); border-right: 1px solid var(--line); padding: 10px 10px 24px; scrollbar-width: thin; }
  #pc-menu a, #pc-menu .pc-gr > button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 12px; border-radius: 9px; color: var(--text); font-size: 14px; line-height: 1.25; }
  #pc-menu a:hover, #pc-menu .pc-gr > button:hover { background: var(--grey-bg); }
  #pc-menu a .ic { width: 18px; height: 18px; color: var(--muted); flex: none; }
  #pc-menu a.active { background: var(--info-bg); color: var(--brand); font-weight: 650; }
  #pc-menu a.active .ic { color: var(--brand); }
  #pc-menu a .dot { margin-left: auto; min-width: 20px; height: 20px; border-radius: 10px; background: var(--err); color: #fff; font-size: 11px; display: grid; place-items: center; padding: 0 5px; }
  #pc-menu .pc-gr { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
  #pc-menu .pc-gr > button { border: 0; background: transparent; font-family: inherit; cursor: pointer; justify-content: space-between; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); text-align: left; }
  #pc-menu .pc-gr > button i { font-style: normal; transition: transform .15s; transform: rotate(-90deg); }
  #pc-menu .pc-gr > div { display: none; }
  #pc-menu .pc-gr.aperto > div { display: block; }
  #pc-menu .pc-gr.aperto > button i { transform: none; }

  body:has(#pc-menu) main { margin-left: max(240px, calc(240px + (100vw - 240px - 1320px) / 2)); margin-right: 0; max-width: min(1320px, calc(100vw - 240px)); padding: 20px 32px 40px; }
  body:has(#pc-menu) main:has(.home-grid), body:has(#pc-menu) main:has(.sq-tab), body:has(#pc-menu) main:has(.gantt) { margin-left: 240px; max-width: none; }

  /* ricerca in alto */
  .topbar h1 { flex: 0 0 auto; min-width: 190px; max-width: 360px; font-size: 18px; }
  #pc-cerca-apri { display: flex; align-items: center; gap: 10px; flex: 0 1 460px; margin: 0 auto 0 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--grey-bg); color: var(--muted); font: inherit; font-size: 13.5px; cursor: pointer; }
  #pc-cerca-apri .ic { width: 17px; height: 17px; flex: none; }
  #pc-cerca-apri span { flex: 1; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  #pc-cerca-apri kbd { font: inherit; font-size: 11px; border: 1px solid var(--line); background: var(--card); border-radius: 5px; padding: 1px 6px; }
  #pc-cerca-apri:hover { border-color: var(--brand); }
  .topbar .mode-pill { margin-left: auto; }

  /* passaggio tra le schermate: la pagina resta visibile, con una barra che scorre in alto */
  main.pc-attesa { opacity: .55; pointer-events: none; transition: opacity .2s .15s; }
  body:has(main.pc-attesa)::before { content: ""; position: fixed; z-index: 30; top: 58px; left: 0; height: 3px; width: 35%; background: var(--logo-azzurro); animation: pc-scorre .9s ease-in-out infinite; }

  /* elenchi, tabelle e pulsanti reagiscono al mouse */
  .li.tap, a.li, .li[onclick] { cursor: pointer; transition: background .12s; }
  .li.tap:hover, a.li:hover, .li[onclick]:hover { background: var(--grey-bg); }
  .table-wrap tbody tr:hover, table.t tbody tr:hover { background: var(--grey-bg); }
  .btn:hover:not(:disabled), a.tile:hover, a.stat:hover { filter: brightness(.96); }
  :focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .home-grid .home-tiles { grid-template-columns: repeat(4, 1fr); }
  .toolbar .search.grow { max-width: 520px; }
  main > .toolbar { position: sticky; top: 61px; z-index: 10; background: var(--bg); padding: 6px 0; margin-bottom: 8px; }

  /* finestre */
  .modal { max-width: 640px; }
  .modal.wide { max-width: 1040px; }
  .modal-wrap { animation: pc-appare .12s ease-out; }

  /* chat: senza barra in basso la stanza usa tutta l’altezza */
  .chat-room { height: calc(100dvh - 130px); }

  /* il tasto + diventa «Nuovo» */
  .fab { right: 32px; width: auto; padding: 0 22px 0 18px; border-radius: 28px; display: flex; align-items: center; gap: 8px; }
  .fab::after { content: "Nuovo"; font-weight: 700; font-size: 15px; }
}
@keyframes pc-scorre { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
@keyframes pc-appare { from { opacity: 0; } to { opacity: 1; } }
@media print { #pc-menu, #pc-cerca, #pc-cerca-apri { display: none !important; } body main { margin: 0 !important; max-width: none !important; } }
