/* The application shell, design spec 3.1 to 3.3 and 3.5, in the look of design D «Sportello» (research/design-d-spec.md
   3 to 7): the sidebar is a paper panel set apart from the tinted page by tone alone, with the company as the brand
   line; the top bar stands on the page with its controls as paper buttons; then the main column, and the centred no
   shell column of the public pages. On the roles of theme.css and the spacing steps of 4.3. */

/* Shell grid: a sticky sidebar beside the column that holds the top bar and main */
.has-shell { font-size: var(--ph-text-md); }
.app-shell { display: grid; grid-template-columns: var(--ph-sidebar-w) minmax(0, 1fr); min-height: 100svh; }
/* The column holds the top bar, main and the legal footer (task 172): main takes the height left, so the footer stands at
   the foot of the window on a short page and after the content on a long one. */
.app-col { display: flex; flex-direction: column; min-width: 0; min-height: 100svh; }
.app-col > .app-main { flex: 1 0 auto; }
.app-main { width: 100%; min-width: 0; margin: 0; padding: var(--space-4) var(--space-5) var(--space-6); }
.app-main:focus { outline: none; }

/* Skip link, spec 7.2: the first focusable element, visible only when focused */
.skip-link { position: fixed; top: var(--space-1); left: var(--space-1); z-index: 50; transform: translateY(-200%); padding: var(--ph-space-15) var(--space-2); border-radius: var(--radius); background: var(--surface-1); color: var(--accent-text); font-weight: 600; box-shadow: var(--shadow-2); }
.skip-link:focus { transform: none; }

/* Sidebar, spec 3.2, in the look of design «Segnale»: a full height panel in its own dark contrast colour, sticky while
   the page scrolls; the brand name in the display face beside the brand mark; the current item on the accent
   ground, in bold, with its pictogram in white. */
.app-sidebar { position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; padding: var(--space-3) var(--ph-space-15) var(--space-2); background: var(--ph-sidebar); color: var(--ph-sidebar-fg); }
.app-brand { display: flex; align-items: center; gap: var(--ph-space-15); width: 100%; min-width: 0; padding: var(--space-1); color: var(--ph-sidebar-fg); font-family: var(--font-display); font-size: var(--text-0); font-weight: 700; line-height: 1.25; text-decoration: none; }
.app-brand:visited { color: var(--ph-sidebar-fg); }
/* Task 285 (KNOWN-ISSUES «Left by task 282»): the sidebar's name wraps between its words and never inside one; a single
   word wider than the sidebar is cut by an ellipsis at its edge, and the link's title keeps the whole name. */
.app-brand-name { min-width: 0; overflow: hidden; overflow-wrap: normal; text-overflow: ellipsis; }
.app-brand-mark { display: grid; place-items: center; flex: none; width: 2.25rem; height: 2.25rem; border-radius: var(--radius); background: var(--ph-brand); color: var(--on-accent); font-family: var(--font-body); font-size: var(--text--1); font-weight: 600; letter-spacing: 0.05em; }
/* Design «Segnale»: the company's own logo in place of the mark, on a light tile so a dark logo reads on the dark menu. */
.app-brand-logo { flex: none; width: 2.25rem; height: 2.25rem; padding: var(--ph-space-05); border-radius: var(--radius); background: var(--surface-1); object-fit: contain; }
.app-sidebar-role { margin: var(--space-4) var(--ph-space-15) var(--space-1); color: var(--ph-sidebar-muted); font-size: var(--text--1); font-weight: 600; letter-spacing: var(--tracking-caps); text-transform: uppercase; }
.app-navigation { padding-block: var(--space-1); }
/* Task 052d (F13): the list scrolls as one, rows sit edge to edge, and a shade at an edge the list scrolls past says
   there is more (it moves with the content, so it shows only while entries sit beyond that edge). Since task 087 the
   list is the rows of the first level and one open group: the account links are in the account menu of the top bar. */
.app-sidebar-scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-color: var(--ph-sidebar-border) var(--ph-sidebar);
  background: linear-gradient(var(--ph-sidebar) 30%, transparent) top / 100% 1.5rem no-repeat local, linear-gradient(transparent, var(--ph-sidebar) 70%) bottom / 100% 1.5rem no-repeat local,
    radial-gradient(farthest-side at 50% 0, var(--ph-sidebar-border), transparent) top / 100% 0.625rem no-repeat scroll, radial-gradient(farthest-side at 50% 100%, var(--ph-sidebar-border), transparent) bottom / 100% 0.625rem no-repeat scroll; }
