/* Patient & Agency Manager - Styles */
:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-hover: #243044;
  --border: #2d3a4d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --success: #3fb950;
  --warning: #d4a017;
  --danger: #f85149;
  --radius: 8px;
  --font: Calibri, 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body.theme-light {
  --bg: #ffffff;
  --surface: #dfefff;
  --surface-hover: #cfe6ff;
  --border: #d0d7de;
  --text: #111111;
  --text-muted: #57606a;
  --accent: #0969da;
  --accent-hover: #1f6feb;
  --success: #1a7f37;
  --warning: #9a6700;
  --danger: #cf222e;
}

body.theme-light .main-nav {
  background: #d8ebff;
}

body.theme-light .btn {
  background: #d8ebff;
  border-color: #b9d8ff;
  color: #000000;
}

body.theme-light .btn:hover {
  background: #cbe4ff;
  border-color: #9fc8f7;
  color: #000000;
}

body.theme-light .btn-primary,
body.theme-light .btn-primary:hover,
body.theme-light .btn-danger,
body.theme-light .btn-danger:hover {
  color: #000000;
}

body.theme-light input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]),
body.theme-light select,
body.theme-light textarea {
  background: #eaf4ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 1200;
}

.nav-status-cluster {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.conn-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg);
}

.conn-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: #c0392b;
  box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.2);
}

.conn-badge.conn-online .conn-dot {
  background: #27ae60;
  box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.25);
}

.conn-badge.conn-syncing .conn-dot {
  background: #f1c40f;
  box-shadow: 0 0 0 2px rgba(241, 196, 15, 0.3);
  animation: pam-pulse 1.2s ease-in-out infinite;
}

.conn-badge.conn-offline .conn-dot {
  background: #c0392b;
}

@keyframes pam-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.nav-theme-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-theme-switch label {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.nav-theme-switch select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}

.nav-brand:hover {
  color: var(--accent);
}

.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1rem;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius);
}

.nav-links a:hover {
  color: var(--accent);
  background: var(--surface-hover);
}

.container {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  width: 100%;
}

