/* The Guide · back-office panels (web/console). Loaded after app.css, whose components (panel, button,
   field, chip, notice, dialog…) the modules use; this file only lays out the desktop-first shell. */

.console-shell {
  --cs-side: 272px;
  --cs-top: 60px;
  --cs-tone: #13303a;
  --cs-tone-soft: #dde7e9;
  --cs-tone-ink: #13303a;
  --header-h: var(--cs-top);
  --cs-page-max: 2000px;
  --cs-gutter: clamp(20px, 2.4vw, 44px);
  background: var(--bg);
}
[data-surface="musei"] .console-shell, .console-shell[data-surface="musei"] { --cs-tone: #6d4f86; --cs-tone-soft: #ece4f2; --cs-tone-ink: #5b3f73; }
[data-surface="attivita"] .console-shell, .console-shell[data-surface="attivita"] { --cs-tone: #c2552f; --cs-tone-soft: #fbe5da; --cs-tone-ink: #a8472a; }
[data-surface="pa"] .console-shell, .console-shell[data-surface="pa"] { --cs-tone: #1f6f78; --cs-tone-soft: #dcecec; --cs-tone-ink: #175960; }
:where([data-theme="dark"]) .console-shell { --cs-tone: #8fb3bb; --cs-tone-soft: #1b3038; --cs-tone-ink: #b9d3d8; }
:where([data-theme="dark"]) [data-surface="musei"] .console-shell, :where([data-theme="dark"]) .console-shell[data-surface="musei"] { --cs-tone: #b99ad0; --cs-tone-soft: #2c2236; --cs-tone-ink: #d4bfe4; }
:where([data-theme="dark"]) [data-surface="attivita"] .console-shell, :where([data-theme="dark"]) .console-shell[data-surface="attivita"] { --cs-tone: #ec7a52; --cs-tone-soft: #3a2620; --cs-tone-ink: #f39a78; }
:where([data-theme="dark"]) [data-surface="pa"] .console-shell, :where([data-theme="dark"]) .console-shell[data-surface="pa"] { --cs-tone: #5fb4ba; --cs-tone-soft: #173a3f; --cs-tone-ink: #8fd0d4; }

/* ---------- Layout ---------- */
.cs-layout { min-height: 100dvh; }
.cs-sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 60; width: var(--cs-side); display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px 14px; overflow-y: auto; overscroll-behavior: contain;
}
.cs-main { margin-left: var(--cs-side); min-width: 0; min-height: 100dvh; display: flex; flex-direction: column; }
.cs-topbar {
  position: sticky; top: 0; z-index: 40; height: var(--cs-top); display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.5) blur(14px); -webkit-backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--line);
}
.cs-content { flex: 1; min-width: 0; }
.console-shell main { max-width: var(--cs-page-max); margin: 0 auto; padding: 26px var(--cs-gutter) 64px; overflow-x: clip; }
/* The panels use the whole width next to the sidebar (6 October 2026: pages stopped at 1180 px, half of a wide
   screen). :root raises the specificity over the «body[data-page=…] main» widths of the modules shared with the app. */
:root .console-shell main { max-width: var(--cs-page-max); }
.console-shell .app-footer { display: none; }
.console-shell #toast { bottom: 24px; }
.cs-menu-button { display: none; }
.cs-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(8, 18, 22, .42); backdrop-filter: blur(1px); }

/* ---------- Sidebar ---------- */
.cs-brand { display: grid; gap: 14px; padding: 2px 6px 16px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.cs-logo { justify-self: start; }
.cs-logo img { height: 34px; width: auto; }
.cs-surface { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 9px 12px 9px 16px; border-radius: var(--r-sm); background: var(--cs-tone-soft); }
.cs-surface::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--cs-tone); }
.cs-surface-kicker { font-size: var(--type-caption-size); font-weight: 800; letter-spacing: .09em; color: var(--muted); }
.cs-surface strong { font-size: var(--type-body-l-size); line-height: 1.25; color: var(--cs-tone-ink); }
.cs-org { margin: 0 2px 14px; }
.cs-org-switch { display: flex; flex-direction: column; gap: 5px; }
.cs-org-label { font-size: var(--type-kicker-size); font-weight: 750; letter-spacing: .04em; color: var(--muted); text-transform: uppercase; padding-left: 4px; }
.cs-org-select { position: relative; display: block; }
.cs-org-select::after { content: ""; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.cs-org-select select {
  width: 100%; appearance: none; -webkit-appearance: none; height: 42px; padding: 0 34px 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--cs-tone-soft); color: var(--ink); font-weight: 700; font-size: var(--type-label-size); text-overflow: ellipsis;
}
.cs-nav { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.cs-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.cs-nav-title { margin: 0 0 4px; padding: 0 10px; font-size: var(--type-kicker-size); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-nav-link {
  display: flex; align-items: center; gap: 11px; min-height: 40px; padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); text-decoration: none; font-weight: 650; font-size: var(--type-label-size); transition: background .15s, color .15s;
}
.cs-nav-link .tg-i { width: 19px; height: 19px; color: var(--muted); }
.cs-nav-link:hover { background: var(--surface-2); color: var(--ink); }
.cs-nav-link[aria-current="page"] { background: var(--cs-tone-soft); color: var(--cs-tone-ink); font-weight: 750; }
.cs-nav-link[aria-current="page"] .tg-i { color: var(--cs-tone); }
.cs-sidebar-foot { margin: 18px 8px 0; font-size: var(--type-caption-size); color: var(--muted); }

/* ---------- Top bar ---------- */
.cs-crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--type-body-s-size); color: var(--muted); white-space: nowrap; overflow: hidden; }
.cs-crumbs::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--cs-tone); box-shadow: 0 0 0 3px var(--cs-tone-soft); flex: none; }
.cs-crumbs > * { overflow: hidden; text-overflow: ellipsis; }
.cs-crumbs strong { color: var(--ink); font-weight: 750; }
.cs-crumb-surface { font-weight: 700; color: var(--cs-tone-ink); }
.cs-crumb-sep { color: var(--line-strong); flex: none; }
.cs-top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.cs-user-menu { position: relative; }
.cs-user-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 4px; border-radius: var(--r-pill); cursor: pointer; }
.cs-user-menu summary::-webkit-details-marker { display: none; }
.cs-user-menu summary:hover, .cs-user-menu[open] summary { background: var(--surface-2); }
.cs-user-menu summary .tg-i { width: 16px; height: 16px; transform: rotate(90deg); color: var(--muted); }
.cs-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: var(--type-label-size); color: #fff; background: var(--cs-tone); flex: none; }
.cs-user-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: var(--type-label-size); }
.cs-user-pop {
  position: absolute; right: 0; top: calc(100% + 8px); width: 280px; padding: 8px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-3); z-index: 80;
}
.cs-user-head { padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.cs-user-head strong { display: block; }
.cs-user-head small { color: var(--muted); overflow-wrap: anywhere; }
.cs-user-title { margin: 8px 10px 4px; font-size: var(--type-kicker-size); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cs-user-link { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: var(--r-sm); text-decoration: none; font-weight: 650; font-size: var(--type-label-size); color: var(--ink-2); text-align: left; }
.cs-user-link:hover { background: var(--surface-2); color: var(--ink); }
.cs-user-link .tg-i { width: 18px; height: 18px; color: var(--muted); }
.cs-user-note { margin: 8px 10px; font-size: var(--type-caption-size); color: var(--muted); }

/* ---------- States: 404, no access, errors ---------- */
.cs-state { max-width: 560px; margin: 8vh auto 0; text-align: center; padding: 36px 28px; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.cs-state > .tg-i { width: 52px; height: 52px; padding: 13px; margin: 0 auto 14px; border-radius: 50%; background: var(--cs-tone-soft); color: var(--cs-tone); }
.cs-state h1 { font: 650 26px/1.15 var(--display); margin-bottom: 10px; }
.cs-state p { color: var(--ink-2); }
.cs-state .actions { justify-content: center; margin-top: 18px; }
.cs-state .tiny { margin-top: 16px; }
.cs-state-code { display: block; font: 700 54px/1 var(--display); color: var(--cs-tone); margin-bottom: 8px; }

/* ---------- Login ---------- */
.cs-auth .cs-sidebar, .cs-auth .cs-topbar { display: none; }
.cs-auth .cs-main { margin-left: 0; }
.cs-auth main { max-width: 1040px; padding-top: max(5vh, 24px); }
.cs-login { display: grid; grid-template-columns: 1.1fr .9fr; gap: 0; border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow-3); border: 1px solid var(--line); background: var(--surface); }
.cs-login-brand {
  position: relative; padding: 40px 40px 44px; color: #f3efe8; isolation: isolate;
  background: radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--cs-tone) 85%, #fff 0%) 0%, transparent 62%), linear-gradient(160deg, #173a45 0%, #0f2831 100%);
}
.cs-login-brand .brand-logo { height: 40px; padding: 6px 12px; border-radius: 14px; background: #fdf6e8; box-sizing: content-box; margin-bottom: 40px; }
.cs-login-kicker { font-size: var(--type-caption-size); font-weight: 800; letter-spacing: .1em; color: rgba(243, 239, 232, .7); margin-bottom: 10px; }
.cs-login-brand h1 { font: 650 clamp(30px, 3.6vw, 42px)/1.06 var(--display); letter-spacing: -.02em; margin-bottom: 12px; }
.cs-login-brand > p { color: rgba(243, 239, 232, .84); max-width: 40ch; }
.cs-login-points { list-style: none; padding: 0; margin: 30px 0 0; display: grid; gap: 10px; font-size: var(--type-label-size); color: rgba(243, 239, 232, .9); }
.cs-login-points li { display: flex; gap: 10px; align-items: center; }
.cs-login-points .tg-i { width: 18px; height: 18px; opacity: .85; }
.cs-login-card { padding: 40px 36px; display: flex; flex-direction: column; justify-content: center; }
.cs-login-card h2 { font-size: 22px; margin-bottom: 6px; }
.cs-login-card .auth-form .button { margin-top: 12px; }
.cs-login-foot { margin-top: 18px; }

/* ---------- Modules inside the panel ---------- */
/* Their own tab strips duplicate the sidebar on large screens. */
@media (min-width: 1024px) {
  .console-shell .biz-manage > .biz-tabs, .console-shell .pa-tabs { display: none; }
  .console-shell .pa-shell { grid-template-columns: minmax(0, 1fr); }
  .console-shell .biz-manage > .app-back { display: none; }
}
.console-shell .app-page-intro { margin-bottom: 18px; }
/* Page wrappers laid out as a grid without columns (.adm-page, .cty-page…) grew as wide as their widest table and
   pushed the page out of the phone screen: one column that can shrink. :where() keeps it below any module layout. */
:where(.console-shell main > [class*="-page"]) { grid-template-columns: minmax(0, 1fr); min-width: 0; }
/* Rows of tabs and chips wrap onto more lines instead of scrolling sideways: on a phone the last buttons were cut
   off at the edge with no sign that there were more (6 October 2026, «occhio ai vari tasti»). */
.console-shell main :is(.tg-chip-row, .cs-tabs, .mod-tabs, .adm-chips, .adm-tabs, .chip-row, .pa-tabs, .biz-tabs) { flex-wrap: wrap; overflow-x: visible; }
.console-shell main .tg-chip-row { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; row-gap: var(--space-2); }
.console-shell main .mod-tabs { width: auto; border-radius: var(--r-md); }
/* The PA tabs stay sticky in the app; wrapped on more lines they would cover the page while scrolling. */
.console-shell main .pa-tabs { position: static; margin-left: 0; margin-right: 0; }
.console-shell main .cs-tabs { row-gap: 2px; }
/* Modules that put their sections straight into <main> (traffic, news, flows, road reports): space between them. */
.console-shell main > :is(section, article, form, div, p) + :is(section, article, form, div) { margin-top: 18px; }
/* The community queue links back to the visitor feed (#social), which is not part of the panel. */
.console-shell[data-page="social-moderation"] .social-back[href="#social"] { display: none; }
.console-shell #detail-dialog { max-width: 720px; }

/* ---------- Tablet and phone ---------- */
@media (max-width: 1023px) {
  .cs-menu-button { display: inline-grid; margin-left: -8px; }
  .cs-sidebar { transform: translateX(-102%); transition: transform .25s var(--ease); box-shadow: none; }
  .cs-menu-open .cs-sidebar { transform: none; box-shadow: var(--shadow-3); }
  .cs-main { margin-left: 0; }
  .cs-topbar { padding: 0 16px; }
  .console-shell main { padding: 20px 18px 56px; }
  :root .console-shell main { padding-left: 18px; padding-right: 18px; }
  .cs-user-name { display: none; }
}
@media (max-width: 760px) {
  .cs-login { grid-template-columns: 1fr; }
  .cs-login-brand { padding: 28px 24px 30px; }
  .cs-login-brand .brand-logo { margin-bottom: 24px; }
  .cs-login-points { display: none; }
  .cs-login-card { padding: 26px 22px 28px; }
  .cs-auth main { padding: 16px 14px 40px; }
  #connection { display: none; }
  .cs-crumb-surface, .cs-crumb-surface + .cs-crumb-sep { display: none; }
  .cs-state { margin-top: 3vh; padding: 28px 20px; }
}
@media (prefers-reduced-motion: reduce) { .cs-sidebar { transition: none; } }

/* ---------- Admin pages (web/console/admin-core.js) ---------- */
.adm-page { display: grid; gap: 16px; }
.adm-page > .app-page-intro { margin-bottom: 2px; }
.adm-h2 { font-size: var(--type-title-size); margin: 8px 0 -4px; }
.adm-h3 { font-size: var(--type-label-size); margin: 18px 0 8px; letter-spacing: .01em; }
.adm-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.adm-kpis-sm { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.adm-kpi { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); text-decoration: none; color: inherit; text-align: left; font: inherit; }
button.adm-kpi, a.adm-kpi { cursor: pointer; transition: border-color .15s, transform .15s; }
button.adm-kpi:hover, a.adm-kpi:hover { border-color: var(--cs-tone); }
.adm-kpi strong { font: 700 var(--type-display-m-size)/1.15 var(--display); overflow-wrap: anywhere; }
.adm-kpi span { color: var(--muted); font-size: var(--type-body-s-size); font-weight: 650; }
.adm-kpi.is-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.adm-kpi.is-warn strong { color: var(--warn); }
.adm-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.adm-card { margin: 0; min-width: 0; }
/* Cards written without .panel (traffic, news, flows, road reports, zone passes) get the same card look. */
.adm-card:not(.panel) { background: var(--color-surface); border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--elevation-3); border: var(--border-width) solid var(--color-outline); }
.adm-h4 { font-size: var(--type-label-size); font-weight: 800; margin: 14px 0 6px; }
.adm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 12px; }
.adm-actions .button { margin: 0; }
label.check, label.adm-check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-weight: 600; }
label.check input, label.adm-check input { flex: none; width: 20px; height: 20px; margin: 0; }
/* Classes used by the modules that had no style yet: card grids, warnings, device and result lists. */
.adm-grid, .adm-devices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; align-items: start; }
.adm-card.is-warn:not(.panel) { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, var(--color-outline)); }
.adm-alert { margin: 0; padding: 10px 14px; border-radius: var(--r-sm); background: var(--surface-2); font-size: var(--type-body-s-size); }
.adm-alert.is-warn { background: var(--warn-soft); }
.adm-alert.is-bad, .adm-alert.is-danger { background: var(--danger-soft); color: var(--danger); }
.adm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.adm-table input, .adm-table select { width: 100%; max-width: 180px; min-height: 40px; }
/* News that act (newsactions-console.js): the AI's reading as a two-column list, sections side by side when wide. */
.nwa-item { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 4px 28px; align-items: start; }
.nwa-item > :is(.nwa-head, h3, p, .adm-actions, form, .adm-note, .nwa-news) { grid-column: 1 / -1; }
.nwa-item > h3 { margin-top: 4px; }
.nwa-fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.nwa-fields dt { color: var(--muted); font-size: var(--type-body-s-size); font-weight: 650; }
.nwa-fields dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.nwa-why ul, .nwa-match ul { margin: 0; padding-left: 20px; }
.adm-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.adm-card-head h2 { font-size: var(--type-title-size); }
.adm-dl { display: grid; gap: 0; }
.adm-dl > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.adm-dl > div:last-child { border-bottom: 0; }
.adm-dl dt { color: var(--muted); font-size: var(--type-body-s-size); font-weight: 650; }
.adm-dl dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.adm-note { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); font-size: var(--type-body-s-size); }
.adm-note.is-ok { background: var(--ok-soft); color: var(--ok); }
.adm-note.is-bad { background: var(--danger-soft); color: var(--danger); }
.adm-audit { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.adm-audit li { display: flex; gap: 12px; }
.adm-audit small { display: block; color: var(--muted); font-size: var(--type-caption-size); }
.adm-audit-dot { width: 9px; height: 9px; margin-top: 7px; border-radius: 50%; background: var(--cs-tone); flex: none; box-shadow: 0 0 0 3px var(--cs-tone-soft); }
.adm-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.adm-panel-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); text-decoration: none; box-shadow: var(--shadow-1); }
.adm-panel-link:hover { border-color: var(--cs-tone); }
.adm-panel-link small { display: block; color: var(--muted); font-size: var(--type-caption-size); }
.adm-panel-link .tg-i { color: var(--muted); }
.adm-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin: 0; padding: 12px 14px; }
.adm-search { display: flex; gap: 8px; flex: 1 1 280px; min-width: 0; }
.adm-search input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--bg-elev); }
.adm-search .button { flex: none; }
.adm-filters { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.adm-chips { margin: 0; padding: 0; flex-wrap: wrap; overflow: visible; }
.adm-tabs { margin: 0; padding: 0; }
.adm-tabs .chip { text-decoration: none; }
.adm-table-wrap { margin: 0; padding: 0; overflow-x: auto; }
.adm-table { width: 100%; border-collapse: collapse; font-size: var(--type-label-size); }
.adm-table th { text-align: left; font-size: var(--type-kicker-size); font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.adm-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.adm-table tbody tr:last-child td { border-bottom: 0; }
.adm-table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.adm-table tr.is-disabled td { opacity: .72; }
.adm-sub { display: block; color: var(--muted); font-size: var(--type-caption-size); max-width: 36ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-user { display: flex; align-items: center; gap: 10px; text-align: left; min-width: 0; }
.adm-user span:last-child { min-width: 0; }
.adm-user strong { display: block; }
.adm-user small { display: block; color: var(--muted); font-size: var(--type-caption-size); overflow-wrap: anywhere; }
.adm-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--cs-tone-soft); color: var(--cs-tone-ink); font-weight: 800; flex: none; }
.adm-org-tag { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 8px; border-radius: var(--r-pill); background: var(--surface-2); font-size: var(--type-caption-size); font-weight: 650; }
.adm-pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2); font-size: var(--type-caption-size); font-weight: 750; white-space: nowrap; }
.adm-pill.is-ok { background: var(--ok-soft); color: var(--ok); }
.adm-pill.is-warn { background: var(--warn-soft); color: var(--warn); }
.adm-pill.is-danger { background: var(--danger-soft); color: var(--danger); }
.adm-pill.is-accent { background: var(--cs-tone-soft); color: var(--cs-tone-ink); }
.adm-actions-cell { text-align: right; white-space: nowrap; }
.adm-row-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.adm-row-actions .tg-i { width: 15px; height: 15px; }
.adm-danger { color: var(--danger) !important; }
.adm-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.adm-pager .actions { margin: 0; }
.adm-new summary { cursor: pointer; display: flex; flex-direction: column; gap: 2px; list-style: none; }
.adm-new summary::-webkit-details-marker { display: none; }
.adm-new summary strong::before { content: "+ "; color: var(--cs-tone); }
/* Forms: fields side by side as long as there is room (at least 320 px each), one per row on phones. Anything that
   is not a plain field (rows, tables, notes, fieldsets, long texts, buttons) takes the whole row. */
