/* Consultant workspace (tasks 030 and 045): only the widgets unique to it; the tables, facts, forms, drawers and lists
   are the shared components. Roles and spacing steps only, no colour literal. */

/* The state of a company's month on «Le mie aziende» (task 202, Silvia P23): the month, then one line saying who acts
   next; the month page holds the steps. */
.turn-month { display: block; font-weight: 600; }
.turn-month .consultant-go { display: inline; }
.turn-cell > .status { display: flex; width: fit-content; }

/* The desk (decision of 2026-10-14): a person and what there is to look at per row, the rows with findings first, the
   whole row opening the person's side panel (the name's link covers the row, as on the notifications). The figures of
   the month are in that panel, as a definition list. */
.consultant-desk tbody tr { position: relative; }
.consultant-desk .desk-row-link::after { content: ""; position: absolute; inset: 0; }
.consultant-desk tbody tr:hover { background: var(--bg); }
.consultant-desk tbody th[scope="row"] { min-width: 14rem; }
.desk-findings-count { margin-right: var(--space-1); font-weight: 600; }
.desk-findings-list { display: inline-flex; flex-wrap: wrap; gap: var(--ph-space-05); vertical-align: middle; }
.desk-chevron { width: 1%; color: var(--ink-3); text-align: right; }
.desk-chevron .app-icon { width: 1.25rem; height: 1.25rem; }
/* An open chiarimento is answered from its row (decision of 2026-10-14). */
.desk-row-action { width: 1%; text-align: right; white-space: nowrap; }
.desk-panel-section + .desk-panel-section { margin-top: var(--space-3); }
.desk-panel-section > h3 { margin: 0 0 var(--space-1); font-size: var(--text-0); }
.desk-panel-findings { display: flex; flex-wrap: wrap; gap: var(--ph-space-05); margin: 0; padding: 0; list-style: none; }

/* A figure the close has not brought yet (decision of 2026-10-15): a quiet dash in the slot it will fill. */
.desk-panel-actions { margin-top: var(--space-3); }
@media (max-width: 40rem) {
  .desk-chevron { display: none; }
}
/* A step with no way back (vocabulary rule 6): what it does in normal text beside its button, then one confirmation. */
.consultant-final { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); margin-top: var(--space-1); }
.consultant-final-lead { margin: 0 0 var(--ph-space-05); color: var(--ink); font-size: var(--ph-text-md); white-space: normal; }
.consultant-final details[open], .consultant-ack[open] { flex-basis: 100%; }
/* The confirmation opens inside a card (a panel's list, a table row): a well on the page tone (design-d-spec.md 5). */
.consultant-final details > form, .consultant-ack > form { display: grid; justify-items: start; gap: var(--space-1); margin-top: var(--space-1); padding: var(--space-2); border-radius: var(--radius); background: var(--bg); white-space: normal; }
.consultant-final details > form > p, .consultant-ack > form > p { margin: 0; }
/* The variations page keeps its confirmation readable inside the row's actions cell. */
.data-table td.row-actions:has(.consultant-ack[open]) { min-width: 16rem; } .data-table td.row-actions:has(.consultant-ack) { text-align: left; white-space: normal; }
/* Where a closed clarification carried its agreement (task 052f, Carla C38). */
.consultant-agreement-carried { margin: 0 0 var(--space-2); padding: var(--space-1) var(--space-2); border-left: 3px solid var(--accent); background: var(--surface-1); }
.consultant-agreements .checklist > li { flex-wrap: wrap; }
.consultant-cig-days { flex: 1 1 100%; margin: 0; padding-left: var(--space-3); color: var(--ink-2); }
/* Task 194: the referente of each company in a member's panel of «Persone e accessi», after the company's access. */
.access-referent { margin-left: auto; font-weight: 400; }
/* Task 273: the company's access and its «Referente» on one line; a field's bottom margin set the first 8px higher. */
[data-access-row] > .check-field { margin-bottom: 0; }
/* Task 277: an ended client's note goes under its row, so its «Referente» stays on the company's line; the company
   panel's line about the end stands apart from the referente's choice under it. */
