.container{ 
  max-width: 1100px; 
  width: 100%;
  padding: 0 20px;
}

/* Responsive container padding */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 0 12px;
  }
}
h1,h2,h3{ letter-spacing: -0.02em; }

:root{ 
  --topbar-h: 56px;
  --admin-banner-h: 48px;
}

/* Topbar */
.topbar{
  height: var(--topbar-h);
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid rgba(255,255,255,0.10);
  position: sticky;
  top: 0;
  z-index: 1030;
}

/* Light mode topbar */
[data-theme="light"] .topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.topbar-inner{
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-brand{
  color: #e5e7eb;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.topbar-btn{
  color: #e5e7eb;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
}
.topbar-btn:hover{
  background: rgba(255,255,255,0.10);
  color: #fff;
}

/* Light mode topbar elements */
[data-theme="light"] .topbar-brand {
  color: var(--text);
}
[data-theme="light"] .topbar-btn {
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--surface);
}
[data-theme="light"] .topbar-btn:hover {
  background: var(--muted);
  color: #fff;
}

.topbar-brand{
  display: flex;
  align-items: center;
  padding: 0;
  margin: 0;
  line-height: 1;
}

.brand-logo{
  display: block;
  width: 185px;
  height: auto;
  max-height: 64px;  /* <-- evita che diventi troppo alto */
  filter: brightness(1.3) contrast(1.3);
}
.brand-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  display: inline-block;
}

/* Shell */
.app-shell{
  display: flex;
  min-height: calc(100vh - var(--topbar-h));
}
.app-sidebar{
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 12px;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.app-sidebar::-webkit-scrollbar{
  display: none;
}

/* Adjust sidebar when admin banner is visible */
body:has(.admin-view-banner) .app-sidebar {
  top: calc(var(--topbar-h) + var(--admin-banner-h));
  height: calc(100vh - var(--topbar-h) - var(--admin-banner-h));
}
.app-content{
  flex: 1;
  min-width: 0;
}

/* Sidebar nav */
.side-nav{ padding: 8px; }
.side-nav-title{
  font-size: .72rem;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 700;
  margin: 4px 4px 2px;
}
.side-nav-link{
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .35rem .75rem;
  margin: 1px 0;
  border-radius: 14px;
  text-decoration: none;
  color: var(--muted);
}
.side-nav-link i{
  font-size: 1.05rem;
  width: 22px;
  text-align: center;
}
.side-nav-link:hover{
  background: rgba(79,70,229,.07);
  color: var(--text);
}
.side-nav-link.active{
  background: rgba(79,70,229,.12);
  color: var(--text);
  font-weight: 700;
}

/* Avatar */
.avatar-circle{
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  color: #e5e7eb;
  font-weight: 800;
}

/* Light mode avatar */
[data-theme="light"] .avatar-circle {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

html { 
  scrollbar-gutter: stable;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
}

body {
  overscroll-behavior-y: none;
}

/* Admin client-view banner (below topbar) */
.admin-view-banner{
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  position: sticky;
  top: var(--topbar-h);
  z-index: 1020;
}

.admin-view-banner__inner{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  max-width: 1400px;        /* opzionale: allinea al container */
  margin: 0 auto;
}

.admin-view-banner__left{
  display:flex;
  align-items:center;
  gap: 10px;
  min-width: 0;
}

.admin-view-badge{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: .78rem;
  letter-spacing: .04em;
  color: color-mix(in srgb, var(--accent) 90%, #fff);
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  white-space: nowrap;
}

.admin-view-text{
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-view-exit{
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--text);
}

.admin-view-exit:hover{
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

/* mobile: allow wrap cleanly */
@media (max-width: 576px){
  .admin-view-banner__inner{
    flex-direction: column;
    align-items: stretch;
  }
  .admin-view-banner__left{
    justify-content: center;
    flex-wrap: wrap;
    text-align: center;
  }
  .admin-view-exit{
    align-self: center;
  }
}

[data-theme="dark"] .admin-view-banner{
  background: color-mix(in srgb, rgba(79,70,229,.28) 60%, var(--surface-2));
  border-bottom-color: rgba(148,163,184,.14);
}

/* Mobile offcanvas sidebar theme fixes */
.offcanvas{
  background: var(--surface);
  color: var(--text);
}

.offcanvas-header{
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.offcanvas-body{
  background: var(--surface);
}

[data-theme="dark"] .offcanvas{
  background: var(--surface);
  color: var(--text);
}

[data-theme="dark"] .offcanvas-header{
  border-bottom-color: var(--border);
  background: var(--surface);
}

[data-theme="dark"] .offcanvas-body{
  background: var(--surface);
}

/* Fix close button in dark mode */
[data-theme="dark"] .btn-close{
  filter: invert(1);
}

/* Ensure sidebar nav links work properly in mobile offcanvas */
.offcanvas .side-nav-link{
  color: var(--muted);
}

.offcanvas .side-nav-link:hover{
  background: rgba(79,70,229,.07);
  color: var(--text);
}

.offcanvas .side-nav-link.active{
  background: rgba(79,70,229,.12);
  color: var(--text);
  font-weight: 700;
}

[data-theme="dark"] .offcanvas .side-nav-link{
  color: var(--muted);
}

[data-theme="dark"] .offcanvas .side-nav-link:hover{
  background: rgba(79,70,229,.15);
  color: var(--text);
}

[data-theme="dark"] .offcanvas .side-nav-link.active{
  background: rgba(79,70,229,.25);
  color: var(--text);
}

/* Mobile sidebar title */
.offcanvas .side-nav-title{
  color: var(--muted);
}

[data-theme="dark"] .offcanvas .side-nav-title{
  color: var(--muted);
}

/* Brand text in mobile sidebar */
.offcanvas .brand-dot + strong{
  color: var(--text);
}

[data-theme="dark"] .offcanvas .brand-dot + strong{
  color: var(--text);
}

/* Language selector at bottom */
.side-nav {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.language-selector-bottom {
  margin-top: auto !important;
  padding-top: 12px !important;
}

/* Language selector dark mode styles */
[data-theme="dark"] .language-selector-bottom .btn-outline-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #9ca3af;
}

[data-theme="dark"] .language-selector-bottom .btn-outline-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #d1d5db;
}

[data-theme="dark"] .language-selector-bottom .dropdown-menu {
  background: var(--surface);
  border-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .language-selector-bottom .dropdown-item {
  color: var(--muted);
}

[data-theme="dark"] .language-selector-bottom .dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}