/* Guscio operativo. Colori e tipografia arrivano dai token BrandConfig
   definiti in base.html; qui non esistono valori di marchio autonomi. */

@font-face {
  font-family: "Geist Variable";
  src: url("fonts/GeistVariable.00427006ddbd.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

img, video, svg, canvas {
  max-width: 100%;
  height: auto;
}

p, h1, h2, h3, h4, h5, h6, span, div, a, li, label, dd, dt, td, th {
  overflow-wrap: break-word;
}

body {
  color: var(--color-text);
  background-color: var(--shell-canvas);
  background-image:
    radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--color-primary) 5%, transparent), transparent 40%),
    radial-gradient(circle at 85% 90%, color-mix(in srgb, var(--color-primary) 3%, transparent), transparent 50%);
  background-attachment: fixed;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: var(--ds-weight-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.dark body {
  background-image:
    radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--color-primary) 8%, transparent), transparent 40%),
    radial-gradient(circle at 85% 90%, color-mix(in srgb, var(--color-primary) 4%, transparent), transparent 50%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--color-primary) 52%, transparent);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Componenti riutilizzabili. */

.label {
  margin: 0;
  color: var(--shell-label);
  font-size: 0.72rem;
  font-weight: var(--ds-weight-medium);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.card,
.feature {
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius-panel);
  box-shadow: var(--shell-shadow-card);
  backdrop-filter: blur(18px) saturate(115%);
}

.card {
  background: var(--shell-surface-veil);
}

.feature {
  padding: clamp(24px, 4vw, 34px);
  background: linear-gradient(
    135deg,
    var(--shell-primary-tint),
    var(--shell-surface) 68%
  );
}

.tile {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 14px;
}

.tile svg,
.nav-icon svg,
.icon-button svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.tile svg {
  width: 26px;
  height: 26px;
}

.t-teal {
  color: var(--color-primary);
  background: var(--shell-primary-tint);
}

.t-blue {
  color: var(--shell-blue);
  background: var(--shell-blue-tint);
}

.t-purple {
  color: var(--shell-purple);
  background: var(--shell-purple-tint);
}

.t-green {
  color: var(--shell-green);
  background: var(--shell-green-tint);
}

.t-amber {
  color: var(--shell-amber);
  background: var(--shell-amber-tint);
}

.t-red {
  color: var(--shell-red);
  background: var(--shell-red-tint);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn,
.btn-ghost,
.open-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--shell-radius-control);
  cursor: pointer;
  font-weight: var(--ds-weight-medium);
}

.btn {
  gap: 8px;
  border: 1px solid var(--color-primary);
  padding: 10px 16px;
  color: var(--shell-on-primary);
  background: var(--ds-button-bg);
  box-shadow: var(--ds-shadow-control);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.88rem;
}

.btn-ghost {
  gap: 8px;
  color: var(--color-primary);
  border: 1px solid var(--shell-border);
  padding: 10px 16px;
  background: var(--shell-surface-veil);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.88rem;
}

.btn:hover,
.open-link:hover {
  opacity: 0.9;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--shell-border);
  border-radius: 999px;
  padding: 4px 11px;
  color: var(--shell-muted);
  font-size: 0.76rem;
  font-weight: var(--ds-weight-medium);
}

.pill-done {
  border-color: transparent;
  color: var(--shell-green);
  background: var(--shell-green-tint);
}

.pill-progress {
  border-color: transparent;
  color: var(--shell-amber);
  background: var(--shell-amber-tint);
}

/* Struttura. */

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  width: 224px;
  flex: none;
  flex-direction: column;
  gap: 14px;
  border-right: 1px solid var(--shell-border);
  padding: 16px 12px;
  background: var(--shell-surface-veil);
  box-shadow: none;
  backdrop-filter: blur(22px) saturate(110%);
}

.sidebar-brand {
  display: flex;
  min-height: 52px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px;
}

.brand-logo {
  max-width: 176px;
  max-height: 48px;
  object-fit: contain;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: var(--ds-weight-heading);
}

.brand-tagline {
  color: var(--shell-label);
  font-size: 0.66rem;
  font-weight: var(--ds-weight-medium);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link,
.sidebar-link {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  border-radius: var(--shell-radius-control);
  padding: 6px 10px;
  color: var(--shell-muted);
  font-size: 0.9rem;
  font-weight: var(--ds-weight-medium);
  transition: color var(--shell-transition), background var(--shell-transition), transform var(--shell-transition);
}

.nav-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: none;
  place-items: center;
  border-radius: 8px;
  color: var(--shell-muted);
}

