/* Company module: only the widgets unique to it (spec 9.1), the logo and the org tree. The page scoped rules of the
   structure lists and forms left with the last view that used .company-page (task 045). */
.company-logo { max-width: 8rem; max-height: 8rem; }

/* Org chart (spec 6.3): the tree keeps its nesting; each group is one row with its name, people count, heads and
   the actions as links, each opening its side panel (task 340: the page reads, panels edit). */
.org-tree { display: grid; gap: var(--space-2); margin: 0 0 var(--space-3); padding: 0; list-style: none; }
.org-tree .org-tree { margin: var(--space-2) 0 0 var(--space-3); padding-left: var(--space-2); border-left: var(--border-w) solid var(--line-strong); }
.org-node { min-width: 0; }
.org-card { padding: var(--space-2) var(--space-3); background: var(--surface-1); border-radius: var(--radius-l); box-shadow: var(--shadow-1); }
.org-card-head { display: flex; align-items: center; gap: var(--space-1); }
.org-card-head > h3 { min-width: 0; margin: 0; font-size: var(--ph-text-lg); overflow-wrap: break-word; }
/* Task 371 (#4 of task 370, the owner's rule of 2026-11-10: never cut, never a sideways scroll): at 320 a chain of five
   levels left the fifth card 80px, one word a line, 29px past the screen. Below 480px a list stops indenting after the
   second level and a unit from the third level on names its parent above its own name (org-node.ejs), which the
   indentation said before; wider, the indentation says it and the line is not drawn. */
.org-card-parent { display: none; }
@media (max-width: 479.98px) {
  .org-tree .org-tree .org-tree { margin-left: 0; padding-left: 0; border-left: 0; }
  .org-card-head { flex-wrap: wrap; }
  .org-card-parent { display: block; flex-basis: 100%; order: -1; margin: 0; color: var(--ink-2); font-size: var(--ph-text-sm); overflow-wrap: break-word; }
}
.org-meta { margin: var(--ph-space-05) 0 var(--space-1); color: var(--ink-2); font-size: var(--ph-text-sm); }
.org-members { display: grid; margin: 0 0 var(--space-1); padding: 0; list-style: none; }
.org-members > li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-1); padding: var(--ph-space-05) 0; border-top: var(--border-w) solid var(--line); }
.org-actions { display: flex; flex-wrap: wrap; gap: var(--space-1); padding-top: var(--space-1); border-top: var(--border-w) solid var(--line); }
/* The history of moves, its own tab (design «Segnale»): one move to a line, the date first. */
.org-moves { margin: 0; padding: 0; list-style: none; }
.org-moves > li { padding: var(--ph-space-15) 0; border-bottom: var(--border-w) solid var(--line); }
.org-moves > li:last-child { border-bottom: 0; }
.org-moves-date { font-variant-numeric: tabular-nums; }

/* Graphic org chart (task 080, redrawn by task 280): nested lists, no script, never cut and never behind a sideways
   scroll (owner, 2026-11-10). One markup, two designs (org-graph-node.ejs): every unit is a native disclosure whose
   summary is its row (colour, name, who is responsible, how many people).
   On a phone and a small screen the chart is a list of those rows: the first screen is the shape of the company, the
   whole row opens the unit's people, and a sub-unit stands under its parent indented by one small step from the second
   level on, so three levels still leave the row its width. */