[data-access-row] > [data-access-note="ended"] { order: 1; flex-basis: 100%; }
.access-panel-form > [data-access-ended] { margin-bottom: var(--space-2); }
/* Task 199: the referente's choice (or a member panel's help) leads the panel, set apart from the list's search below it. */
.access-panel-form > [data-referent-choice], .access-panel-form > [data-referent-help] { margin-bottom: var(--space-3); }
/* What the current step of a month not closed waits for (task 122), inside the progress card. */
.consultant-open-month { max-width: var(--ph-measure); }
.consultant-packet-format { margin: 0 0 var(--space-2); }
.consultant-messages { display: grid; gap: var(--space-2); margin: 0 0 var(--space-3); padding: 0; list-style: none; }
.consultant-messages li { padding: var(--space-1) var(--space-2); border-left: 3px solid var(--line); }
.consultant-messages li.message-consultant { border-left-color: var(--accent); }
.consultant-messages p { margin: var(--space-1) 0 0; white-space: pre-wrap; }
/* A form whose labels wrap their controls instead of naming ids (the chiarimenti of the payslips). */
.stack-form { display: grid; gap: var(--space-2); max-width: var(--ph-page-form); margin-bottom: var(--space-3); }
.stack-form > label { font-weight: 600; }
.stack-form > label:has(> :is(input, select, textarea)) { display: grid; gap: var(--ph-space-05); }
.stack-form .checkbox { display: flex; align-items: center; gap: var(--space-1); min-height: var(--ph-control-h); font-weight: 400; }

/* Le mie aziende: what waits and the recent activity side by side on a wide screen. */
.consultant-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); align-items: start; gap: var(--space-3); }
.consultant-columns > .panel { margin: 0; }

/* The studio's CAP, comune and provincia on one row (2026-10-15): the two codes as wide as their characters, the comune
   taking the rest; on a narrow panel the row wraps. */
.studio-place { display: flex; flex-wrap: wrap; align-items: start; gap: var(--space-2); }
.studio-place > .form-field { flex: 1 1 6rem; margin: 0; }
.studio-place > .form-field:has(#studio-cap) { flex: 0 0 7rem; }
.studio-place > .form-field:has(#studio-province) { flex: 0 0 6rem; }
.studio-place .input-short { width: 100%; }

/* Task 122 (owner, 2026-10-15): «Il mese» in bands, the period navigator alone on its own, left-aligned under the header. */
.consultant-period, .calendar-period { margin: 0 0 var(--space-3); }
/* On a phone the page's secondary actions sit side by side, so the first person is in the first screen (Iris I51). */
@media (max-width: 40rem) {
  [data-consultant-month] .page-actions > * { flex: 1 1 0; }
}
/* A «variazione di paga» finding leads to its row on the variations page (task 122, Silvia S6); the row reached is marked. */
.finding-link { display: inline-flex; border-radius: var(--radius-s); text-decoration: none; }
.finding-link:hover .pill, .finding-link:focus-visible .pill { box-shadow: inset 0 0 0 1px var(--accent-border); }
.data-table tr:target > * { background: var(--accent-subtle-bg); }
.consultant-variation-group > h2 { margin: 0 0 var(--ph-space-05); font-size: var(--text-0); }
/* «Precedente / Successiva» (task 122, Silvia S2): in the panel's footer under its buttons, and under the person page's header. */
.person-steps { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-1); width: 100%; }
.person-steps-position { color: var(--ink-2); font-size: var(--ph-text-sm); }
.person-step[aria-disabled="true"] { color: var(--ink-3); pointer-events: none; }
.person-steps-page { justify-content: flex-start; margin: 0 0 var(--space-3); }
/* The person's figures in the side panel (task 122, Silvia S5): the same list as the page, two columns in the panel. */
.side-panel .facts.consultant-facts-grid { grid-template-columns: minmax(8rem, auto) minmax(0, 1fr); }
.person-figures dd.figure-pending { color: var(--ink-3); cursor: help; }
.consultant-registry { margin: 0 0 var(--space-2); }

/* «Cosa e cambiato» (task 054b, H3): the company's entries and the studio's own as two lists of a client, and the line
   that says from when «Nuovo» counts. */
.consultant-activity-origin { margin: var(--space-2) 0 var(--ph-space-05); color: var(--ink-2); font-size: var(--text--1); font-weight: 600; }
.consultant-activity-visit { display: block; margin: 0 0 var(--space-1); }
.consultant-activity-more { margin: var(--space-1) 0 var(--space-2); }
.consultant-changes-since { margin: 0 0 var(--space-2); }
/* The free subject of a new chiarimento is asked only with «Altro» (task 054b, Iris I44); the server still checks it. */
.consultant-thread-form:not(:has(#thread-subject option[value="altro"]:checked)) .form-field:has(#thread-free) { display: none; }
/* Rework 08, Le mie aziende: the row is one line to choose a client by. Task 285: a long name wraps inside a column of
   32 characters, a single long word too, so «Stato del mese», «Cosa è cambiato» and «Azioni» stay in view at 1440. */
.consultant-company-name { display: inline-block; max-width: 32ch; font-weight: 600; overflow-wrap: anywhere; }
/* Decision S6: the oldest month the client has not closed, under the month shown; past its window in the warning ink. */
.turn-behind { display: block; margin-top: var(--ph-space-05); }
.turn-behind .consultant-go { display: inline; }
.turn-behind .consultant-go .link-button { text-align: start; }
.consultant-page > .table-scroll + .panel { margin-top: var(--space-4); }
/* The person page (rework 08): the sections one jump away, the summary in two or three columns, the items above zero
   in the desk's mark. */
.consultant-person-nav ul { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); margin: 0 0 var(--space-3); padding: 0; list-style: none; }
.consultant-person-nav a { display: inline-flex; align-items: center; min-height: var(--ph-control-h); }
@media (min-width: 64rem) {
  .facts.consultant-facts-grid { grid-template-columns: minmax(10rem, 1fr) 1fr minmax(10rem, 1fr) 1fr; }
  .facts.consultant-facts-grid > dd { padding-right: var(--space-3); }
}
.consultant-facts-grid dd.is-item { color: var(--accent-text); font-weight: 600; }
/* «Cosa è cambiato»: an entry is a link without a standing underline, so the list reads as text; the underline comes on
   hover and focus. */
.consultant-activity .consultant-change-what > a { text-decoration: none; }
.consultant-activity .consultant-change-what > a:hover, .consultant-activity .consultant-change-what > a:focus-visible { text-decoration: underline; }
/* Rework 08, the desk: the filters on one line. */
@media (min-width: 40.0625rem) { .consultant-desk-toolbar .filter-bar { align-items: center; } }
/* «Cosa è cambiato» of a client (decision of 2026-10-14): two groups, «Da guardare» and «Già visti»; an entry is its
   sentence, then the month as a small pill and the day in the muted ink at the right edge; on a phone the two stack. */
.consultant-changes-group { display: flex; align-items: center; gap: var(--space-1); margin: var(--space-3) 0 var(--space-1); font-size: var(--text-0); }
.consultant-changes-group:first-of-type { margin-top: 0; }
.consultant-changes-list { margin: 0 0 var(--space-2); padding: 0; list-style: none; }
.consultant-change { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--ph-space-05) var(--space-3); padding: var(--space-1) 0; border-top: var(--border-w) solid var(--line); }
.consultant-change:first-child { border-top: 0; }
.consultant-change-what { flex: 1 1 24rem; min-width: 0; }
.consultant-change-what .cell-note { display: block; }
.consultant-change-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); font-size: var(--ph-text-sm); }
.consultant-change-when { font-variant-numeric: tabular-nums; white-space: nowrap; }
.consultant-changes-list.is-new .consultant-change-what { font-weight: 600; }
/* Forced colours (task 071, components.css): the list of the other months is a card, so it keeps a visible edge where the fills and
   the shadows are gone. */
