:root {
  color-scheme: light dark;
  --background: #f5f5f7;
  --chrome: rgba(246, 246, 248, 0.86);
  --rail: #f0f0f3;
  --content: #fafafa;
  --detail: #f7f7f9;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --surface-soft: rgba(118, 118, 128, 0.11);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --tertiary: #8e8e93;
  --line: rgba(60, 60, 67, 0.13);
  --line-strong: rgba(60, 60, 67, 0.23);
  --primary: #0a84ff;
  --primary-soft: rgba(10, 132, 255, 0.12);
  --primary-selected: rgba(10, 132, 255, 0.09);
  --primary-border: rgba(10, 132, 255, 0.30);
  --focus-ring: rgba(10, 132, 255, 0.28);
  --success: #248a3d;
  --success-soft: rgba(52, 199, 89, 0.13);
  --danger: #d70015;
  --danger-soft: rgba(255, 59, 48, 0.12);
  --danger-border: rgba(255, 59, 48, 0.24);
  --warning: #a05a00;
  --warning-soft: rgba(255, 149, 0, 0.14);
  --neutral-soft: rgba(118, 118, 128, 0.12);
  --registry-noti: var(--primary);
  --registry-ignoti: var(--success);
  --registry-ncr: var(--warning);
  --registry-gdp: #5856d6;
  --topbar-gradient-start: rgba(255, 255, 255, 0.82);
  --topbar-gradient-end: rgba(255, 255, 255, 0.56);
  --brand-start: #2d89ff;
  --brand-end: #006edb;
  --radius: 16px;
  --shadow-subtle: 0 10px 28px rgba(0, 0, 0, 0.06);
  --shadow-panel: 0 20px 54px rgba(0, 0, 0, 0.10);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #111114;
    --chrome: rgba(28, 28, 31, 0.88);
    --rail: #17181c;
    --content: #101114;
    --detail: #17181c;
    --surface: rgba(35, 36, 40, 0.82);
    --surface-strong: #1f2024;
    --surface-soft: rgba(235, 235, 245, 0.07);
    --text: #f5f5f7;
    --muted: #a1a1a8;
    --tertiary: #73737a;
    --line: rgba(235, 235, 245, 0.13);
    --line-strong: rgba(235, 235, 245, 0.24);
    --primary: #0a84ff;
    --primary-soft: rgba(10, 132, 255, 0.18);
    --primary-selected: rgba(10, 132, 255, 0.16);
    --primary-border: rgba(10, 132, 255, 0.38);
    --focus-ring: rgba(10, 132, 255, 0.34);
    --success: #30d158;
    --success-soft: rgba(48, 209, 88, 0.18);
    --danger: #ff453a;
    --danger-soft: rgba(255, 69, 58, 0.18);
    --danger-border: rgba(255, 69, 58, 0.30);
    --warning: #ffd60a;
    --warning-soft: rgba(255, 214, 10, 0.16);
    --neutral-soft: rgba(235, 235, 245, 0.09);
    --registry-gdp: #5e5ce6;
    --topbar-gradient-start: rgba(37, 38, 42, 0.90);
    --topbar-gradient-end: rgba(28, 29, 33, 0.72);
    --brand-start: #0a84ff;
    --brand-end: #0057d9;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  transform: translateY(-140%);
  border: 1px solid color-mix(in srgb, var(--primary) 34%, var(--line));
  border-radius: 999px;
  padding: 0.56rem 0.82rem;
  color: var(--primary);
  background: var(--surface);
  box-shadow: var(--shadow-subtle);
  font-size: 0.82rem;
  font-weight: 820;
  text-decoration: none;
  transition: transform 0.16s ease;
}

.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--background);
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.44), rgba(0, 0, 0, 0.18) 48%, rgba(0, 0, 0, 0.08)),
    url("./assets/procdesk-login-background.jpg") center / cover no-repeat,
    var(--background);
}

.login-card {
  display: grid;
  justify-items: center;
  gap: 20px;
  width: min(100%, 560px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 28px;
  padding: 48px 42px 36px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(22px);
  text-align: center;
}

@media (prefers-color-scheme: dark) {
  .login-card {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(28, 29, 33, 0.78);
  }
}

.login-brand-mark {
  border-radius: 30px;
}

.login-brand-mark img {
  transform: scale(1.24);
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 2.08rem;
  font-weight: 830;
  line-height: 1;
}

.login-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.42;
}

.login-actions {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: 100%;
  padding-top: 6px;
}

.login-button-shell {
  position: relative;
  display: grid;
  justify-items: center;
  width: min(100%, 280px);
}

.login-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(100%, 280px);
  min-height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  padding: 0 1.18rem;
  color: white;
  background: #111114;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  font-size: 0.98rem;
  font-weight: 760;
}

.login-button-shell:has(#apple-sign-in-button:not(:empty)) .login-button {
  pointer-events: none;
}

.login-button:hover {
  background: #000000;
}

.login-button:disabled {
  opacity: 0.58;
}

.login-button-icon {
  font-size: 1.12rem;
  line-height: 1;
}

.login-status {
  min-height: 1.3em;
  font-size: 0.82rem;
}

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

button {
  border: 0;
  border-radius: 999px;
  min-height: 36px;
  padding: 0.52rem 0.84rem;
  color: white;
  background: var(--primary);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  color: var(--primary);
  background: var(--primary-soft);
}

button.danger {
  background: var(--danger);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.row.interactive:focus-visible,
.fascicolo-list-row:focus-visible,
.workflow-item:focus-visible,
.menu-item:focus-visible,
.import-category-header:focus-visible,
.settings-secretariat-row:focus-visible,
.compact-button:focus-visible,
.primary-button:focus-visible,
.icon-button:focus-visible,
.search-filter-button:focus-visible,
.detail-actions-panel button:focus-visible,
.detail-quick-actions button:focus-visible,
.safe-field-actions button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--focus-ring) 16%, transparent);
}

#main-content:focus-visible {
  outline: 0;
}

.import-file-control:focus-within {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--focus-ring) 16%, transparent);
}

input,
select,
textarea {
  min-width: 0;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  min-height: 38px;
  padding: 0.58rem 0.72rem;
  color: var(--text);
  background: var(--surface-soft);
}

textarea {
  resize: vertical;
  line-height: 1.36;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 2px;
  font-size: 1.34rem;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.82rem;
  line-height: 1.08;
  letter-spacing: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 228px minmax(520px, 1.14fr) minmax(410px, 0.86fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  min-height: 720px;
  overflow: hidden;
  background: var(--background);
}

.app-content,
.app-menu,
.detail-panel {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.app-content {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--content) 92%, var(--surface-strong)) 0, var(--content) 260px),
    var(--content);
}

.app-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  color: var(--text);
  background: color-mix(in srgb, var(--content) 62%, transparent);
  backdrop-filter: blur(16px) saturate(1.08);
  font-size: 0.92rem;
  font-weight: 780;
}

.app-loading-overlay[hidden] {
  display: none;
}

.loading-panel {
  display: grid;
  justify-items: center;
  gap: 12px;
  min-width: 154px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px 24px 20px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 color-mix(in srgb, white 55%, transparent);
}

.loading-progress-ring {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, color-mix(in srgb, var(--surface) 94%, transparent) 0 56%, transparent 57%),
    conic-gradient(var(--primary) var(--loading-progress, 0%), color-mix(in srgb, var(--primary) 9%, var(--surface-soft)) 0);
  box-shadow:
    0 10px 28px color-mix(in srgb, var(--primary) 12%, transparent),
    inset 0 0 0 1px color-mix(in srgb, var(--primary) 10%, var(--line));
  display: grid;
  place-items: center;
}

.loading-progress-ring::after {
  content: "";
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background:
    linear-gradient(var(--primary), var(--primary)) 12px 14px / 14px 2px no-repeat,
    linear-gradient(var(--primary), var(--primary)) 12px 20px / 10px 2px no-repeat,
    color-mix(in srgb, var(--primary) 8%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 15%, var(--line));
}

.loading-panel span {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 790;
}

.sync-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  border-radius: 999px;
  padding: 0 0.72rem;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  white-space: nowrap;
  font-size: 0.76rem;
  font-weight: 780;
}

.sync-status-badge span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 14%, transparent);
}

.sync-status-badge.syncing span {
  background: var(--warning);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning) 16%, transparent);
  animation: pulse 1.6s ease-in-out infinite;
}

.sync-status-badge.error {
  color: var(--warning);
  background: var(--warning-soft);
}

.sync-status-badge.error span {
  background: var(--warning);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning) 18%, transparent);
}

.app-menu {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  align-content: start;
  gap: 16px;
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--rail) 88%, var(--surface-strong)) 0, var(--rail) 100%);
}

.menu-items {
  display: grid;
  align-content: start;
  gap: 4px;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 36px;
  border-radius: 10px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  font-size: 0.92rem;
  font-weight: 730;
  text-align: left;
}