.container:has(.home-layout) {
  max-width: none;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.container:has(.visit-form-with-pin) {
  max-width: 98%;
}

/* Protocollo azienda–mansione: stessa larghezza utile della griglia protocolli in Impostazioni */
.container:has(.amp-protocollo-page) {
  max-width: min(1800px, 98vw);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.3;
}

.btn:hover {
  background: var(--surface-hover);
  border-color: var(--text-muted);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-danger:hover {
  background: rgba(248, 81, 73, 0.15);
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.875rem;
}

/* Flash messages */
.flash-messages {
  list-style: none;
  margin: 0 0 1rem 0;
  padding: 0;
}

.flash {
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.flash-success {
  background: rgba(63, 185, 80, 0.2);
  border: 1px solid var(--success);
  color: #7ee787;
}

.flash-error {
  background: rgba(248, 81, 73, 0.2);
  border: 1px solid var(--danger);
  color: #ff7b72;
}

/* Hero & cards (home) */
.hero {
  text-align: center;
  padding: 2rem 0;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.hero p {
  color: var(--text-muted);
  margin: 0;
}

.quick-links,
.report-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.card:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.card h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  color: var(--accent);
}

.card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: var(--surface-hover);
  font-weight: 600;
  color: var(--text-muted);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.data-table .actions {
  white-space: nowrap;
}

.data-table .actions .btn,
.data-table .actions .inline-form {
  margin-right: 0.35rem;
  margin-bottom: 0.25rem;
}

.inline-form {
  display: inline;
}

.empty {
  color: var(--text-muted);
  padding: 1.5rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.empty a {
  color: var(--accent);
}

/* Summary cards (home) */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}
.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  text-decoration: none;
  color: inherit;
}
.summary-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
}
.summary-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

@media (max-width: 700px) {
  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tabella a larghezza piena senza scroll orizzontale */
.table-wrap-fullwidth {
  overflow: hidden;
  width: 100%;
}
.data-table-fit {
  table-layout: fixed;
  width: 100%;
}
.data-table-fit th,
.data-table-fit td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-table-fit .actions {
  white-space: nowrap;
  overflow: visible;
}

/* Pagina Aziende: tabella fino a 1 cm dai bordi sinistro/destro */
.container:has(.page-agencies-list) {
  max-width: none;
  width: 100%;
  padding-left: 1cm;
  padding-right: 1cm;
  box-sizing: border-box;
}

.page-agencies-list .table-wrap {
  width: 100%;
}

.page-agencies-list .data-table {
  width: 100%;
}

/* Pagina lavoratori: scorrimento pagina come Aziende */
.page-workers-list {
  display: block;
  height: auto;
  min-height: 0;
}
.page-workers-list .page-header {
  flex-shrink: initial;
}
.page-workers-list .workers-search-bar {
  flex-shrink: initial;
}
.page-workers-list .table-wrap-workers {
  flex: none;
  min-height: auto;
  overflow-y: visible;
  overflow-x: auto;
}

/* Tabella lavoratori: larghezza fissa, senza scroll orizzontale */
.container:has(.table-wrap-workers) {
  max-width: 1800px;
  overflow-x: auto;
}
.table-wrap-workers {
  width: 100%;
  min-width: 0;
}
.data-table-workers {
  width: 100%;
  table-layout: fixed;
  font-size: 0.82rem;
}
.data-table-workers th,
.data-table-workers td {
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  padding: 0.4rem 0.65rem;
}
.data-table-workers .actions {
  white-space: nowrap;
}
.data-table-workers .actions .btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.deadline-date {
  font-weight: 700;
}

.deadline-date-red {
  color: #d1242f;
}

.deadline-date-yellow {
  color: #b58900;
}

.deadline-date-green {
  color: #1a7f37;
}

.impostazioni-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Forms */
.form-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: none;
  width: 100%;
}

.form-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem 2rem;
  align-items: start;
  margin-bottom: 2rem;
}

.form-grid label {
  padding-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  width: 100%;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-grid textarea {
  resize: vertical;
  min-height: 3.5rem;
  line-height: 1.5;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.5rem;
}

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.filter-bar label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.filter-bar input,
.filter-bar select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.report-filters .btn-primary {
  margin-left: 0.5rem;
}

.filter-bar-stampa-wrap {
  position: relative;
  margin-left: 0.25rem;
}
.filter-bar-stampa-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.25rem;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 100;
}
.filter-bar-stampa-dropdown[aria-hidden="true"] {
  display: none;
}
.filter-bar-stampa-dropdown a {
  display: block;
  padding: 0.4rem 0.75rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}
.filter-bar-stampa-dropdown a:hover {
  background: var(--surface-hover);
}

/* Filtri standard (/filterstyle) */
.pam-filter-form {
  margin-bottom: 1.25rem;
}
.pam-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.25rem;
  align-items: end;
}
.pam-filter-grid--1col {
  grid-template-columns: 1fr;
  max-width: 520px;
}
.pam-filter-field label,
.pam-filter-field .search-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.pam-filter-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0;
}
.pam-filter-fieldset legend {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0 0.35rem;
}
.pam-filter-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}
.pam-filter-checks label {
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}
.pam-filter-checks input {
  margin-right: 0.35rem;
  vertical-align: middle;
}
.pam-filter-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}
.pam-filter-actions-left,
.pam-filter-actions-right {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.pam-filter-actions-right {
  margin-left: auto;
}

/* Alias layout convocazioni/agenda (stesso schema) */
.agenda-conv-filters,
.report-agencies-filters {
  margin-bottom: 1.25rem;
}
.agenda-conv-filter-grid,
.agenda-conv-dates-row,
.report-agencies-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.25rem;
  align-items: end;
}
.agenda-conv-dates-row {
  margin-top: 0.75rem;
}
.agenda-conv-field label,
.agenda-conv-field .search-label,
.report-agencies-field .search-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.agenda-conv-actions,
.report-agencies-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}
.agenda-conv-actions-left,
.agenda-conv-actions-right,
.report-agencies-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.agenda-conv-actions-right {
  margin-left: auto;
}