/* «Riporta in un altro mese» in the reply form (decision of 2026-10-14): the two fields of the rare case behind it. */
.consultant-carry { margin: var(--space-2) 0; }
.consultant-carry[open] > summary { margin-bottom: var(--space-2); }
/* Decision of 2026-10-15 (Iris I4): the facts of the person's month beside the chiarimento's reply, in the side panel. */
.consultant-thread-facts { margin: var(--space-2) 0 0; padding: var(--space-2); border: var(--border-w) solid var(--line); border-radius: var(--radius); }
.consultant-thread-facts > h3 { margin: 0 0 var(--space-1); font-size: var(--text-0); }
.consultant-thread-facts > h4 { margin: var(--space-1) 0; color: var(--ink-2); font-size: var(--ph-text-sm); font-weight: 600; }
.consultant-thread-facts > :last-child { margin-bottom: 0; }
.consultant-thread-facts .consultant-thread-items { margin: var(--space-1) 0 0; }
.consultant-thread-facts .table-scroll { box-shadow: none; }
.consultant-expenses-compact { font-size: var(--ph-text-sm); }
.consultant-expenses-compact :is(thead th, tbody th, tbody td), .consultant-expenses-compact :is(thead th, tbody th, tbody td):is(:first-child, :last-child, .num) { padding: var(--ph-space-05) var(--ph-space-05); }
.consultant-expenses-compact thead th { letter-spacing: 0; text-transform: none; }
/* Decision of 2026-10-15 (Iris I25): the open company's row of «Le mie aziende» is marked by a rule on its left, not by
   the tonal ground that hid its tonal button. */