.menu-item:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.menu-item.selected {
  color: var(--text);
  background: color-mix(in srgb, var(--primary-selected) 82%, transparent);
  box-shadow: inset 3px 0 0 var(--primary);
}

.app-view {
  height: 100%;
  min-height: 100%;
}

.fascicoli-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100%;
}

.home-view,
.placeholder-view,
.import-view {
  display: grid;
  align-content: start;
  gap: 14px;
  padding-bottom: 20px;
}

.home-registry-filter-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  margin-bottom: -6px;
  padding: 6px 20px 2px;
}

.home-registry-filter {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px;
  max-width: min(100%, 560px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 3px;
  background: color-mix(in srgb, var(--surface-soft) 86%, transparent);
}

.home-registry-filter-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 780;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.home-registry-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 4px 10px;
  color: var(--muted);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 760;
  cursor: pointer;
}

.home-registry-tab:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
}

.home-registry-tab:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.home-registry-tab.selected {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary-border) 70%, transparent);
  background: color-mix(in srgb, var(--surface-strong) 72%, var(--primary-selected));
  box-shadow:
    0 1px 0 color-mix(in srgb, var(--surface-strong) 80%, transparent) inset,
    0 2px 8px rgba(0, 0, 0, 0.05);
}

.home-registry-tab strong {
  color: var(--tertiary);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

.home-registry-tab.selected strong {
  color: var(--primary);
}

.home-dashboard {
  display: grid;
  gap: 18px;
  padding: 0 20px 20px;
}

.home-overview {
  display: grid;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 13%, var(--line));
  border-radius: 24px;
  padding: 18px;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--primary) 11%, transparent), transparent 42%),
    color-mix(in srgb, var(--surface-strong) 86%, var(--surface));
  box-shadow: var(--shadow-subtle);
}

.home-overview-heading,
.home-secondary-heading {
  display: grid;
  gap: 3px;
}

.home-overview-heading span,
.home-secondary-heading span,
.deadline-container-header span,
.pendenza-total-card span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 780;
  letter-spacing: 0.015em;
}

.home-overview-heading h3,
.home-secondary-heading h3 {
  margin: 0;
  font-size: 1.16rem;
  font-weight: 840;
  line-height: 1.14;
}

.home-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.home-overview-card {
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 128px;
  border: 1px solid color-mix(in srgb, var(--line) 74%, transparent);
  border-radius: 18px;
  padding: 14px;
  background: color-mix(in srgb, var(--surface-strong) 78%, transparent);
}

.home-overview-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 790;
}

.home-overview-card strong {
  color: var(--primary);
  font-size: clamp(2.05rem, 4vw, 3.12rem);
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.home-overview-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.80rem;
  line-height: 1.30;
}

.home-overview-card.warning strong {
  color: var(--warning);
}

.home-overview-card.danger strong {
  color: var(--danger);
}

.home-overview-card.muted strong {
  color: var(--text);
}

.home-dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: start;
  gap: 18px;
}

.home-dashboard-column {
  display: grid;
  min-width: 0;
  gap: 12px;
}

.home-secondary-block {
  display: grid;
  gap: 10px;
}

.home-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 16px;
  padding: 12px 13px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.home-section-heading .section-label {
  color: var(--muted);
  font-size: 0.68rem;
}

.home-section-heading h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 820;
}

.home-section-heading strong {
  color: var(--muted);
  font-size: 1.22rem;
  font-weight: 830;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.pendenza-total-card {
  align-items: center;
  padding-block: 12px;
}

.home-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.home-status-card {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 128px;
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 15px;
  background: var(--surface);
}

.home-status-card span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 780;
}

.home-status-card strong {
  color: var(--text);
  font-size: 2.1rem;
  font-weight: 820;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.home-status-card.warning strong {
  color: var(--warning);
}

.home-status-card.danger strong {
  color: var(--danger);
}

.home-status-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.32;
}

.home-workflow-board {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.home-workflow-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 13px;
  background: var(--surface);
}

.home-workflow-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.home-workflow-card h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 780;
}

.home-workflow-card-header span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
}

.home-workflow-list {
  display: grid;
  gap: 6px;
}

.home-workflow-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 6px 8px;
  color: var(--text);
  background: var(--surface-soft);
  text-align: left;
}

button.home-workflow-row {
  width: 100%;
  cursor: pointer;
}

.home-workflow-row:hover {
  border-color: var(--primary-border);
  background: var(--primary-selected);
}

.home-workflow-row span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-workflow-row strong {
  font-size: 0.9rem;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.home-workflow-row.warning strong {
  color: var(--warning);
}

.home-workflow-row.danger strong {
  color: var(--danger);
}

.home-workflow-row.ok strong {
  color: var(--success);
}

.control-container {
  display: grid;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--line) 68%, transparent);
  border-radius: 18px;
  padding: 13px;
  background: color-mix(in srgb, var(--surface) 64%, transparent);
}

.operational-section {
  align-content: start;
  border-color: color-mix(in srgb, var(--line) 70%, transparent);
  background: color-mix(in srgb, var(--surface) 66%, transparent);
}

.control-container-header h3 {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 840;
}

.control-container-header.split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.control-container-header.split strong {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 830;
  font-variant-numeric: tabular-nums;
}

.home-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px;
}

.home-section-grid .control-container {
  height: 100%;
}

.control-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(104px, auto);
  align-content: start;
  gap: 8px;
}

.control-card-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(126px, auto);
}

.control-card-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(122px, auto);
}

.control-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 9px;
  min-height: 104px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 15px;
  padding: 10px;
  background: color-mix(in srgb, var(--surface-strong) 72%, transparent);
}

.operational-section .control-card {
  border-color: color-mix(in srgb, var(--line) 70%, transparent);
  background: color-mix(in srgb, var(--surface-strong) 70%, transparent);
  box-shadow: none;
}

.control-card.warning {
  border-color: var(--line);
  background: var(--surface-strong);
}

.control-card.accent {
  border-color: var(--line);
  background: var(--surface-strong);
}

.control-card.muted {
  opacity: 0.82;
}

.control-card > div:first-child span {
  display: block;
  overflow: hidden;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 820;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.28;
}

.control-card > strong {
  color: color-mix(in srgb, var(--primary) 78%, var(--text));
  font-size: 1.28rem;
  font-weight: 840;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.control-card.warning > strong {
  color: color-mix(in srgb, var(--primary) 78%, var(--text));
}

.control-card.accent > strong {
  color: color-mix(in srgb, var(--primary) 78%, var(--text));
}

.control-card-metrics {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.control-card-metrics div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  border-radius: 10px;
  padding: 5px 7px;
  background: color-mix(in srgb, var(--surface-soft) 72%, transparent);
}

.control-card-metrics span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-card-metrics strong {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.home-deadline-column {
  align-items: start;
}

.deadline-container {
  display: grid;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 74%, transparent);
  border-radius: 20px;
  padding: 15px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.deadline-container-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.deadline-container-header h3 {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 840;
}

.deadline-container-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
}

.deadline-section {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  height: calc(112px + (var(--deadline-visible-rows, 1) * 78px));
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 12px;
  background: color-mix(in srgb, var(--surface-strong) 78%, transparent);
}

.deadline-section.primary {
  border-color: color-mix(in srgb, var(--danger) 20%, var(--line));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--danger) 8%, transparent), transparent 48%),
    var(--surface-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.035);
}

.deadline-section.secondary {
  border-color: color-mix(in srgb, var(--warning) 24%, var(--line));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--warning) 6%, transparent), transparent 46%),
    var(--surface);
}

.deadline-section.primary .deadline-section-header h3 {
  color: var(--danger);
}

.deadline-section.secondary .deadline-section-header h3 {
  color: var(--warning);
}

.deadline-section-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px;
}

.deadline-section-header h3 {
  margin: 0 0 4px;
  font-size: 0.96rem;
  font-weight: 830;
}

.deadline-section-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.32;
}

.deadline-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px;
  background: var(--surface-soft);
}

.deadline-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 22px;
  padding: 0 0.36rem;
  color: var(--muted);
  background: transparent;
  font-size: 0.64rem;
  font-weight: 760;
}

.deadline-tab.selected {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.deadline-tab.overdue-alert {
  color: var(--danger);
  background: var(--danger-soft);
}

.deadline-tab.overdue-alert strong {
  color: white;
  border-radius: 999px;
  padding: 0.04rem 0.30rem;
  background: var(--danger);
}

.deadline-tab.overdue-alert.selected {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 16%, var(--surface));
  box-shadow:
    0 1px 4px rgba(0, 0, 0, 0.10),
    inset 0 0 0 1px color-mix(in srgb, var(--danger) 26%, transparent);
}

.deadline-tab strong {
  color: inherit;
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
}