.org-graph-area { margin: 0 0 var(--space-3); padding: var(--space-2); background: var(--surface-2); border-radius: var(--radius-l); }
.org-graph, .org-graph ul { margin: 0; padding: 0; list-style: none; }
.org-graph ul { margin-left: var(--space-1); padding-left: var(--space-1); border-left: var(--border-w) solid var(--line-strong); }
.org-graph-root > li > ul { margin-left: 0; padding-left: 0; border-left: 0; }
.org-graph-node { margin: var(--space-1) 0 0; }
.org-graph-box { position: relative; display: block; box-sizing: border-box; min-width: 0; max-width: 100%; background: var(--surface-1); overflow: hidden; border-radius: var(--radius-l); box-shadow: var(--shadow-1); }
.org-graph-company { padding: var(--space-1) var(--space-2); border-top: 4px solid var(--accent); }
/* Task 285: a name breaks between its words; a single word breaks only where it alone is wider than the box. */
.org-graph-box h2, .org-graph-box h3 { margin: 0; font-size: var(--ph-text-lg); overflow-wrap: break-word; }
.org-graph-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; column-gap: var(--space-1); min-height: var(--ph-control-h-touch); box-sizing: border-box; padding: var(--space-1) var(--space-2); list-style: none; cursor: pointer; }
.org-graph-row::-webkit-details-marker { display: none; }
.org-graph-row > h3 { grid-column: 1; grid-row: 1; font-size: var(--ph-text-md); font-weight: 600; }
.org-graph-brief { display: contents; }
.org-graph-brief-head { grid-column: 1; grid-row: 2; color: var(--ink-2); font-size: var(--ph-text-sm); overflow-wrap: break-word; }
.org-graph-count { grid-column: 2; grid-row: 1 / span 2; color: var(--ink-2); font-size: var(--ph-text-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.org-graph-row::after { content: ""; grid-column: 3; grid-row: 1 / span 2; width: 0.5em; height: 0.5em; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-0.15em) rotate(45deg); }
.org-graph-box[open] > .org-graph-row::after { transform: translateY(0.15em) rotate(-135deg); }
/* On a phone the colour is a bar down the row's edge. */
.org-graph-colour { position: absolute; top: 0; left: 0; width: 4px; height: 100%; }
.org-graph-detail { padding: 0 var(--space-2) var(--space-2); }
.org-graph-people { margin: var(--ph-space-05) 0 0; padding: 0; list-style: none; font-size: var(--ph-text-sm); }
.org-graph ul.org-graph-people { margin-left: 0; padding-left: 0; border-left: 0; }
.org-graph-more summary { cursor: pointer; font-size: var(--ph-text-sm); }
.org-graph-rest { margin-top: var(--ph-space-05); }
.org-graph-box p { margin: var(--ph-space-05) 0 0; font-size: var(--ph-text-sm); }
.org-graph-role { margin: var(--space-1) 0 0; padding-top: var(--space-1); border-top: var(--border-w) solid var(--line); text-align: left; }
.org-graph-label { margin: 0 0 var(--ph-space-05); color: var(--ink-2); font-size: var(--ph-text-sm); }
.org-graph-note { margin: 0; color: var(--ink-2); font-size: var(--ph-text-sm); }
.org-graph-nohead { margin: var(--ph-space-05) 0 0; }
.org-graph-people li + li, .org-graph-role > .person-cell + .person-cell { margin-top: var(--ph-space-05); }
/* On a phone the row already says that nobody is responsible. Task 285: the indent stops at the third level, so a chain
   of six still leaves the row its width (at 320 the sixth level had 57px for its name): a deeper level keeps only its
   line, a half step from its parent's edge, so the chain still reads as a chain. */
@media (max-width: 899.98px) {
  .org-graph-nohead { display: none; }
  .org-graph-root > li > ul ul ul ul:not(.org-graph-people) { margin-left: 0; padding-left: var(--ph-space-05); }
}
/* Narrower than 22rem the count goes under the name, so the name keeps the row's width. */
@media (max-width: 21.999rem) {
  .org-graph-row { grid-template-columns: minmax(0, 1fr) auto; }
  .org-graph-count { grid-column: 1; grid-row: 3; }
  .org-graph-row::after { grid-column: 2; grid-row: 1 / span 3; }
}
/* An opened unit on a phone lists its first twenty people: they are already folded behind the row, so the «Altre N
   persone» of the wide box would be a second click for nothing; past twenty the rest wait behind their own «Altre N
   persone» (task 285: a unit of 81 opened was 4166px tall). Only where the browser can show a closed disclosure's
   content; elsewhere the «Altre N persone» stays and nobody is lost. */
@supports selector(::details-content) {
  @media (max-width: 899.98px) {
    .org-graph-more > summary { display: none; }
    .org-graph-more::details-content { content-visibility: visible; }
  }
}
/* From 900px the company stands on top and every group of sibling units is a framed band hung under its parent by one
   line; the band wraps its units into further rows when they do not fit side by side, and a unit with a wide family
   takes a row of its own and wraps its children inside it, so the whole tree fits the content width at any number of
   units and levels. Each box shows what its row folds, without a click. */
@media (min-width: 900px) {
  .org-graph, .org-graph li.org-graph-node { display: flex; flex-direction: column; align-items: center; }
  .org-graph li.org-graph-node { flex: 0 1 auto; min-width: 0; max-width: 100%; margin: 0; }
  .org-graph ul { position: relative; display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: var(--space-2); box-sizing: border-box; max-width: 100%; margin: var(--space-2) 0 0; padding: var(--space-2); border: var(--border-w) solid var(--line-strong); border-radius: var(--radius-l); }
  .org-graph-root > li > ul { margin-top: var(--space-2); padding: var(--space-2); border: var(--border-w) solid var(--line-strong); }
  .org-graph ul::before { content: ""; position: absolute; bottom: 100%; left: 50%; height: var(--space-2); border-left: var(--border-w) solid var(--line-strong); }
  .org-graph ul.org-graph-people { display: block; margin: var(--ph-space-05) 0 0; padding: 0; border: 0; }
  .org-graph ul.org-graph-people::before { display: none; }
  .org-graph-box { width: 15rem; }
  .org-graph-company { width: auto; text-align: center; }
  .org-graph-colour { width: 100%; height: 4px; }
}
@supports selector(::details-content) {
  @media (min-width: 900px) {
    .org-graph-row { display: block; min-height: 0; padding: var(--space-1) var(--space-2) 0; cursor: default; }
    .org-graph-row::after, .org-graph-brief { display: none; }
    .org-graph-row > h3 { padding-top: var(--ph-space-05); font-size: var(--ph-text-lg); }
    .org-graph-box::details-content { content-visibility: visible; }
    /* The wide box folds its people once, behind the «Altre N persone» of the six. */
    .org-graph-rest > summary { display: none; }
    .org-graph-rest::details-content { content-visibility: visible; }
  }
}
/* Storico modifiche (design «Segnale»): the sentence of a change stays on its line and the changed fields open under it
   as label and value pairs. */
.history-table td.date { white-space: nowrap; }
.history-detail { display: inline-block; margin: 0 0 0 var(--space-1); vertical-align: baseline; }
.history-detail[open] { display: block; margin: var(--ph-space-05) 0 0; }
.history-fields { display: grid; grid-template-columns: max-content 1fr; gap: var(--ph-space-05) var(--space-2); margin: 0 0 var(--space-1); }
.history-fields > dt { color: var(--ink-2); }
.history-fields > dd { margin: 0; overflow-wrap: anywhere; }

/* Tutte le impostazioni (design «Segnale»): the groups as tabs and the search on one line; on a phone the search goes
   under the tabs. A setting row keeps its value and its one way in on the line of the name. */
.settings-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2); margin: 0 0 var(--space-3); box-shadow: inset 0 -1px 0 var(--line); }
.settings-bar > .tabs { flex: 1 1 auto; min-width: 0; margin: 0; box-shadow: none; }
.settings-bar > .tabs::after { box-shadow: none; }
.settings-bar > .toolbar-form { flex: 0 1 18rem; margin: 0 0 var(--space-1); }
.setting-group > h2.visually-hidden + .setting-row { border-top: 0; }
.setting-text > h3 > a { color: inherit; text-decoration: none; }
.setting-text > h3 > a:hover { text-decoration: underline; }