@media (max-width: 640px) {
  .pam-filter-grid,
  .agenda-conv-filter-grid,
  .agenda-conv-dates-row,
  .report-agencies-filter-grid {
    grid-template-columns: 1fr;
  }
  .pam-filter-actions-right,
  .agenda-conv-actions-right {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
  }
}

/* Home: search bars + worker list + bookmarks */
.home-layout {
  display: flex;
  gap: 1rem;
  align-items: stretch;
  width: 100%;
  max-width: none;
  margin: 0;
  height: calc(100vh - 140px);
  min-height: 400px;
}

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

.search-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
  overflow: visible;
}

.search-box-wrap {
  position: relative;
  overflow: visible;
}

.search-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.search-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.search-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Ricerca lavoratore Home: nome in bianco, senza sottolineato */
#worker-results.search-dropdown .search-dropdown-item,
#worker-results.search-dropdown .search-dropdown-item:hover,
#worker-results.search-dropdown .search-dropdown-item:visited {
  color: #fff;
  text-decoration: none;
}

.search-dropdown[aria-hidden="true"] {
  display: none;
}

.search-dropdown-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.search-dropdown-item:last-child {
  border-bottom: none;
}

.search-dropdown-item:hover {
  background: var(--surface-hover);
}

.search-dropdown-empty {
  color: var(--text-muted);
  cursor: default;
}

.agency-data-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.agency-data-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 2rem;
  align-items: baseline;
  font-size: 0.9rem;
}

.agency-data-label {
  color: var(--text-muted);
}

.agency-data-value {
  color: var(--text);
}