.deadline-list {
  display: grid;
  grid-auto-rows: 78px;
  align-content: start;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.deadline-row {
  height: 78px;
  min-height: 78px;
  border-radius: 0;
  border-top: 1px solid var(--line);
  padding: 5px 0;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.deadline-row-placeholder {
  height: 78px;
  min-height: 78px;
}

.deadline-row:first-child {
  border-top: 0;
  padding-top: 2px;
}

.deadline-row:hover {
  background: transparent;
}

.deadline-row.procdesk-fascicolo-row:hover {
  background: var(--surface-soft);
}

.deadline-date {
  display: grid;
  place-items: center;
  align-content: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  font-variant-numeric: tabular-nums;
}

.deadline-date strong {
  font-size: 0.86rem;
  font-weight: 760;
  line-height: 1;
}

.deadline-date span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 780;
}

.deadline-date small {
  margin-top: 0;
  color: var(--muted);
  font-size: 0.54rem;
  font-weight: 780;
}

.deadline-row-body {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.deadline-row-body strong,
.deadline-row-body span,
.deadline-row-body small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deadline-row-body strong {
  font-size: 0.88rem;
  font-weight: 790;
}

.deadline-row-body span,
.deadline-row-body small {
  color: var(--muted);
  font-size: 0.78rem;
}

.deadline-badge {
  justify-self: end;
  align-self: center;
  max-width: 86px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 8px;
  padding: 0.22rem 0.42rem;
  color: var(--muted);
  background: var(--neutral-soft);
  font-size: 0.68rem;
  font-weight: 820;
}

.deadline-empty {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.28;
}

.deadline-list.is-empty {
  min-height: calc(var(--deadline-visible-rows, 1) * 78px);
}

.deadline-list.is-empty::before {
  content: "";
  display: block;
  min-height: 100%;
}

.deadline-list .deadline-empty {
  color: var(--muted);
}

.registry-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.registry-pendenza-card,
.registry-chart-card {
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 66%, transparent);
}

.registry-pendenza-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 56px;
  padding: 9px 10px;
  border-color: color-mix(in srgb, var(--registry-color) 28%, var(--line));
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--registry-color) 10%, transparent), transparent 60%),
    var(--surface);
}

.registry-pendenza-card::before {
  content: "";
  position: absolute;
  inset: 9px auto 9px 0;
  width: 3px;
  border-radius: 999px;
  background: var(--registry-color);
}

.registry-noti {
  --registry-color: var(--registry-noti);
}

.registry-ignoti {
  --registry-color: var(--registry-ignoti);
}

.registry-ncr {
  --registry-color: var(--registry-ncr);
}

.registry-gdp {
  --registry-color: var(--registry-gdp);
}

.registry-card-symbol {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  color: var(--registry-color);
  background: color-mix(in srgb, var(--registry-color) 14%, transparent);
  font-size: 0.72rem;
  font-weight: 850;
}

.registry-pendenza-card span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 780;
}

.registry-pendenza-card strong {
  display: block;
  justify-self: end;
  margin-top: 0;
  color: var(--registry-color);
  font-size: 1.22rem;
  font-weight: 820;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.registry-pendenza-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 650;
  line-height: 1.32;
}

.registry-chart-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  opacity: 0.86;
}

.registry-chart-header,
.registry-chart-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.registry-chart-header h3 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
}

.registry-chart-header span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 720;
}

.registry-pie-layout {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.registry-pie {
  width: 72px;
  height: 72px;
  overflow: visible;
  transform: rotate(-90deg);
}

.registry-pie-track,
.registry-pie-segment {
  fill: none;
  stroke-width: 6;
}

.registry-pie-track {
  stroke: var(--surface-soft);
}

.registry-pie-segment {
  stroke: var(--registry-color);
  stroke-linecap: butt;
}

.registry-chart-list {
  display: grid;
  gap: 4px;
}

.registry-chart-row {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 730;
}

.registry-chart-row span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.registry-chart-row i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--registry-color);
}

.registry-chart-row strong {
  color: var(--text);
  font-size: 0.70rem;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.home-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: var(--surface);
}

.home-panel h3 {
  margin-bottom: 5px;
  font-size: 1.2rem;
}

.home-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.38;
}

.inline-label {
  display: block;
  margin: 0 0 8px;
}

.home-quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0 20px;
}

.home-quick-action {
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 6px;
  min-height: 110px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  color: var(--text);
  background: var(--surface);
  text-align: left;
}

.home-quick-action span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.32;
}

.placeholder-view .empty-state {
  margin: 0 20px;
}

.import-content {
  display: grid;
  gap: 16px;
  padding: 0 20px 20px;
}

.import-hero,
.import-panel,
.import-results,
.import-category {
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  box-shadow: var(--shadow-subtle);
}

.import-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 18px;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--primary) 10%, transparent), transparent 44%),
    color-mix(in srgb, var(--surface-strong) 78%, var(--surface));
}

.import-hero span,
.import-panel .section-header span,
.import-results .section-header span,
.import-report-overview span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 780;
  letter-spacing: 0.015em;
}

.import-hero h3,
.import-panel h3,
.import-results h3,
.import-category h4 {
  margin: 0;
  color: var(--text);
}

.import-hero p,
.import-category-header p,
.import-result-row p,
.import-status,
.import-empty {
  margin: 0;
  color: var(--muted);
  line-height: 1.42;
}

.import-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin: 0;
  padding: 0;
  list-style: none;
}

.import-steps li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: color-mix(in srgb, var(--surface-strong) 76%, transparent);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 720;
}

.import-steps span {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--primary-selected);
  color: var(--primary);
  font-size: 0.72rem;
}

.import-panel,
.import-results {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.import-upload-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.import-file-control {
  display: grid;
  gap: 8px;
  min-width: 0;
  border: 1px dashed color-mix(in srgb, var(--primary) 24%, var(--line));
  border-radius: 16px;
  padding: 13px;
  background: color-mix(in srgb, var(--surface-strong) 64%, transparent);
  color: var(--text);
  font-weight: 720;
  cursor: pointer;
}

.import-file-control input {
  font: inherit;
  color: var(--muted);
}

.import-status.error {
  color: var(--danger);
}

.import-warning {
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--warning) 36%, var(--line));
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--warning);
  background: var(--warning-soft);
  font-size: 0.86rem;
  line-height: 1.42;
}

.import-report-overview {
  position: relative;
  display: grid;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--primary) 16%, var(--line));
  border-radius: 18px;
  padding: 12px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 6%, transparent), transparent 54%),
    color-mix(in srgb, var(--surface-strong) 76%, transparent);
}

.import-report-sticky-summary {
  position: sticky;
  top: 12px;
  z-index: 20;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-subtle);
}

.import-report-meta {
  display: grid;
  grid-template-columns: 1.6fr repeat(4, minmax(0, 0.8fr));
  gap: 8px;
}

.import-report-meta article,
.import-report-priority-counts article {
  display: grid;
  gap: 4px;
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  border-radius: 14px;
  padding: 10px;
  background: color-mix(in srgb, var(--surface-strong) 62%, transparent);
}

.import-report-meta strong,
.import-report-priority-counts strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.import-report-priority-counts {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.import-report-priority-counts article {
  min-height: 64px;
}

.import-report-priority-counts .high-priority {
  border-color: color-mix(in srgb, var(--primary) 22%, var(--line));
  background: color-mix(in srgb, var(--primary) 7%, var(--surface-strong));
}

.import-report-priority-counts .low-priority {
  border-color: color-mix(in srgb, var(--line) 64%, transparent);
  background: color-mix(in srgb, var(--surface-strong) 48%, transparent);
}

.import-report-priority-counts .high-priority strong {
  color: var(--text);
  font-size: clamp(1.35rem, 2.2vw, 1.8rem);
  line-height: 1;
}

.import-report-priority-counts .low-priority strong {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1;
}

.import-report-footnote {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.import-report-meta .import-summary-warning {
  border-color: color-mix(in srgb, var(--warning) 34%, var(--line));
  background: var(--warning-soft);
}

.import-focus-panel,
.import-available-actions,
.import-filter-empty {
  display: grid;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--line));
  border-radius: 18px;
  padding: 14px;
  background: color-mix(in srgb, var(--surface-strong) 72%, transparent);
}

.import-focus-heading,
.import-available-actions {
  align-items: start;
}

.import-focus-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.import-focus-heading span,
.import-available-actions span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.015em;
}

.import-focus-heading h4,
.import-available-actions h4 {
  margin: 2px 0 0;
  font-size: 1rem;
}

.import-focus-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.import-kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.import-kpi-strip article {
  display: grid;
  gap: 4px;
  border: 1px solid color-mix(in srgb, var(--line) 64%, transparent);
  border-radius: 15px;
  padding: 12px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.import-kpi-strip article.action {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--line));
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

.import-kpi-strip article.warning {
  border-color: color-mix(in srgb, var(--warning) 34%, var(--line));
  background: var(--warning-soft);
}

.import-kpi-strip span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 780;
}

.import-kpi-strip strong {
  color: var(--text);
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 0.95;
}

.import-category-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.import-category-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid color-mix(in srgb, var(--line) 74%, transparent);
  border-radius: 999px;
  padding: 0.34rem 0.68rem;
  color: var(--text);
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 760;
}

