/* ============================================
   GRUPPO ASTRO — Area Riservata
   Global Stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600&display=swap');

/* ---- CSS Variables ---- */
:root {
  /* Brand Colors */
  --color-primary:        #1a56db;
  --color-primary-dark:   #1446c0;
  --color-primary-light:  #ebf0ff;
  --color-primary-hover:  #1648d4;

  /* Dark Sidebar/Login */
  --color-dark:           #0d1b2e;
  --color-dark-mid:       #122036;
  --color-dark-card:      #172540;
  --color-dark-border:    #1e2f45;

  /* Neutral Palette */
  --color-bg:             #f4f6f9;
  --color-surface:        #ffffff;
  --color-border:         #e2e8f0;
  --color-border-light:   #f0f4f8;

  /* Text */
  --color-text-primary:   #0f172a;
  --color-text-secondary: #475569;
  --color-text-muted:     #94a3b8;
  --color-text-white:     #ffffff;

  /* Status */
  --color-success:        #10b981;
  --color-success-bg:     #ecfdf5;
  --color-warning:        #f59e0b;
  --color-warning-bg:     #fffbeb;
  --color-error:          #ef4444;
  --color-error-bg:       #fef2f2;
  --color-info:           #3b82f6;
  --color-info-bg:        #eff6ff;

  /* Accents for services */
  --color-academy:        #7c3aed;
  --color-academy-bg:     #f5f3ff;
  --color-convenzioni:    #059669;
  --color-convenzioni-bg: #ecfdf5;
  --color-cert:           #2563eb;
  --color-cert-bg:        #eff6ff;

  /* Layout */
  --sidebar-width:        210px;
  --header-height:        56px;
  --border-radius:        10px;
  --border-radius-lg:     14px;
  --border-radius-sm:     6px;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:   0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:   0 10px 30px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.05);
  --shadow-xl:   0 20px 50px rgba(0,0,0,.15);

  /* Transitions */
  --transition:  0.18s ease;
  --transition-slow: 0.32s ease;

  /* Typography */
  --font-main:   'Plus Jakarta Sans', sans-serif;
  --font-body:   'Inter', sans-serif;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-body);
  color: var(--color-text-primary);
  background: var(--color-bg);
  line-height: 1.6;
}

a { color: var(--color-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-primary-dark); }

img { max-width: 100%; display: block; }

/* ---- Typography Utilities ---- */
.text-xs    { font-size: .75rem; }
.text-sm    { font-size: .8125rem; }
.text-base  { font-size: .9375rem; }
.text-lg    { font-size: 1.0625rem; }
.text-xl    { font-size: 1.25rem; }
.text-2xl   { font-size: 1.5rem; }
.text-3xl   { font-size: 1.875rem; }

.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }
.font-extrabold{font-weight: 800; }

