/* Richieste dal sito · «Scuro premium» (DESIGN-V6). Prefix ld-. */

/* Status KPIs (each one filters the list) */
.ld-kpis { margin-bottom: 16px; }
@media (min-width: 769px) {
  .ld-kpis { --kpi-cols: 4; }
  .ld-kpis > .kpi:nth-child(odd)::before { display: block; }
  .ld-kpis > .kpi:first-child::before { display: none; }
  .ld-kpis > .kpi:nth-child(n + 3) { border-top: 0; }
}
.ld-kpi {
  display: flex; flex-direction: column; align-items: stretch; width: 100%; margin: 0; border: 0; border-radius: 0; background: none;
  font: inherit; color: inherit; text-align: left; cursor: pointer; transition: background-color var(--t-fast) var(--ease);
}
.ld-kpi:hover { background: rgba(255, 255, 255, .02); }
.ld-kpi.is-active { background: rgba(255, 255, 255, .035); }
.ld-kpi.is-active::after { content: ""; position: absolute; left: 20px; right: 20px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); }
.ld-kpi:focus-visible { outline-offset: -3px; }
.ld-kpi .kpi-label .dot { width: 6px; height: 6px; margin-left: 2px; }
.ld-kpi .kpi-foot { margin-top: 6px; }

/* List panel */
.ld-head { flex-wrap: wrap; row-gap: 8px; padding-top: 8px; padding-bottom: 8px; }
.ld-head .panel-title { display: inline-flex; align-items: center; gap: 8px; }
.ld-clear { cursor: pointer; border: 0; font: inherit; font-size: 12px; }
.ld-clear:hover { color: var(--text-1); background: rgba(255, 255, 255, .08); }
.ld-search { width: min(280px, 100%); }
.ld-head .panel-actions { gap: 4px; }
.ld-results { min-height: 140px; }
.ld-state { padding: 12px 16px; }
.ld-list { margin: 0; padding: 4px 0; list-style: none; }
.ld-list > li { position: relative; }
.ld-list > li + li::before { content: ""; position: absolute; left: 64px; right: 16px; top: 0; height: 1px; background: var(--line-soft); }
.ld-row {
  position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr) minmax(150px, 220px) 104px 80px 16px; align-items: center; gap: 4px 16px;
  width: 100%; min-height: 64px; margin: 0; padding: 10px 16px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: background-color var(--t-fast) var(--ease);
}
.ld-row:hover { background: rgba(255, 255, 255, .025); }
.ld-row:focus-visible { outline-offset: -2px; }
.ld-row.is-selected { background: rgba(255, 255, 255, .04); box-shadow: inset 2px 0 0 var(--accent); }
.ld-row.is-new .ld-r-name { font-weight: 600; }
.ld-row.is-lost { color: var(--text-2); }
.ld-row.is-lost .ld-avatar { opacity: .55; }
.ld-r-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ld-r-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-row.is-lost .ld-r-name { color: var(--text-2); }
.ld-r-note { display: inline-flex; flex: none; color: var(--text-3); }
.ld-r-preview { min-width: 0; font-size: 13px; line-height: 18px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-r-empty { color: var(--text-4); }
.ld-r-venue { min-width: 0; display: flex; flex-direction: column; font-size: 13px; line-height: 18px; }
.ld-r-venue > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-r-venue > span:first-child { color: var(--text-2); }
.ld-r-venue > span:last-child { color: var(--text-3); font-size: 12.5px; }
.ld-r-time { font-size: 12.5px; color: var(--text-3); white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.ld-r-chev { color: var(--text-4); transition: transform var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.ld-row:hover .ld-r-chev { color: var(--text-2); transform: translateX(2px); }
.ld-skeleton { padding: 8px 16px 12px; }
.ld-skel-row { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.ld-skel-main { flex: 1; display: flex; flex-direction: column; gap: 4px; }

/* Drawer */
dialog.ld-drawer { width: min(520px, calc(100vw - 16px)); max-width: none; overflow: hidden; }
.ld-dh { flex: none; padding: 14px 16px 16px 20px; border-bottom: 1px solid var(--line-soft); }
.ld-dh-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.ld-dh-eyebrow { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-size: 12.5px; color: var(--text-3); }
.ld-dh-eyebrow .icon { color: var(--text-3); flex: none; }
.ld-dh-title { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ld-dh-text { min-width: 0; }
.ld-dh-text h2 { margin: 0; font-size: 18px; line-height: 24px; font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; }
.ld-dh-text p { margin: 2px 0 0; font-size: 13.5px; line-height: 20px; color: var(--text-2); overflow-wrap: anywhere; }
.ld-status { display: flex; width: 100%; }
.ld-status > button { flex: 1; justify-content: center; gap: 7px; }
.ld-status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-4); flex: none; }
.ld-status > .ld-status-new[aria-checked="true"] .ld-status-dot { background: var(--amber); }
.ld-status > .ld-status-contacted[aria-checked="true"] .ld-status-dot { background: var(--blue); }
.ld-status > .ld-status-won[aria-checked="true"] .ld-status-dot { background: var(--green); }
.ld-status > .ld-status-lost[aria-checked="true"] .ld-status-dot { background: var(--text-2); }
.ld-status .spinner { --spinner-size: 12px; }
.ld-db { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 16px; }
.ld-sec { padding: 16px 0; }
.ld-sec + .ld-sec { border-top: 1px solid var(--line-soft); }
.ld-sec-title { display: flex; align-items: baseline; gap: 8px; margin: 0 0 10px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--text-1); }
.ld-sec-hint { font-size: 12px; font-weight: 400; color: var(--text-3); }
.ld-contacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.ld-contact { --btn-h: auto; justify-content: flex-start; gap: 10px; min-height: 48px; padding: 7px 12px; text-align: left; }
.ld-contact > .icon { color: var(--text-2); flex: none; }
.ld-contact-text { min-width: 0; display: flex; flex-direction: column; }
.ld-contact-text b { font-size: 13.5px; font-weight: 500; line-height: 18px; }
.ld-contact-text small { font-size: 12px; line-height: 16px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-message { margin: 0; padding: 12px 14px; border-radius: var(--r-md); background: rgba(255, 255, 255, .03); box-shadow: inset 0 0 0 1px var(--line); font-size: 14px; line-height: 21px; color: var(--text-1); white-space: pre-wrap; overflow-wrap: anywhere; }
.ld-muted { margin: 0; font-size: 13.5px; color: var(--text-3); }
.ld-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin: 0; }
.ld-facts > div { min-width: 0; }
.ld-facts dt { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--text-3); }
.ld-facts dd { margin: 2px 0 0; font-size: 13.5px; line-height: 20px; color: var(--text-1); overflow-wrap: anywhere; }
.ld-notes { min-height: 96px; }
.ld-notes-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.ld-notes-count { font-size: 12px; color: var(--text-4); font-variant-numeric: tabular-nums; }
.ld-notes-state { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text-3); text-align: right; }
.ld-hidden { display: none; }
.ld-df { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line-soft); background: var(--bg-2); }
.ld-df-help { flex: 1; min-width: 0; margin: 0; font-size: 12.5px; line-height: 17px; color: var(--text-3); }
.ld-df .btn { flex: none; }