.import-category-filter strong {
  min-width: 24px;
  border-radius: 999px;
  padding: 0.1rem 0.38rem;
  color: var(--muted);
  background: var(--surface-soft);
  text-align: center;
}

.import-category-filter.selected {
  border-color: color-mix(in srgb, var(--primary) 36%, var(--line));
  color: var(--primary);
  background: var(--primary-selected);
}

.import-category-filter.selected strong {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}

.import-available-actions {
  grid-template-columns: minmax(190px, 0.42fr) minmax(0, 1fr);
  border-color: color-mix(in srgb, var(--success) 24%, var(--line));
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--success) 8%, transparent), transparent 40%),
    color-mix(in srgb, var(--surface-strong) 78%, transparent);
}

.import-available-actions-buttons,
.import-available-actions .import-bulk-panel {
  grid-column: 2;
}

.import-available-actions-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.import-filter-empty {
  justify-items: start;
  border-style: dashed;
  color: var(--muted);
}

.import-filter-empty strong {
  color: var(--text);
}

.import-filter-empty p {
  margin: 0;
  font-size: 0.84rem;
}

.import-diagnostics {
  border: 1px solid color-mix(in srgb, var(--warning) 34%, var(--line));
  border-radius: 16px;
  margin-top: 8px;
  padding: 12px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
}

.import-report-diagnostics {
  border-style: dashed;
  opacity: 0.82;
}

.import-diagnostics summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.import-diagnostics summary span {
  color: var(--text);
  font-weight: 820;
}

.import-diagnostics summary strong {
  color: var(--muted);
  font-size: 0.78rem;
}

.import-diagnostics-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
}

.import-diagnostics-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.38;
}

.import-diagnostics-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.import-diagnostics pre {
  overflow: auto;
  max-height: 520px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-strong);
  color: var(--text);
  font: 0.78rem/1.42 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.import-category-grid {
  display: grid;
  gap: 12px;
}

.import-category {
  display: grid;
  gap: 0;
  padding: 0;
  box-shadow: none;
}

.import-category.secondary {
  background: color-mix(in srgb, var(--surface) 54%, transparent);
}

.import-category.secondary .import-category-header {
  padding-block: 11px;
}

.import-category.secondary .import-category-header p {
  font-size: 0.82rem;
}

.import-category-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}

.import-category-header::-webkit-details-marker {
  display: none;
}

.import-category-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
}

.import-category-chevron {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.16s ease;
}

.import-category[open] .import-category-chevron {
  transform: rotate(45deg);
}

.import-category-body {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px;
}

.import-category-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.import-category-actions .compact-button {
  min-height: 32px;
  padding: 0.36rem 0.68rem;
  font-size: 0.76rem;
}

.import-bulk-panel {
  display: grid;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--line));
  border-radius: 14px;
  padding: 11px;
  background: color-mix(in srgb, var(--primary) 7%, var(--surface-strong));
}

.import-bulk-panel.error {
  border-color: color-mix(in srgb, var(--danger) 38%, var(--line));
  background: var(--danger-soft);
}

.import-bulk-panel.done {
  border-color: color-mix(in srgb, var(--success) 36%, var(--line));
  background: var(--success-soft);
}

.import-bulk-panel p {
  margin: 0;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.38;
}

.import-bulk-actions,
.import-bulk-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.import-bulk-progress-header strong,
.import-bulk-progress-header span {
  font-size: 0.82rem;
}

.import-bulk-progress {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 58%, transparent);
}

.import-bulk-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.18s ease;
}

.import-bulk-progress-details {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.import-bulk-progress-details div {
  display: grid;
  gap: 3px;
  border: 1px solid color-mix(in srgb, var(--line) 58%, transparent);
  border-radius: 12px;
  padding: 8px;
  background: color-mix(in srgb, var(--surface-strong) 58%, transparent);
}

.import-bulk-progress-details span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 780;
}

.import-bulk-progress-details strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.82rem;
  line-height: 1.25;
}

.import-result-list {
  display: grid;
  gap: 8px;
}

.import-result-row {
  display: grid;
  gap: 5px;
  border: 1px solid color-mix(in srgb, var(--line) 58%, transparent);
  border-radius: 14px;
  padding: 10px 11px;
  background: color-mix(in srgb, var(--surface-strong) 60%, transparent);
}

.import-result-row .form-status.ok {
  border: 1px solid color-mix(in srgb, var(--success) 28%, transparent);
  border-radius: 999px;
  width: fit-content;
  padding: 3px 8px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.78rem;
  font-weight: 720;
}

.import-result-row .form-status.danger {
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: 999px;
  width: fit-content;
  padding: 3px 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 720;
}

.import-result-row-action {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.import-result-row-action .compact-button {
  min-height: 32px;
  padding: 0.36rem 0.68rem;
  font-size: 0.76rem;
  white-space: nowrap;
}

.import-result-row-action .form-status:empty {
  display: none;
}

@media (max-width: 900px) {
  .import-hero,
  .import-upload-row,
  .import-report-meta,
  .import-report-priority-counts,
  .import-kpi-strip,
  .import-available-actions,
  .import-bulk-progress-details {
    grid-template-columns: 1fr;
  }

  .import-steps {
    justify-content: flex-start;
  }

  .import-category-header,
  .import-bulk-actions,
  .import-bulk-progress-header {
    align-items: stretch;
    flex-direction: column;
  }

  .import-category-actions {
    justify-content: flex-start;
  }

  .import-available-actions-buttons,
  .import-available-actions .import-bulk-panel {
    grid-column: 1;
  }

  .import-available-actions-buttons {
    justify-content: flex-start;
  }

  .import-result-row-action {
    grid-template-columns: 1fr;
  }

  .import-result-row-action .compact-button {
    justify-self: start;
  }
}

.settings-view {
  overflow: auto;
  padding: 0 20px 20px;
}

.settings-content {
  display: grid;
  gap: 16px;
}

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

.settings-product-section,
.settings-section {
  display: grid;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 20px;
  padding: 15px;
  background: color-mix(in srgb, var(--surface) 68%, transparent);
}

.settings-workspace-section {
  border-color: color-mix(in srgb, var(--primary) 15%, var(--line));
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--primary) 8%, transparent), transparent 46%),
    color-mix(in srgb, var(--surface-strong) 72%, var(--surface));
}

.settings-overview-primary {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
}

.settings-role-access-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.settings-role-access-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.settings-summary-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--line) 62%, transparent);
  border-radius: 16px;
  padding: 12px;
  background: color-mix(in srgb, var(--surface-strong) 62%, transparent);
}

.settings-summary-card span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 780;
}

.settings-summary-card strong {
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 820;
  line-height: 1.2;
}

.settings-summary-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.34;
}

.settings-hero-card {
  min-height: 112px;
  border-color: color-mix(in srgb, var(--primary) 16%, var(--line));
  background: color-mix(in srgb, var(--surface-strong) 74%, transparent);
}

.settings-hero-card strong {
  font-size: 1.28rem;
  letter-spacing: -0.01em;
}

.settings-diagnostics {
  border: 1px dashed color-mix(in srgb, var(--line-strong) 70%, transparent);
  border-radius: 16px;
  margin-top: 0;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--surface-soft) 62%, transparent);
}

.settings-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.settings-section-heading h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 820;
}

.settings-section-heading span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 780;
  letter-spacing: 0.015em;
}

.settings-section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.settings-secretariats-list {
  display: grid;
  gap: 6px;
}

.keyboard-shortcuts-panel {
  gap: 14px;
}

.keyboard-shortcuts-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.keyboard-shortcuts-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 74%, transparent);
  border-radius: 12px;
  padding: 9px 10px;
  background: color-mix(in srgb, var(--surface-strong) 78%, transparent);
}

.keyboard-shortcuts-list dt,
.keyboard-shortcuts-list dd {
  margin: 0;
}

.keyboard-shortcuts-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  border: 1px solid color-mix(in srgb, var(--line-strong) 76%, transparent);
  border-radius: 7px;
  padding: 0 0.35rem;
  color: var(--text);
  background: var(--surface);
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--line) 82%, transparent);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 840;
}

.settings-secretariat-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.15fr) repeat(6, minmax(68px, auto));
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 10px 11px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface-strong) 58%, transparent);
  text-align: left;
}

.settings-secretariat-row:hover,
.settings-secretariat-row.selected {
  border-color: var(--primary-border);
  background: var(--primary-selected);
}

.settings-secretariat-row.selected {
  box-shadow: inset 3px 0 0 var(--primary), var(--shadow-subtle);
}

.settings-secretariat-main,
.settings-secretariat-meta {
  min-width: 0;
}

.settings-secretariat-main {
  display: grid;
  gap: 3px;
}