.workers-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.workers-table-wrap {
  overflow: hidden;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.workers-table {
  width: 100%;
  table-layout: fixed;
  font-size: 0.85rem;
}

.workers-table th,
.workers-table td {
  padding: 0.5rem 0.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workers-table .actions {
  white-space: nowrap;
  overflow: visible;
}

.workers-table .actions .btn {
  padding: 0.25rem 0.4rem;
  font-size: 0.8rem;
}

.workers-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 0.75rem 0;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.home-bookmarks {
  width: 120px;
  flex-shrink: 0;
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.6rem;
  min-height: auto;
}

.bookmarks-title {
  margin: 0 0 0.35rem 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.bookmark-link {
  display: block;
  padding: 0.3rem 0;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
}

.bookmark-link:hover {
  text-decoration: underline;
}

.bookmarks-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.3;
}

/* Worker detail: layout con pin STAMPA a destra (come home-bookmarks) */
.worker-layout {
  display: flex;
  gap: 1rem;
  align-items: stretch;
  width: 100%;
  max-width: none;
}
.worker-main {
  flex: 1;
  min-width: 0;
}
.worker-bookmarks {
  width: 120px;
  flex-shrink: 0;
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.6rem;
  min-height: auto;
}
.worker-stampa-wrap {
  position: relative;
}
.worker-stampa-btn {
  width: 100%;
  padding: 0.5rem 0.6rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.worker-stampa-btn:hover {
  background: var(--accent-hover);
}
.worker-stampa-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.25rem;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 100;
}
.worker-stampa-dropdown[aria-hidden="true"] {
  display: none;
}
.worker-stampa-dropdown .bookmark-link {
  display: block;
  padding: 0.4rem 0.75rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}
.worker-stampa-dropdown .bookmark-link:hover {
  background: var(--surface-hover);
}
.worker-stampa-dropdown .bookmark-disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  pointer-events: none;
}
.worker-invia-wrap {
  position: relative;
}
.worker-invia-form {
  display: block;
  margin: 0;
}
.worker-invia-link {
  display: block;
  width: 100%;
  padding: 0.4rem 0.75rem;
  border: none;
  background: none;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}
.worker-invia-link:hover {
  background: var(--surface-hover);
}
@media (max-width: 900px) {
  .home-layout {
    flex-direction: column;
  }
  .home-bookmarks {
    width: 100%;
  }
  .worker-layout {
    flex-direction: column;
  }
  .worker-bookmarks {
    width: 100%;
  }
  .search-row {
    grid-template-columns: 1fr;
  }
}

/* Logo intestazione stampe (in alto a sinistra, solo prima pagina) */
.print-intestazione-sx {
  margin: 1cm 0 1rem 1cm;
}
.print-intestazione-sx img {
  max-height: 72px;
  width: auto;
  display: block;
}

/* Visit sheet (print-friendly) */
.sheet-header {
  margin-bottom: 1rem;
}

.visit-sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.visit-sheet .sheet-section {
  margin-bottom: 1.5rem;
}

.visit-sheet .sheet-section h2 {
  font-size: 1rem;
  margin: 0 0 0.5rem 0;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}
.visit-sheet .sheet-subsection {
  font-size: 0.95rem;
  margin: 1rem 0 0.35rem 0;
  color: var(--text-muted);
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.sheet-table th {
  width: 180px;
  padding: 0.4rem 0.75rem 0.4rem 0;
  color: var(--text-muted);
  font-weight: 500;
  vertical-align: top;
}

.sheet-table td {
  padding: 0.4rem 0;
}

.sheet-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Reports */
.report-content {
  margin-top: 0.5rem;
}

.report-meta {
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.report-content .btn-primary {
  margin-bottom: 1rem;
}

/* Print */
@media print {
  .main-nav,
  .page-header .btn,
  .header-actions .btn,
  .filter-bar,
  .flash-messages,
  .form-actions,
  .report-filters,
  .report-content .btn-primary,
  .main-footer {
    display: none !important;
  }

  body {
    background: #fff;
    color: #111;
    font-family: var(--font);
  }

  .print-intestazione-sx {
    height: calc(1cm + 72px);
    margin: 0 0 1rem 0;
  }

  .print-intestazione-sx img {
    position: absolute;
    top: 1cm;
    left: 1cm;
  }

  .print-friendly,
  .visit-sheet,
  .report-content {
    background: #fff;
    border: none;
    box-shadow: none;
  }

  .visit-sheet .sheet-section h2 {
    color: #111;
    border-color: #ccc;
  }

  .sheet-table th {
    color: #333;
  }

  .data-table th {
    background: #f0f0f0;
    color: #333;
  }

  .table-wrap {
    border: 1px solid #ddd;
  }

  .data-table th,
  .data-table td {
    border-color: #ddd;
  }
}

.main-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.main-footer p {
  margin: 0;
}

/* Worker detail page */
.container:has(.worker-data-section) {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.worker-data-section {
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

.worker-info-panel {
  padding: 0.75rem 1rem;
}

.worker-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 2rem;
}

.worker-info-col {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.worker-info-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.5rem;
  font-size: 0.9rem;
  align-items: start;
}

.worker-info-row .worker-label {
  color: var(--text-muted);
  font-weight: 500;
}

.visits-section {
  flex: 1;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

.visits-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.5rem;
  flex: 1;
  min-height: 0;
}

.visits-list-panel,
.visit-detail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-y: auto;
}

.visits-list-panel h2,
.visit-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.visit-detail-header h2 {
  margin: 0;
  font-size: 1.1rem;
}
.visit-detail-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}
.visit-detail-panel h2 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.visits-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.visit-item {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.visit-item:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.visit-item.active {
  background: rgba(88, 166, 255, 0.15);
  border-color: var(--accent);
}

.visit-date {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.visit-type {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.visit-detail-content {
  min-height: 200px;
}

.visit-detail-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 0.75rem 1.5rem;
  align-items: start;
}

.visit-detail-grid label {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding-top: 0.4rem;
}

.visit-detail-grid .full-width {
  grid-column: 1 / -1;
}

.visit-detail-grid > div {
  padding: 0.4rem 0;
}

.tests-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.tests-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.test-item {
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.test-item strong {
  color: var(--accent);
  display: block;
  margin-bottom: 0.25rem;
}

.test-item small {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Visit form header + sections */
.visit-form-header {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.visit-form-header-block {
  min-width: 200px;
}

.visit-form-header-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.visit-form-header-value {
  font-weight: 600;
  color: var(--accent);
}

.visit-form-header-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.visit-form-sections .visit-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.visit-form-sections .visit-section:last-of-type {
  border-bottom: none;
}

.visit-section-title {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  color: var(--accent);
}

.visit-form-sections .form-grid .full-width {
  grid-column: 1 / -1;
}

/* Impostazioni visita: campi più larghi */
.container:has(.impostazioni-visita-panel) {
  max-width: 1400px;
}
.impostazioni-visita-panel textarea.full-width {
  min-width: 100%;
  width: 100%;
}
.impostazioni-visita-panel .visit-section textarea {
  min-height: 4rem;
}

/* Impostazioni - Anamnesi fisiologica opzioni */
.anam-fis-opts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.anam-fis-opt-item label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.anam-fis-opt-item textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  resize: vertical;
}
.add-option-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.2rem;
}

/* Impostazioni - Esame obiettivo opzioni */
.esame-ob-opts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.esame-ob-opts-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: var(--bg);
}
.esame-ob-opts-sec-title {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  color: var(--accent);
}
.esame-ob-opt-item {
  margin-bottom: 0.5rem;
}
.esame-ob-opt-item:last-child {
  margin-bottom: 0;
}
.esame-ob-opt-item label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.esame-ob-opt-item textarea {
  width: 100%;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  resize: vertical;
}

/* Anamnesi fisiologica - due colonne */
.anamnesi-fisiologica-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 2rem;
}
.anam-fis-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.anam-fis-item label {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.anam-fis-fields {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.anam-fis-fields select {
  flex: 0 0 auto;
  min-width: 120px;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}
.anam-fis-note {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}

/* Esame oggettivo */
.esame-oggettivo-grid {
  display: grid;
  grid-template-columns: repeat(6, auto 1fr);
  gap: 0.75rem 1rem;
  align-items: center;
}
.esame-oggettivo-grid label {
  padding-top: 0;
}
.esame-field-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.esame-field-wrap input[type="number"] {
  width: 70px;
  padding: 0.5rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}
.esame-unit {
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 2.5rem;
}
.esame-bmi {
  padding: 0.5rem 0;
  color: var(--accent);
  font-weight: 600;
}
.esame-pa {
  gap: 0.2rem;
}
.esame-pa input {
  width: 55px;
}
.esame-pa-sep {
  color: var(--text-muted);
}

/* Esame obiettivo - sezioni a scomparsa */
.esame-obiettivo-collapsible {
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
.esame-ob-details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  overflow: hidden;
}
.esame-ob-summary {
  padding: 0.75rem 1rem;
  background: var(--surface-hover);
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
}
.esame-ob-summary::-webkit-details-marker {
  display: none;
}
.esame-ob-summary::before {
  content: "▶ ";
  font-size: 0.75rem;
  margin-right: 0.5rem;
}
.esame-ob-details[open] .esame-ob-summary::before {
  content: "▼ ";
}
.esame-ob-content {
  padding: 1rem;
  background: var(--bg);
}
.esame-ob-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.esame-ob-item:last-child {
  margin-bottom: 0;
}
.esame-ob-item label {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.esame-ob-fields {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.esame-ob-fields select {
  min-width: 120px;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.esame-ob-note {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.esame-ob-altro {
  margin-top: 1rem;
  width: 100%;
}
.esame-ob-altro label {
  display: block;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}
.esame-ob-altro textarea {
  width: 100%;
  min-width: 100%;
  box-sizing: border-box;
  min-height: 6rem;
  resize: vertical;
}

/* Agenda: ricerca azienda + lavoratore (come Home) */
.agenda-search-row.search-row {
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  overflow: visible;
}
.agenda-search-reset-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.agenda-search-reset-wrap .search-label {
  visibility: hidden;
  min-height: 1.2em;
}
#agenda-agency-results.search-dropdown .search-dropdown-item,
#agenda-worker-results.search-dropdown .search-dropdown-item {
  color: var(--text);
  text-decoration: none;
}
.agenda-date-field {
  min-width: 10.5rem;
  max-width: 100%;
  box-sizing: border-box;
}
@media (max-width: 900px) {
  .agenda-search-row.search-row {
    grid-template-columns: 1fr;
  }
}

/* Agenda: due colonne (prenotazione | report PDF) */
.agenda-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem 1.5rem;
  align-items: start;
  margin-top: 1.25rem;
}
.agenda-col {
  min-width: 0;
}
.agenda-panel {
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 100%;
}
.agenda-panel-report {
  position: sticky;
  top: 0.75rem;
}
.agenda-panel-title {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}
.agenda-subheading {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}
.agenda-hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 40rem;
}
.agenda-check-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  max-width: 100%;
}
.agenda-check-label input {
  margin-top: 0.2rem;
}
.agenda-workers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.35rem 1rem;
  max-height: 240px;
  overflow: auto;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  background: var(--bg);
}
.agenda-worker-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.95rem;
}
.agenda-acc-wrap {
  margin-bottom: 0.75rem;
}
.agenda-acc-wrap label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.agenda-acc-select {
  width: 100%;
  max-width: 100%;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}
.agenda-actions {
  margin-top: 0.5rem;
}
.agenda-report-desc {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.4;
}
.agenda-report-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
}
.agenda-report-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  width: 100%;
}
.agenda-report-fields label {
  font-size: 0.9rem;
  color: var(--text-muted);
}
.agenda-report-select {
  min-width: 180px;
  flex: 1;
  max-width: 100%;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}
.agenda-bookings-section {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.agenda-acc-cell {
  max-width: 28rem;
  font-size: 0.9rem;
  white-space: normal;
  word-break: break-word;
}

@media (max-width: 960px) {
  .agenda-two-col {
    grid-template-columns: 1fr;
  }
  .agenda-panel-report {
    position: static;
  }
}

@media (max-width: 900px) {
  .anamnesi-fisiologica-grid {
    grid-template-columns: 1fr;
  }
  .esame-oggettivo-grid {
    grid-template-columns: auto 1fr;
  }
}

/* Conferma eliminazione lavoratore / visita */
.pam-delete-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}
.pam-delete-modal.is-open {
  display: flex;
}
.pam-delete-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  cursor: pointer;
}
.pam-delete-modal-dialog {
  position: relative;
  z-index: 1;
  max-width: 440px;
  width: 100%;
  background: var(--surface);
  border: 3px solid var(--danger);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
}
.pam-delete-modal-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--danger);
  margin: 0 0 1.1rem 0;
  line-height: 1.45;
}
.pam-delete-modal-check {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.45;
  margin: 0 0 0.75rem 0;
}
.pam-delete-modal-check input {
  margin-top: 0.2rem;
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--danger);
}
.pam-delete-modal-hint {
  font-size: 0.875rem;
  color: var(--danger);
  margin: 0 0 0.75rem 0;
}
.pam-delete-modal-check input.pam-delete-ack-missing {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}
.pam-delete-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* Page help "?" button */
.page-top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  position: relative;
}
.page-top-bar .page-header {
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
}
.page-help-wrap {
  position: relative;
  flex-shrink: 0;
}
.page-help-trigger {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  cursor: help;
  padding: 0;
}
.page-help-trigger:hover,
.page-help-trigger:focus {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.page-help-panel {
  display: none;
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 200;
  min-width: 280px;
  max-width: min(420px, 90vw);
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text);
}
.page-help-panel p {
  margin: 0 0 0.5rem;
}
.page-help-panel p:last-child {
  margin-bottom: 0;
}
.page-help-wrap:hover .page-help-panel,
.page-help-wrap:focus-within .page-help-panel {
  display: block;
}