.text-primary   { color: var(--color-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted     { color: var(--color-text-muted); }
.text-white     { color: #fff; }

/* ---- Layout: Authenticated Pages ---- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition-slow);
}

.sidebar-logo {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--color-dark-border);
}
.sidebar-logo img {     height: auto;
    width: 100%; }

.sidebar-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-dark-border);
  margin-bottom: 8px;
}
.sidebar-badge svg { width: 13px; height: 13px; opacity: .6; }

.sidebar-nav {
  flex: 1;
  padding: 4px 8px;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--border-radius-sm);
  color: #8faec8;
  font-family: var(--font-main);
  font-size: .83rem;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
}
.sidebar-nav a svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-nav a:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}
.sidebar-nav a.active {
  background: var(--color-primary);
  color: #fff;
}
.sidebar-nav a.active svg { opacity: 1; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--color-dark-border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-user:hover { background: rgba(255,255,255,.05); }

.user-avatar {
  width: 32px; height: 32px;
  background: var(--color-primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-main);
  font-size: .8rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-family: var(--font-main);
  font-size: .8rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-company {
  font-size: .7rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--border-radius-sm);
  color: var(--color-text-muted);
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.sidebar-logout:hover { color: #ef4444; background: rgba(239,68,68,.08); }
.sidebar-logout svg { width: 14px; height: 14px; }

/* ---- Main Content Area ---- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- Top Header ---- */
.page-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0 28px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-header-left h1 {
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.2;
}
.page-header-left p {
  font-size: .75rem;
  color: var(--color-text-muted);
}
.page-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-user-info { text-align: right; }
.header-user-name {
  font-family: var(--font-main);
  font-size: .82rem;
  font-weight: 600;
}
.header-user-company {
  font-size: .72rem;
  color: var(--color-text-muted);
}
.header-avatar {
  width: 30px; height: 30px;
  background: var(--color-primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-main);
  font-size: .78rem;
  font-weight: 700;
  color: #fff;
}

/* ---- Page Body ---- */
.page-body {
  padding: 28px;
  flex: 1;
  margin-bottom: 75px !important;
}

/* ---- Cards ---- */
.card {
  background: var(--color-surface);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--color-border);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-sm { padding: 16px; }
.card-hover {
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  cursor: pointer;
}
.card-hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: #c7d8f0;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-main);
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  color: #fff;
  box-shadow: 0 4px 12px rgba(26,86,219,.3);
}

.btn-outline {
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}
.btn-outline:hover {
  background: var(--color-bg);
  border-color: #c5d3e0;
  color: var(--color-text-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  padding: 8px 12px;
}
.btn-ghost:hover {
  background: var(--color-bg);
  color: var(--color-text-primary);
}

.btn-sm { padding: 6px 13px; font-size: .78rem; }
.btn-lg { padding: 12px 24px; font-size: .95rem; }
.btn-full { width: 100%; }

/* ---- Badges / Tags ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 600;
  font-family: var(--font-main);
}
.badge-blue     { background: #dbeafe; color: #1d4ed8; }
.badge-green    { background: #d1fae5; color: #065f46; }
.badge-purple   { background: #ede9fe; color: #5b21b6; }
.badge-orange   { background: #ffedd5; color: #9a3412; }
.badge-gray     { background: #f1f5f9; color: #475569; }
.badge-dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ---- Form Elements ---- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: .73rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  font-family: var(--font-body);
  font-size: .875rem;
  color: var(--color-text-primary);
  background: var(--color-surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--color-text-muted); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}
.form-textarea { resize: vertical; min-height: 90px; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---- Alerts / Notices ---- */
.alert {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--border-radius);
  font-size: .845rem;
}
.alert-info    { background: var(--color-info-bg); color: #1e40af; border: 1px solid #bfdbfe; }
.alert-success { background: var(--color-success-bg); color: #065f46; border: 1px solid #a7f3d0; }
.alert-warning { background: var(--color-warning-bg); color: #92400e; border: 1px solid #fcd34d; }
.alert-error   { background: var(--color-error-bg); color: #991b1b; border: 1px solid #fecaca; }
.alert-icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.alert-text p:first-child { font-weight: 600; margin-bottom: 2px; }

/* ---- Dividers ---- */
.divider { border: none; border-top: 1px solid var(--color-border); margin: 20px 0; }

/* ---- Loading Spinner ---- */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner-blue {
  border-color: rgba(26,86,219,.2);
  border-top-color: var(--color-primary);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Tab Navigation ---- */
.tab-nav {
  display: flex;
  gap: 4px;
  background: var(--color-bg);
  border-radius: var(--border-radius);
  padding: 4px;
  width: fit-content;
  border: 1px solid var(--color-border);
}
.tab-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-main);
  font-size: .82rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
}
.tab-btn svg { width: 14px; height: 14px; }
.tab-btn:hover { color: var(--color-text-primary); background: rgba(255,255,255,.7); }
.tab-btn.active {
  background: var(--color-dark);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* ---- Toast Notification ---- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--color-dark);
  color: #fff;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  font-size: .84rem;
  font-weight: 500;
  animation: slideUp .3s ease;
  max-width: 320px;
}
.toast.success { background: #065f46; }
.toast.error   { background: #991b1b; }
@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .2s ease;
}
.modal {
  background: var(--color-surface);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn .2s ease;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 1;
}
.modal-title {
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
}
.modal-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--color-bg);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-secondary);
  transition: all var(--transition);
}
.modal-close:hover { background: #fee2e2; color: #ef4444; }
.modal-body { padding: 20px 24px 24px; }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---- Progress Bar ---- */
.progress-bar {
  height: 5px;
  background: var(--color-border);
  border-radius: 10px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 10px;
  transition: width .4s ease;
}
.progress-fill.warning { background: var(--color-warning); }
.progress-fill.danger  { background: var(--color-error); }

/* ---- Utility ---- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.w-full { width: 100%; }

/* ---- Sidebar Admin Section ---- */
.sidebar-section-divider {
  height: 1px;
  background: var(--color-dark-border);
  margin: 10px 8px 8px;
}
.sidebar-section-label {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.22);
  padding: 0 10px 4px;
}

/* ---- Admin Tables ---- */
.admin-table-wrap {
  overflow-x: auto;
  border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .845rem;
}
.admin-table thead th {
  background: var(--color-bg);
  padding: 11px 14px;
  text-align: left;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.admin-table tbody tr {
  border-bottom: 1px solid var(--color-border-light);
  transition: background var(--transition);
}
.admin-table tbody tr:last-child { border-bottom: none; }
.admin-table tbody tr:hover { background: #fafbfc; }
.admin-table tbody td {
  padding: 12px 14px;
  vertical-align: middle;
}
.admin-table .col-actions {
  text-align: right;
  white-space: nowrap;
}
.admin-table .col-actions .btn { margin-left: 4px; }

/* ---- Admin Filter Bar ---- */
.admin-filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.admin-filters .form-input,
.admin-filters .form-select {
  max-width: 200px;
  padding: 8px 12px;
  font-size: .83rem;
}
.admin-filters .search-input {
  min-width: 220px;
  max-width: 300px;
  position: relative;
}
.search-input-wrap {
  position: relative;
}
.search-input-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}
.search-input-wrap .form-input { padding-left: 32px; }

/* ---- Admin Page Header ---- */
.admin-page-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}
.admin-page-top h2 {
  font-family: var(--font-main);
  font-size: 1.05rem;
  font-weight: 700;
}
.admin-page-top p {
  font-size: .8rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ---- Inline badge for table ---- */
.table-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: .68rem;
  font-weight: 700;
  white-space: nowrap;
}
.table-badge-green  { background:#d1fae5; color:#065f46; }
.table-badge-blue   { background:#dbeafe; color:#1d4ed8; }
.table-badge-purple { background:#ede9fe; color:#5b21b6; }
.table-badge-orange { background:#ffedd5; color:#9a3412; }
.table-badge-gray   { background:#f1f5f9; color:#475569; }
.table-badge-red    { background:#fee2e2; color:#991b1b; }

/* ---- Empty state ---- */
.table-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted);
}
.table-empty svg { margin: 0 auto 12px; opacity: .3; }
.table-empty p { font-size: .875rem; }

/* ---- Stats mini cards ---- */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
@media (max-width: 900px) { .admin-stats { grid-template-columns: repeat(2,1fr); } }
.admin-stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: 16px 18px;
}
.admin-stat-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}
.admin-stat-value {
  font-family: var(--font-main);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
}
.admin-stat-sub {
  font-size: .73rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ---- Confirm dialog ---- */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .15s ease;
}
.confirm-box {
  background: var(--color-surface);
  border-radius: var(--border-radius-lg);
  padding: 28px;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: scaleIn .15s ease;
}
.confirm-box h3 {
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.confirm-box p { font-size: .875rem; color: var(--color-text-secondary); margin-bottom: 20px; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-danger { background: var(--color-error); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }

/* ---- File upload field ---- */
.file-upload-area {
  border: 2px dashed var(--color-border);
  border-radius: var(--border-radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.file-upload-area:hover, .file-upload-area.dragover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}
.file-upload-area input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.file-upload-icon { color: var(--color-text-muted); margin: 0 auto 8px; }
.file-upload-label { font-size: .84rem; color: var(--color-text-secondary); }
.file-upload-label span { color: var(--color-primary); font-weight: 600; }
.file-upload-current {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--color-bg);
  border-radius: var(--border-radius-sm);
  font-size: .8rem;
  margin-top: 8px;
  border: 1px solid var(--color-border);
}
.file-upload-current a { font-weight: 600; }

/* ============================================
   RESPONSIVE — Mobile & Tablet
   ============================================ */

/* ---- Hamburger button (visibile solo su mobile/tablet) ---- */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  color: var(--color-text-primary);
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--color-bg); border-color: #c5d3e0; }
.sidebar-toggle svg { width: 18px; height: 18px; }

/* ---- Overlay scuro dietro la sidebar aperta ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 99;
  animation: fadeIn .2s ease;
}
.sidebar-overlay.active { display: block; }

/* ============================================
   TABLET  (max 1024px)
   ============================================ */
@media (max-width: 1024px) {

  /* Sidebar nascosta di default, scorre da sinistra */
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
    box-shadow: none;
    transition: transform var(--transition-slow), box-shadow var(--transition-slow);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.25);
  }

  /* Main content occupa tutto lo schermo */
  .main-content { margin-left: 0; }

  /* Hamburger visibile */
  .sidebar-toggle { display: flex; }

  /* Header adattato */
  .page-header { padding: 0 16px; gap: 10px; }
  .page-header-left { flex: 1; min-width: 0; }
  .page-header-left h1 { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page-header-left p  { display: none; }

  /* Nasconde testo utente nell'header, mostra solo avatar */
  .header-user-info { display: none; }

  /* Padding pagina ridotto */
  .page-body { padding: 18px 16px; }
}

/* ============================================
   MOBILE  (max 640px)
   ============================================ */
@media (max-width: 640px) {

  /* Sidebar a tutto schermo su telefono piccolo */
  .sidebar { width: min(var(--sidebar-width), 85vw); }

  /* Header più compatto */
  .page-header { height: 50px; padding: 0 12px; }
  .page-body   { padding: 14px 12px; }

  /* Grids a colonna singola */
  .services-grid    { grid-template-columns: 1fr !important; }
  .form-grid-2      { grid-template-columns: 1fr !important; }
  .admin-stats      { grid-template-columns: 1fr 1fr !important; }
  .profilo-grid     { grid-template-columns: 1fr !important; }
  .brand-grid       { grid-template-columns: 1fr !important; }
  .premi-steps      { grid-template-columns: 1fr !important; }

  /* Tabelle: scroll orizzontale */
  .admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-table { min-width: 600px; }

  /* Bottoni azioni tabella: icone sole su mobile */
  .admin-table .col-actions .btn span { display: none; }

  /* Modal: full screen su mobile */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    max-width: 100% !important;
    max-height: 92vh;
    animation: slideUpModal .25s ease;
  }
  @keyframes slideUpModal {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  /* Tabs orizzontali: scroll se necessario */
  .brand-modal-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .brand-tab-btn    { flex-shrink: 0; font-size: .72rem; padding: 6px 10px; }

  /* Welcome banner più compatto */
  .welcome-name { font-size: 1.5rem !important; }

  /* Corsi */
  .corso-card   { flex-direction: column; gap: 16px; }
  .corso-side   { align-items: flex-start; min-width: unset; width: 100%; }
  .iscrizione-btn { width: 100%; }

  /* Convenzioni banner */
  .conv-banner-content { flex-direction: column; gap: 16px; }
  .conv-banner-stats   { width: 100%; justify-content: flex-start; }

  /* Archivio normativa */
  .norm-doc-card { flex-direction: column; gap: 12px; }
  .norm-doc-action { width: 100%; }
  .norm-doc-action .btn { width: 100%; justify-content: center; }

  /* Filters wrap */
  .admin-filters  { flex-direction: column; align-items: stretch; }
  .admin-filters .form-input,
  .admin-filters .form-select { max-width: 100%; }
  .search-input-wrap { max-width: 100%; }

  /* Toast bottom safe area */
  .toast-container { bottom: 16px; right: 12px; left: 12px; }
  .toast { max-width: 100%; }
}