.app-nav-link, .app-nav-group > summary { display: flex; align-items: center; gap: var(--ph-space-15); min-height: var(--ph-control-h); padding: var(--space-1) var(--ph-space-15); border-radius: var(--radius); color: var(--ph-sidebar-fg); font-size: var(--ph-text-md); line-height: 1.35; text-decoration: none; transition: background-color var(--dur-micro) var(--ease-enter), box-shadow var(--dur-micro) var(--ease-enter); }
.app-nav-link:visited { color: var(--ph-sidebar-fg); }
.app-nav-link { margin-block: var(--ph-space-05); }
.app-nav-link > span:first-of-type, .app-nav-group > summary > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.app-nav-link:hover, .app-nav-group > summary:hover { background: var(--ph-sidebar-hover); color: var(--ph-sidebar-fg); }
.app-nav-link[aria-current], .app-nav-link.is-section { background: var(--ph-sidebar-active); color: var(--ph-sidebar-current); font-weight: 600; }
.app-icon { flex: none; width: 1.125rem; height: 1.125rem; }
.app-sidebar .app-icon, .app-menu-panel .app-icon { color: var(--ph-sidebar-muted); }
.app-nav-link[aria-current] .app-icon, .app-nav-link.is-section .app-icon { color: var(--ph-sidebar-current); }
.app-chevron { flex: none; width: 1.125rem; height: 1.125rem; margin-left: auto; }
.app-nav-group { margin-block: var(--ph-space-05); }
.app-nav-group > summary { list-style: none; cursor: pointer; }
.app-nav-group > summary::-webkit-details-marker { display: none; }
.app-nav-group[open] > summary .app-chevron { transform: rotate(90deg); }
/* Task 052d (F13): a closed group that holds the current page stays marked, so the reader still sees where they are. */
.app-nav-group.is-active:not([open]) > summary { background: var(--ph-sidebar-active); color: var(--ph-sidebar-current); font-weight: 600; }
.app-nav-group.is-active:not([open]) > summary .app-icon { color: var(--ph-sidebar-current); }
.app-nav-children { margin: var(--ph-space-05) 0 var(--space-1) var(--space-3); padding-left: var(--ph-space-15); border-left: var(--border-w) solid var(--ph-sidebar-border); }
.app-nav-sublink { position: relative; min-height: var(--ph-control-h); padding-left: var(--ph-space-15); font-size: var(--ph-text-sm); }
/* The dot sits centred on the rail of .app-nav-children: back over the list's padding, then half the dot less half the rail. */
.app-nav-sublink[aria-current]::before, .app-nav-sublink.is-section::before { content: ""; position: absolute; top: calc(50% - 3px); left: calc(-1 * var(--ph-space-15) - 3px - var(--border-w) / 2); width: 6px; height: 6px; border-radius: 50%; background: var(--ph-sidebar-rail); }
/* The count of a menu entry is of things that wait for the user: a small badge on the attention ground with the ink
   of the text (design-d-spec.md 7). */