/* The people of a place or a project (design «Segnale»): chips with their own remove button, the add field on one line. */
.member-chips { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: 0 0 var(--space-2); padding: 0; list-style: none; }
.member-chip { display: inline-flex; align-items: center; gap: var(--ph-space-05); padding: 0 0 0 var(--space-2); border: var(--border-w) solid var(--line); border-radius: var(--radius-l); background: var(--bg); }
.member-chip > form { display: contents; }
.member-chip-remove { display: inline-flex; align-items: center; justify-content: center; min-width: var(--ph-control-h-compact); min-height: var(--ph-control-h-compact); padding: 0; border: 0; border-radius: var(--radius-l); background: transparent; color: var(--ink-2); cursor: pointer; }
.member-chip-remove::before { content: "\00d7"; font-size: var(--ph-text-lg); line-height: 1; }
.member-chip-remove:hover { background: var(--surface-2); color: var(--err); }
/* Task 369 (rompi-ui 368 #10): a place's ties come first, each a chip with the people it brought folded under it. */
.place-ties { margin: 0 0 var(--space-2); padding: 0; list-style: none; }
.place-ties > li { padding: var(--space-1) 0; }
.place-ties > li > .member-chip { max-width: 100%; overflow-wrap: break-word; }
.place-ties > li > .disclosure { margin: var(--space-1) 0 0; }
/* Task 335: who a step on a place or a project affects, by name, in its confirmation panel; a tied group's people in the add panel. */
.impact-list { margin: 0 0 var(--space-2); padding-left: var(--space-3); }
.place-impact > h3 { margin: var(--space-2) 0 var(--space-1); }
.member-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2); }
.member-add > .form-field { flex: 0 1 20rem; margin: 0; }
.panel > h2 > .count { color: var(--ink-3); font-weight: 400; }

/* The hours of a project against its budget (design «Segnale»): the figures, a bar, and the state in words, red once the
   budget is passed. */
