/* esigo: struttura e componenti di Resana, colori 2night. */

:root {
   --brand: #cd3174;
   --brand-hover: #b3285f;
   --brand-soft: #fbe9f1;
   --accent: #09c2bc;
   --accent-soft: #dcf6f5;
   --navy: #272a37;

   --chrome: var(--navy);
   --chrome-2: #31354a;
   --chrome-hover: rgba(255, 255, 255, .08);
   --chrome-active: rgba(255, 255, 255, .15);
   --chrome-text: #eceef3;
   --chrome-muted: #a5a8b8;

   --bg: #ffffff;
   --bg-soft: #f6f7f8;
   --bg-hover: #f2f3f5;
   --border: #e5e8e7;
   --border-strong: #cfd3d6;
   --text: #1e1f24;
   --text-2: #4b4c4b;
   --muted: #6b6a6a;
   --late: #d0453c;
   --late-soft: #fdecea;
   --soon: #c77a12;
   --soon-soft: #fdf3e2;
   --ok: #2f9e5f;

   /* stati delle pratiche */
   --s-valutazione: #4f6bed;
   --s-pec1: #cd3174;
   --s-pec2: #8e2a68;
   --s-trattativa: #09a8a3;
   --s-avvocato: #e07a2e;
   --s-verifica: #c99a06;
   --s-perdita-proposta: #b4505f;
   --s-saldata: #2f9e5f;
   --s-persa: #8a8d99;
   --s-non-uscita: #6b62a8;
   --s-annullata: #b0b3bd;

   --radius: 8px;
   --radius-lg: 12px;
   --shadow-menu: 0 6px 24px rgba(20, 22, 33, .18), 0 1px 3px rgba(20, 22, 33, .12);
   --shadow-panel: -8px 0 32px rgba(20, 22, 33, .14);
   --topbar-h: 52px;
   --sidebar-w: 260px;
   --ease: cubic-bezier(.2, .7, .3, 1);
   --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

   font-family: var(--font);
   font-size: 14px;
   line-height: 1.45;
   color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--chrome); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }

.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic--sm { width: 16px; height: 16px; }
.ic--xs { width: 12px; height: 12px; stroke-width: 2.4; }

.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; color: var(--chrome-muted); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--chrome-hover); color: var(--chrome-text); }
.icon-btn--light { color: var(--muted); }
.icon-btn--light:hover { background: var(--bg-hover); color: var(--text); }