.app-nav-count { display: inline-grid; place-items: center; min-width: 1.5em; height: 1.5em; padding: 0 var(--ph-space-05); border-radius: var(--radius-s); background: var(--ph-attention-bg); color: var(--ink); font-size: var(--text--1); font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.app-sidebar :is(.app-nav-link, .app-nav-group) { margin-block: var(--ph-space-05); }
/* Design «Segnale»: the rows of the sidebar breathe, a touch target high with the pictogram a step larger. */
.app-sidebar :is(.app-nav-link, .app-nav-group > summary) { min-height: var(--ph-control-h-touch); padding-inline: var(--ph-space-15); gap: var(--ph-space-15); font-size: var(--text-0); }
.app-sidebar .app-nav-sublink { min-height: var(--ph-control-h); font-size: var(--ph-text-md); }
.app-sidebar .app-icon { width: 1.25rem; height: 1.25rem; }

/* Focus inside the sidebar and the phone menu, spec 4.7: the ring in the ink of their links, drawn inside so the
   scrolling list never clips it; it shows on the panel and on the current item alike. */
.app-sidebar :focus-visible, .app-menu-panel :focus-visible { outline: 2px solid var(--ph-sidebar-fg); outline-offset: -2px; }

/* Top bar, spec 3.3 and design-d-spec.md 6: it stands on the page with no ground and no rule of its own, and a button
   in it is a paper button with the one soft shadow. */
.app-topbar { position: relative; z-index: 30; display: flex; align-items: center; gap: var(--space-2); min-height: var(--ph-topbar-h); padding: var(--ph-space-05) var(--space-4); }
.app-topbar > .menu > .button { background: var(--surface-1); color: var(--ink); box-shadow: var(--shadow-1); }
.app-topbar > .menu > .button:hover, .app-topbar > .menu[open] > .button { background: var(--surface-1); box-shadow: var(--shadow-2); }
.app-company { display: flex; align-items: center; gap: var(--ph-space-15); min-width: 0; margin-left: auto; font-size: var(--ph-text-sm); }
.app-company-name { font-weight: 600; overflow-wrap: anywhere; }
/* Task 282 (KNOWN-ISSUES «Left by task 280»): the company's name in the top bar breaks between its words only, on two
   lines at most. Each word is a box of its own (layouts/base.ejs), so a word wider than the room left is cut with an
   ellipsis instead of breaking inside it, and a name longer than two lines ends with one; the element's title and its
   text keep the whole name readable. */
.app-topbar .app-company-name { min-width: 0; max-width: 100%; overflow-wrap: normal; --ph-name-lines: 2; }
/* The words hold the lines their place gives (--ph-name-lines): two for the company beside the controls and for the brand
   of a narrow bar with the assistant (components.css), one for the brand of a narrow bar without it, which keeps its one
   line (design-d-spec.md 10), and one beside the clock (clock.css). */
.app-mobile-brand { --ph-name-lines: 1; }
.app-topbar .app-name-words { display: -webkit-box; overflow: hidden; white-space: normal; -webkit-box-orient: vertical; -webkit-line-clamp: var(--ph-name-lines); }
.app-topbar .app-name-word { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: top; }
/* A narrower desktop puts the role under the name, as the bar with the clock does (clock.css), so the name keeps the room
   of its words: at 1024 the name beside its role had 32px and broke in every word. */
@media (min-width: 64rem) and (max-width: 79.999rem) {
  .app-company { flex-direction: column; align-items: flex-start; gap: 0; }
  .app-company .app-role { min-height: 0; }
}
/* Task 052d (N10): the role is a caption beside the company, never a tag or a button. */
.app-role { display: inline-flex; align-items: center; min-height: 1.5rem; color: var(--ink-2); font-size: var(--text--1); white-space: nowrap; }
/* The search of the top bar, design-d-spec.md 9 (task 070): the product's own search field (.search of components.css,
   which fixes its height and draws its glyph) in a GET form, before the bell as in the mockup. It asks the bar for
   10rem and grows into the room the bar has left, up to the 20rem of the mockup: the company's name and the account
   control keep the width they had before the field came, so neither wraps to make room for it. The page holds the form
   a second time inside the phone menu (.app-menu-search), which is not displayed here, as the menu is not. */
.app-search { flex: 1 0 10rem; max-width: 20rem; margin: 0; }
/* A consultant's bar has no company caption (the open client is in the sidebar): its controls stand at the right. */
.app-topbar:not(:has(.app-company)) { justify-content: flex-end; }
.app-user-menu > summary { gap: var(--space-1); }
.app-user-menu > summary .app-icon { width: 1rem; height: 1rem; }
/* Task 052d round 2: a phone shows the person's first name (or «Profilo») in the account control, the desktop its full name. */
.app-user-menu > summary .app-user-short { display: none; }
.app-user-menu .menu-panel > li > form { margin: 0; }
/* Task 087: the account menu is the one place of its links, so the entry that owns the page shown is marked in it, by
   its weight and its ground (the weight stays where the system forces its colours). */
.app-user-menu .menu-panel a[aria-current] { background: var(--accent-subtle-bg); font-weight: 600; }
/* Esci is the last entry of the account menu, under a hairline of its own, shaped as the entries above it. */
.app-user-menu .menu-panel > li > .app-logout { margin-top: var(--ph-space-05); padding-top: var(--ph-space-05); border-top: var(--border-w) solid var(--line); }
.app-logout .link-button { display: flex; align-items: center; justify-content: flex-start; width: 100%; min-height: 2.75rem; padding: 0 var(--space-2); border: 0; border-radius: var(--radius); color: var(--ink); font-size: var(--ph-text-md); font-weight: 400; }
.app-logout .link-button:hover { background: var(--accent-subtle-bg); }
/* The bell, task 061: a menu like the account's beside it. The summary is the icon alone, with the count to read as a
   badge on the attention ground (the words are for the screen reader), so it draws no menu arrow; the panel is the
   popover of spec 5.20, wider because its rows are sentences, each with its area and date under it and its two buttons,
   and it scrolls inside itself when the rows are taller than the screen. */
.app-bell > summary, .app-topbar > .button.app-bell-link { gap: var(--ph-space-05); min-width: var(--ph-control-h); padding: 0 var(--space-1); }
.app-bell > summary::after { content: none; }
/* Task 087: where the bell cannot be drawn in full (no company in session, a read that failed) it is a plain link to
   the notifications page: the same paper button of the top bar with the same drawing, no number and no panel. */
.app-topbar > .button.app-bell-link, .app-topbar > .button.app-bell-link:visited { background: var(--surface-1); color: var(--ink); box-shadow: var(--shadow-1); }
.app-topbar > .button.app-bell-link:hover { background: var(--surface-1); box-shadow: var(--shadow-2); }
/* The bell counts what waits to be read, on its control and on the way to the inbox: the badge of design-d-spec.md 7,
   where a plain .count of components.css is a quiet number. */
.app-bell-count, .app-bell-all .count { display: inline-grid; place-items: center; min-width: 1.5em; height: 1.5em; padding: 0 var(--ph-space-05); border-radius: var(--radius-s); background: var(--ph-attention-bg); color: var(--ink); line-height: 1; }
/* Task 295 (#17 of task 293): the badge takes its width from its number («271»), never squeezed by the bell beside it. */
.app-bell-count, .app-bell-all .count { flex: none; width: max-content; }
.app-bell-panel { position: absolute; top: calc(100% + var(--ph-space-05)); right: 0; z-index: 20; width: 24rem; max-width: calc(100vw - 2 * var(--space-2)); max-height: calc(100svh - var(--ph-topbar-h) - var(--space-2)); overflow-y: auto; overscroll-behavior: contain; scroll-padding-bottom: calc(var(--ph-control-h) + 2 * var(--ph-space-05)); background: var(--surface-1); border-radius: var(--radius-l); box-shadow: var(--shadow-2); color: var(--ink); font-size: var(--ph-text-md); }
.app-bell-list { margin: 0; padding: 0; list-style: none; }
.app-bell-row { padding: var(--ph-space-15) var(--space-2); border-bottom: var(--border-w) solid var(--surface-2); }
.app-bell-title { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.app-bell-meta { margin: var(--ph-space-05) 0 0; color: var(--ink-2); font-size: var(--text--1); }
.app-bell-actions { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-top: var(--space-1); }
.app-bell-actions > form { margin: 0; }
.app-bell-empty { margin: 0; padding: var(--space-2); color: var(--ink-2); }
.app-bell-unread { margin: 0; padding: var(--ph-space-05) var(--space-2); border-bottom: var(--border-w) solid var(--surface-2); color: var(--ink-2); }
/* A consultant's bell (decision of 2026-10-14): the rows under a heading per client, its name with its count to read. */
.app-bell-client { display: flex; align-items: center; justify-content: space-between; gap: var(--space-1); margin: 0; padding: var(--space-1) var(--space-2) var(--ph-space-05); background: var(--surface-2); color: var(--ink); font-size: var(--ph-text-sm); font-weight: 700; }
.app-bell-group + .app-bell-all { margin-top: calc(-1 * var(--border-w)); border-top: var(--border-w) solid var(--surface-2); }
/* Task 096 (persona panel of 2026-10-10, Franco F54, Bruno B11 B45): the way to every notice stays the last thing of
   the panel and is held at its bottom edge while the rows scroll under it, at every width. The panel scrolls inside
   itself, and on a phone, where it is as tall as the screen, six rows left the line below the edge. The line stands on
   the panel's own ground, which covers the rows that pass under it, and under a rule that takes the place of the last
   row's own: one hairline at rest, and an edge for the line while rows are under it. Where the system forces its
   colours the ground is the system's and the rule takes the colour of the text, so the line is held and set apart
   there too. The panel keeps a focused control of a row clear of the held line (scroll-padding-bottom, the height of
   the line: its control and its two paddings). */
.app-bell-all { position: sticky; bottom: 0; z-index: 1; margin: 0; padding: var(--ph-space-05) var(--space-2); background: var(--surface-1); }
.app-bell-list + .app-bell-all { margin-top: calc(-1 * var(--border-w)); border-top: var(--border-w) solid var(--surface-2); }
.app-bell-all > a { display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--ph-control-h); font-weight: 600; }
.app-menu, .has-shell .app-mobile-brand { display: none; }

/* No shell pages, spec 3.5 and 6.1: a centred column with the product mark above one panel */
/* The no shell page is main and the legal footer (task 172): main takes the window's height but the footer's. */
.no-shell:has(> .app-main) { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 100svh; }
.no-shell .app-main { display: flex; flex-direction: column; align-items: center; padding: var(--space-5) var(--space-2); }
.app-public-brand { display: flex; align-items: center; gap: var(--ph-space-15); margin: 0 0 var(--space-3); color: var(--ink); font-family: var(--font-display); font-size: var(--ph-text-lg); font-weight: 600; }
.no-shell .app-main > .flash { width: 100%; max-width: var(--ph-column-public); }
.public-column { width: 100%; max-width: var(--ph-column-public); }
.public-column-wide { max-width: var(--ph-column-public-wide); }
.public-column > .panel > h1 { margin-bottom: var(--space-1); font-size: var(--text-1); }
.public-column .public-lead { color: var(--ink-2); }
.public-column .panel > form { display: grid; gap: var(--space-2); margin-top: var(--space-3); }
/* The sole submit of a no shell form is its primary (spec 6.1), so the magic link page keeps its bare button. */
.no-shell main form > button:only-of-type { width: 100%; min-height: var(--ph-control-h-touch); background: var(--accent); color: var(--on-accent); font-weight: 600; box-shadow: var(--shadow-1); }
.no-shell main form > button:only-of-type:hover { background: var(--accent-hover); box-shadow: var(--shadow-2); }
.no-shell main form > button:only-of-type:focus-visible { outline-color: var(--on-accent); outline-offset: -3px; }
.no-shell :is(input, select, textarea) { font-size: var(--text-0); }
.public-links { display: grid; gap: var(--space-1); margin: var(--space-2) 0 0; padding: 0; list-style: none; text-align: center; font-size: var(--ph-text-md); }
.public-links a { display: inline-flex; align-items: center; min-height: 1.5rem; }

@media (max-width: 63.999rem) {
  .app-shell { display: block; }
  /* The anonymous secondary links are touch targets on a phone or tablet (spec 6.1). */
  .public-links a { min-height: var(--ph-control-h-touch); }
  .app-sidebar { display: none; }
  .app-main { padding: var(--space-3); }
  /* In the phone top bar the brand name is in the body face on one line, cut with an ellipsis when it does not fit
     (design-d-spec.md 10): the display face is wide, and a name on two lines made the bar taller. */
  .has-shell .app-mobile-brand { display: block; grid-area: brand; align-self: end; min-width: 0; overflow: hidden; color: var(--ink); font-size: var(--ph-text-md); font-weight: 600; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
  /* Task 052d (N10, N11, I53): the menu, the brand with its caption under it, the account menu with its name. */
  .app-topbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "menu brand user" "menu company user"; column-gap: var(--space-1); padding: var(--ph-space-05) var(--space-2); }
  .app-menu { grid-area: menu; }
  .app-user-menu { grid-area: user; }
  /* Task 061: the bell takes a column of its own between the brand and the account menu, only where there is a bell (in
     full, or as the plain link of task 087, which carries the bell's class), so the wizard keeps the three columns. Its
     panel hangs from the top bar, not from the
     bell: on a phone it spans the screen between the page's margins, so no row is cut and nothing scrolls sideways at
     390, and on a tablet it keeps the desktop's width at the right edge. */
  .app-topbar:has(.app-bell) { grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "menu brand bell user" "menu company bell user"; }
  .app-bell { grid-area: bell; position: static; }
  .app-bell > summary, .app-topbar > .button.app-bell-link { min-width: var(--ph-control-h-touch); }
  /* Task 295 (#17 of task 293): a tall panel reaches the screen's bottom edge, so its «Tutte le notifiche» closes what
     is seen and no row of the page below shows under it. */
  .app-bell-panel { top: 100%; right: var(--space-2); width: min(24rem, calc(100% - 2 * var(--space-2))); max-width: none; max-height: calc(100svh - 100%); border-end-start-radius: 0; border-end-end-radius: 0; scroll-padding-bottom: calc(var(--ph-control-h-touch) + 2 * var(--ph-space-05)); }
  .app-bell-all > a { min-height: var(--ph-control-h-touch); }
  /* Task 070 (design-d-spec.md 9): below 64rem the search is not in the bar, where it would add a row to every page of a
     phone. The form of the bar is taken out of the page, and with it out of the tab order and of the accessibility tree,
     and the same form is the first thing of the menu, a step above its first entry. */
  .app-search { display: none; }
  .app-menu-search { margin: 0 0 var(--space-2); }
  .app-company { grid-area: company; align-self: start; margin-left: 0; font-size: var(--text--1); }
  /* The mobile brand already names the company, so the caption is the role; a consultant's brand is the studio, so the
     caption is the open client instead. */
  .has-shell .app-company:not(.is-client) .app-company-name { display: none; }
  .app-company.is-client .app-role { display: none; }
  .app-company.is-client .app-company-name { font-weight: 400; color: var(--ink-2); }
  .app-menu { display: block; }
  /* The menu control is a paper button like the others of the top bar. */
  .app-menu > summary { display: flex; align-items: center; gap: var(--ph-space-05); min-height: var(--ph-control-h-touch); padding: var(--space-1); border: var(--border-w) solid transparent; border-radius: var(--radius); background: var(--surface-1); box-shadow: var(--shadow-1); font-size: var(--ph-text-sm); list-style: none; cursor: pointer; }
  .app-menu > summary::-webkit-details-marker { display: none; }
  .app-menu[open] > summary { box-shadow: var(--shadow-2); }
  .app-menu-panel { position: absolute; top: 100%; left: 0; right: 0; max-height: calc(100svh - var(--ph-topbar-h)); overflow: auto; padding: var(--space-2); background: var(--ph-sidebar); color: var(--ph-sidebar-fg); box-shadow: var(--shadow-2); }
  .app-menu-panel .app-nav-link { min-height: var(--ph-control-h-touch); }
  .app-menu-panel .app-nav-sublink { padding-left: var(--space-3); }
  /* Task 052d (A5b): the phone menu's groups read as the sidebar's, each with its icon, their entries at full size. */
  .app-menu-panel .app-nav-group > summary { min-height: var(--ph-control-h-touch); }
  .app-menu-panel .app-nav-sublink { font-size: var(--ph-text-md); }
  /* Task 053b (theme 5, N15): the panel reaches the bottom of the screen, so no page shows under it as if the menu ended
     there, and while entries sit below its lower edge a cue says so: it sticks to the bottom of the panel and the
     panel's end, drawn over it, covers it once the reader has scrolled to the last entry (or when everything fits). */
  .app-menu-panel { max-height: calc(100svh - 100%); overscroll-behavior: contain; }
  /* Task 056a (theme 2, Nina N11 N49): the cue is a hint, not a control: no bar, no border and no weight of a button, the
     entries fading into the panel under a quiet line of text, and a tap on it reaches the entry beneath. */
  .app-menu-more { position: sticky; bottom: calc(-1 * var(--space-2)); z-index: 0; display: flex; align-items: flex-end; justify-content: center; gap: var(--ph-space-05); height: var(--ph-control-h); margin: var(--space-1) calc(-1 * var(--space-2)) 0; padding-bottom: var(--ph-space-05); background: linear-gradient(to bottom, transparent, var(--ph-sidebar) 55%); color: var(--ph-sidebar-muted); font-size: var(--ph-text-sm); font-weight: 400; pointer-events: none; }
  .app-menu-more .app-icon { width: 1rem; height: 1rem; }
  .app-menu-end { position: relative; z-index: 1; display: block; height: var(--ph-control-h); margin: calc(-1 * var(--ph-control-h)) calc(-1 * var(--space-2)) 0; background: var(--ph-sidebar); }
  /* Task 052d (B27): an open menu covers the page, and the page's own menus are neither drawn nor offered while it is open,
     never a toggle that answers nothing. */
  body:has(.app-menu[open]) .app-main :is(.menu, .page-info) { visibility: hidden; }
  .app-logout .link-button { min-height: var(--ph-control-h-touch); }
}
@media (max-width: 40rem) {
  .app-main { padding: var(--space-2) var(--space-2) var(--space-4); }
  .app-role { padding: 0; background: transparent; }
  /* Task 052d (N11): the account menu keeps its name on a phone, in a compact control that leaves the brand its line. */
  .app-user-menu > summary { gap: var(--ph-space-05); padding-inline: var(--space-1); font-size: var(--ph-text-sm); }
  .app-user-menu > summary .app-user-short { display: inline; }
  .app-user-menu > summary .app-user-label { display: none; }
  /* Task 061: on a phone the count sits on the bell's corner, so the bell is one touch target wide and the brand keeps
     the line it had before the bell took a column. Task 205 (Iris I50): the corner is inside the button's box, in the
     small text, so a three-digit count no longer rises above the button nor runs past its edge. */
  .app-bell > summary, .app-topbar > .button.app-bell-link { position: relative; padding: 0; }
  .app-bell-count { position: absolute; top: 0; right: 0; font-size: var(--text--1); }
  .app-bell > summary:has(.app-bell-count), .app-topbar > .button.app-bell-link:has(.app-bell-count) { padding-top: var(--space-2); }
  .no-shell .app-main { padding-top: var(--space-4); }
}
/* The open client of a consultant (decision of 2026-10-14): a block on the dark ground of the sidebar, under the brand,
   and the first thing of the phone menu. «Cliente aperto» as the sidebar's captions, the client's name in bold, and the
   control that opens the list of clients: a menu as the others, whose panel is the paper popover of the product, hung
   under the control across the block's width. The open client is named in its row and marked as current. */
.app-client { margin: var(--space-2) 0 0; padding: var(--ph-space-15); border-radius: var(--radius); background: var(--ph-sidebar-hover); }
.app-client-label { margin: 0 0 var(--ph-space-05); color: var(--ph-sidebar-muted); font-size: var(--text--1); font-weight: 600; }
.app-client-name { min-width: 0; margin: 0; color: var(--ph-sidebar-fg); font-size: var(--text-0); font-weight: 700; overflow-wrap: anywhere; }
.app-client-switch { display: block; }
.app-client-switch > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-1); min-height: var(--ph-control-h); padding: 0 var(--ph-space-15); border-radius: var(--radius); background: var(--ph-sidebar-border); color: var(--ph-sidebar-fg); cursor: pointer; }
.app-client-switch > summary:hover, .app-client-switch[open] > summary { background: var(--ph-sidebar-active); }
.app-client-switch .menu-panel { left: 0; right: auto; width: 100%; min-width: 0; }
.app-client-switch .menu-panel form { margin: 0; }
/* Decision of 2026-10-15: a company with a month late carries a red dot of attention, the name first; the closed
   control carries the open company's. Past a handful of companies the list opens with its search. */