/* Impostazioni sidebar tabs (Tabelle, Modelli, Formato stampa) */
.tabelle-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}
.tabelle-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.tabelle-sidebar-title {
  margin: 0 0 0.75rem 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tabelle-pin,
.tabelle-pin-btn {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
  margin-bottom: 0.25rem;
  font-weight: 500;
  transition: background 0.2s;
  border: none;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.tabelle-pin:hover,
.tabelle-pin-btn:hover {
  background: var(--surface-hover);
  color: var(--accent);
}
.tabelle-pin.active,
.tabelle-pin-btn.active {
  background: var(--accent);
  color: #fff;
}
.tabelle-pin.active:hover,
.tabelle-pin-btn.active:hover {
  background: var(--accent-hover);
  color: #fff;
}
.tabelle-content {
  flex: 1;
  min-width: 0;
}
.tabelle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.tabelle-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}
.tabelle-tab-panel[hidden] {
  display: none !important;
}
@media (max-width: 700px) {
  .tabelle-layout {
    flex-direction: column;
  }
  .tabelle-sidebar {
    width: 100%;
  }
}

/* Agenda tabs */
.agenda-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
}
.agenda-tab {
  padding: 0.55rem 1.1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.agenda-tab:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.agenda-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.agenda-tab-panel[hidden] {
  display: none !important;
}
.agenda-book-date-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}
.agenda-book-date-row label {
  font-size: 0.9rem;
  color: var(--text-muted);
}
.agenda-selection-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1rem;
}
.agenda-selection-col {
  min-width: 0;
}
.agenda-selection-col h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}
.agenda-selected-workers {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  max-height: 280px;
  overflow: auto;
}
.agenda-selected-workers li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.agenda-selected-workers li:last-child {
  border-bottom: none;
}
.agenda-selected-workers .btn-remove-worker {
  flex-shrink: 0;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
}
.agenda-book-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
/* Convocazioni modals */
.convocazioni-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.convocazioni-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.convocazioni-modal-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.convocazioni-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.convocazioni-modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
}
.convocazioni-modal-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0 0.25rem;
}
.convocazioni-modal-close:hover {
  color: var(--text);
}
.convocazioni-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.convocazioni-print-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (max-width: 768px) {
  .agenda-selection-row {
    grid-template-columns: 1fr;
  }
  .agenda-two-col {
    grid-template-columns: 1fr;
  }
}

/* Import attestati corsi */
.corsi-import-panel {
  max-width: none;
}
.corsi-import-table {
  font-size: 0.9rem;
}
.corsi-import-table .col-check {
  width: 2.2rem;
}
.corsi-import-table select.search-input,
.corsi-import-table input.search-input {
  min-width: 10rem;
  width: 100%;
}
.corsi-import-file {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 14rem;
  word-break: break-word;
}
.corsi-import-warn {
  margin-top: 0.35rem;
  color: var(--warning);
  font-size: 0.8rem;
}
.corsi-import-date-it {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.corsi-match-ok {
  background: rgba(63, 185, 80, 0.18);
}
.corsi-match-review {
  background: rgba(212, 160, 23, 0.22);
}
.corsi-match-missing {
  background: rgba(248, 81, 73, 0.16);
}
body.theme-light .corsi-match-ok {
  background: #d8f3dc;
}
body.theme-light .corsi-match-review {
  background: #fff3c4;
}
body.theme-light .corsi-match-missing {
  background: #ffd7d5;
}