.settings-secretariat-main strong {
  overflow: hidden;
  font-size: 0.95rem;
  font-weight: 790;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-secretariat-main span,
.settings-secretariat-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.settings-secretariat-meta {
  display: contents;
}

.settings-secretariat-meta > span {
  justify-self: start;
  overflow: hidden;
  max-width: 100%;
  color: var(--muted);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-secretariat-meta .badge {
  justify-self: start;
}

.settings-secretariat-warning {
  grid-column: 1 / -1;
  color: var(--warning);
  font-size: 0.78rem;
  line-height: 1.3;
}

.tone-warning {
  color: var(--warning);
  font-weight: 720;
}

.settings-secretariat-detail {
  min-width: 0;
}

.settings-secretariat-detail-card {
  display: grid;
  gap: 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 16%, var(--line));
  border-radius: 20px;
  padding: 16px;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--primary) 9%, transparent), transparent 44%),
    color-mix(in srgb, var(--surface-strong) 82%, var(--surface));
  box-shadow: var(--shadow-subtle);
}

.settings-secretariat-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.settings-secretariat-detail-header span:first-child {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 780;
}

.settings-secretariat-detail-header strong {
  display: block;
  margin-top: 3px;
  font-size: 1.38rem;
  font-weight: 820;
  line-height: 1.08;
}

.settings-secretariat-detail-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.32;
}

.settings-secretariat-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.settings-secretariat-facts.primary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-secretariat-facts.technical {
  grid-template-columns: 1fr;
  gap: 6px;
}

.settings-secretariat-facts div {
  min-width: 0;
  border-radius: 12px;
  padding: 9px 10px;
  background: color-mix(in srgb, var(--surface-soft) 74%, transparent);
}

.settings-secretariat-facts.primary div {
  background: color-mix(in srgb, var(--surface-strong) 66%, transparent);
}

.settings-secretariat-facts dt {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.70rem;
  font-weight: 760;
}

.settings-secretariat-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 680;
  line-height: 1.28;
}

.settings-detail-technical {
  display: grid;
  gap: 7px;
  border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  padding-top: 10px;
}

.settings-detail-technical > span {
  color: var(--muted);
  font-size: 0.70rem;
  font-weight: 780;
}

.settings-detail-technical .settings-secretariat-facts dd {
  color: var(--muted);
  font-size: 0.78rem;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

.settings-secretariat-alert {
  display: grid;
  gap: 6px;
  border: 1px solid var(--warning);
  border-radius: 13px;
  padding: 10px 12px;
  color: var(--warning);
  background: var(--warning-soft);
}

.settings-secretariat-alert strong {
  font-size: 0.84rem;
}

.settings-secretariat-alert ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.35;
}

.detail-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  padding: 16px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--detail) 86%, var(--surface-strong)) 0, var(--detail) 240px),
    var(--detail);
}

.detail-overlay-close {
  display: none;
}

.detail-overlay-open::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
}

.app-shell.home-mode.detail-overlay-open .detail-panel {
  position: fixed;
  inset: 28px 28px 28px auto;
  z-index: 90;
  display: grid;
  width: min(560px, calc(100vw - 56px));
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.24);
}

.app-shell.home-mode.detail-overlay-open .detail-overlay-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 0.78rem;
  color: var(--primary);
  background: var(--primary-selected);
  font-size: 0.78rem;
  font-weight: 760;
}

.app-shell.home-mode.detail-overlay-open .detail-toolbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.app-shell.home-mode {
  grid-template-columns: 228px minmax(0, 1fr);
}

.app-shell.home-mode .detail-panel {
  display: none;
}

.app-shell.fascicoli-mode {
  grid-template-columns: 228px 326px minmax(0, 1fr);
}

.app-shell:not(.home-mode) {
  grid-template-rows: auto minmax(0, 1fr);
}

.app-shell:not(.home-mode) .app-menu {
  grid-row: 1 / 3;
}

.app-shell:not(.home-mode) .app-content {
  display: contents;
}

.app-shell:not(.home-mode) .app-page-toolbar {
  grid-column: 2 / 4;
  grid-row: 1;
  border-bottom: 1px solid var(--line);
  background: var(--content);
}

.app-shell:not(.home-mode) .app-view {
  grid-column: 2;
  grid-row: 2;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--content);
  overflow: hidden;
}

.app-shell:not(.home-mode) .import-view,
.app-shell:not(.home-mode) .settings-view {
  overflow-x: hidden;
  overflow-y: auto;
}

.app-shell:not(.home-mode) .detail-panel {
  grid-column: 3;
  grid-row: 2;
  min-height: 0;
}

.app-shell:not(.home-mode) .app-loading-overlay {
  position: fixed;
}

.app-shell.fascicoli-mode .fascicoli-sidebar-header h2 {
  display: none;
}

.app-shell.fascicoli-mode .fascicoli-sidebar-header {
  padding-top: 12px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-bottom: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-mark.login-brand-mark {
  width: 124px !important;
  height: 124px !important;
  max-width: min(42vw, 124px) !important;
  max-height: min(42vw, 124px) !important;
  border-radius: 28px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.16);
}

.brand-mark.login-brand-mark img {
  transform: scale(1.24);
}

.brand-lockup p,
.field-note,
.muted,
.meta,
.content-toolbar p,
.detail-toolbar p {
  color: var(--muted);
}

.brand-lockup p,
.content-toolbar p,
.detail-toolbar p {
  margin-bottom: 0;
  font-size: 0.82rem;
  line-height: 1.28;
}

.brand-lockup h1 {
  margin: 0;
  font-size: 1.48rem;
  font-weight: 820;
  line-height: 1;
}

.global-search {
  display: grid;
  gap: 4px;
  position: relative;
  width: 100%;
}

.global-search > label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.search-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-strong) 72%, var(--surface-soft));
  box-shadow: 0 1px 0 var(--surface-strong) inset;
}

.search-control:focus-within {
  border-color: var(--primary);
  box-shadow:
    0 0 0 3px var(--focus-ring),
    0 1px 0 var(--surface-strong) inset;
}

.global-search input {
  min-height: 40px;
  border-color: transparent;
  border-radius: 15px 0 0 15px;
  padding-left: 1rem;
  background: transparent;
  box-shadow: none;
  font-size: 0.98rem;
}

.global-search input:focus-visible {
  outline: none;
}

.search-filter-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  margin-right: 5px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0 0.82rem;
  color: var(--primary);
  background: color-mix(in srgb, var(--surface-strong) 80%, transparent);
  font-size: 0.82rem;
  font-weight: 760;
}

.control-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-filter-button:hover,
.search-filter-button.has-active-filters {
  border-color: var(--primary-border);
  background: var(--primary-soft);
}

.filter-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  color: white;
  background: var(--primary);
  font-size: 0.68rem;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.search-filter-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  display: grid;
  gap: 8px;
  width: min(280px, 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: var(--surface-strong);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.14);
}

.search-filter-popover label {
  position: static;
  display: grid;
  gap: 6px;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
}

.filter-checks {
  display: grid;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.filter-checks label {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.search-filter-popover span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 760;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  padding: 0 0.48rem;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 0.68rem;
  font-weight: 820;
  text-transform: uppercase;
}

.section-label {
  margin: 18px 8px 7px;
  color: var(--muted);
  font-size: 0.70rem;
  font-weight: 760;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.workspace-picker {
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 0;
}

.workspace-select-wrap {
  position: relative;
  display: grid;
  align-items: center;
  width: 100%;
}

.workspace-picker select {
  appearance: none;
  width: 100% !important;
  min-width: 190px;
  max-width: none;
  min-height: 32px;
  border-color: var(--line);
  border-radius: 12px;
  padding: 0.44rem 2.3rem 0.32rem 5.45rem;
  background: color-mix(in srgb, var(--surface-strong) 68%, transparent);
  box-shadow: none;
  font-size: 0.82rem;
  font-weight: 720;
}

.workspace-picker select:hover {
  border-color: var(--line-strong);
  background: var(--surface);
}

.select-chevron {
  position: absolute;
  right: 12px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.workspace-inline-label {
  position: absolute;
  left: 14px;
  z-index: 1;
  color: var(--muted);
  font-size: 0.70rem;
  font-weight: 760;
  pointer-events: none;
}

.workspace-picker label,
.manual-record label,
.status-form label,
.history-form label,
.filter-bar span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.workspace-picker .field-note {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.28;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-workspace {
  display: grid;
  align-content: end;
  gap: 7px;
  align-self: end;
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.sidebar-workspace .sync-status-badge {
  justify-self: start;
  min-height: 30px;
  opacity: 0.84;
}

.logout-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  min-height: 42px;
  border: 1px solid var(--line);
  padding: 0 0.82rem;
  color: var(--danger);
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 760;
}

.logout-button:hover {
  color: var(--danger);
  border-color: var(--danger-border);
  background: var(--danger-soft);
}

.icon-button {
  flex: 0 0 auto;
}

.compact-login {
  min-height: 30px;
  padding: 0.34rem 0.64rem;
  font-size: 0.76rem;
  font-weight: 760;
}

#apple-sign-in-button,
#apple-sign-out-button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 92px;
  min-height: 30px;
  overflow: hidden;
}

.apple-technical-button {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0;
}

.apple-login-overlay {
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

#apple-sign-out-button:empty {
  display: none;
}

#apple-sign-in-button:empty {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 50px !important;
  min-height: 50px !important;
  opacity: 0;
  pointer-events: none;
}

#apple-sign-in-button:not(:empty) {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 50px !important;
  min-height: 50px !important;
  opacity: 0.01;
  pointer-events: auto;
}

#apple-sign-in-button > *,
#apple-sign-out-button > * {
  transform: scale(0.74);
  transform-origin: center;
}

