/* Tasklog su liste: i pezzi nuovi (menu, anteprima mail, persone e mail, import, scheda in sola lettura)
   e i ritocchi per il telefono. Si carica dopo styles.css e ne usa i colori. */

/* ---------- testata ---------- */

.btn .new-plus { display: none; font-size: 20px; line-height: 1; font-weight: 500; }
.ro-badge {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 13px;
  background: var(--tile); color: var(--ink-2); font-size: 12px; font-weight: 600; letter-spacing: .02em;
}
.foot-data a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.foot-data a:hover { text-decoration-color: currentColor; }

/* ---------- finestre ---------- */

.modal { max-height: calc(82vh - 16px); overflow-y: auto; }
.modal-wide { top: 4vh; width: min(1040px, calc(100vw - 32px)); max-height: 92vh; }
.modal-medio { top: 8vh; width: min(760px, calc(100vw - 32px)); max-height: 86vh; }
.modal .m-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.modal .m-head h2 { margin: 4px 0 0; }
.modal .m-head .icon-btn { margin: -6px -10px 0 0; color: var(--ink-2); }
.modal .m-head .icon-btn:hover { background: var(--tile); color: var(--ink); }
.modal .m-sub { margin: 0 0 16px; color: var(--ink-3); font-size: 13px; }
.modal .m-foot { margin: 16px 0 0; color: var(--ink-3); font-size: 12px; }

.menu-list { display: grid; gap: 6px; }
.menu-list button {
  display: grid; gap: 1px; width: 100%; padding: 9px 12px; text-align: left;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper);
}
.menu-list button:hover { border-color: #C6C6CB; background: var(--hover); }
.menu-list strong { font-weight: 600; }
.menu-list span { color: var(--ink-3); font-size: 13px; }

.confirm-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- anteprima delle mail ---------- */

.mp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin: 10px 0 16px; }
.mp-bar label { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.mp-bar .input { width: auto; }
.mp-note { color: var(--ink-3); font-size: 13px; }
.mp-body { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; align-items: start; }
.mp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mp-list button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; text-align: left;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper);
}
.mp-list button:hover { border-color: #C6C6CB; background: var(--hover); }
.mp-list button[aria-pressed="true"] { border-color: var(--char); box-shadow: inset 0 -3px 0 var(--gold); }
.mp-list button.is-empty { color: var(--ink-3); }
.mp-list button.is-empty .initials { opacity: .6; }
.mp-who { display: grid; min-width: 0; }
.mp-name { font-weight: 600; }
.mp-sub { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-preview { min-width: 0; }
.mp-meta { display: grid; gap: 2px; margin-bottom: 8px; font-size: 13px; color: var(--ink-2); }
.mp-meta strong { color: var(--ink); font-weight: 600; }
.mp-warn { color: var(--st-stop); font-weight: 600; }
.mp-frame { display: block; width: 100%; height: min(64vh, 680px); border: 1px solid var(--rule); background: #F3F4F5; }
.modal .mp-empty { color: var(--ink-2); padding: 18px 0; margin: 0; }

/* ---------- persone e mail ---------- */

.pm-wrap { overflow-x: auto; margin: 6px 0 18px; }
.pm-table { width: 100%; border-collapse: collapse; }
.pm-table th { padding: 6px 14px 6px 0; text-align: left; font-weight: 600; white-space: nowrap; }
.pm-table td { padding: 6px 14px 6px 0; }
.pm-table td:last-child { padding-right: 0; white-space: nowrap; }
.pm-table .input { min-width: 240px; }
#pm-chiusure { min-height: 80px; }
.modal .error { color: var(--st-stop); }

/* ---------- import ---------- */

.imp-options { display: grid; gap: 8px; margin-top: 18px; }
.imp-opt {
  display: grid; gap: 2px; width: 100%; padding: 11px 14px; text-align: left;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper);
}
.imp-opt:hover:not([disabled]) { border-color: #C6C6CB; background: var(--hover); }
.imp-opt strong { font-weight: 600; }
.imp-opt span { color: var(--ink-3); font-size: 13px; }
.imp-opt[disabled] { opacity: .5; cursor: default; }
.imp-run p { margin: 18px 0 10px; }
.imp-bar { height: 5px; background: var(--rule); overflow: hidden; }
.imp-bar span { display: block; height: 100%; background: var(--gold); transition: width .3s ease-out; }
.imp-done p { margin: 14px 0 6px; }
.imp-done ul { margin: 0 0 14px; padding-left: 20px; color: var(--ink-2); font-size: 15px; }
.modal .imp-done ul { font-size: 14px; }
.imp-done .banner ul { margin: 4px 0 0; font-size: 14px; color: var(--ink); }

/* ---------- scheda in sola lettura (vista sponsor) ---------- */

.title-read { margin: 4px 0 18px; font-size: 23px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.read-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; margin: 0 0 18px; }
.read-grid div { min-width: 0; }
.read-grid dt { margin-bottom: 6px; color: var(--ink-3); font-size: 13px; }
.read-grid dd { margin: 0; }
.read-grid .due { padding-top: 0; }
.next-read { padding-top: 2px; }

/* ---------- telefono e tablet ---------- */

@media (max-width: 900px) {
  .top-actions .sync-lbl { display: none; }
  .field-cycle:not(:has(button, p)) { display: none; }
  .read-grid { grid-template-columns: 1fr 1fr; }
  .mp-body { grid-template-columns: 1fr; }
  .mp-list { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
  .mp-list li { flex: 0 0 auto; }
  .mp-list button { width: auto; }
  .mp-sub { max-width: 180px; }
  .mp-frame { height: 62vh; }
  .pm-table .input { min-width: 200px; }

  /* la scheda prende tutto lo schermo: i pulsanti di salvataggio restano in vista mentre si compilano i campi */
  .drawer { border-left: 0; }
  .drawer .drawer-actions {
    position: sticky; bottom: 0; z-index: 2; flex-wrap: wrap;
    margin: 6px -18px 10px; padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
    background: var(--paper); border-top: 1px solid var(--rule);
  }
  body.has-drawer, body.has-modal { overflow: hidden; }
}

@media (max-width: 560px) {
  .btn .new-lbl, .me-btn .me-name { display: none; }
  .btn .new-plus { display: inline; }
  .me-btn { padding: 0 8px; }
  .modal, .modal-medio { top: 8vh; max-height: 84vh; padding: 18px 16px 16px; }
  .modal-wide { top: 0; width: 100vw; max-height: 100vh; height: 100vh; border-top-width: 0; padding-top: 14px; }
  .read-grid { grid-template-columns: 1fr; }
  .pm-table, .pm-table tbody, .pm-table tr, .pm-table th, .pm-table td { display: block; width: 100%; padding-right: 0; }
  .pm-table tr { padding: 8px 0; border-bottom: 1px solid var(--rule-soft); }
  .pm-table .input { min-width: 0; }
}

/* dita invece del mouse: bersagli più grandi e niente zoom automatico di iOS nei campi */
@media (pointer: coarse) {
  .btn { height: 40px; }
  .chip { height: 34px; padding: 0 13px; border-radius: 17px; }
  .seg button { padding: 9px 12px; }
  .status-pick button { height: 38px; border-radius: 19px; }
  .icon-btn { width: 44px; height: 44px; }
  .toggle input { width: 20px; height: 20px; }
  input, select, textarea { font-size: 16px; }
}