.nav-icon svg {
  width: 19px;
  height: 19px;
}

.nav-link:hover,
.sidebar-link:hover {
  color: var(--color-text);
  background: var(--shell-primary-tint);
  transform: none;
}

.nav-link.is-active {
  color: var(--color-text);
  background: var(--shell-primary-tint);
}

.nav-link.is-active .nav-icon {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-bg));
}

.sidebar-footer {
  display: flex;
  margin-top: auto;
  flex-direction: column;
  gap: 8px;
}

.user-chip {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  border-radius: 10px;
  padding: 9px 10px;
  border: 1px solid var(--shell-border);
  background: var(--shell-surface-veil);
}

.role-tag {
  border-radius: 6px;
  padding: 3px 7px;
  color: var(--color-primary);
  background: var(--shell-primary-tint);
  font-size: 0.62rem;
  font-weight: var(--ds-weight-medium);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.user-email {
  max-width: 100%;
  overflow: hidden;
  color: var(--shell-muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-stat {
  margin: 0;
  padding: 2px 10px;
  color: var(--shell-label);
  font-size: 0.72rem;
}

.main {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.topbar {
  display: flex;
  min-height: 60px;
  align-items: center;
  gap: 10px;
  padding: 14px 30px 0;
}

.topbar-spacer {
  flex: 1;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius-control);
  padding: 11px;
  color: var(--color-text);
  background: var(--shell-surface-veil);
  box-shadow: var(--ds-shadow-control);
  cursor: pointer;
}

.icon-button:hover {
  color: var(--color-primary);
  background: var(--shell-primary-tint);
}

.logout-form {
  margin: 0;
}

.theme-form {
  margin: 0;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.sidebar-overlay {
  display: none;
}

.content {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding: 22px 30px 40px;
}

.messages {
  margin: 0 0 18px;
}

.message {
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--color-primary) 24%, transparent);
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--shell-primary-tint);
}

/* Intestazioni e dashboard. */

.page-head {
  margin-bottom: 22px;
}

.page-head h1 {
  margin: 6px 0;
  font-size: clamp(1.25rem, 2.5vw, 1.55rem);
  font-weight: var(--ds-weight-heading);
  letter-spacing: -0.01em;
}

.home-head h1 {
  color: var(--color-primary);
}

.page-head p,
.section-intro {
  max-width: 68ch;
  margin: 0;
  color: var(--shell-muted);
  line-height: 1.55;
}

.page-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.compact-head {
  max-width: 720px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 20px;
  margin-bottom: 20px;
}

.dashboard-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.feature > .tile {
  margin-bottom: 16px;
}

.feature h2,
.journey h2,
.settings-card h2,
.form-card h2 {
  margin: 0 0 6px;
  font-size: 1.3rem;
  font-weight: var(--ds-weight-heading);
}

.feature p {
  max-width: 48ch;
  margin: 0 0 18px;
  color: var(--shell-muted);
  line-height: 1.55;
}

.journey {
  padding: 20px 22px;
}

.journey > p {
  margin: 0 0 15px;
  color: var(--shell-muted);
  font-size: 0.86rem;
}

.journey ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.journey li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: var(--ds-weight-medium);
}

.journey-number {
  display: grid;
  width: 28px;
  height: 28px;
  flex: none;
  place-items: center;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: var(--ds-weight-heading);
}

.tools-card {
  padding: 8px;
}

.tools-card > .label {
  padding: 12px 12px 8px;
}

.tool-list {
  display: flex;
  flex-direction: column;
}

.tool {
  display: flex;
  min-height: 64px;
  align-items: center;
  gap: 13px;
  border-radius: 12px;
  padding: 10px 12px;
  transition: background var(--shell-transition), transform var(--shell-transition);
}

.tool:hover {
  background: var(--shell-canvas);
  transform: translateX(3px);
}

.tool .tile {
  width: 42px;
  height: 42px;
  border-radius: 11px;
}

.tool .tile svg {
  width: 21px;
  height: 21px;
}

.tool-text {
  min-width: 0;
  flex: 1;
}

.tool-text strong,
.tool-text small {
  display: block;
}

.tool-text strong {
  font-size: 0.95rem;
}

.tool-text small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--shell-muted);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron {
  color: var(--shell-label);
  font-size: 1.3rem;
}

.recent {
  padding: 6px 6px 10px;
}

.recent > .label {
  padding: 14px 16px 6px;
}