.adm-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 4px 18px; margin-top: 12px; align-items: end; }
.adm-form > :not(label, button, .button), .adm-form > label:has(textarea, input[type="checkbox"], input[type="radio"]) { grid-column: 1 / -1; }
.adm-form .button { justify-self: start; margin-top: 6px; }
.adm-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 4px 18px; align-items: end; }
.adm-mini-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.adm-mini-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); }
.adm-mini-list li span { color: var(--muted); font-size: var(--type-body-s-size); flex: 1; }
.adm-services { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.adm-services li { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); }
.adm-services small { grid-column: 2; color: var(--muted); font-size: var(--type-caption-size); }
.adm-services-all { grid-column: 1 / -1; }
.adm-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.adm-services .is-bad .adm-dot { background: var(--danger); }
@media (max-width: 1180px) { .adm-hide-md { display: none; } }
@media (max-width: 900px) { .adm-grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .adm-hide-sm { display: none; }
  .adm-kpis-sm { grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px; }
  .adm-kpis-sm .adm-kpi { padding: 10px 12px; }
  .adm-kpi strong { font-size: var(--type-display-s-size); }
  /* Phones: table rows become cards. */
  .adm-table-wrap { background: none; border: 0; box-shadow: none; overflow: visible; }
  .adm-table, .adm-table tbody, .adm-table td { display: block; }
  .adm-table thead, .adm-table .adm-hide-sm, .adm-table .adm-hide-md { display: none; }
  .adm-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 14px; margin-bottom: 8px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
  .adm-table tbody tr:hover { background: var(--surface); }
  .adm-table td { padding: 0; border: 0; }
  .adm-table td:first-child { flex: 1 1 100%; }
  .adm-table .adm-actions-cell { flex: 1 1 100%; text-align: left; }
  .adm-row-actions { justify-content: flex-start; }
  .adm-sub { max-width: none; white-space: normal; }
}