.consultant-portfolio tr.is-selected { background: none; }
.consultant-portfolio tr.is-selected > :first-child { box-shadow: inset 3px 0 0 var(--accent); }
@media (max-width: 40rem) {
  .consultant-portfolio.stack-on-phone tbody tr.is-selected > :first-child { box-shadow: none; }
  .consultant-portfolio.stack-on-phone tbody tr.is-selected { box-shadow: inset 3px 0 0 var(--accent); }
  /* Task 202 (Silvia P23): a shorter card. The month and its one line take the card's width, under no label (the month
     names the cell), so the line reads on one row; the people stand beside the name (nothing there takes focus, so the
     order of the keys is the table's), and «Apri» pairs with the fact before it. */
  .consultant-portfolio.stack-on-phone tbody tr[id] > th { grid-column: 1; grid-row: 1; min-width: 0; }
  .consultant-portfolio.stack-on-phone tbody tr[id] > th .consultant-company-name { max-width: 100%; }
  .consultant-portfolio.stack-on-phone td.portfolio-headcount { grid-column: 2; grid-row: 1; }
  .consultant-portfolio.stack-on-phone td.turn-cell { grid-column: 1 / -1; }
  .consultant-portfolio.stack-on-phone td.turn-cell::before { content: none; }
  .consultant-portfolio.stack-on-phone tbody tr[id] > td.row-actions { grid-column: auto; }
}
.turn-behind .pill-strong { margin-left: var(--ph-space-05); }
/* The search of «Le mie aziende» (decision of 2026-10-15), on its own line above the table. */
.consultant-companies-search { margin: 0 0 var(--space-2); }
/* «Persone e accessi» (task 124): the list of companies searched on its own line, as «Le mie aziende» is; the row a
   panel was opened from, where its close and its save land, kept clear of the window's top edge and marked while the
   address names it; the outcome of a save drawn under that row, the row's whole width (the payslips' row flash). */
.studio-companies-search { margin: 0 0 var(--space-2); }
/* Task 333: the count of a search, under the segments that count the whole list. */
.studio-companies-count { margin: var(--space-1) 0 var(--space-2); }
[data-studio-row] { scroll-margin-top: var(--space-4); }
[data-studio-row]:target { box-shadow: inset 3px 0 0 var(--accent); }
/* The rows of «Persone» take the inline padding the rows of «Aziende» have (their cells', and a stacked row's on a
   phone), so the bar of the row a save lands on stands apart from its text (task 124 fix round, the browser pass). */
.studio-people > li { padding-inline: var(--space-3); }
/* A pending invitation's «Invia di nuovo» and «Ritira l'invito» (task 135, g04): two forms beside its status, items of
   the row's wrapping line as a member row's controls are. */
.studio-people .inline-form { margin: 0; }
.studio-row-flash > td { padding-block: var(--space-1); }
.studio-row-flash .flash { margin: 0; }
@media (max-width: 40rem) {
  .studio-people > li { padding-inline: var(--space-2); }
  .studio-row-flash > td { grid-column: 1 / -1; }
}

/* «Scadenze» (task 118): each day once, at the left on a wide screen, with how far it is; its acts beside it, each with
   what still holds it up on its own line and its one way to act at the right edge, as «Da fare ora» lays out a row. On a
   phone the day heads its acts and each act stacks. */
.schedule-days { margin: 0; padding: 0; list-style: none; }
.schedule-day { display: grid; grid-template-columns: minmax(9rem, 13rem) minmax(0, 1fr); gap: var(--space-1) var(--space-3); padding: var(--space-2) 0; border-top: var(--border-w) solid var(--line); }
.schedule-day:first-child { border-top: 0; padding-top: 0; }
.schedule-day:last-child { padding-bottom: 0; }
.schedule-when { margin: 0; font-size: var(--text-0); font-weight: 700; }
.schedule-distance { display: block; color: var(--ink-2); font-size: var(--text--1); font-weight: 400; }
.schedule-acts { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.schedule-act { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: var(--space-1) var(--space-3); }
.schedule-title { display: block; font-weight: 600; }
.schedule-title + .schedule-title { margin-top: var(--ph-space-05); }
.schedule-aside { display: block; margin-top: var(--ph-space-05); color: var(--ink-2); font-size: var(--text--1); }
.schedule-standing { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ph-space-05) var(--space-2); margin: var(--ph-space-05) 0 0; }
.schedule-month { color: var(--ink-2); font-size: var(--text--1); }
.schedule-hold { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--ph-space-05) var(--space-1); min-width: 0; max-width: 100%; }
.schedule-hold .schedule-aside { display: inline; margin: 0; }
/* Task 373 (rompi-ui 372 #5): the pill naming the companies wraps, even inside a one-word name; at 390 it scrolled the page sideways. */
.schedule-hold .status { min-width: 0; overflow-wrap: anywhere; white-space: normal; }
/* Each late company of a group named with its own days late (task 123). */
.schedule-late-company { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); min-width: 0; }
/* Every company's month only running (review of 2026-10-15, P3-b): one muted line, no mark, nothing to open. */
.schedule-quiet { color: var(--ink-2); font-size: var(--text--1); }
.schedule-action form, .schedule-company-actions form { margin: 0; }
/* The act's side panel: a company a row, its name and state, the actions at the right edge. */
.schedule-companies { margin: 0; padding: 0; list-style: none; }
.schedule-company { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: var(--space-1) var(--space-2); padding: var(--space-1) 0; border-top: var(--border-w) solid var(--line); }
.schedule-company:first-child { border-top: 0; }
/* Task 295 (#4 of task 293): a one-word name of 60 letters wraps inside the list; its late pill stays whole. */
.schedule-company-name { font-weight: 600; overflow-wrap: anywhere; }
:is(.schedule-days, .schedule-companies) .pill-strong { flex: none; white-space: nowrap; }
.schedule-company-actions { display: flex; flex-wrap: wrap; gap: var(--space-1); }
/* A refused reminder under the company it was for (P2-2), the row's whole width. */
.schedule-company > .alert { flex-basis: 100%; margin: 0; }
@media (max-width: 40rem) {
  .schedule-day, .schedule-act { grid-template-columns: minmax(0, 1fr); }
  .schedule-distance { display: inline; margin-left: var(--space-1); }
}