.app-client-switch .menu-panel :is(button, .app-client-current) { gap: var(--space-1); padding-block: var(--ph-space-05); }
/* Task 285: a client's name, a single long word too, wraps inside its row; the red dot keeps its place beside it. */
.app-client-option { flex: 0 1 auto; min-width: 0; overflow-wrap: anywhere; }
.app-client-alert { flex: none; width: 0.55rem; height: 0.55rem; margin-left: auto; border-radius: 50%; background: var(--err); }
.app-client-switch > summary .app-client-alert { margin-left: 0; }
.app-client-switch .menu-panel { max-height: min(70vh, 32rem); overflow-y: auto; }
.app-client-search { position: sticky; top: calc(-1 * var(--space-1)); z-index: 1; padding: 0 0 var(--ph-space-05); background: var(--surface-1); }
.app-client-search form { margin: 0; }
.app-client-search input { width: 100%; }
.app-client-unread { margin: var(--ph-space-05) 0 0; color: var(--ph-sidebar-muted); font-size: var(--text--1); overflow-wrap: anywhere; }
.app-client-switch .menu-panel .app-client-unread { margin: 0; padding: var(--ph-space-05) var(--space-2); color: var(--ink-2); font-size: var(--ph-text-md); }
.app-client-current { display: flex; align-items: center; min-height: 2.75rem; padding: 0 var(--space-2); border-radius: var(--radius); background: var(--accent-subtle-bg); color: var(--ink); font-size: var(--ph-text-md); font-weight: 600; }
@media (max-width: 63.999rem) {
  /* In the phone menu the block opens the menu, a step above the search; its control is a touch target. */
  .app-menu-panel .app-client { margin: 0 0 var(--space-2); }
  /* Task 122 (Silvia S12): in the phone menu the list of companies opens in the menu's own flow, as long as it is, and
     the menu scrolls it with its search held at the top; a floating panel of 32rem cut it after five companies. */
  .app-menu-panel .app-client-switch .menu-panel { position: static; max-height: none; margin-top: var(--ph-space-05); box-shadow: none; }
  .app-client-switch > summary { min-height: var(--ph-control-h-touch); }
  /* A consultant's bar has no caption under the brand: the open client is in the menu, so the studio's name takes both rows. */
  .has-shell .app-topbar:not(:has(.app-company)) .app-mobile-brand { grid-row: 1 / 3; align-self: center; }
}
/* The first row on a narrow screen (task 135, g15; KNOWN-ISSUES, «The first row of the top bar overflows»): a phone of
   390 px at 200 % zoom is 195 CSS px wide, where the menu, the bell and the account with their names took 228 px of the
   163 inside the bar's margins. Narrower than 22.5rem, the breakpoint of the assistant's stacked rows (components.css),
   the brand and its caption leave the first row for rows of their own under it, so that row holds the controls alone.
   Narrower than 16.25rem, where the three controls with their names no longer fit, the menu and the account are drawn
   by their icons: their names stay in the summary, hidden from sight only, so each control keeps its accessible name. */