#apple-sign-in-button:not(:empty) > * {
  width: 100% !important;
  height: 50px !important;
  transform: none !important;
}

.content-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 760px) minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 16px 20px 10px;
}

.app-page-toolbar {
  position: relative;
  z-index: 20;
  padding-top: 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  background: linear-gradient(180deg, var(--topbar-gradient-start), var(--topbar-gradient-end));
  backdrop-filter: blur(18px) saturate(1.04);
}

.page-toolbar-actions {
  grid-column: 3;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-page-toolbar .global-search {
  grid-column: 2;
  justify-self: center;
  min-width: 0;
  width: min(100%, 760px);
}

.app-page-toolbar .toolbar-refresh-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  border-color: var(--primary-border);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary-selected) 80%, var(--surface));
  font-weight: 790;
  white-space: nowrap;
}

.app-page-toolbar .toolbar-refresh-button:hover {
  background: var(--primary-soft);
}

.toolbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

#toolbar-refresh-shadow {
  pointer-events: none;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(150px, 220px);
  gap: 8px;
  padding: 0 20px 12px;
  justify-content: end;
}

.filter-bar label {
  display: grid;
  gap: 5px;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 0 20px 12px;
}

.metric-tile {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 9px 10px;
  background: var(--surface);
}

.metric-tile span {
  display: block;
  overflow: hidden;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-tile strong {
  color: var(--text);
  font-size: 1.08rem;
  font-variant-numeric: tabular-nums;
}

.metric-tile.warning strong,
.workflow-item.warning strong {
  color: var(--warning);
}

.metric-tile.danger strong,
.workflow-item.danger strong {
  color: var(--danger);
}

.workflow-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 0 20px 12px;
}

.workflow-section {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 8px;
  background: var(--surface);
}

.workflow-section-title {
  color: var(--muted);
  font-size: 0.70rem;
  font-weight: 780;
}

.workflow-items {
  display: grid;
  gap: 5px;
}

.workflow-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 5px 7px;
  color: var(--text);
  background: var(--surface-soft);
  text-align: left;
  cursor: default;
}

button.workflow-item {
  width: 100%;
  cursor: pointer;
}

.workflow-item span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 660;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-item strong {
  color: var(--text);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.workflow-item.ok strong {
  color: var(--success);
}

.workflow-item.interactive:hover,
.workflow-item.selected {
  border-color: var(--primary-border);
  background: var(--primary-selected);
}

.list {
  display: grid;
  gap: 8px;
}

.workspace-list {
  gap: 6px;
}

.fascicoli-list {
  display: block;
  overflow: auto;
  min-height: 0;
  padding: 10px 12px 18px;
}

.fascicoli-sidebar-header {
  display: grid;
  gap: 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  padding: 16px 14px 12px;
  background: color-mix(in srgb, var(--content) 84%, transparent);
}

.fascicoli-sidebar-header h2 {
  margin: 0 0 2px;
  font-size: 1.26rem;
  font-weight: 830;
}

.fascicoli-sidebar-header p {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fascicoli-sidebar-actions {
  display: grid;
  gap: 6px;
}

.fascicoli-sidebar-actions .primary-button {
  width: 100%;
  min-height: 34px;
}

.fascicoli-sidebar-actions .form-status {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.25;
}

.registry-filter-panel {
  display: grid;
  justify-items: center;
  gap: 7px;
  width: min(100%, 430px);
  margin-inline: auto;
}

.registry-filter-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: uppercase;
}

.registry-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.registry-tab {
  display: grid;
  place-items: center;
  gap: 2px;
  min-width: 70px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  font-weight: 760;
  cursor: pointer;
}

.registry-tab span,
.registry-tab strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.registry-tab span {
  font-size: 0.68rem;
}

.registry-tab strong {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.registry-tab:hover {
  color: var(--text);
  border-color: var(--primary-border);
  background: color-mix(in srgb, var(--primary-selected) 72%, var(--surface));
}

.registry-tab:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.registry-tab.selected {
  color: var(--primary);
  border-color: var(--primary-border);
  background: color-mix(in srgb, var(--primary-selected) 88%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 18%, transparent);
}

.fascicolo-list-row {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 16px;
  margin: 0 0 8px;
  background: color-mix(in srgb, var(--surface-strong) 92%, var(--surface));
  box-shadow: 0 1px 0 color-mix(in srgb, white 48%, transparent) inset;
}

.fascicolo-list-row:first-child {
  margin-top: 0;
  border-top-color: var(--line);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}

.fascicolo-list-row:last-child {
  border-bottom-right-radius: 16px;
  border-bottom-left-radius: 16px;
}

.fascicolo-list-row:hover,
.fascicolo-list-row.selected {
  border-color: var(--primary-border);
  background: var(--primary-selected);
}

.fascicolo-list-row.selected {
  box-shadow: inset 3px 0 0 var(--primary);
}

.procdesk-fascicolo-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: start;
  gap: 11px;
  width: 100%;
  padding: 11px 12px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.procdesk-fascicolo-row.has-leading-date {
  grid-template-columns: 46px 32px minmax(0, 1fr);
}

.fascicolo-registry-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--registry-color);
  background: color-mix(in srgb, var(--registry-color) 14%, transparent);
  font-size: 0.74rem;
  font-weight: 850;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--registry-color) 12%, transparent);
}

.fascicolo-registry-avatar.codice-rosso {
  color: var(--danger);
  background: var(--danger-soft);
  box-shadow: inset 0 0 0 1px var(--danger-border);
}

.fascicolo-row-body {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.fascicolo-row-body strong,
.row-secondary,
.row-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  min-width: 0;
}

.fascicolo-row-body strong {
  min-width: 0;
  font-size: 1rem;
  font-weight: 790;
  line-height: 1.16;
}

.row-secondary {
  display: -webkit-box;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: color-mix(in srgb, var(--text) 84%, var(--muted));
  font-size: 0.80rem;
  line-height: 1.22;
}

.row-meta {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 9px;
  color: var(--muted);
  font-size: 0.70rem;
  font-weight: 690;
  line-height: 1.16;
}

.row-flags {
  display: flex;
  min-height: 0;
}

.row-flags:empty,
.fascicolo-row-flags:empty {
  display: none;
}

.fascicolo-row-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.mini-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 0.12rem 0.40rem;
  color: var(--success);
  background: var(--success-soft);
  font-size: 0.62rem;
  font-weight: 760;
}

.mini-badge.warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.mini-badge.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.mini-badge.muted {
  color: var(--muted);
  background: var(--neutral-soft);
}

.fascicolo-row-metric {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.fascicolo-row-icon {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fascicolo-status-badge {
  flex: 0 1 auto;
  max-width: 116px;
  overflow: hidden;
  border-radius: 999px;
  padding: 0.18rem 0.48rem;
  color: var(--success);
  background: var(--success-soft);
  font-size: 0.68rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fascicolo-list-title {
  min-width: 0;
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fascicolo-list-state {
  max-width: 82px;
  overflow: hidden;
  border-radius: 999px;
  padding: 0.16rem 0.42rem;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 0.62rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: var(--surface);
}

button.row {
  width: 100%;
  color: var(--text);
  text-align: left;
}

.fascicoli-list .row {
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  margin: 0 8px;
  border-radius: 0;
  border-color: transparent;
  border-top-color: var(--line);
  background: var(--surface-strong);
}

.fascicoli-list .row:first-child {
  border-top-color: transparent;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}

.fascicoli-list .row:last-child {
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
}

.row.interactive {
  cursor: pointer;
}

.row.interactive:hover,
.row.selected {
  border-color: var(--primary-border);
  background: var(--primary-selected);
}

.row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 720;
}

.row-title span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta {
  overflow: hidden;
  font-size: 0.80rem;
  line-height: 1.32;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0.18rem 0.46rem;
  color: var(--success);
  background: var(--success-soft);
  font-size: 0.68rem;
  font-weight: 740;
  white-space: nowrap;
}

.badge.warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.badge.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.badge.muted {
  color: var(--muted);
  background: var(--neutral-soft);
}

.detail-toolbar {
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.detail-toolbar h2 {
  font-size: 1.64rem;
}

.detail-empty,
.muted-list {
  color: var(--muted);
  font-size: 0.92rem;
}

.detail-stack {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
  min-height: 0;
}

.detail-alerts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-section,
.detail-banner,
.detail-facts-panel,
.detail-actions-workspace {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: var(--surface);
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.36fr);
  gap: 14px;
  border-color: color-mix(in srgb, var(--primary) 18%, var(--line));
  border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--line));
  border-radius: 18px;
  padding: 16px;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--primary) 14%, transparent), transparent 44%),
    linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 92%, var(--primary-selected)), var(--surface));
  box-shadow: var(--shadow-subtle);
}