.client-directory {
  padding: 20px 22px;
}

.client-directory-heading,
.selector-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.client-directory-heading p,
.selector-heading p,
.quick-prospect > p {
  margin: 7px 0 0;
  color: var(--shell-muted);
}

.organization-search {
  display: flex;
  width: min(100%, 460px);
  gap: 8px;
}

.organization-search input {
  min-width: 0;
  min-height: 44px;
  flex: 1;
  border: 1px solid var(--shell-border);
  border-radius: 11px;
  padding: 9px 12px;
  color: var(--color-text);
  background: var(--shell-surface);
}

.client-result-list,
.organization-choice-list {
  display: grid;
  gap: 7px;
  margin-top: 16px;
}

.client-result,
.organization-choice button {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--shell-border);
  border-radius: 11px;
  padding: 10px 14px;
  color: var(--color-text);
  background: var(--shell-surface);
  cursor: pointer;
  text-align: left;
}

.client-result:hover,
.organization-choice button:hover {
  border-color: var(--color-primary);
  background: var(--shell-primary-tint);
}

.client-result span:first-child,
.organization-choice button span:first-child {
  display: grid;
  gap: 3px;
}

.client-result small,
.organization-choice small {
  color: var(--shell-muted);
}

.vetrina-links {
  padding: 20px 22px;
}

.vetrina-links h2 {
  margin: 6px 0 0;
}

.vetrina-intro {
  margin: 6px 0 16px;
  color: var(--shell-muted);
}

.leg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.leg-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  border: 1px solid var(--shell-border);
  border-left-width: 4px;
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--color-text);
  background: var(--shell-surface);
  transition: background var(--shell-transition), box-shadow var(--shell-transition), transform var(--shell-transition);
}

.leg-link:hover {
  background: var(--shell-primary-tint);
  box-shadow: var(--shell-shadow-card);
  transform: translateY(-2px);
}

.leg-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
}

.leg-icon svg {
  width: 20px;
  height: 20px;
}

.leg-text {
  display: grid;
  gap: 2px;
}

.leg-text small {
  color: var(--shell-muted);
}

.leg-vetrina { border-left-color: var(--color-primary); }
.leg-analisi { border-left-color: var(--color-accent-analisi); }
.leg-gestione { border-left-color: var(--color-accent-gestione); }
.leg-sicurezza { border-left-color: var(--color-accent-sicurezza); }
.leg-produttivita { border-left-color: var(--color-accent-produttivita); }

.table-scroll {
  overflow-x: auto;
}

.shell-table {
  width: 100%;
  border-collapse: collapse;
}

.shell-table th {
  padding: 10px 16px;
  color: var(--shell-label);
  font-size: 0.68rem;
  font-weight: var(--ds-weight-medium);
  letter-spacing: 0.07em;
  text-align: left;
  text-transform: uppercase;
}

.shell-table td {
  border-top: 1px solid var(--shell-border);
  padding: 14px 16px;
  font-size: 0.92rem;
}

.shell-table tbody tr:hover {
  background: var(--shell-canvas);
}

.client-name {
  font-weight: var(--ds-weight-medium);
}

.step-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: var(--ds-weight-medium);
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--color-primary);
}

.table-action {
  text-align: right;
}

.open-link {
  min-height: 38px;
  border: 1px solid var(--shell-border);
  padding: 7px 13px;
  color: var(--color-text);
  background: var(--shell-surface);
  font-size: 0.85rem;
}

.open-link:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.shell-empty-state {
  padding: 28px;
  text-align: center;
}

.shell-empty-state h2,
.shell-empty-state h3 {
  margin: 0;
}

.shell-empty-state p {
  margin: 8px auto 18px;
  color: var(--shell-muted);
}

/* Strumenti, impostazioni e form. */

.tools-page-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  max-width: 860px;
}

.settings-grid,
.selector-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.selector-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr);
  align-items: start;
}

.organization-selector {
  padding: 22px;
}

.selector-heading {
  align-items: flex-start;
  flex-direction: column;
}

.selector-heading h2,
.quick-prospect h2 {
  margin: 0;
}

.tools-page-card > .section-intro {
  padding: 0 12px 8px;
  font-size: 0.86rem;
}

.settings-card,
.form-card {
  padding: 24px;
}

.settings-list {
  display: grid;
  gap: 0;
  margin: 18px 0 0;
}

.settings-list > div {
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) 1fr;
  gap: 18px;
  border-top: 1px solid var(--shell-border);
  padding: 12px 0;
}

