html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus,
.form-select:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

/* -----------------------------
   App shell (UI 3.0)
   ----------------------------- */

body.app {
  min-height: 100vh;
  background: #f6f7fb;
  margin: 0;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: linear-gradient(135deg, #1f2a44 0%, #2b3b66 55%, #1f2a44 100%);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.app-topbar .container-fluid {
  height: 56px;
  display: flex;
  align-items: center;
}

.app-brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.app-brand:hover {
  color: #fff;
  text-decoration: none;
}

.app-icon {
  line-height: 1;
}

.app-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.85rem;
}

.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.app-sidebar {
  width: 280px;
  background: #ffffff;
  border-right: 1px solid #e6e7ee;
}

/*
  Bootstrap 5.1 non supporta le classi responsive offcanvas-*(es. offcanvas-lg).
  La sidebar usa quindi l'offcanvas standard ma, su desktop (>= lg), la rendiamo
  "statica" per evitare il vuoto a sinistra.
*/
@media (min-width: 992px) {
  .app-sidebar.offcanvas {
    position: sticky;
    top: 56px; /* altezza topbar (coerente con il layout) */
    height: calc(100vh - 56px);
    visibility: visible !important;
    transform: none !important;
    border-right: 1px solid #e6e7ee;
  }

  .app-sidebar.offcanvas-start {
    transform: none !important;
  }

  .offcanvas-backdrop {
    display: none !important;
  }
}

.app-sidebar-inner {
  padding: 14px 10px;
}

.app-sidebar-section + .app-sidebar-section {
  margin-top: 14px;
}

.app-sidebar-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  padding: 6px 12px;
}

/* Sidebar widgets */
.sidebar-widget {
  border: 1px solid #e6e7ee;
  border-radius: 16px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 10px 22px rgba(17, 24, 39, 0.04);
}

.sidebar-widget + .sidebar-widget {
  margin-top: 12px;
}

.sidebar-widget-header {
  padding: 10px 12px;
  font-weight: 700;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(17, 24, 39, 0.06);
}

.sidebar-widget-body {
  padding: 12px;
}

.sidebar-widget-primary .sidebar-widget-header {
  background: radial-gradient(900px circle at 10% 20%, rgba(37, 140, 251, 0.18), transparent 55%),
              radial-gradient(700px circle at 90% 10%, rgba(99, 102, 241, 0.16), transparent 60%),
              #f7fbff;
  color: #1f3a8a;
}

.sidebar-widget-neutral .sidebar-widget-header {
  background: #f7f7fb;
  color: #374151;
}

.sidebar-widget-admin .sidebar-widget-header {
  background: #fff7ed;
  color: #7c2d12;
}

.sidebar-widget-footer {
  background: #ffffff;
}

.sidebar-list {
  margin: 0;
  padding-left: 18px;
  color: #374151;
}

.sidebar-list li {
  margin-bottom: 6px;
}

.sidebar-list li:last-child {
  margin-bottom: 0;
}

.app-nav .nav-link {
  border-radius: 12px;
  padding: 10px 12px;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-nav .nav-link:hover {
  background: #f1f3f9;
  color: #111827;
}

.app-nav .nav-link.active {
  background: #eef2ff;
  color: #1f3a8a;
  font-weight: 600;
  border: 1px solid #dbe1ff;
}

.app-main {
  flex: 1;
  min-width: 0;
}

.app-container {
  padding: 18px 18px 28px 18px;
}

.app-footer {
  background: #ffffff;
  border-top: 1px solid #e6e7ee;
  padding: 12px 0;
  color: #6b7280;
}

/* -----------------------------
   Dashboard
   ----------------------------- */

.dash-hero {
  background: radial-gradient(1200px circle at 10% 10%, rgba(37, 140, 251, 0.18), transparent 50%),
              radial-gradient(900px circle at 90% 20%, rgba(99, 102, 241, 0.18), transparent 55%),
              #ffffff;
  border: 1px solid #e6e7ee;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.06);
}

.dash-kpi {
  border: 1px solid #e6e7ee;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(17, 24, 39, 0.05);
}

.dash-kpi .dash-kpi-value {
  font-size: 1.6rem;
  font-weight: 800;
}

.dash-muted {
  color: #6b7280;
}

.dash-action {
  display: block;
  width: 100%;
  text-decoration: none;
  color: inherit;
  border: 1px solid #e6e7ee;
  border-radius: 16px;
  background: #ffffff;
  padding: 14px 14px;
  box-shadow: 0 10px 22px rgba(17, 24, 39, 0.05);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.dash-action:hover {
  color: inherit;
  border-color: #cfd6e6;
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(17, 24, 39, 0.08);
}

.dash-action:active {
  transform: translateY(0);
}

.dash-action-arrow {
  flex: 0 0 auto;
  font-weight: 700;
  opacity: 0.75;
  font-size: 1.1rem;
}

/* -----------------------------
   Cards (soft highlights)
   ----------------------------- */

.card-soft-primary {
  border: 1px solid rgba(37, 140, 251, 0.25);
  background: radial-gradient(900px circle at 10% 20%, rgba(37, 140, 251, 0.10), transparent 55%),
              radial-gradient(700px circle at 90% 10%, rgba(99, 102, 241, 0.10), transparent 60%),
              #ffffff;
  box-shadow: 0 10px 26px rgba(17, 24, 39, 0.04);
}

.card-soft-slate {
  border: 1px solid rgba(17, 24, 39, 0.08);
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(17, 24, 39, 0.05);
}


/* -----------------------------
   FIR create section headers
   ----------------------------- */
.card-header.section-blue {
  background: rgba(37, 140, 251, 0.12);
  border-bottom: 1px solid rgba(37, 140, 251, 0.22);
  color: #123a7a;
}

.card-header.section-green {
  background: rgba(34, 197, 94, 0.12);
  border-bottom: 1px solid rgba(34, 197, 94, 0.22);
  color: #0f5a2a;
}

.card-header.section-amber {
  background: rgba(245, 158, 11, 0.14);
  border-bottom: 1px solid rgba(245, 158, 11, 0.24);
  color: #7a4302;
}

.card-header.section-purple {
  background: rgba(168, 85, 247, 0.12);
  border-bottom: 1px solid rgba(168, 85, 247, 0.22);
  color: #5b1a86;
}

.card-header.section-slate {
  background: rgba(15, 23, 42, 0.05);
  border-bottom: 1px solid rgba(15, 23, 42, 0.12);
  color: #111827;
}

.footer-sfb {
  color: #6b7280;
  font-size: 0.9rem;
}

.footer-sfb .sfb-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid #e6e7ee;
  border-radius: 999px;
  background: #ffffff;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.footer-sfb .footer-sfb-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.footer-sfb .footer-sfb-link:hover {
  text-decoration: underline;
}

/* Tables: keep action buttons on one line when possible */
.table td .btn {
  white-space: nowrap;
}