.detail-hero-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.detail-hero-kicker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.detail-hero-kicker span,
.detail-hero-kicker strong {
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 820;
}

.detail-hero-kicker span {
  color: var(--primary);
  background: var(--primary-selected);
}

.detail-hero-kicker strong {
  color: var(--text);
  background: color-mix(in srgb, var(--surface-strong) 72%, transparent);
}

.detail-hero h3 {
  margin: 0;
  color: var(--text);
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.detail-hero p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.32;
}

.detail-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  border-top: 1px solid color-mix(in srgb, var(--line) 68%, transparent);
  padding-top: 10px;
}

.detail-quick-actions .compact-button {
  min-height: 32px;
  padding: 0.36rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 800;
}

.detail-hero-side {
  display: grid;
  align-content: start;
  gap: 7px;
}

.detail-hero-signal {
  display: grid;
  gap: 2px;
  border-radius: 12px;
  padding: 9px;
  background: color-mix(in srgb, var(--surface-strong) 72%, transparent);
}

.detail-hero-signal span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 780;
}

.detail-hero-signal strong {
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 830;
}

.detail-group {
  border-color: color-mix(in srgb, var(--line) 76%, transparent);
  background: color-mix(in srgb, var(--surface) 74%, transparent);
}

.detail-banner.warning {
  border-color: color-mix(in srgb, var(--warning) 42%, var(--line));
  color: var(--warning);
  background: var(--warning-soft);
}

.detail-banner strong {
  display: block;
  margin-bottom: 3px;
  font-size: 0.92rem;
}

.detail-banner p {
  margin: 0;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.35;
}

.detail-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-section-heading > span,
.detail-section-heading > div > span,
.detail-section-heading p,
.detail-empty-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.detail-section-heading h3 {
  margin: 2px 0 0;
  font-size: 1.08rem;
  font-weight: 820;
  line-height: 1.18;
}

.detail-section-heading.compact {
  align-items: baseline;
}

.detail-section-heading.compact h3 {
  margin: 0;
  font-size: 0.98rem;
}

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

.detail-facts-panel {
  border-color: color-mix(in srgb, var(--line) 56%, transparent);
  border-radius: 14px;
  padding: 12px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.detail-fact-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

.detail-fact-strip .detail-item {
  border: 0;
  border-right: 1px solid color-mix(in srgb, var(--line) 58%, transparent);
  border-radius: 0;
  padding: 9px 10px;
  background: transparent;
}

.detail-fact-strip .detail-item:nth-child(3n),
.detail-fact-strip .detail-item:last-child {
  border-right: 0;
}

.identifier-display,
.identifier-editor {
  margin-top: 10px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 12px;
  padding: 10px;
  background: var(--surface-soft);
}

.identifier-display {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.identifier-display span,
.identifier-editor-current span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.identifier-editor-grid {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
}

.identifier-editor-grid label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.identifier-warning {
  margin: 0;
  color: var(--warning);
  font-size: 0.78rem;
  line-height: 1.35;
}

.detail-item,
.note-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: color-mix(in srgb, var(--surface-strong) 86%, var(--surface));
}

.detail-item span,
.note-box span,
.history-header span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.detail-item strong {
  overflow-wrap: anywhere;
  font-size: 0.92rem;
}

.detail-item-wide {
  grid-column: 1 / -1;
}

.note-box p {
  margin-bottom: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.88rem;
  line-height: 1.42;
}

.note-box.readonly {
  background: var(--surface-soft);
}

.detail-actions-workspace {
  gap: 12px;
  border-color: color-mix(in srgb, var(--primary) 24%, var(--line));
  border-radius: 18px;
  padding: 14px;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--primary) 8%, transparent), transparent 38%),
    color-mix(in srgb, var(--surface-strong) 78%, var(--surface));
}

.detail-operational-content {
  display: grid;
  gap: 10px;
}

.safe-field-display {
  gap: 8px;
}

.safe-field-display-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.safe-field-display-header span,
.safe-field-editor label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.safe-field-display .compact-button {
  justify-self: start;
  min-height: 30px;
  padding: 0.34rem 0.62rem;
  font-size: 0.74rem;
}

.safe-field-editor {
  display: grid;
  gap: 8px;
}

.safe-field-editor textarea {
  min-height: 104px;
  resize: vertical;
}

.safe-field-editor select,
.safe-field-editor input[type="number"],
.safe-field-editor input[type="date"] {
  width: 100%;
}

.misura-editor {
  margin-bottom: 14px;
}

.misura-date-grid label {
  display: grid;
  gap: 6px;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.safe-field-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.safe-field-actions button {
  min-height: 34px;
}

.detail-record-list {
  display: grid;
  gap: 8px;
}

.reato-importato-row {
  gap: 10px;
}

.reato-association-form,
.reato-catalog-form {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.reato-catalog-form {
  grid-template-columns: minmax(180px, 1fr) auto minmax(220px, 1.3fr) auto;
  align-items: end;
}

.reato-catalog-form .form-status {
  grid-column: 1 / -1;
}

.reato-association-form label,
.reato-catalog-form label {
  display: grid;
  gap: 5px;
}

.reato-association-form label span,
.reato-catalog-form label span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

@media (max-width: 920px) {
  .reato-catalog-form {
    grid-template-columns: 1fr;
  }
}

.detail-record-row {
  display: grid;
  gap: 4px;
  border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  border-radius: 13px;
  padding: 10px;
  background: color-mix(in srgb, var(--surface-strong) 76%, transparent);
}

.detail-record-row strong {
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  line-height: 1.24;
}

.detail-record-row p {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.34;
}

.detail-record-row small {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.32;
}

.detail-mini-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 4px 0 0;
}

.detail-mini-facts div {
  min-width: 0;
  border-radius: 10px;
  padding: 7px;
  background: var(--surface-soft);
}

.detail-mini-facts dt {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 740;
}

.detail-mini-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.25;
}

.history-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.history-header small,
.history-item small {
  color: var(--muted);
  font-size: 0.72rem;
}

.history-list {
  display: grid;
  position: relative;
  gap: 0;
}

.history-list.scrollable {
  overflow: auto;
  max-height: 460px;
  padding: 0 3px 0 13px;
}

.history-list::before {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 4px;
  width: 2px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 18%, var(--line));
  content: "";
}

.history-item {
  position: relative;
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  padding: 10px 0 10px 12px;
}

.history-item::before {
  position: absolute;
  top: 15px;
  left: -13px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--primary);
  content: "";
}

.history-item:first-child {
  border-top: 0;
}

.history-item strong {
  display: block;
  margin-bottom: 3px;
  font-size: 0.88rem;
}

.history-item p {
  margin: 0 0 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.83rem;
  line-height: 1.34;
}

.status-form,
.history-form {
  display: grid;
  gap: 7px;
}

.detail-actions-panel {
  display: grid;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 0;
  margin: 0;
  padding: 0 0 12px;
  background: transparent;
}

.detail-actions-slot:empty {
  display: none;
}

.detail-actions-panel:not(:has(form:not([hidden]))) {
  display: none;
}

.detail-actions-heading {
  display: grid;
  gap: 3px;
}

.detail-actions-heading h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 840;
}

.detail-actions-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.32;
}

.status-form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.history-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.history-form-footer span,
.form-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.30;
}

.form-status.ok {
  color: var(--success);
}

.form-status.warning {
  color: var(--warning);
}

.form-status.danger {
  color: var(--danger);
}

.new-fascicolo-workspace {
  gap: 14px;
}

.new-fascicolo-form {
  display: grid;
  gap: 14px;
}

.new-fascicolo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.new-fascicolo-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 760;
}

.new-fascicolo-field.wide {
  margin-top: 12px;
}

.new-fascicolo-field input,
.new-fascicolo-field select,
.new-fascicolo-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  font-weight: 650;
}

.new-fascicolo-field textarea {
  resize: vertical;
}

.new-fascicolo-field input[aria-invalid="true"],
.new-fascicolo-field select[aria-invalid="true"],
.new-fascicolo-field textarea[aria-invalid="true"] {
  border-color: color-mix(in srgb, var(--danger) 56%, var(--line));
  background: color-mix(in srgb, var(--danger) 5%, var(--surface));
}

.field-error {
  min-height: 1em;
  color: var(--danger);
  font-size: 0.7rem;
  font-weight: 720;
}

.new-fascicolo-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  color: var(--text);
  background: var(--surface);
  font-weight: 760;
}

.new-fascicolo-context-strip,
.new-fascicolo-preview-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.new-fascicolo-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--line));
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 7%, var(--surface));
}

.new-fascicolo-reati,
.new-fascicolo-reati-results,
.new-fascicolo-selected-reati {
  display: grid;
  gap: 10px;
}

.new-fascicolo-selected-reati > strong {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.new-fascicolo-tech-preview {
  margin-top: 10px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--surface-soft) 72%, transparent);
}

