/**
 * Impronta — Layout
 * App layout (loggato) + Guest layout (non loggato).
 * Dipende da tokens.css e base.css.
 */

/* ============================================================
   APP LAYOUT — utenti loggati
   Desktop: sidebar fissa sinistra + main area destra
   Mobile:  topbar + contenuto + bottom navigation
   ============================================================ */

.app-layout {
  display:    flex;
  min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.app-sidebar {
  width:            var(--sidebar-w);
  flex-shrink:      0;
  background:       var(--bg2);
  border-right:     0.5px solid var(--ln);
  position:         fixed;
  top:              0;
  left:             0;
  height:           100vh;
  height:           100dvh;
  overflow-y:       auto;
  display:          flex;
  flex-direction:   column;
  z-index:          var(--z-sidebar);
  transition:       transform var(--t-slow);
  scrollbar-width:  thin;
  scrollbar-color:  rgba(var(--gold-rgb), .2) transparent;
}

.app-sidebar::-webkit-scrollbar       { width: 4px; }
.app-sidebar::-webkit-scrollbar-track { background: transparent; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(var(--gold-rgb), .18); border-radius: var(--rFull); }
.app-sidebar:hover::-webkit-scrollbar-thumb { background: rgba(var(--gold-rgb), .32); }

/* Logo */
.app-sidebar__logo {
  padding:         18px 20px 16px;
  border-bottom:   0.5px solid var(--ln);
  display:         flex;
  align-items:     center;
  gap:             9px;
  text-decoration: none;
  flex-shrink:     0;
}
.app-sidebar__logo:hover { text-decoration: none; }

.app-sidebar__logo img {
  width:       22px;
  height:      22px;
  object-fit:  contain;
  flex-shrink: 0;
  opacity:     .85;
}

.app-sidebar__logo-text {
  font-size:      13px;
  font-weight:    var(--fw-medium);
  letter-spacing: .08em;
  color:          var(--ink);
  text-transform: uppercase;
}
.app-sidebar__logo-text span { color: var(--gold); }

/* Nav principale */
.app-sidebar__nav {
  flex:       1;
  padding:    10px 0;
  overflow-y: auto;
}

/* Etichetta gruppo nav */
.app-sidebar__section {
  font-family:    var(--mono);
  font-size:      8px;
  font-weight:    var(--fw-regular);
  letter-spacing: .18em;
  text-transform: uppercase;
  color:          var(--ink20);
  padding:        14px 20px 3px;
}

/* Nav item */
.app-nav-item {
  display:         flex;
  align-items:     center;
  gap:             9px;
  padding:         8px 20px;
  font-size:       12px;
  font-weight:     var(--fw-regular);
  color:           var(--ink40);
  letter-spacing:  .01em;
  text-decoration: none;
  border-left:     1.5px solid transparent;
  transition:      color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
  position:        relative;
}
.app-nav-item:hover {
  background:      var(--ink06);
  color:           var(--ink70);
  text-decoration: none;
}
button.app-nav-item {
  width:       100%;
  font-family: inherit;
  background:  none;
  border:      0;
  border-left: 1.5px solid transparent;
  text-align:  left;
  cursor:      pointer;
}
.app-nav-item.active {
  color:             var(--gold);
  background:        var(--gold-bg);
  border-left-color: var(--gold);
  text-decoration:   none;
}

/* Icone nav */
.app-nav-item svg,
.app-nav-item > i {
  width:       14px;
  height:      14px;
  flex-shrink: 0;
  opacity:     .6;
}
.app-nav-item.active svg,
.app-nav-item.active > i { opacity: 1; }

/* Sub-item (figli indentati) */
.app-nav-item--sub {
  padding-left: 34px;
  font-size:    11px;
  color:        var(--ink30);
}
.app-nav-item--sub:hover { color: var(--ink55); }
.app-nav-item--sub.active { color: var(--gold); }

/* Footer sidebar */
.app-sidebar__footer {
  padding:        14px 20px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  border-top:     0.5px solid var(--ln);
  flex-shrink:    0;
}

.app-sidebar__user {
  display:     flex;
  align-items: center;
  gap:         9px;
  margin-bottom: 8px;
}

.app-sidebar__avatar {
  width:           28px;
  height:          28px;
  border-radius:   var(--rFull);
  background:      var(--gold-bg);
  border:          0.5px solid var(--gold-ln);
  display:         flex;
  align-items:     center;
  justify-content: center;
  flex-shrink:     0;
  overflow:        hidden;
}
.app-sidebar__avatar img {
  width:      100%;
  height:     100%;
  object-fit: cover;
}
.app-sidebar__avatar-initial {
  font-size:   11px;
  font-weight: var(--fw-medium);
  color:       var(--gold);
}

.app-sidebar__user-main   { flex: 1; min-width: 0; }
.app-sidebar__user-top    { display: flex; align-items: center; gap: 6px; }

.app-sidebar__username {
  font-size:     12px;
  font-weight:   var(--fw-regular);
  color:         var(--ink70);
  overflow:      hidden;
  text-overflow: ellipsis;
  white-space:   nowrap;
  flex:          1;
  min-width:     0;
}

.app-sidebar__settings-gear {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  color:           var(--ink30);
  flex-shrink:     0;
  transition:      color var(--t-fast);
  text-decoration: none;
}
.app-sidebar__settings-gear:hover { color: var(--gold); }

.app-sidebar__plan-badge {
  display:         inline-block;
  padding:         2px 9px;
  border-radius:   var(--rFull);
  font-family:     var(--mono);
  font-size:       9px;
  letter-spacing:  .08em;
  text-transform:  uppercase;
  color:           var(--gold);
  background:      var(--gold-bg);
  border:          0.5px solid var(--gold-ln);
  text-decoration: none;
  transition:      background var(--t-fast), border-color var(--t-fast);
  margin-bottom:   10px;
}
.app-sidebar__plan-badge:hover {
  background:   rgba(var(--gold-rgb), .14);
  border-color: var(--gold);
}

.app-sidebar__footer-actions {
  display:     flex;
  align-items: center;
  gap:         10px;
  margin-top:  4px;
}

.app-sidebar__logout-btn {
  background:     none;
  border:         none;
  font-family:    var(--mono);
  font-size:      9px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color:          var(--ink30);
  cursor:         pointer;
  padding:        0;
  transition:     color var(--t-fast);
}
.app-sidebar__logout-btn:hover { color: var(--terra); }

/* Theme switch button */
.theme-switch {
  display:         inline-flex;
  align-items:     center;
  gap:             5px;
  background:      none;
  border:          0.5px solid var(--ln2);
  border-radius:   var(--r);
  padding:         3px 8px;
  font-family:     var(--mono);
  font-size:       9px;
  letter-spacing:  .08em;
  color:           var(--ink30);
  cursor:          pointer;
  transition:      all var(--t-fast);
  margin-left:     auto;
}
.theme-switch:hover { border-color: var(--gold-ln); color: var(--gold); }
.theme-switch svg   { width: 11px; height: 11px; }

/* Lang switcher sidebar */
.sidebar-lang-switcher {
  margin-top:  6px;
  padding-top: 8px;
  border-top:  0.5px solid var(--ln);
}

/* ── SIDEBAR OVERLAY (mobile) ──────────────────────────────── */
.app-sidebar-overlay {
  display:    none;
  position:   fixed;
  inset:      0;
  background: rgba(0, 0, 0, .55);
  z-index:    calc(var(--z-sidebar) - 10);
  backdrop-filter: blur(2px);
}
.app-sidebar-overlay.visible { display: block; }

/* ── MAIN CONTENT ─────────────────────────────────────────── */
.app-main {
  flex:       1;
  margin-left: var(--sidebar-w);
  min-width:   0;
}

/* ── TOPBAR (solo mobile) ─────────────────────────────────── */
.app-topbar {
  display:          none;
  height:           var(--topbar-h);
  background:       var(--bg2);
  border-bottom:    0.5px solid var(--ln);
  position:         sticky;
  top:              0;
  z-index:          var(--z-sticky);
  padding:          0 16px;
  align-items:      center;
  justify-content:  space-between;
  flex-shrink:      0;
}

.app-topbar__menu-btn {
  background:   none;
  border:       none;
  color:        var(--ink55);
  cursor:       pointer;
  padding:      6px;
  display:      flex;
  align-items:  center;
  border-radius: var(--r);
  transition:   background var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.app-topbar__menu-btn:hover { background: var(--ink06); }

.app-topbar__logo {
  display:         flex;
  align-items:     center;
  gap:             7px;
  text-decoration: none;
}
.app-topbar__logo img {
  width:      20px;
  height:     20px;
  object-fit: contain;
  opacity:    .85;
}
.app-topbar__logo-text {
  font-size:      12px;
  font-weight:    var(--fw-medium);
  letter-spacing: .08em;
  color:          var(--ink);
  text-transform: uppercase;
}
.app-topbar__logo-text span { color: var(--gold); }

/* ── BOTTOM NAVIGATION (mobile) ──────────────────────────── */
.app-bottombar {
  display:    none;
  position:   fixed;
  bottom:     0;
  left:       0;
  right:      0;
  height:     var(--bottombar-h);
  background: var(--bg2);
  border-top: 0.5px solid var(--ln);
  z-index:    var(--z-sidebar);
}

.app-bottombar__inner {
  display: flex;
  height:  100%;
}

.app-bottombar__item {
  flex:            1;
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  gap:             3px;
  text-decoration: none;
  color:           var(--ink30);
  font-family:     var(--mono);
  font-size:       8px;
  letter-spacing:  .06em;
  transition:      color var(--t-fast);
  position:        relative;
  -webkit-tap-highlight-color: transparent;
}
button.app-bottombar__item {
  background: none;
  border:     none;
  padding:    0;
  cursor:     pointer;
}
.app-bottombar__item svg {
  width:      20px;
  height:     20px;
  flex-shrink: 0;
}
.app-bottombar__item.active { color: var(--gold); }
.app-bottombar__item.active::before {
  content:       '';
  position:      absolute;
  top:           0;
  left:          50%;
  transform:     translateX(-50%);
  width:         28px;
  height:        1.5px;
  background:    var(--gold);
  border-radius: 0 0 2px 2px;
}

/* ── IMPERSONATION BAR ─────────────────────────────────────── */
.impersonate-bar {
  background:      #6030a0;
  color:           #fff;
  padding:         6px 20px;
  font-size:       11px;
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  position:        sticky;
  top:             0;
  z-index:         var(--z-top);
  font-family:     var(--mono);
  letter-spacing:  .04em;
}
.impersonate-bar__btn {
  background:    rgba(255, 255, 255, .15);
  border:        0.5px solid rgba(255, 255, 255, .3);
  color:         #fff;
  padding:       3px 12px;
  border-radius: var(--r);
  cursor:        pointer;
  font-size:     10px;
  font-family:   var(--mono);
  transition:    background var(--t-fast);
}
.impersonate-bar__btn:hover { background: rgba(255, 255, 255, .25); }

/* ── LOADING OVERLAY ──────────────────────────────────────── */
.loading-overlay {
  position:        fixed;
  inset:           0;
  z-index:         var(--z-top);
  background:      var(--bg);
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  opacity:         0;
  pointer-events:  none;
  transition:      opacity .4s ease;
}
.loading-overlay.active { opacity: 1; pointer-events: auto; }

.lo-logo {
  font-family:    var(--mono);
  font-size:      14px;
  font-weight:    var(--fw-regular);
  letter-spacing: .18em;
  color:          var(--ink30);
  text-transform: uppercase;
  margin-bottom:  32px;
}
.lo-logo span { color: var(--gold); opacity: .6; }

.lo-figure-wrap {
  position:   relative;
  width:      180px;
  height:     180px;
  display:    flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
}
.lo-figure {
  width:      160px;
  height:     160px;
  object-fit: contain;
  opacity:    .22;
  mix-blend-mode: luminosity;
}

.lo-scan {
  position:   absolute;
  top:        0;
  left:       0;
  width:      100%;
  height:     2px;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(var(--gold-rgb), .6) 50%,
    transparent 100%);
  animation:  loScan 2.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes loScan {
  0%   { top: -4px; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: .8; }
  100% { top: calc(100% + 4px); opacity: 0; }
}

.lo-pulse {
  position:      absolute;
  top:           58%;
  left:          50%;
  transform:     translate(-50%, -50%);
  width:         8px;
  height:        8px;
  border-radius: var(--rFull);
  background:    rgba(152, 120, 200, .5);
  animation:     loPulse 2.2s ease-out infinite;
}
@keyframes loPulse {
  0%, 100% { opacity: .6; transform: translate(-50%, -50%) scale(1); }
  50%       { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
}

.lo-text {
  font-family:    var(--mono);
  font-size:      10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color:          var(--ink30);
  min-height:     16px;
  text-align:     center;
  margin-bottom:  24px;
  transition:     opacity .3s;
}
.lo-bar-wrap {
  width:         140px;
  height:        1px;
  background:    var(--ink10);
  border-radius: 1px;
  overflow:      hidden;
}
.lo-bar {
  height:        100%;
  width:         0%;
  background:    linear-gradient(90deg, rgba(var(--gold-rgb), .4), rgba(var(--gold-rgb), .9));
  border-radius: 1px;
  transition:    width .1s linear;
}

/* ============================================================
   GUEST LAYOUT — utenti non loggati
   ============================================================ */

.guest-layout {
  display:        flex;
  flex-direction: column;
  min-height:     100vh;
}

/* ── GUEST NAV ─────────────────────────────────────────────── */
.site-nav {
  background:      var(--bg2);
  border-bottom:   0.5px solid var(--ln);
  position:        sticky;
  top:             0;
  z-index:         var(--z-sticky);
}

.nav-inner {
  display:     flex;
  align-items: center;
  justify-content: space-between;
  height:      52px;
  padding:     0 var(--sp-6);
  gap:         20px;
}

.nav-logo {
  display:         flex;
  align-items:     center;
  gap:             9px;
  text-decoration: none;
  flex-shrink:     0;
}
.nav-logo img {
  width:      26px;
  height:     26px;
  object-fit: contain;
  opacity:    .88;
}
.nav-logo-text {
  font-size:      13px;
  font-weight:    var(--fw-medium);
  letter-spacing: .08em;
  color:          var(--ink);
  text-transform: uppercase;
}
.nav-logo-text span { color: var(--gold); }

.nav-links {
  display:     flex;
  align-items: center;
  gap:         20px;
  list-style:  none;
}
.nav-links a {
  font-size:   12px;
  font-weight: var(--fw-regular);
  color:       var(--ink40);
  transition:  color var(--t-fast);
}
.nav-links a:hover { color: var(--ink70); }

.nav-actions {
  display:     flex;
  align-items: center;
  gap:         8px;
  flex-shrink: 0;
}

/* ── GUEST FOOTER ─────────────────────────────────────────── */
.site-footer {
  border-top:  0.5px solid var(--ln);
  padding:     20px 0;
  margin-top:  60px;
}
.footer-inner {
  display:     flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap:   wrap;
  gap:         14px;
  padding:     0 var(--sp-6);
}
.footer-copy {
  font-family:    var(--mono);
  font-size:      10px;
  color:          var(--ink30);
  letter-spacing: .04em;
}
.footer-links {
  display:   flex;
  gap:       18px;
  list-style: none;
}
.footer-links a {
  font-size:  12px;
  color:      var(--ink30);
  transition: color var(--t-fast);
}
.footer-links a:hover { color: var(--ink55); }

.footer-lang {
  display:     flex;
  align-items: center;
  gap:         6px;
}

/* ── LANG DROPDOWN ─────────────────────────────────────────── */
.lang-dropdown {
  position: relative;
  display:  inline-block;
}

.lang-dropdown__trigger {
  display:         inline-flex;
  align-items:     center;
  gap:             4px;
  padding:         4px 10px;
  border-radius:   var(--r);
  border:          0.5px solid var(--ln2);
  background:      transparent;
  color:           var(--ink40);
  font-family:     var(--mono);
  font-size:       10px;
  font-weight:     var(--fw-regular);
  letter-spacing:  .1em;
  cursor:          pointer;
  transition:      all var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.lang-dropdown__trigger:hover { border-color: var(--gold-ln); color: var(--gold); }
.lang-dropdown__trigger svg   { transition: transform var(--t-fast); }
.lang-dropdown.open .lang-dropdown__trigger svg { transform: rotate(180deg); }

.lang-dropdown__menu {
  display:       none;
  position:      absolute;
  right:         0;
  top:           calc(100% + 4px);
  background:    var(--card2);
  border:        0.5px solid var(--ln2);
  border-radius: var(--rM);
  padding:       4px;
  min-width:     52px;
  z-index:       var(--z-dropdown);
  box-shadow:    0 8px 24px rgba(0, 0, 0, .35);
}
.lang-dropdown__menu--up { top: auto; bottom: calc(100% + 4px); }
.lang-dropdown.open .lang-dropdown__menu { display: block; }

.lang-dropdown__item {
  display:         block;
  padding:         5px 12px;
  border-radius:   6px;
  font-family:     var(--mono);
  font-size:       10px;
  font-weight:     var(--fw-regular);
  letter-spacing:  .1em;
  color:           var(--ink40);
  text-decoration: none;
  text-align:      center;
  transition:      all var(--t-fast);
}
.lang-dropdown__item:hover { background: var(--ink06); color: var(--ink70); }

/* ── NOTIFICATION BADGES ──────────────────────────────────── */
.notif-badge {
  background:  var(--gold);
  color:       var(--bg);
  font-family: var(--mono);
  font-size:   8px;
  font-weight: var(--fw-medium);
  border-radius: var(--rFull);
  min-width:   15px;
  height:      15px;
  display:     inline-flex;
  align-items: center;
  justify-content: center;
  padding:     0 3px;
  line-height: 1;
}
.notif-badge--sidebar     { margin-left: auto; }
.notif-badge--topbar {
  position:  absolute;
  top:       -2px;
  right:     -3px;
  font-size: 7px;
  min-width: 13px;
  height:    13px;
}
.notif-badge--bottombar {
  position:      absolute;
  top:           4px;
  right:         4px;
  font-size:     7px;
  min-width:     13px;
  height:        13px;
  border-radius: var(--rFull);
  padding:       0;
}

/* Topbar bell */
.notif-topbar-btn {
  position:    relative;
  background:  none;
  border:      none;
  color:       var(--ink55);
  cursor:      pointer;
  padding:     4px;
  display:     flex;
  align-items: center;
  transition:  color var(--t-fast);
}
.notif-topbar-btn:hover { color: var(--gold); }
.notif-topbar-btn { display: none; }

/* ── NOTIFICATION DRAWER (desktop) ──────────────────────────── */
.notif-drawer-overlay {
  display:    none;
  position:   fixed;
  inset:      0;
  background: rgba(0, 0, 0, .4);
  z-index:    calc(var(--z-overlay) - 1);
  backdrop-filter: blur(2px);
}
.notif-drawer-overlay.visible { display: block; }

.notif-drawer {
  position:       fixed;
  top:            0;
  right:          0;
  width:          320px;
  height:         100vh;
  height:         100dvh;
  background:     var(--bg2);
  border-left:    0.5px solid var(--ln);
  z-index:        var(--z-overlay);
  display:        flex;
  flex-direction: column;
  transform:      translateX(100%);
  transition:     transform var(--t-slow);
}
.notif-drawer.open { transform: translateX(0); }

.notif-drawer__header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         16px 20px;
  border-bottom:   0.5px solid var(--ln);
  flex-shrink:     0;
}
.notif-drawer__title {
  font-size:   14px;
  font-weight: var(--fw-medium);
  color:       var(--ink);
}
.notif-drawer__close {
  background:   none;
  border:       none;
  color:        var(--ink30);
  cursor:       pointer;
  padding:      4px;
  display:      flex;
  align-items:  center;
  border-radius: var(--r);
  transition:   all var(--t-fast);
}
.notif-drawer__close:hover { color: var(--ink70); background: var(--ink06); }

.notif-drawer__body {
  flex:       1;
  overflow-y: auto;
  padding:    6px 10px;
}
.notif-drawer__footer {
  padding:    12px 20px;
  border-top: 0.5px solid var(--ln);
  text-align: center;
  flex-shrink: 0;
}
.notif-drawer__seeall {
  font-size:   11px;
  color:       var(--gold);
  font-family: var(--mono);
  letter-spacing: .06em;
}
.notif-drawer__loading {
  text-align: center;
  padding:    40px 0;
  font-size:  12px;
  color:      var(--ink30);
}

/* ── NOTIFICATION DROPDOWN (mobile) ──────────────────────── */
.notif-dropdown {
  display:       none;
  position:      fixed;
  top:           var(--topbar-h);
  left:          10px;
  right:         10px;
  max-height:    340px;
  background:    var(--bg2);
  border:        0.5px solid var(--ln);
  border-radius: var(--rL);
  z-index:       var(--z-overlay);
  flex-direction: column;
  overflow:      hidden;
  box-shadow:    0 8px 32px rgba(0, 0, 0, .35);
}
.notif-dropdown.open          { display: flex; }
.notif-dropdown__body         { flex: 1; overflow-y: auto; padding: 6px 8px; max-height: 270px; }
.notif-dropdown__seeall       { display: block; text-align: center; padding: 10px; font-size: 11px; color: var(--gold); border-top: 0.5px solid var(--ln); font-family: var(--mono); letter-spacing: .06em; }
.notif-dropdown-overlay       { display: none; position: fixed; inset: 0; z-index: calc(var(--z-overlay) - 1); }
.notif-dropdown-overlay.visible { display: block; }

/* Notification item */
.notif-item {
  display:         flex;
  align-items:     center;
  gap:             10px;
  padding:         9px 10px;
  border-radius:   var(--r);
  text-decoration: none;
  color:           var(--ink);
  transition:      background var(--t-fast);
}
.notif-item:hover      { background: var(--ink06); }
.notif-item--unread    { background: var(--ink06); }

.notif-item__avatar {
  width:         28px;
  height:        28px;
  border-radius: var(--rFull);
  object-fit:    cover;
  flex-shrink:   0;
}
.notif-item__avatar--fallback {
  display:         flex;
  align-items:     center;
  justify-content: center;
  background:      var(--gold-bg);
  color:           var(--gold);
  font-size:       11px;
  font-weight:     var(--fw-medium);
}
.notif-item__body    { flex: 1; min-width: 0; }
.notif-item__text    { display: block; font-size: 12px; line-height: 1.4; color: var(--ink70); }
.notif-item__text strong { font-weight: var(--fw-medium); }
.notif-item__time    { display: block; font-size: 10px; color: var(--ink30); margin-top: 2px; font-family: var(--mono); }
.notif-empty         { text-align: center; padding: 28px 16px; font-size: 12px; color: var(--ink30); }

/* ── AURA SOUND nav toggle ─────────────────────────────────── */
.aura-nav           { display: flex; align-items: center; }
.aura-nav .app-nav-item { flex: 1; }

.aura-switch {
  flex-shrink:   0;
  width:         30px;
  height:        17px;
  border-radius: var(--rFull);
  border:        0.5px solid var(--ln2);
  background:    var(--ink10);
  position:      relative;
  cursor:        pointer;
  padding:       0;
  margin-right:  16px;
  transition:    background var(--t-base), border-color var(--t-base);
  -webkit-tap-highlight-color: transparent;
}
.aura-switch__knob {
  position:      absolute;
  top:           2px;
  left:          2px;
  width:         11px;
  height:        11px;
  border-radius: var(--rFull);
  background:    var(--ink40);
  transition:    transform var(--t-base), background var(--t-base);
}
.aura-switch.on                  { background: var(--gold-bg); border-color: var(--gold-ln); }
.aura-switch.on .aura-switch__knob { transform: translateX(13px); background: var(--gold); }
.aura-switch.busy               { opacity: .5; }

/* ── BETA BADGE nav ────────────────────────────────────────── */
.nav-beta {
  font-family:    var(--mono);
  font-size:      7px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color:          var(--gold);
  border:         0.5px solid var(--gold-ln);
  border-radius:  5px;
  padding:        1px 5px;
  margin-left:    4px;
  vertical-align: middle;
  opacity:        .8;
}

/* ============================================================
   RESPONSIVE — mobile < 768px
   ============================================================ */
@media (max-width: 768px) {

  /* Sidebar — nascosta, slide-in da sinistra */
  .app-sidebar {
    transform: translateX(-100%);
    z-index:   var(--z-sidebar);
  }
  .app-sidebar.open {
    transform: translateX(0);
    z-index:   320;
  }
  .app-sidebar-overlay.visible { z-index: 310; }

  /* Topbar e bottombar visibili */
  .app-topbar    { display: flex; }
  .app-bottombar { display: block; }

  /* Main — niente margin sidebar */
  .app-main {
    margin-left:    0;
    padding-bottom: var(--bottombar-h);
  }

  /* Footer app nascosto su mobile */
  .app-layout .site-footer { display: none; }

  /* Nav guest semplificata */
  .nav-links { display: none; }
  .nav-inner { padding: 0 16px; }

  /* Container padding ridotto */
  .container { padding: 0 14px; }

  /* Notifiche mobile */
  .notif-topbar-btn { display: flex; }
  .notif-drawer,
  .notif-drawer-overlay { display: none !important; }
  .notif-dropdown.open  { display: flex; }
  .notif-dropdown-overlay.visible { display: block; }
}

/* ── TABLET 769-1024px ─────────────────────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
  :root { --sidebar-w: 180px; }
}

/* ── SAFE AREAS (iPhone notch / home indicator) ─────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .app-bottombar {
    height:         calc(var(--bottombar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
  }
  @media (max-width: 768px) {
    .app-main {
      padding-bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom));
    }
  }
}

@supports (padding-top: env(safe-area-inset-top)) {
  @media (max-width: 768px) {
    .app-topbar {
      padding-top: env(safe-area-inset-top);
      height:      calc(var(--topbar-h) + env(safe-area-inset-top));
    }
    .guest-layout .site-nav {
      padding-top: env(safe-area-inset-top);
    }
  }
}

/* ============================================================
   LIGHT MODE — Layout refinements
   Sidebar: ombra leggera sul lato destro per separazione
   senza bordo pesante. Topbar/bottombar: blur glassmorphism
   caldo che funziona bene sulla superficie avorio.
   ============================================================ */

/* Sidebar — shadow invece di border duro */
[data-theme="light"] .app-sidebar {
  border-right: none;
  box-shadow: 2px 0 14px rgba(28, 22, 8, .07);
}

/* Nav active — gold più visibile su chiaro */
[data-theme="light"] .app-nav-item.active {
  background: var(--gold-bg);
  border-left-color: var(--gold);
  color: var(--gold);
}
[data-theme="light"] .app-nav-item:hover {
  background: rgba(28, 22, 8, .04);
  color: var(--ink60);
}
[data-theme="light"] .app-nav-item.active svg,
[data-theme="light"] .app-nav-item.active > i { opacity: 1; color: var(--gold); }

/* Topbar mobile: stesso colore header sidebar — pannello scuro caldo */
[data-theme="light"] .app-topbar {
  background: #7A6E5C;
  border-bottom: 0.5px solid rgba(28, 22, 8, .16);
  box-shadow: 0 1px 8px rgba(28, 22, 8, .10);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
/* Testi e icone nel topbar: crema su scuro */
[data-theme="light"] .app-topbar__logo-text          { color: #F0E8D4; }
[data-theme="light"] .app-topbar__logo-text span      { color: rgba(212, 176, 104, .88); }
[data-theme="light"] .app-topbar__logo img            { opacity: .88; }
[data-theme="light"] .app-topbar__menu-btn            { color: rgba(240, 232, 212, .70); }
[data-theme="light"] .app-topbar__menu-btn:hover      { background: rgba(255, 255, 255, .10); color: rgba(240, 232, 212, .95); }
[data-theme="light"] .notif-topbar-btn                { color: rgba(240, 232, 212, .70); }

/* Bottombar blur: glassmorphism avorio */
[data-theme="light"] .app-bottombar {
  background: rgba(233, 229, 215, .92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 0.5px solid rgba(28, 22, 8, .10);
  box-shadow: 0 -1px 8px rgba(28, 22, 8, .06);
}

/* Logo text: color coerente */
[data-theme="light"] .app-sidebar__logo-text { color: var(--ink); }
[data-theme="light"] .app-sidebar__logo-text span { color: var(--gold); }

/* Plan badge */
[data-theme="light"] .app-sidebar__plan-badge {
  color: var(--gold);
  background: var(--gold-bg);
  border-color: var(--gold-ln);
}

/* Theme switch */
[data-theme="light"] .theme-switch {
  border-color: var(--ln2);
  color: var(--ink40);
}
[data-theme="light"] .theme-switch:hover {
  border-color: var(--gold-ln);
  color: var(--gold);
}

/* Impersonate bar in light */
[data-theme="light"] .impersonate-bar {
  background: var(--terra-bg);
  border-bottom-color: var(--terra-ln);
  color: var(--terra);
}