.avatar {
   --av: var(--brand);
   display: inline-grid; place-items: center; flex: none;
   width: 28px; height: 28px; border-radius: 50%;
   background: var(--av); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .02em; user-select: none;
}
.avatar--sm { width: 22px; height: 22px; font-size: 9px; }
.avatar--md { width: 30px; height: 30px; }
.avatar--lg { width: 40px; height: 40px; font-size: 14px; }
.avatar--sys { --av: #dfe2e6; color: var(--muted); }

/* ---------- barra in alto ---------- */
.topbar {
   position: fixed; inset: 0 0 auto 0; z-index: 30; height: var(--topbar-h);
   display: flex; align-items: center; gap: 10px; padding: 0 12px;
   background: var(--chrome); color: var(--chrome-text);
}
.brand { display: inline-flex; align-items: center; height: 34px; padding: 0 6px; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.create { position: relative; }
.create__btn {
   display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 6px;
   background: var(--brand); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
}
.create__btn:hover { background: var(--brand-hover); }

.menu {
   position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; min-width: 220px; padding: 6px 0;
   background: #fff; color: var(--text); border-radius: var(--radius); box-shadow: var(--shadow-menu);
}
.menu--right { left: auto; right: 0; }
.menu__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 16px; text-align: left; font-size: 14px; }
.menu__item .ic { color: var(--muted); }
.menu__item:hover { background: var(--bg-hover); }
.menu__sep { height: 1px; margin: 6px 0; background: var(--border); }
.menu__head { display: flex; gap: 12px; align-items: center; padding: 10px 16px; }
.menu__name { font-weight: 700; }
.menu__mail { color: var(--muted); font-size: 12px; }

/* ---------- ricerca omni ---------- */
.search { position: absolute; left: 50%; transform: translateX(-50%); width: min(560px, 40vw); display: flex; align-items: center; }
.search__icon { position: absolute; left: 12px; color: var(--chrome-muted); pointer-events: none; }
.search__field {
   width: 100%; height: 34px; display: flex; align-items: center; gap: 6px; padding: 0 10px 0 36px;
   border-radius: 6px; border: 1px solid transparent; background: var(--chrome-2); color: var(--chrome-text); transition: background .15s;
}
.search__field:hover { background: #3a3f57; }
.search.is-open .search__field { background: #fff; color: var(--text); border-color: var(--border-strong); }
.search.is-open .search__icon { color: var(--muted); }
.search__input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none; }
.search__input::placeholder { color: var(--chrome-muted); }
.search.is-open .search__input::placeholder { color: var(--muted); }
.search__chip { flex: none; height: 22px; padding: 0 8px; border-radius: 4px; background: rgba(255,255,255,.18); font-size: 12px; font-weight: 700; line-height: 22px; white-space: nowrap; }
.search.is-open .search__chip { background: var(--brand-soft); color: var(--brand); }
.search.is-open .search__chip--scope { background: var(--brand); color: #fff; }
.search__kbd { flex: none; padding: 0 6px; border: 1px solid rgba(255,255,255,.2); border-radius: 4px; color: var(--chrome-muted); font-size: 11px; line-height: 18px; }
.search.is-open .search__kbd { display: none; }

.omni {
   position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 60;
   width: min(720px, calc(100vw - 24px));
   background: #fff; color: var(--text); border-radius: var(--radius-lg); box-shadow: var(--shadow-menu);
}
.omni__scopes { display: flex; gap: 2px; margin: 10px 12px 0; padding: 3px; border-radius: 8px; background: var(--bg-soft); }
.omni__scope { flex: 1; height: 28px; border-radius: 6px; color: var(--text-2); font-size: 13px; }
.omni__scope:hover { color: var(--text); }
.omni__scope.is-active { background: #fff; color: var(--text); font-weight: 700; box-shadow: 0 1px 3px rgba(20, 22, 33, .14); }
.omni__scope small { color: var(--muted); font-weight: 400; margin-left: 3px; }
.omni__pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 12px 0; }
.omni__break { flex-basis: 100%; height: 0; }
.fpill {
   display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px;
   border: 1px solid var(--border-strong); border-radius: 13px; background: #fff; color: var(--text-2); font-size: 12px; white-space: nowrap;
}
.fpill:hover { border-color: #b4b9bd; color: var(--text); }
.fpill.is-on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.fpill b { font-weight: 700; }
.fpill .ic--xs { opacity: .6; }
.omni__sort { display: inline-flex; align-items: center; gap: 3px; height: 26px; margin-left: auto; padding: 0 6px; border-radius: 6px; color: var(--muted); font-size: 12.5px; }
.omni__sort b { color: var(--text-2); }
.omni__sort:hover { background: var(--bg-hover); }
.omni__body { max-height: min(56vh, 480px); overflow-y: auto; margin-top: 10px; padding: 4px 0 6px; border-top: 1px solid var(--border); }
.omni__head { padding: 10px 14px 4px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.omni__row { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 6px 14px; cursor: pointer; }
.omni__row:hover { background: var(--bg-hover); }
.omni__row.is-active { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.omni__icon { display: grid; place-items: center; flex: none; width: 20px; color: var(--muted); }
.omni__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.omni__main > span { display: block; }
.omni__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.omni__label small { color: var(--muted); font-size: 12px; margin-left: 6px; }
.omni__snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.omni__side { flex: none; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.omni__row--all { margin-top: 4px; border-top: 1px solid var(--border); min-height: 42px; }
.omni__row--all .omni__label { color: var(--brand); font-weight: 700; }
.omni__keys { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border); background: var(--bg-soft); border-radius: 0 0 var(--radius-lg) var(--radius-lg); color: var(--muted); font-size: 11px; }
kbd { display: inline-block; min-width: 18px; padding: 0 4px; margin-right: 3px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; background: #fff; font: 11px/16px var(--font); text-align: center; }
mark { background: #fff1a8; color: inherit; border-radius: 2px; padding: 0 1px; }

/* ---------- guscio ---------- */
.shell { display: flex; height: 100vh; padding-top: var(--topbar-h); }
.sidebar { flex: none; width: var(--sidebar-w); overflow-y: auto; padding: 8px 8px 24px; color: var(--chrome-text); }
.nav { list-style: none; margin: 0; padding: 0; }
.nav__item { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 6px; color: var(--chrome-text); white-space: nowrap; }
.nav__item .ic { color: var(--chrome-muted); }
.nav__item:hover { background: var(--chrome-hover); }
.nav__item.is-active { background: var(--chrome-active); }
.nav__item.is-active .ic { color: #fff; }
.nav__label { overflow: hidden; text-overflow: ellipsis; }
.nav__badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 4px; background: var(--brand); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.nav__n { margin-left: auto; color: var(--chrome-muted); font-size: 12px; }
.nav-group { margin-top: 18px; border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 12px; }
.nav-group__head { padding: 4px 10px 6px; font-weight: 700; color: var(--chrome-text); display: flex; align-items: center; gap: 6px; }
.nav-group__head .ic { color: var(--chrome-muted); }
.dot { --c: var(--brand); width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.nav .dot { margin: 0 5px; }

.main { flex: 1; min-width: 0; display: flex; background: var(--bg); border-top-left-radius: var(--radius-lg); overflow: hidden; position: relative; }
.page { flex: 1; min-width: 0; overflow-y: auto; }
.page__head { display: flex; align-items: center; gap: 12px; padding: 18px 24px 0; }
.page__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); flex: none; }
.page__icon--dark { background: var(--navy); color: #fff; }
.page__kicker { color: var(--muted); font-size: 12px; }
.page__title { margin: 0; font-size: 20px; font-weight: 700; }
.page__tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.page__body { padding: 20px 24px 40px; }
.page__lead { margin: 0 0 16px; color: var(--text-2); max-width: 75ch; }

.tabs { display: flex; gap: 20px; margin: 12px 24px 0; border-bottom: 1px solid var(--border); }
.tabs__tab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 0 10px; color: var(--muted); font-weight: 700; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs__tab:hover { color: var(--text); }
.tabs__tab.is-active { color: var(--text); border-bottom-color: var(--brand); }
.tabs__count { min-width: 18px; padding: 0 5px; border-radius: 4px; background: var(--bg-soft); color: var(--muted); font-size: 11px; line-height: 18px; text-align: center; }
.tabs__count--brand { background: var(--brand); color: #fff; }
.tabs__count--late { background: var(--late-soft); color: var(--late); }

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 24px; }
.toolbar__info { color: var(--muted); font-size: 13px; }
.toolbar__right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---------- bottoni e campi ---------- */
.btn {
   display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
   border-radius: 6px; font-weight: 700; white-space: nowrap; transition: background .15s, color .15s, border-color .15s;
}
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-hover); }
.btn--outline { border: 1px solid var(--border-strong); color: var(--text-2); background: #fff; }
.btn--outline:hover { background: var(--bg-soft); color: var(--text); }
.btn--danger { border: 1px solid #efc1bd; color: var(--late); background: #fff; }
.btn--danger:hover { background: var(--late-soft); }
.btn--ok { background: var(--ok); color: #fff; }
.btn--sm { height: 32px; padding: 0 12px; gap: 6px; font-size: 13px; }
.btn--ghost { color: var(--text-2); }
.btn--ghost:hover { background: var(--bg-soft); }

.field { display: block; margin: 0 0 16px; }
.field__label { display: block; margin-bottom: 6px; font-weight: 700; color: var(--text-2); font-size: 13px; }
.field__label small { color: var(--muted); font-weight: 400; }
.field__hint { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.input {
   width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 6px; background: #fff;
   transition: border-color .15s, box-shadow .15s;
}
.input:hover { border-color: #b4b9bd; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.select { appearance: none; padding-right: 30px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6a6a' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") right 8px center / 14px no-repeat; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* ---------- stati, chip e badge ---------- */
.state {
   --c: var(--muted);
   display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px 0 7px; border-radius: 6px;
   background: color-mix(in srgb, var(--c) 11%, #fff); color: color-mix(in srgb, var(--c) 82%, #000); font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.state::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.state--lg { height: 30px; padding: 0 12px 0 10px; font-size: 14px; }
.state--old { background: none; color: var(--muted); font-weight: 400; text-decoration: line-through; padding: 0 2px; }
.state--old::before { opacity: .5; }
.s-valutazione { --c: var(--s-valutazione); }
.s-pec_da_inviare { --c: var(--s-pec1); }
.s-pec1_inviata { --c: var(--s-pec2); }
.s-da_verificare { --c: var(--s-verifica); }
.s-perdita_da_confermare { --c: var(--s-perdita-proposta); }
.s-trattativa { --c: var(--s-trattativa); }
.s-avvocato { --c: var(--s-avvocato); }
.s-saldata { --c: var(--s-saldata); }
.s-persa { --c: var(--s-persa); }
.s-non_uscita { --c: var(--s-non-uscita); }
.s-annullata { --c: var(--s-annullata); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; border-radius: 4px; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 700; line-height: 18px; white-space: nowrap; }
.badge--tag { background: var(--bg-soft); color: var(--text-2); font-weight: 600; border: 1px solid var(--border); }

.due { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.due--late { color: var(--late); font-weight: 700; }
.due--soon { color: var(--soon); font-weight: 700; }

/* ---------- tabella ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
   position: sticky; top: 0; z-index: 1; background: #fff; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border);
   color: var(--muted); font-size: 12px; font-weight: 400; white-space: nowrap;
}
.tbl th.r, .tbl td.r { text-align: right; }
.tbl th.c, .tbl td.c { text-align: center; }
.tbl th button { display: inline-flex; align-items: center; gap: 4px; color: inherit; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:first-child th:first-child, .tbl td:first-child { padding-left: 24px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 24px; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--bg-soft); }
.tbl tbody tr.is-open td { background: var(--brand-soft); }
.tbl .help { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--border-strong); font-size: 9px; color: var(--muted); cursor: help; margin-left: 3px; }
.cust { font-weight: 700; }
.cust__sub { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.money { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.money small { color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.who { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; }

/* ---------- riepiloghi in alto ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(125px, 1fr)); gap: 12px; }
.stat { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; transition: border-color .15s, box-shadow .15s; }
a.stat:hover { border-color: var(--border-strong); box-shadow: 0 2px 10px rgba(20, 22, 33, .06); }
.stat__n { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat__l { font-weight: 700; margin-top: 2px; }
.stat__d { margin-top: 4px; color: var(--muted); font-size: 12px; }
.stat--late .stat__n { color: var(--late); }
.stat--brand .stat__n { color: var(--brand); }
.stat--ok .stat__n { color: var(--ok); }
.stat--soon .stat__n { color: var(--soon); }

.sec { margin: 28px 0 10px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.sec:first-child { margin-top: 0; }

/* ---------- pannello laterale della pratica ---------- */
.panel {
   position: absolute; top: 0; right: 0; bottom: 0; z-index: 20; width: min(620px, 62%);
   display: flex; flex-direction: column; background: #fff; border-left: 1px solid var(--border); box-shadow: var(--shadow-panel);
}
/* scorre dentro solo quando si apre dalla lista (la mette il javascript): non quando la pagina si ricarica dopo
   una stella, un "segui" o un'azione, con la scheda già aperta */
.panel--enter { animation: panel-in .2s var(--ease); }
/* la scheda entra ed esce scorrendo da destra, come la barra laterale (stessa durata e curva) */
@keyframes panel-in { from { transform: translateX(100%); } }
.panel.is-closing { transform: translateX(100%); transition: transform .2s var(--ease); pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
   .panel--enter { animation: none; }
   .panel.is-closing { transition: none; }
}
.panel__bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--border); }
.panel__bar .spacer { flex: 1; }
.panel__body { flex: 1; overflow-y: auto; padding: 18px 22px 24px; }
.panel__path { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.panel__title { margin: 4px 0 2px; font-size: 22px; font-weight: 800; line-height: 1.25; }
.panel__sub { color: var(--muted); }
.panel__foot { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-top: 1px solid var(--border); background: #fff; }
.panel__foot .input { min-height: 40px; height: 40px; resize: none; }

/* il riquadro "a che punto è": stato, scadenza, provenienza, chi deve agire */
.status { margin: 16px 0 18px; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--bg-soft); border: 1px solid var(--border); }
.status__top { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.status__from { margin: 6px 0 0; color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.fields { display: grid; grid-template-columns: 150px minmax(0, 1fr); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.fields__label { padding: 9px 12px; background: var(--bg-soft); color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--border); }
.fields__value { padding: 9px 12px; border-bottom: 1px solid var(--border); min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fields > :nth-last-child(-n+2) { border-bottom: 0; }
.copy { color: var(--muted); }

.rates { width: 100%; border-collapse: collapse; font-size: 13px; }
.rates th { text-align: left; color: var(--muted); font-weight: 400; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.rates td { padding: 7px 8px; border-bottom: 1px solid var(--border); }
.rates .r { text-align: right; }
.rates tr.is-paid td { color: var(--muted); }
.rates tfoot td { font-weight: 700; border-bottom: 0; }
/* nella scheda le colonne non seguono il contenuto: stessa larghezza in ogni pratica. Date e importi non vanno a capo;
   lo spazio che resta è del tipo di pagamento. Su uno schermo stretto le colonne tornano a seguire il contenuto */
.rates--fixed .r-due, .rates--fixed .num, .rates--fixed tfoot td { white-space: nowrap; }
.rates--fixed .tagpaid { display: block; margin-left: 0 !important; }
@media (min-width: 900px) {
   .rates--fixed { table-layout: fixed; }
   /* la seconda colonna parte dove partono i valori dei Dati sopra: 1px di bordo + 150px di etichetta + 12px, meno gli 8px della cella */
   .rates--fixed th:nth-child(1) { width: 155px; }
   .rates--fixed th:nth-child(3), .rates--fixed th:nth-child(4) { width: 112px; }
   .rates--fixed .r-type { overflow-wrap: anywhere; }
}

/* attività */
.feed__head { display: flex; align-items: center; gap: 10px; margin: 26px 0 6px; }
.feed__title { margin: 0; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-right: auto; }
.seg { display: inline-flex; padding: 2px; border: 1px solid var(--border-strong); border-radius: 6px; background: #fff; }
.seg__opt { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 4px; color: var(--text-2); font-size: 12.5px; }
.seg__opt:hover { background: var(--bg-hover); }
.seg__opt.is-active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.feed { list-style: none; margin: 0; padding: 0; }
.ev { display: flex; align-items: center; gap: 8px; padding: 6px 0 6px 4px; color: var(--muted); font-size: 13px; line-height: 20px; }
.ev__text { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.ev__who { color: var(--text-2); font-weight: 700; }
.ev__time { flex: none; font-size: 12px; }
.ev__why { flex-basis: 100%; color: var(--text-2); }
.ev--state { padding: 10px 10px; margin: 6px 0; border-radius: 8px; background: var(--bg-soft); align-items: flex-start; }
.ev--start { color: var(--text-2); }
.ev--start .ev__ic { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border-strong); color: var(--muted); flex: none; }
.ev.is-mine .ev__who { color: var(--brand); }
.cm { display: flex; gap: 10px; padding: 10px 8px; margin: 4px -8px; border-radius: 8px; }
.cm:hover { background: var(--bg-soft); }
.cm__main { flex: 1; min-width: 0; }
.cm__head { display: flex; align-items: baseline; gap: 8px; }
.cm__who { font-weight: 700; }
.cm__time { color: var(--muted); font-size: 12px; }
.cm__body { margin-top: 2px; }
.cm.is-mine .cm__who::after { content: "tu"; margin-left: 6px; padding: 0 5px; border-radius: 4px; background: var(--brand-soft); color: var(--brand); font-size: 10px; font-weight: 700; vertical-align: 1px; }

/* ---------- finestra di conferma ---------- */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: rgba(20, 22, 33, .45); animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal__box { width: min(520px, 100%); background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-menu); animation: pop .18s var(--ease); }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal__head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 0; }
.modal__title { margin: 0; font-size: 18px; font-weight: 800; }
.modal__body { padding: 14px 20px 6px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
.change { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 8px; background: var(--bg-soft); margin-bottom: 16px; }

/* ---------- utenti ---------- */
.tbl--users td { cursor: default; }
.tbl--users tbody tr { cursor: default; }
.person { display: flex; align-items: center; gap: 10px; }
.person__name { font-weight: 700; }
.person__sub { color: var(--muted); font-size: 12px; }
.tick { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; margin: 0; }
.tbl--users tr.is-off td { color: var(--muted); }
.tbl--users tr.is-off .person__name { color: var(--muted); }
.legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px 24px; margin-top: 8px; }
.legend dt { font-weight: 700; }
.legend dd { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

/* ---------- import ---------- */
.drop {
   display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 20px; text-align: center;
   border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--bg-soft); color: var(--text-2);
}
.drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.drop__icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(20,22,33,.12); }
.drop__title { font-weight: 800; font-size: 16px; color: var(--text); }
.option { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); margin-top: 14px; }
.option input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand); }
.option__title { font-weight: 700; }
.option__text { color: var(--muted); font-size: 13px; margin-top: 2px; }
.diff td:first-child { width: 44%; }

/* ---------- login ---------- */
.login { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: var(--chrome); }
.login__box { width: min(400px, 100%); padding: 34px 32px 30px; border-radius: var(--radius-lg); background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login__brand { display: inline-flex; padding: 10px 14px; border-radius: 8px; background: var(--navy); }
.login__title { margin: 22px 0 4px; font-size: 20px; }
.login__text { margin: 0 0 22px; color: var(--muted); }
.login__error { margin: 0 0 16px; padding: 10px 12px; border-radius: 6px; background: var(--late-soft); color: var(--late); font-size: 13px; }

/* ===================================================================== */
/* parti dell'app (oltre ai componenti dei mock)                          */
/* ===================================================================== */

/* marchio: il nome, con il punto magenta */
.brand { gap: 0; color: var(--chrome-text); }
.wordmark { font-weight: 900; font-size: 19px; letter-spacing: -.02em; line-height: 1; }
.wordmark::after { content: "."; color: var(--brand); }
.wordmark--big { font-size: 30px; }

/* menu a tendina senza javascript: <details> */
details.create > summary, details.account > summary { list-style: none; cursor: pointer; }
details.create > summary::-webkit-details-marker, details.account > summary::-webkit-details-marker { display: none; }
details.create:not([open]) > .menu, details.account:not([open]) > .menu { display: none; }
details.account > summary { display: block; border-radius: 50%; }
details.account[open] > summary .avatar, details.account > summary:hover .avatar { box-shadow: 0 0 0 2px var(--chrome), 0 0 0 4px var(--chrome-muted); }
.menu form { margin: 0; }

/* ricerca: senza javascript è un normale form verso la lista */
.search form { width: 100%; margin: 0; }

/* messaggi dopo un'azione */
.flash { display: flex; align-items: center; gap: 8px; margin: 14px 24px 0; padding: 10px 14px; border-radius: 8px; background: #e7f6ee; color: #1d6b41; font-weight: 600; }
.flash--error { background: var(--late-soft); color: var(--late); }
.panel .flash { margin: 0 0 14px; }

.page__head .btn { flex: none; }
.cust a:hover, a.cust:hover { text-decoration: underline; text-underline-offset: 2px; }
.tbl tbody tr a.rowlink { color: inherit; }
.tbl tbody tr a.rowlink:hover { text-decoration: underline; text-underline-offset: 2px; }
.qchip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 6px 0 10px; border-radius: 13px; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 700; }
.qchip a { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; }
.qchip a:hover { background: rgba(205, 49, 116, .15); }
select.omni__sort { appearance: none; border: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--text-2); cursor: pointer; padding-right: 4px; }
.sortbox { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12.5px; }
.sortbox:hover { color: var(--text-2); }
.toolbar .fpill.is-on .x { margin-left: 2px; }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty__title { margin: 10px 0 4px; color: var(--text); font-weight: 700; font-size: 15px; }
.empty .ic { width: 44px; height: 44px; color: var(--border-strong); stroke-width: 1.2; }
.empty a { color: var(--brand); font-weight: 700; }
.listfoot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px 40px; color: var(--muted); font-size: 13px; }
.listfoot .pager { display: flex; gap: 8px; }

/* il pannello come pagina intera (/pratica?id=...) */
.panel--page { position: static; width: auto; max-width: 860px; margin: 0 auto; box-shadow: none; border-left: 0; animation: none; flex: 1; }
.panel__bar .btn { flex: none; }
.panel-open .page .tbl td:nth-child(5), .panel-open .page .tbl th:nth-child(5),
.panel-open .page .tbl td:nth-child(6), .panel-open .page .tbl th:nth-child(6) { display: none; }
.panel__body .flash { margin: 0 0 12px; }
.status__note { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.fields__value .muted { font-size: 13px; }
.rates tr.is-paid .tagpaid { color: var(--ok); font-weight: 700; font-size: 11px; margin-left: 6px; }

/* storico: "Solo note" senza javascript, con un radio nascosto */
.feedsw { position: absolute; opacity: 0; pointer-events: none; }
#feed-note:checked ~ .feed > li:not(.cm) { display: none; }
#feed-note:checked ~ .feed__head label[for=feed-note], #feed-all:checked ~ .feed__head label[for=feed-all] { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.feed__head label.seg__opt { cursor: pointer; }
.cm__body { white-space: pre-wrap; overflow-wrap: anywhere; }
.ev__why { white-space: pre-wrap; }
.ev.is-current { color: var(--text-2); }
.panel__foot form { display: flex; gap: 10px; align-items: flex-start; flex: 1; margin: 0; }
.panel__foot textarea.input { flex: 1; min-height: 40px; height: 40px; padding: 9px 12px; resize: vertical; }
/* resta alta anche premendo "Aggiungi" (se si stringesse, il tasto scivolerebbe via da sotto il puntatore) e finché
   c'è del testo */
.panel__foot form:focus-within textarea.input, .panel__foot textarea.input:not(:placeholder-shown) { height: 84px; }

/* conferma delle azioni: finestra solo css (:target) */
.modal { display: none; }
.modal:target { display: grid; }
.modal__bg { position: absolute; inset: 0; }
.modal__box { position: relative; }
.modal--danger .modal__title { color: var(--late); }
.modal__body textarea.input { min-height: 90px; }

/* utenti */
.tbl--users .person__name input {
   width: 100%; max-width: 240px; height: 28px; padding: 0 6px; margin-left: -6px; border: 1px solid transparent; border-radius: 6px;
   background: none; font-weight: 700;
}
.tbl--users .person__name input:hover { border-color: var(--border); }
.tbl--users .person__name input:focus { outline: none; border-color: var(--brand); background: #fff; }
.tbl--users .savebtn { visibility: visible; }
.js .tbl--users .savebtn { display: none; }
.tagpick { display: flex; flex-wrap: wrap; gap: 8px; }
.tagpick label { cursor: pointer; }
.tagpick input { position: absolute; opacity: 0; }
.tagpick input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.tagpick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.tagpick span { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 14px; font-size: 13px; color: var(--text-2); }

/* import */
.drop { cursor: pointer; position: relative; }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop.has-file { border-color: var(--brand); background: var(--brand-soft); }
.drop__file { font-weight: 700; color: var(--brand); }
.reslist { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); font-size: 13px; }
.reslist li { margin: 3px 0; }
.howto { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.howto li { margin: 4px 0; }

/* nuova pratica */
.rates input.input { height: 34px; }
.rates td { vertical-align: top; }

/* accesso */
.login__brand { padding: 12px 16px; color: #fff; }
.login form { margin: 0; }
.login__ok { margin: 0 0 16px; padding: 10px 12px; border-radius: 6px; background: #e7f6ee; color: #1d6b41; font-size: 13px; }
.dev-login { margin-top: 24px; padding-top: 18px; border-top: 1px dashed var(--border-strong); display: grid; gap: 8px; }
.dev-title { margin: 0 0 2px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.dev-login .btn { width: 100%; justify-content: space-between; font-weight: 600; }
.dev-tags { color: var(--muted); font-weight: 400; font-size: 12px; }

/* schermi stretti: la barra laterale si apre con il tasto ☰ */
@media (max-width: 900px) {
   .sidebar { position: fixed; top: var(--topbar-h); bottom: 0; left: 0; z-index: 40; background: var(--chrome); transform: translateX(-100%); transition: transform .2s var(--ease); }
   body.sidebar-open .sidebar { transform: none; }
   .search { position: static; transform: none; flex: 1; width: auto; }
   .create__btn span { display: none; }
   .panel { width: 100%; }
   .tbl td:nth-child(n+5), .tbl th:nth-child(n+5) { display: none; }
}
/* schermi larghi: l'hamburger nasconde la barra laterale (e se lo ricorda) */
@media (min-width: 901px) {
   .sidebar { transition: width .2s var(--ease), padding .2s var(--ease); }
   .sidebar-collapsed .sidebar { width: 0; padding-left: 0; padding-right: 0; overflow: hidden; }
}

/* storico: chi, cosa ha fatto, il passaggio, il motivo e cosa viene dopo */
.ev--state .ev__text { display: block; }
.ev__line { display: block; color: var(--text-2); }
.ev__line .what { color: var(--text-2); }
.ev__change { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.ev--state .ev__why { display: block; margin-top: 4px; color: var(--text); }
.ev__next { display: block; margin-top: 4px; color: var(--muted); font-size: 12.5px; }

/* cosa c'è da fare: in fondo, dopo lo storico */
.next { margin: 24px 0 4px; padding: 14px 16px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-soft); }
.next--open { background: #fff; border-color: color-mix(in srgb, var(--brand) 40%, #fff); box-shadow: 0 0 0 3px var(--brand-soft); }
.next--open .feed__title { color: var(--brand); }
.next__head { display: flex; align-items: center; gap: 8px; }
.next__head .feed__title { margin-right: auto; }
.next__what { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin: 10px 0 0; font-size: 15px; }
.next__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.next__actions a.btn { text-decoration: none; }
.mine-tag { margin-left: 4px; }

/* il "?" accanto a ogni tasto: spiega cosa significa (al passaggio del mouse o con Tab) */
.act { display: inline-flex; align-items: center; gap: 4px; }
.next__actions { position: relative; }
.tip {
   display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; flex: none;
   border: 1px solid var(--border-strong); background: #fff; color: var(--muted); font-size: 11px; font-weight: 700; cursor: help;
}
.tip:hover, .tip:focus-visible { border-color: var(--brand); color: var(--brand); outline: none; }
.tip::after {
   content: attr(data-tip); position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 30;
   padding: 9px 11px; border-radius: 8px; background: var(--navy); color: #fff; font-size: 12.5px; font-weight: 400; line-height: 1.45;
   text-align: left; white-space: normal; box-shadow: var(--shadow-menu); opacity: 0; visibility: hidden; pointer-events: none;
}
/* subito al passaggio; un clic non lo lascia aperto (solo il focus da tastiera lo tiene) */
.tip:hover::after, .tip:focus-visible::after { opacity: 1; visibility: visible; }
.m-help { margin: -4px 0 14px; color: var(--muted); font-size: 13px; }

/* il pannello si allarga o si stringe trascinando il bordo sinistro */
.panel__resize { position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; z-index: 5; cursor: col-resize; }
.panel__resize::after { content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 2px; background: transparent; transition: background .15s; }
.panel__resize:hover::after, body.resizing .panel__resize::after { background: var(--brand); }
body.resizing { cursor: col-resize; user-select: none; }

/* filtri per azione nello storico: Azione, Quando, Chi */
.fmenus { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fmenu { position: relative; }
.fmenu > summary { list-style: none; cursor: pointer; }
.fmenu > summary::-webkit-details-marker { display: none; }
.fmenu:not([open]) > .menu { display: none; }
.fmenu[open] > summary { border-color: var(--brand); }
.fmenu__menu { min-width: 240px; max-height: 60vh; overflow-y: auto; }
.fmenu__menu .menu__item { padding: 6px 14px; font-size: 13px; }
.menu__sub { padding: 8px 14px 2px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.menu__item.is-current { color: var(--brand); font-weight: 700; }
.fpill__x { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-left: -4px; border-radius: 50%; color: var(--brand); }
.fpill__x:hover { background: var(--brand-soft); }
.fmenu__range { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 6px 14px 10px; }
.fmenu__range label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.fmenu__range .input { height: 32px; width: 150px; padding: 0 8px; }
.omni__pills .fmenu__menu { left: 0; top: calc(100% + 4px); z-index: 70; }
.omni__fmenu { position: relative; margin: 0 12px; }
.omni__fmenu .fmenu__menu { position: absolute; left: 0; top: 4px; }
.omni__pills .fpill.is-open { border-color: var(--brand); }
.omni__pills .fmenu { display: inline-flex; align-items: center; gap: 2px; }
button.menu__item { font-size: 13px; padding: 6px 14px; }

/* stella e seguire */
.panel__bar form.inline { margin: 0; display: inline-flex; }
.star .ic { transition: fill .15s, color .15s; }
.star.is-on { color: #e8a317; }
.star.is-on .ic { --ic-fill: #f5b82e; stroke: #e8a317; }   /* la stella dell'icona si riempie con --ic-fill */
.nav__unstar .ic { --ic-fill: #f5b82e; }
.follow.is-on { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.nav__item--star .nav__label { font-size: 13px; }

/* scadenza */
.next__due-edit { color: var(--brand); font-size: 13px; font-weight: 700; }
.next__due-edit:hover { text-decoration: underline; }
.ev--due .ev__line .what { color: var(--text-2); }

/* citazioni */
/* citazioni come in Resana: magenta, leggere, con i puntini sotto; chi legge la sua anche su un fondo chiaro */
.mention { color: var(--brand); font-weight: 400; white-space: nowrap; border-bottom: 1.5px dotted var(--brand); }
.mention--me { background: var(--brand-soft); border-radius: 3px 3px 0 0; padding: 0 2px; }
.panel__foot form { position: relative; }
.mention-menu { position: absolute; left: 0; bottom: calc(100% + 6px); top: auto; min-width: 240px; }
.mention-menu .menu__item { gap: 8px; }

/* menu a caselle (stati) */
.menu__check { display: flex; align-items: center; gap: 8px; padding: 6px 14px; font-size: 13px; cursor: pointer; }
.menu__check:hover { background: var(--bg-hover); }
.menu__check .dot { width: 8px; height: 8px; }
.fmenu__foot { padding: 8px 14px 10px; border-top: 1px solid var(--border); margin-top: 6px; }

/* notifiche */
.inbox { list-style: none; margin: 8px 0 40px; padding: 0; }
.inbox__item { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--border); }
.inbox__item:hover { background: var(--bg-soft); }
.inbox__item.is-unread { background: #fff8fb; }
.inbox__item.is-unread .inbox__what { font-weight: 600; }
.inbox__icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--bg-soft); color: var(--muted); flex: none; }
.k-citazione .inbox__icon { background: #e9eefb; color: #2b4a9a; }
.k-assegnazione .inbox__icon { background: var(--brand-soft); color: var(--brand); }
.inbox__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.inbox__what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox__where { color: var(--muted); font-size: 12px; }
.inbox__kind { flex: none; padding: 0 6px; border-radius: 4px; background: var(--bg-soft); color: var(--text-2); font-size: 11px; font-weight: 700; line-height: 18px; }
.k-assegnazione .inbox__kind { background: var(--brand-soft); color: var(--brand); }
.inbox__time { flex: none; width: 110px; text-align: right; color: var(--muted); font-size: 12px; }

/* le icone dentro la pagina: non occupano spazio */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* il filtro "Azione": azione, quando e chi insieme */
.fmenu__activity { display: grid; gap: 10px; padding: 10px 14px 0; width: 320px; }
.fmenu__field { display: grid; gap: 4px; }
.fmenu__label { font-size: 12px; font-weight: 700; color: var(--text-2); }
.fmenu__label small { font-weight: 400; color: var(--muted); }
.fmenu__activity .input { height: 34px; }
.fmenu__activity .fmenu__range { padding: 0; }
.fmenu__activity .fmenu__range .input { width: 140px; }
.fmenu__activity .fmenu__foot { margin: 0 -14px; }

/* utenti */
.users { overflow-x: auto; }
.tbl--users thead th { vertical-align: bottom; }
.users__groups th { border-bottom: 0; padding-bottom: 2px; }
.users__group { color: var(--text-2) !important; font-weight: 700 !important; font-size: 11px !important; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border) !important; }
#users-head th { font-size: 11.5px; padding-top: 6px; }
.tbl--users td.c, .tbl--users th.c { width: 84px; }
.savecol { width: 1px; }
.js .savecol { display: none; }
.sec2 { margin: 28px 0 12px; font-size: 15px; font-weight: 800; }
.taggroups { display: grid; gap: 18px; }
.taggroup__title { margin: 0 0 8px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.tagcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tagcard { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.tagcard__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tagcard__name { font-size: 14px; }
.tagcard__n { color: var(--muted); font-size: 12px; }
.tagcard__desc { margin: 4px 0 0; color: var(--text-2); font-size: 13px; }
.tagcard__owns { margin: 6px 0 0; color: var(--muted); font-size: 12px; }

/* profilo */
.profile { max-width: 900px; padding: 24px 24px 48px; }
.profile__card { display: flex; align-items: center; gap: 18px; padding: 20px 22px; border: 1px solid var(--border); border-radius: var(--radius-lg);
   background: linear-gradient(135deg, #fff 60%, var(--brand-soft)); }
.profile__avatar { width: 64px; height: 64px; font-size: 22px; }
.profile__who { flex: 1; min-width: 0; }
.profile__name { margin: 0; font-size: 22px; font-weight: 800; }
.profile__mail { color: var(--muted); }
.profile__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.profile__digest { flex: none; align-self: flex-start; }
.profile__note { margin: -6px 0 12px; }
.profile__stats { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.profile__can { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.profile__can li { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); }
.profile__can span { color: var(--text-2); }
.profile__owns { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 14px 0 6px; }

/* stella da togliere nella barra laterale */
.nav__starred { position: relative; }
.nav__starred .nav__item { padding-right: 34px; }
.nav__unstar { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); margin: 0; }
.nav__unstar button { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; color: #f5b82e; opacity: 0; transition: opacity .12s, background .12s; }
.nav__starred:hover .nav__unstar button, .nav__unstar button:focus-visible { opacity: 1; }
.nav__unstar button:hover { background: var(--chrome-hover); }

/* storico: l'inizio non è un tasto */
.ev--start .ev__ic { border: 0; width: 18px; height: 18px; }

/* dati del cliente: titolo con il tasto per modificarli */
.feed__head--fields { margin-top: 4px; }
.feed__head--fields .next__due-edit { display: inline-flex; align-items: center; gap: 4px; }

.manual-tag { margin-left: 6px; padding: 0 5px; border-radius: 4px; background: var(--accent-soft); color: #067a76; font-size: 10.5px; font-weight: 700; cursor: help; }

/* in fondo alla scheda: sempre a portata, sopra il campo della nota */
.panel__foot { position: relative; }
.to-end {
   position: absolute; right: 16px; bottom: calc(100% + 12px); z-index: 2; width: 36px; height: 36px;
   display: grid; place-items: center; border-radius: 50%; background: #fff; color: var(--muted);
   border: 1px solid var(--border); box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}
.to-end:hover { color: var(--text); border-color: var(--border-strong); }
.to-end { transition: opacity .15s, visibility .15s; }
.to-end.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }

/* la voce dello storico aperta da una notifica */
.feed > li:target { background: var(--brand-soft); border-radius: 8px; animation: note-target 2.4s var(--ease) forwards; }
@keyframes note-target { 70% { background: var(--brand-soft); } to { background: transparent; } }
.feed > li { scroll-margin: 24px; }

/* lista continua: il tasto "Successive" serve solo senza javascript */
.list-endless #next { display: none; }
.listfoot.is-loading #count::after { content: " · carico le altre…"; color: var(--muted); }
.panel__body { padding-bottom: 64px; }

/* la lista: colonne a larghezza fissa (non cambiano caricando altre righe), la prima prende lo spazio che resta;
   si possono allargare trascinando il bordo dell'intestazione; i testi lunghi si tagliano */
.tbl--list { table-layout: fixed; }
.tbl--list th:nth-child(2) { width: 11%; }
.tbl--list th:nth-child(3) { width: 17%; }
.tbl--list th:nth-child(4) { width: 14%; }
.tbl--list th:nth-child(5) { width: 11%; }
.tbl--list th:nth-child(6) { width: 13%; }
.tbl--list td { overflow: hidden; overflow-wrap: anywhere; }
.tbl--list .rowlink, .tbl--list .cust__sub { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tbl--list th { position: sticky; }
.colresize {
   position: absolute; top: 0; right: -4px; bottom: 0; width: 9px; z-index: 2; cursor: col-resize;
   touch-action: none;
}
/* il separatore si vede sempre; passandoci sopra (o trascinando) diventa una maniglia colorata */
.colresize::after {
   content: ""; position: absolute; top: 20%; bottom: 20%; left: 3px; width: 2px; border-radius: 1px;
   background: var(--border-strong); transition: background .15s, top .15s, bottom .15s;
}
.colresize:hover::after, .colresize.is-dragging::after { top: 4px; bottom: 4px; background: var(--brand); }
.tbl--list th:last-child .colresize { display: none; }   /* dopo l'ultima non c'è niente da spostare */
body.is-resizing-cols { cursor: col-resize; user-select: none; }

/* "Arriva da": la scelta attiva */
.menu__item.is-on { font-weight: 700; }
.menu__item .menu__tick { margin-left: auto; color: var(--brand); }
.fmenu__menu .menu__item .dot { width: 10px; height: 10px; flex: none; }
/* con il pannello aperto (o sugli schermi stretti) le ultime due colonne spariscono: l'ultima visibile è la quarta */
.panel-open .tbl--list th:nth-child(4) .colresize { display: none; }
@media (max-width: 900px) { .tbl--list th:nth-child(4) .colresize { display: none; } }
.tbl--list th.r { padding-right: 18px; }   /* staccato dal separatore */

/* ordinamento: si clicca l'intestazione */
.th-sort { display: inline-flex; align-items: center; gap: 3px; color: inherit; max-width: 100%; overflow: hidden; white-space: nowrap; }
.th-sort:hover { color: var(--text); }
.th-sort.is-on { color: var(--text); font-weight: 700; }
.th-sort__ic { flex: none; color: var(--brand); transition: transform .15s; }
.th-sort.is-reverse .th-sort__ic { transform: rotate(180deg); }

/* avviso breve in basso (come in Resana) */
.toast {
   position: fixed; z-index: 100; left: 50%; bottom: 28px; transform: translateX(-50%);
   padding: 10px 16px; border-radius: 6px; background: var(--navy); color: #fff; font-size: 14px;
   box-shadow: var(--shadow-menu); animation: toast-in .15s var(--ease); transition: opacity .3s;
}
.toast.is-out { opacity: 0; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } }

/* chiudere in ogni momento: a parte, sotto il prossimo passo, chiuso finché non serve */
.closebox { margin: 10px 0 4px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); }
.closebox summary { display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--muted); font-size: 13.5px; cursor: pointer; list-style: none; }
.closebox summary::-webkit-details-marker { display: none; }
.closebox summary:hover { color: var(--text); }
.closebox__caret { margin-left: auto; transition: transform .15s; }
.closebox[open] .closebox__caret { transform: rotate(180deg); }
.closebox[open] summary { color: var(--text); }
.closebox__help { margin: 0 14px; color: var(--muted); font-size: 13px; }
.closebox .next__actions { margin: 10px 14px 14px; }
/* nelle colonne allineate a destra (Residuo) la freccia sta a sinistra, così il testo resta allineato ai numeri */
.tbl th.r .th-sort { flex-direction: row-reverse; }

/* ---------- le tue notifiche ---------- */
.settings { max-width: 760px; display: grid; gap: 18px; }
.setcard { padding: 18px 20px 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; }
.setcard__title { margin: 0 0 6px; font-size: 16px; font-weight: 800; }
.setcard__title--sep { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); }
.setcard__intro { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.setcard__warn { margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius); background: var(--soon-soft); font-size: 13px; }
.setcard__foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.prefs { display: grid; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.prefs__row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, 96px); align-items: center; border-top: 1px solid var(--border); }
.prefs__row:first-child { border-top: 0; }
.prefs__row--head { background: var(--bg-soft); color: var(--muted); font-size: 12px; }
.prefs__what { padding: 10px 14px; }
.prefs__what b { display: block; font-weight: 600; }
.prefs__what small { color: var(--muted); font-size: 12px; }
.prefs__col { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 10px 6px; cursor: pointer; }
.prefs__row--head .prefs__col { cursor: default; }
.prefs__col input[disabled] { opacity: .5; }
.pushdev__hint { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--brand-soft); font-size: 13px; }
.pushdev__state { margin: 0; font-size: 14px; }
.pushdev__state.is-on { display: flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 600; }
.pushdev__state.is-on[hidden] { display: none; }
.pushdev__state.is-warn { padding: 8px 12px; border-radius: var(--radius); background: var(--late-soft); font-size: 13px; line-height: 1.5; }
.pushdev__title { margin: 22px 0 8px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pushdev__list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); }
.pushdev__item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); }
.pushdev__item:first-child { border-top: 0; }
.pushdev__item > .ic { color: var(--muted); flex: none; }
.pushdev__main { flex: 1; min-width: 0; }
.pushdev__main small { display: block; color: var(--muted); font-size: 12px; }
.pushdev__item form { margin: 0; }
.pushdev__item.is-this { background: var(--bg-soft); }
@media (max-width: 600px) { .prefs__row { grid-template-columns: minmax(0, 1fr) repeat(3, 64px); } .prefs__col { font-size: 11px; flex-direction: column; } }

/* ---------- importazione ---------- */
.setcard__title .ic { vertical-align: -2px; margin-right: 6px; color: var(--ok); }
.setcard--result { border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); }
.imp__stats { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.stat.is-zero { opacity: .45; }
.reslist--late { color: var(--late); }
.setcard .drop { margin-top: 4px; }
.imp__rules { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); }
.imp__rules li { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 13.5px; line-height: 1.5; }
.imp__rules li:first-child { border-top: 0; }
.imp__when { font-weight: 600; }
.imp__cols { display: flex; flex-wrap: wrap; gap: 6px; }
.imp__cols .badge, .imp__opt .badge { line-height: 22px; padding: 0 8px; font-size: 12px; }
.imp__opt { margin: 10px 0 0; }
@media (max-width: 600px) { .imp__rules li { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- chiuse ma ancora da pagare ---------- */
.status__stillopen { display: flex; align-items: flex-start; gap: 6px; margin: 8px 0 0; padding: 8px 10px; border-radius: var(--radius); background: var(--late-soft); color: var(--text); font-size: 13px; line-height: 1.45; }
.status__stillopen .ic { flex: none; margin-top: 2px; color: var(--late); }
.imp__list { list-style: none; margin: 0 0 12px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); }
.imp__list li { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--border); font-size: 13.5px; }
.imp__list li:first-child { border-top: 0; }
.imp__link { flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.imp__link:hover b { color: var(--brand); text-decoration: underline; }
.imp__link .muted { margin-left: 6px; font-size: 12.5px; }
.k-assegnazione .inbox__kind.is-past { background: var(--bg-soft); color: var(--muted); font-weight: 600; }
.imp__modes { display: grid; gap: 8px; margin-top: 14px; }
.imp__modes .option { margin-top: 0; cursor: pointer; }
.imp__modes .option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