.settings-list dt {
  color: var(--shell-muted);
  font-size: 0.82rem;
  font-weight: var(--ds-weight-medium);
}

.settings-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.swatch-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.swatch-list li {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border-top: 1px solid var(--shell-border);
  padding-top: 10px;
}

.color-swatch {
  width: 30px;
  height: 30px;
  border: 1px solid var(--shell-border);
  border-radius: 9px;
  background: var(--swatch-color);
}

.swatch-list code {
  color: var(--shell-muted);
}

.form-card {
  max-width: 660px;
}

.shell-form {
  display: grid;
  gap: 22px;
  margin-top: 20px;
}

.form-field {
  display: grid;
  gap: 7px;
}

.form-field label {
  font-weight: var(--ds-weight-medium);
}

.form-field input,
.login-form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius-control);
  padding: 10px 13px;
  color: var(--color-text);
  background: var(--shell-surface-veil);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-bg) 74%, transparent);
}

.form-field input:focus,
.login-form input:focus {
  border-color: var(--color-primary);
}

.field-error {
  margin: 0;
  color: var(--shell-red);
  font-size: 0.84rem;
}

.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Login: usa gli stessi token del guscio. */

.login-page {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--shell-canvas, var(--color-bg));
}

.login-card {
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--shell-border, var(--color-primary));
  border-radius: 16px;
  padding: 32px;
  background: var(--color-bg);
  box-shadow: 0 1px 2px var(--shell-shadow, transparent), 0 6px 20px var(--shell-shadow, transparent);
}

.login-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.login-brand .brand-name {
  color: var(--color-primary);
}

.login-title {
  margin: 0 0 20px;
  font-size: 1.4rem;
  text-align: center;
}

.login-form {
  display: flex;
  flex-direction: column;
}

.login-form label {
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: var(--ds-weight-medium);
}

.login-form input {
  margin-bottom: 16px;
}

.login-btn {
  min-height: 48px;
  border: 0;
  border-radius: 11px;
  padding: 12px;
  color: var(--color-bg);
  background: var(--color-primary);
  cursor: pointer;
  font-weight: var(--ds-weight-medium);
}

.login-btn:hover {
  opacity: 0.92;
}

.form-errors {
  margin-bottom: 16px;
  border: 1px solid var(--shell-red, var(--color-primary));
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--shell-red, var(--color-primary));
  background: var(--shell-red-tint, var(--color-bg));
  font-size: 0.9rem;
}

/* R2 — pagine del guscio allineate al workspace CyberHealth. */
.tools-page-grid,
.settings-grid {
  gap: 24px;
  align-items: stretch;
}

.tools-page-grid > .feature,
.tools-page-grid > .card,
.settings-card {
  border-color: var(--ds-border);
  border-radius: var(--ds-radius-panel);
  background: var(--ds-surface-veil);
  box-shadow: var(--ds-shadow-ambient);
}

.tools-page-grid > .feature {
  padding: clamp(26px, 4vw, 38px);
  background: linear-gradient(
    145deg,
    var(--ds-primary-tint),
    var(--ds-surface-veil) 72%
  );
}

.tools-page-card {
  padding: 18px;
}

.tools-page-card > .label,
.tools-page-card > .section-intro {
  padding-inline: 4px;
}

.tools-page-card > .section-intro {
  margin-bottom: 10px;
}

.tools-page-card .tool-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tools-page-card .tool {
  min-height: 70px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-card);
  background: var(--ds-surface);
}

.tools-page-card .tool:hover {
  border-color: var(--ds-border-strong);
  background: var(--ds-surface-strong);
  box-shadow: var(--ds-shadow-control);
  transform: translateY(-1px);
}

.tools-page-card .tool .tile {
  width: 44px;
  height: 44px;
  border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
  border-radius: 14px;
}

.settings-card {
  padding: clamp(24px, 3vw, 32px);
}

.settings-list,
.swatch-list {
  margin-top: 22px;
}

.settings-list > div,
.swatch-list li {
  border-color: var(--ds-border);
  padding-block: 15px;
}

.color-swatch {
  border-color: var(--ds-border);
  border-radius: var(--ds-radius-control);
}

/* R3 OneIT — profondità ambientale, vetro sobrio e movimento Apple-like. */
.card,
.feature,
.settings-card,
.form-card,
.selector-card,
.recent,
.message {
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-panel);
  background: var(--ds-surface-veil);
  box-shadow: var(--ds-shadow-md);
  backdrop-filter: blur(18px) saturate(112%);
}