.new-fascicolo-tech-preview summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 780;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px 18px;
  color: var(--muted);
  background: var(--surface);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
  font-size: 0.98rem;
}

.empty-state p {
  max-width: 34ch;
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.38;
}

.empty-state button {
  margin-top: 4px;
}

.empty-mark {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background:
    linear-gradient(var(--primary), var(--primary)) 9px 11px / 16px 2px no-repeat,
    linear-gradient(var(--primary), var(--primary)) 9px 17px / 12px 2px no-repeat,
    var(--surface-strong);
  opacity: 0.72;
}

.skeleton-list,
.home-dashboard-skeleton {
  display: grid;
  gap: 10px;
}

.skeleton-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
}

.skeleton-row:first-child {
  border-top: 1px solid var(--line);
}

.skeleton-lines {
  display: grid;
  gap: 7px;
}

.skeleton-avatar,
.skeleton-pill,
.skeleton-chip,
.skeleton-title,
.skeleton-line,
.skeleton-box,
.skeleton-lines span,
.skeleton-dashboard-card {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 84%, var(--line));
}

.skeleton-avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

.skeleton-pill {
  width: 58px;
  height: 20px;
}

.skeleton-lines span,
.skeleton-line {
  display: block;
  width: min(100%, 190px);
  height: 10px;
}

.skeleton-lines span + span,
.skeleton-line.wide {
  width: min(100%, 270px);
  opacity: 0.72;
}

.skeleton-chip {
  display: inline-block;
  width: 84px;
  height: 24px;
}

.skeleton-title {
  display: block;
  width: min(72%, 240px);
  height: 42px;
  border-radius: 14px;
}

.skeleton-title.small {
  width: 92px;
  height: 30px;
}

.skeleton-box {
  display: block;
  min-height: 46px;
  border-radius: 12px;
}

.skeleton-panel {
  pointer-events: none;
}

.skeleton-dashboard-card {
  display: grid;
  gap: 12px;
  min-height: 132px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 16px;
  padding: 14px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 82%, transparent), color-mix(in srgb, var(--surface) 84%, transparent));
}

.skeleton-list,
.skeleton-panel,
.home-dashboard-skeleton {
  animation: skeleton-soft-pulse 1.8s ease-in-out infinite;
}

@keyframes skeleton-soft-pulse {
  0%,
  100% {
    opacity: 0.78;
  }

  50% {
    opacity: 1;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.40;
    transform: scale(0.98);
  }

  50% {
    opacity: 0.86;
    transform: scale(1);
  }
}

.diagnostics {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 12px;
}

.diagnostics summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 740;
}

.diagnostics-content {
  display: grid;
  gap: 10px;
  padding-top: 12px;
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.status-item,
.performance-summary,
.danger-tool {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: var(--surface);
}

.status-item strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.72rem;
}

.status-item span {
  color: var(--muted);
  font-size: 0.74rem;
}

.manual-record {
  display: grid;
  gap: 7px;
}

.manual-record-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.danger-tool {
  display: grid;
  gap: 8px;
  border-color: var(--danger-border);
  background: var(--danger-soft);
}

.danger-tool p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.performance-summary {
  display: grid;
  gap: 8px;
}

.performance-summary h3 {
  margin: 0 0 4px;
  font-size: 0.86rem;
}

.performance-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.32;
}

.performance-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.performance-metric {
  border-radius: 11px;
  padding: 7px 8px;
  background: var(--surface-soft);
}

.performance-metric span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 720;
}

.performance-metric strong {
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

.diagnostic-actions {
  display: grid;
  gap: 6px;
}

.technical-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.technical-log-header strong {
  font-size: 0.84rem;
}

.log {
  overflow: auto;
  min-height: 140px;
  max-height: 260px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px;
  color: var(--text);
  background: var(--surface-strong);
  font: 0.74rem/1.38 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    overflow: auto;
  }

  .app-menu {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(220px, 300px);
    align-items: center;
    gap: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 12px 14px;
  }

  .menu-items {
    display: flex;
    gap: 8px;
    overflow-x: auto;
  }

  .menu-item {
    flex: 0 0 auto;
    width: auto;
  }

  .detail-panel {
    grid-column: 1;
    min-height: 520px;
  }

  .brand-lockup h1 {
    font-size: 1.52rem;
  }

  .global-search {
    width: min(100%, 520px);
  }

  .home-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-dashboard-layout {
    grid-template-columns: 1fr;
  }

  .home-section-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .registry-card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .registry-pendenza-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .registry-pendenza-card strong {
    grid-column: 2;
    justify-self: start;
  }

  .registry-chart-card {
    display: none;
  }

  .detail-hero {
    grid-template-columns: 1fr;
  }

  .detail-hero-side {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .detail-fact-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-fact-strip .detail-item:nth-child(3n) {
    border-right: 1px solid color-mix(in srgb, var(--line) 58%, transparent);
  }

  .detail-fact-strip .detail-item:nth-child(2n),
  .detail-fact-strip .detail-item:last-child {
    border-right: 0;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .app-menu,
  .app-content,
  .detail-panel {
    overflow: visible;
    border-right: 0;
  }

  .detail-panel {
    padding: 14px;
  }

  .app-menu {
    display: grid;
    grid-template-columns: 1fr;
    border-bottom: 1px solid var(--line);
  }

  .menu-items {
    display: flex;
  }

  .page-toolbar-actions {
    grid-column: auto;
    display: flex;
    justify-content: flex-start;
  }

  .app-page-toolbar .toolbar-refresh-button,
  .app-page-toolbar .global-search,
  .app-page-toolbar .logout-button {
    grid-column: auto;
  }

  .home-panel {
    display: grid;
    margin-inline: 14px;
  }

  .home-quick-grid {
    grid-template-columns: 1fr;
    padding-inline: 14px;
  }

  .home-dashboard {
    padding-inline: 14px;
  }

  .home-registry-filter-wrap {
    grid-template-columns: 1fr;
    padding-inline: 14px;
  }

  .home-dashboard-layout {
    grid-template-columns: 1fr;
  }

  .home-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-control-grid,
  .home-workflow-board,
  .home-deadline-column {
    grid-template-columns: 1fr;
  }

  .deadline-container-grid {
    grid-template-columns: 1fr;
  }

  .control-card-grid {
    grid-template-columns: 1fr;
  }

  .home-section-grid,
  .control-card-grid.three,
  .control-card-grid.compact {
    grid-template-columns: 1fr;
  }

  .keyboard-shortcuts-list {
    grid-template-columns: 1fr;
  }

  .deadline-container-grid {
    grid-template-columns: 1fr;
  }

  .app-loading-overlay {
    position: fixed;
  }

  .workspace-picker {
    grid-column: 1 / -1;
    flex-basis: auto;
  }

  .brand-lockup {
    margin-bottom: 14px;
  }

  .content-toolbar,
  .filter-bar,
  .metric-strip,
  .workflow-board {
    padding-inline: 14px;
  }

  .content-toolbar,
  .filter-bar,
  .status-form-row {
    grid-template-columns: 1fr;
  }

  .identifier-display,
  .identifier-editor-grid {
    grid-template-columns: 1fr;
  }

  .app-page-toolbar {
    grid-template-columns: 1fr;
  }

  .toolbar-meta {
    display: none;
  }

  .metric-strip,
  .workflow-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fascicoli-list {
    padding-inline: 6px;
  }

  .detail-panel {
    padding: 14px;
  }

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

  .detail-hero-side,
  .detail-fact-strip,
  .new-fascicolo-grid,
  .new-fascicolo-context-strip,
  .new-fascicolo-preview-list {
    grid-template-columns: 1fr;
  }

  .detail-quick-actions .compact-button {
    width: 100%;
  }

  .detail-quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-fact-strip .detail-item,
  .detail-fact-strip .detail-item:nth-child(3n) {
    border-right: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--line) 58%, transparent);
  }

  .detail-fact-strip .detail-item:last-child {
    border-bottom: 0;
  }

  .detail-section-heading {
    display: grid;
  }

  .detail-mini-facts {
    grid-template-columns: 1fr;
  }

  .safe-field-display-header,
  .safe-field-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-view {
    padding-inline: 14px;
  }

  .settings-overview {
    grid-template-columns: 1fr;
  }

  .settings-role-access-grid {
    grid-template-columns: 1fr;
  }

  .settings-secretariat-row {
    grid-template-columns: 1fr;
  }

  .settings-secretariat-meta {
    justify-content: flex-start;
  }

  .settings-secretariat-facts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  input,
  select,
  textarea {
    min-height: 42px;
    font-size: 16px;
  }

  button {
    min-height: 42px;
  }

  h2 {
    font-size: 1.46rem;
  }

  .metric-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .home-overview-grid {
    grid-template-columns: 1fr;
  }

  .home-control-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .registry-card-grid {
    grid-template-columns: 1fr;
  }

  .workflow-board {
    grid-template-columns: 1fr;
  }
}