/* Task 136: «Nuovo cliente» and the card of a managed client. A recipient's name, role and address share one line where
   there is room, and stack on a phone. */
.managed-client-recipient { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0 var(--space-2); }
.managed-client-recipient > .form-errors, .managed-client-recipient > .form-actions { grid-column: 1 / -1; }
/* Task 192: the line on who receives the studio's mails stands apart from the first person's labels. */
.form-section > .field-help:has(+ .managed-client-recipient) { margin-bottom: var(--space-2); }

/* Task 143: «Dati del mese», a grid of short values that scrolls sideways; numbers stay narrow, texts readable. */
.month-data-grid input.month-data-short { width: 5.5rem; }
.month-data-grid input.month-data-text, .month-data-grid select.month-data-text { width: 12rem; }
.month-data-grid tr.row-refused th { color: var(--err); }
/* Task 295 (#7 of task 293): the person column stays while the grid scrolls to «Altre», «Rimborsi» and «Nota», so a
   row is never typed without its name in sight. (#14) The note is two lines wide enough to read what was written. */
.month-data-grid th[scope="row"], .month-data-grid thead th:first-child { position: sticky; left: 0; z-index: 1; min-width: 10rem; background: var(--surface-1); box-shadow: inset -1px 0 0 var(--line); }
.month-data-grid textarea.month-data-note { width: 18rem; min-height: 0; }

/* Task 281 (D5 of task 272): on a phone the column mapping of a client's file sets each column's name over its
   choice, the choice at the table's whole width, so the field chosen is read whole («Ore di permesso», never
   «Ore di permes…»). The name is the select's own label; the head row, whose two columns no longer exist, is kept
   for screen readers only. */
@media (max-width: 40rem) {
  .data-table[data-file-columns], .data-table[data-file-columns] tbody { display: block; }
  .data-table[data-file-columns] caption { display: block; }
  .data-table[data-file-columns] thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .data-table[data-file-columns] tbody tr { display: grid; grid-template-columns: minmax(0, 1fr); }
  .data-table[data-file-columns] tbody th { border-bottom: 0; padding-bottom: 0; }
}
/* Task 299: «Clienti terminati» under the list of «Le mie aziende», folded; its title is the toggle, at the size of a
   section's title, and a long name wraps on a phone. */
.former-clients { margin-top: var(--space-4); }
.former-clients-title { display: inline; margin: 0; font-size: var(--ph-text-lg); }
.former-clients > details > summary { align-items: center; gap: var(--space-1); cursor: pointer; }
.former-clients > details > summary::before { content: ""; flex: none; width: 0.45em; height: 0.45em; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); }
.former-clients > details[open] > summary::before { transform: rotate(45deg); }
.former-clients-table .consultant-company-name { overflow-wrap: anywhere; }
/* Task 299: «In ritardo» of «Scadenze», one row per late company above the days; its acts wrap under its name. */
.schedule-late { margin-bottom: var(--space-3); }
.schedule-late > h2 { margin: 0 0 var(--space-1); font-size: var(--ph-text-lg); }
.schedule-late-list .schedule-company > div:first-child { flex: 1 1 16rem; min-width: 0; }