@media (max-width: 22.499rem) {
  .app-topbar { grid-template-areas: "menu . user" "brand brand brand" "company company company"; row-gap: var(--ph-space-05); }
  .app-topbar:has(.app-bell) { grid-template-areas: "menu . bell user" "brand brand brand brand" "company company company company"; }
  .has-shell .app-topbar:not(:has(.app-company)) .app-mobile-brand { grid-row: auto; }
  /* The account's panel hangs from the right edge of its control, at the bar's margin: it keeps its 16rem while that
     fits and otherwise spans the screen between the margins, never past the left edge. */
  .app-user-menu .menu-panel { min-width: min(16rem, calc(100vw - 2 * var(--space-2))); }
}
@media (max-width: 16.249rem) {
  .app-topbar { column-gap: var(--ph-space-05); }
  .app-menu > summary, .app-user-menu > summary { position: relative; justify-content: center; min-width: var(--ph-control-h-touch); }
  .app-menu > summary > span, .app-user-menu > summary .app-user-short { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
/* Motion, design-d-spec.md 4: the sidebar links fade their ground in 120ms; a person who asked for less motion gets none. */
@media (prefers-reduced-motion: reduce) {
  .app-nav-link, .app-nav-group > summary { transition: none; }
}
@media print {
  .app-sidebar, .app-topbar, .skip-link { display: none; }
  .app-shell { display: block; }
  .app-main { padding: 0; }
}
/* Task 314 (F2 of task 313): a browser without :has (older than Safari 15.4, Firefox 121 or Chrome 105) drops every rule
   above that names :has, so the bell, the clock (clock.css) and the assistant (components.css) asked for grid areas the
   bar's template did not name, and each opened a track of its own. Here the bar names every area outside :has: the bell
   in its column, the clock and the assistant on rows of their own under the brand. A bar without one of them keeps an
   empty column or row. A browser with :has never reads this block. */
@supports not selector(:has(*)) {
  @media (max-width: 63.999rem) {
    .app-topbar { grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "menu brand bell user" "menu company bell user" "clock clock clock clock" "assistant assistant assistant assistant"; }
  }
  @media (max-width: 22.499rem) {
    .app-topbar { grid-template-areas: "menu . bell user" "brand brand brand brand" "company company company company" "clock clock clock clock" "assistant assistant assistant assistant"; }
  }
}
/* Forced colours, design-d-spec.md 4 (task 071). The current item of the sidebar and of the phone menu, which is the
   same list, is marked by its ground, by the ink of its text and by the accent of its pictogram: where the system
   forces its colours all three are gone and only its bold text is left. There it is framed, a 1px border in the colour
   of the text that follows its corners, and so is the closed group that holds the current page. No rule names a
   colour, and outside that mode no item has a border.
   The floating layers of the shell (the skip link, the bell panel and the phone menu panel) are drawn by a ground and a
   shadow alone, and the sidebar is set apart from the page by its tone alone (review of round 1, finding 2): there each
   layer takes the border of a card (components.css) and the sidebar a rule on the side of the page. */
@media (forced-colors: active) {
  .app-nav-link[aria-current], .app-nav-link.is-section, .app-nav-group.is-active:not([open]) > summary { border: var(--border-w) solid; }
  .skip-link, .app-bell-panel, .app-menu-panel { border: var(--border-w) solid; }
  .app-sidebar { border-right: var(--border-w) solid; }
}