.card,
.feature,
.tool,
.btn,
.btn-ghost,
.open-link,
.icon-button,
input,
select,
textarea {
  transition:
    color var(--ds-duration-fast) var(--ds-easing),
    border-color var(--ds-duration-fast) var(--ds-easing),
    background var(--ds-duration-fast) var(--ds-easing),
    box-shadow var(--ds-duration-base) var(--ds-easing),
    transform var(--ds-duration-base) var(--ds-easing);
}

h1,
h2,
h3,
.brand-name {
  font-weight: var(--ds-weight-heading);
  letter-spacing: -0.025em;
}

.sidebar {
  border-color: var(--ds-border);
  background: color-mix(in srgb, var(--ds-surface-veil) 82%, transparent);
  box-shadow: none;
}

.nav-link,
.sidebar-link {
  min-height: 40px;
  font-weight: var(--ds-weight-medium);
}

.nav-link.is-active {
  box-shadow: inset 0 0 0 1px var(--ds-border);
}

.btn,
.btn-ghost,
.open-link,
.icon-button,
input,
select,
textarea {
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-control);
  box-shadow: none;
}

input,
select,
textarea {
  color: var(--color-text);
  background: color-mix(in srgb, var(--ds-surface-strong) 86%, transparent);
}

.btn:hover,
.btn-ghost:hover,
.open-link:hover,
.icon-button:hover {
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: var(--ds-shadow-sm);
}

.btn:active,
.btn-ghost:active,
.open-link:active,
.icon-button:active {
  transform: translateY(0) scale(.985);
}

/* Interno — griglia moduli. */

.internal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  max-width: 860px;
}

.internal-module-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  transition: border-color var(--ds-duration-fast) var(--ds-easing), box-shadow var(--ds-duration-base) var(--ds-easing), transform var(--ds-duration-base) var(--ds-easing);
}

.internal-module-card:hover {
  border-color: var(--ds-border-strong);
  box-shadow: var(--ds-shadow-md);
  transform: translateY(-2px);
}

.internal-module-text {
  min-width: 0;
  flex: 1;
}

.internal-module-text strong,
.internal-module-text small {
  display: block;
}

.internal-module-text strong {
  font-size: 0.95rem;
}

.internal-module-text small {
  margin-top: 3px;
  color: var(--shell-muted);
  font-size: 0.8rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Tablet: il contenuto si impila e la sidebar diventa a scomparsa. */

@media (max-width: 900px) {
  .dashboard-grid,
  .tools-page-grid,
  .settings-grid,
  .selector-grid {
    grid-template-columns: 1fr;
  }

  .tools-page-card .tool-list {
    grid-template-columns: 1fr;
  }

  .internal-grid {
    grid-template-columns: 1fr;
  }

  .menu-toggle {
    display: flex;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    background: color-mix(in srgb, var(--color-text) 45%, transparent);
    cursor: pointer;
  }
}

/* Telefono: azioni larghe, tabella trasformata in schede leggibili. */

@media (max-width: 640px) {
  .topbar {
    padding: 10px 16px 0;
  }

  .content {
    padding: 16px 16px 32px;
  }

  .page-head-actions,
  .page-header,
  .page-header-actions,
  .client-directory-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .organization-search {
    width: 100%;
    flex-direction: column;
  }

  .organization-search .btn {
    width: 100%;
  }

  .feature,
  .journey,
  .settings-card,
  .form-card {
    padding: 20px;
  }

  .journey ol {
    grid-template-columns: 1fr;
  }

  .actions .btn,
  .page-head-actions .btn,
  .page-header-actions .btn {
    width: 100%;
  }

  .tool-text small {
    white-space: normal;
  }

  .recent {
    padding: 8px;
  }

  .recent > .label {
    padding: 10px 8px 14px;
  }

  .shell-table,
  .shell-table tbody,
  .shell-table tr,
  .shell-table td {
    display: block;
    width: 100%;
  }

  .shell-table thead {
    display: none;
  }

  .shell-table tr {
    border-top: 1px solid var(--shell-border);
    padding: 12px 8px;
  }

  .shell-table td {
    border: 0;
    padding: 5px 0;
  }

  .table-action {
    text-align: left;
  }

  .open-link {
    width: 100%;
    margin-top: 5px;
  }

  .settings-list > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .swatch-list li {
    grid-template-columns: 34px 1fr;
  }

  .swatch-list code {
    grid-column: 2;
  }

  .login-card {
    padding: 24px;
  }
}