/* ---------- Shell additions: badge, tabs of merged pages, «A cosa serve», search ---------- */
.cs-nav-link > span:not(.cs-nav-badge) { flex: 1; min-width: 0; }
.cs-nav-badge { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); display: inline-grid; place-items: center; background: var(--warn-soft); color: var(--warn); font-size: var(--type-caption-size); font-weight: 800; flex: none; }
.cs-tabs { display: flex; gap: 4px; margin: -4px 0 18px; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.cs-tab { flex: none; padding: 10px 14px; margin-bottom: -1px; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 700; font-size: var(--type-label-size); text-decoration: none; white-space: nowrap; border-radius: var(--r-sm) var(--r-sm) 0 0; }
.cs-tab:hover { color: var(--ink); background: var(--surface-2); }
.cs-tab[aria-current="page"] { color: var(--cs-tone-ink); border-bottom-color: var(--cs-tone); }
.cs-purpose { max-width: 78ch; }
.cs-purpose-label { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: var(--r-pill); background: var(--cs-tone-soft); color: var(--cs-tone-ink); font-size: var(--type-caption-size); font-weight: 800; letter-spacing: .02em; vertical-align: 1px; }
main > .cs-purpose { margin: 0 0 14px; color: var(--ink-2); }
.cs-search { position: relative; flex: 1 1 320px; max-width: 460px; min-width: 0; }
.cs-search form { position: relative; display: flex; align-items: center; }
.cs-search form > .tg-i { position: absolute; left: 12px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.cs-search input { width: 100%; height: 40px; padding: 0 40px 0 38px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--bg-elev); color: var(--ink); font: inherit; font-size: var(--type-label-size); }
.cs-search input:focus { outline: 2px solid var(--cs-tone); outline-offset: 1px; }
.cs-search kbd { position: absolute; right: 12px; min-width: 20px; padding: 0 6px; border-radius: var(--r-xs); border: 1px solid var(--line-strong); color: var(--muted); font: inherit; font-size: var(--type-caption-size); text-align: center; pointer-events: none; }
.cs-search input:focus ~ kbd { display: none; }
.cs-search-pop { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 70; max-height: min(70vh, 520px); overflow-y: auto; padding: 6px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-3); }
.cs-search-title { margin: 8px 10px 4px; font-size: var(--type-kicker-size); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cs-search-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--r-sm); text-decoration: none; color: var(--ink); text-align: left; font: inherit; background: none; border: 0; cursor: pointer; }
.cs-search-item:hover, .cs-search-item:focus-visible { background: var(--surface-2); outline: none; }
.cs-search-item .tg-i { width: 18px; height: 18px; color: var(--muted); flex: none; }
.cs-search-item span { min-width: 0; }
.cs-search-item strong { display: block; font-size: var(--type-label-size); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-search-item small { display: block; color: var(--muted); font-size: var(--type-caption-size); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-search-note { margin: 8px 10px; color: var(--muted); font-size: var(--type-body-s-size); }

/* ---------- Admin hub pages (web/console/admin-hub.js): Oggi, Da approvare, Collegamenti ---------- */
.hub-todo { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.hub-alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hub-alert { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); }
.hub-alert p { flex: 1; margin: 0; min-width: 0; }
.hub-alert .button { flex: none; }
.hub-alert-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.hub-alert.is-danger { background: var(--danger-soft); }
.hub-alert.is-danger .hub-alert-dot { background: var(--danger); }
.hub-alert.is-warn { background: var(--warn-soft); }
.hub-alert.is-warn .hub-alert-dot { background: var(--warn); }
.hub-jobs { list-style: none; margin: 0; padding: 0; display: grid; }
.hub-jobs li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.hub-jobs li:last-child { border-bottom: 0; }
.hub-jobs a { min-width: 0; text-decoration: none; color: inherit; }
.hub-jobs a:hover strong { text-decoration: underline; }
.hub-jobs small { display: block; color: var(--muted); font-size: var(--type-caption-size); }
.hub-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; }
.hub-shortcuts .tg-i { width: 16px; height: 16px; }
.hub-filters .chip { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.hub-count { min-width: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--surface-2); font-size: var(--type-caption-size); text-align: center; }
.hub-filters .chip[aria-pressed="true"] .hub-count { background: color-mix(in srgb, currentColor 18%, transparent); }
.hub-more td { color: var(--muted); }
.hub-errors { margin: 0; }
.hub-empty { text-align: center; }
.hub-empty > .tg-i { width: 40px; height: 40px; padding: 9px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.hub-connections { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.hub-connection { display: flex; flex-direction: column; }
.hub-connection .actions { margin-top: auto; padding-top: 8px; }
.hub-connection-label { margin: 0 0 6px; font-weight: 750; }
.hub-connection.is-off, .hub-connection.is-error { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.adm-tech { margin-top: 12px; }
.adm-tech summary { cursor: pointer; color: var(--muted); font-size: var(--type-body-s-size); font-weight: 650; }
@media (max-width: 1023px) {
  .cs-search { flex-basis: 200px; }
}
@media (max-width: 640px) {
  .cs-search kbd { display: none; }
  .cs-search:focus-within ~ .cs-top-actions, .cs-search:focus-within ~ * { display: none; }
  .cs-crumbs:has(~ .cs-search) { display: none; }
  .hub-alert { flex-wrap: wrap; }
  .hub-alert p { flex-basis: calc(100% - 24px); }
  .hub-alert .button { margin-left: 22px; }
}

/* ---------- Full-screen module pages (zones editor) and printing ---------- */
@media (min-width: 960px) { .console-shell .zones-page { inset: var(--cs-top) 0 0 0; } }
@media (min-width: 1024px) { .console-shell .zones-page { left: var(--cs-side); } }
@media print {
  .console-shell .cs-sidebar, .console-shell .cs-topbar, .console-shell .cs-scrim, .console-shell #toast, .console-shell .skip-link { display: none !important; }
  .console-shell .cs-main { margin-left: 0; }
  .console-shell main { max-width: none; padding: 0; }
}

/* «Risorse del server» (resources-admin.js): a bar under each meter, the minutes as small bars. */
.rsr-meter small { display: block; margin-top: var(--space-1); font: var(--type-caption); color: var(--color-muted); }
.rsr-track { display: block; height: 8px; margin-top: var(--space-2); border: var(--border-width) solid var(--color-outline); border-radius: 999px; overflow: hidden; background: var(--color-bg); }
.rsr-track > span { display: block; height: 100%; background: var(--color-ink); }
.rsr-meter.is-warn .rsr-track > span { background: var(--color-block-yellow); }
.rsr-meter.is-bad .rsr-track > span { background: var(--color-block-red); }
.rsr-bars { display: block; width: 100%; height: 80px; fill: var(--color-ink); }
.rsr-limits { margin: 0; padding-left: var(--space-5); display: grid; gap: var(--space-2); font: var(--type-body); }