/* Responsive */
@media (max-width: 1280px) {
  .ld-row { grid-template-columns: 32px minmax(0, 1fr) minmax(130px, 180px) 100px 72px 16px; gap: 4px 12px; }
}
@media (max-width: 900px) {
  .ld-row { grid-template-columns: 32px minmax(0, 1fr) auto 16px; grid-template-areas: "avatar main status chev" "avatar venue time chev"; align-items: start; row-gap: 2px; }
  .ld-row .ld-avatar { grid-area: avatar; margin-top: 2px; }
  .ld-r-main { grid-area: main; }
  .ld-r-venue { grid-area: venue; flex-direction: row; gap: 6px; font-size: 12.5px; }
  .ld-r-venue > span:last-child::before { content: "·"; margin-right: 6px; color: var(--text-4); }
  .ld-r-status { grid-area: status; justify-self: end; }
  .ld-r-time { grid-area: time; align-self: center; }
  .ld-r-chev { grid-area: chev; align-self: center; }
}
@media (max-width: 768px) {
  .ld-head .panel-actions { width: 100%; margin-left: 0; }
  .ld-search { flex: 1; width: auto; }
}
@media (max-width: 560px) {
  .ld-kpi { padding: 12px 14px; }
  .ld-kpi .kpi-value { margin-top: 4px; font-size: 24px; line-height: 28px; }
  .ld-kpi .kpi-foot { display: none; }
  .ld-kpi.is-active::after { left: 14px; right: 14px; }
  .ld-row { padding: 12px; gap: 2px 10px; }
  .ld-list > li + li::before { left: 12px; right: 12px; }
  .ld-r-chev { display: none; }
  .ld-row { grid-template-columns: 32px minmax(0, 1fr) auto; grid-template-areas: "avatar main status" "avatar venue time"; }
  dialog.ld-drawer { inset: auto 0 0 0; width: 100%; height: 92dvh; max-height: 92dvh; border-radius: 16px 16px 0 0; transform: none; animation: sheet-in var(--t-med) var(--ease); }
  .ld-dh { padding: 12px 12px 14px 16px; }
  .ld-db { padding: 0 16px 12px; }
  .ld-df { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .ld-df-help { flex-basis: 100%; }
  .ld-df .btn { flex: 1; justify-content: center; }
  .ld-status > button { padding: 0 6px; font-size: 12.5px; }
  .ld-facts { grid-template-columns: minmax(0, 1fr); }
}
@media (pointer: coarse) {
  .ld-row { min-height: 68px; }
  .ld-status > button { height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .ld-row, .ld-r-chev, .ld-kpi { transition: none; }
  dialog.ld-drawer { animation: none; }
}