.project-budget { margin: 0 0 var(--space-3); }
.project-budget-figures { margin: 0 0 var(--space-1); color: var(--ink-2); }
.project-budget-figures > strong { color: var(--ink); font-size: var(--ph-text-lg); }
.project-budget-bar { display: block; width: min(100%, 28rem); height: 0.5rem; border: 0; border-radius: var(--radius); background: var(--surface-2); appearance: none; overflow: hidden; }
.project-budget-bar::-webkit-progress-bar { background: var(--surface-2); }
.project-budget-bar::-webkit-progress-value { background: var(--accent); }
.project-budget-bar::-moz-progress-bar { background: var(--accent); }
.project-budget.is-over .project-budget-bar::-webkit-progress-value { background: var(--err); }
.project-budget.is-over .project-budget-bar::-moz-progress-bar { background: var(--err); }
.project-budget-state { margin: var(--space-1) 0 0; }

/* Commesse e progetti (design «Segnale»): from 40rem a project is one line. */
@media (min-width: 40rem) {
  [aria-labelledby="projects-caption"] :is(th, td) { white-space: nowrap; }
}

/* Contratti applicati (design «Segnale»): the deletion of a row is a quiet link-like drawer, not a button on every row. */
.contract-facts .row-drawer > summary { background: transparent; color: var(--ink-2); font-weight: 400; }
.contract-facts .row-drawer > summary:hover, .contract-facts .row-drawer[open] > summary { background: var(--surface-2); color: var(--err); }

/* Impostazioni paghe (design «Segnale»): the groups of the settings as a row of links at the top; task 340: each group reads
   and opens its own panel. */
.settings-index { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: 0 0 var(--space-3); }
.settings-index > a { display: inline-flex; align-items: center; min-height: var(--ph-control-h-compact); padding: 0 var(--space-2); border: var(--border-w) solid var(--line); border-radius: var(--radius-l); color: var(--ink-2); text-decoration: none; }
.settings-index > a:hover { background: var(--accent-subtle-bg); color: var(--accent-text); }
.page-read .panel[id^="group-"] { scroll-margin-top: var(--space-3); }

/* Azienda (design «Segnale»): the facts of the company in two columns on a wide screen. */
@media (min-width: 64rem) {
  .facts-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-4); align-items: start; }
}

.figure-holder { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ph-space-05) var(--space-1); }
/* Task 198 (Silvia P26, P27): the studio's referente inside the consultant's row, right under the studio, ruled off from
   it; the roles nobody holds as one line of names a dot apart; the roles of the add panel opened with none, one a line. */
.figure-referents { display: grid; gap: var(--space-1); margin: var(--space-1) 0 0; padding: var(--space-1) 0 0; list-style: none; border-top: var(--border-w) solid var(--line); }
.figure-referents > li { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--ph-space-05) var(--space-2); }
.figure-referent-label { flex-basis: 100%; color: var(--ink-2); font-size: var(--text--1); font-weight: 600; }
.figure-referents .checklist-label { flex-basis: 100%; font-weight: 600; }
.figures-to-name-list { display: flex; flex-wrap: wrap; gap: var(--ph-space-05) 0; margin: 0; padding: 0; list-style: none; }
.figures-to-name-list > li:not(:last-child)::after { content: "\00b7"; padding: 0 var(--space-1); color: var(--ink-2); }
@media (max-width: 63.999rem) {
  .data-table.stack-on-phone tbody tr.figures-to-name > td { grid-column: 1 / -1; }
}
.figure-roles { display: grid; margin: 0; padding: 0; list-style: none; }
.figure-roles > li { border-top: var(--border-w) solid var(--line); }
.figure-roles > li:first-child { border-top: 0; }
.figure-roles a { display: flex; align-items: center; min-height: var(--ph-control-h); padding: var(--space-1) 0; }
/* Task 204 (Silvia P33), task 334: the studio of the delegated collaborators heads its table, how to reach it one muted
   line under its name; the referente's tag under the person. */
.delegation-studio { margin: var(--space-3) 0 0; }
.delegation-studio:first-child { margin-top: 0; }
.delegation-contacts { margin: var(--ph-space-05) 0 var(--space-1); }
.data-table th [data-referent-tag] { margin-top: var(--ph-space-05); }
/* Task 204 (Silvia P30): the standard mark after the category's label, the box beside the label on one line. */
[data-document-categories] .check-field { flex-wrap: nowrap; }
[data-document-categories] .check-field .pill { margin-left: var(--space-1); }
/* Forced colours (task 071, components.css): the card of an organisation unit and a box of the graphic org chart are cards,
   so they keep a visible edge where the fills and the shadows are gone. */
@media (forced-colors: active) {
  .org-card, .org-graph-box { border: var(--border-w) solid; }
}
