/* ============================================================
   LOGIN + APP SHELL
   ============================================================ */

/* ---------- LOGIN ---------- */
.login-screen{
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 24px;
  position: relative;
}
.login-hero-bg{
  position: fixed; inset: 0; z-index: -1;
  background: url('/assets/am-hero.jpg') center/cover no-repeat;
  opacity: 0.55;
  mask-image: radial-gradient(ellipse 70% 80% at 50% 42%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 50% 42%, #000 30%, transparent 78%);
}

.login-card{
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, rgba(20,20,30,0.82), rgba(10,10,17,0.9));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  padding: 44px 40px 36px;
  box-shadow: var(--shadow), var(--shadow-glow);
  position: relative;
  overflow: hidden;
}
.login-card::before{
  content:'';
  position:absolute; top:0; left:0; right:0; height:1px;
  background: var(--grad);
  opacity: 0.8;
}
.login-logo{
  width: 66px; height: 66px;
  border-radius: 17px;
  display:block; margin: 0 auto 22px;
  box-shadow: 0 10px 30px -8px rgba(236,30,121,0.5);
}
.login-title{
  font-family: var(--display);
  font-weight: 700;
  font-size: 25px;
  text-align: center;
  letter-spacing: -0.01em;
  margin-bottom: 5px;
}
.login-sub{
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  margin-bottom: 30px;
}
.field{ margin-bottom: 16px; }
.field label{
  display:block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 7px;
}
.field input{
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 13px 15px;
  color: var(--text);
  font-size: 14.5px;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus{
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(236,30,121,0.15);
}
.field input::placeholder{ color: var(--text-4); }

.btn-primary{
  width: 100%;
  background: var(--grad);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  padding: 14px;
  border-radius: var(--r-sm);
  margin-top: 8px;
  transition: transform .12s, box-shadow .2s, filter .2s;
  box-shadow: 0 8px 24px -8px rgba(236,30,121,0.5);
}
.btn-primary:hover{ filter: brightness(1.08); box-shadow: 0 10px 30px -6px rgba(236,30,121,0.6); }
.btn-primary svg{ width: 15px; height: 15px; vertical-align: -2px; margin-right: 5px; }
.btn-primary:active{ transform: translateY(1px); }
.btn-primary:disabled{ opacity: 0.6; cursor: not-allowed; }

.login-error{
  background: var(--bad-dim);
  border: 1px solid rgba(255,90,106,0.3);
  color: #ffb3ba;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  margin-bottom: 18px;
  text-align: center;
}
.login-foot{
  text-align:center;
  margin-top: 24px;
  font-size: 11.5px;
  color: var(--text-4);
}

/* ---------- APP SHELL ---------- */
.app{ display: flex; min-height: 100vh; padding: 16px; gap: 16px; }

.sidebar{
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(16,16,24,0.92), rgba(9,9,15,0.94));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 22px 15px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 16px; bottom: 16px; left: 16px;
  z-index: 40;
  box-shadow: var(--shadow);
}
.sidebar-brand{
  display: flex; align-items: center; gap: 11px;
  padding: 8px 8px 20px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.sidebar-brand img{ width: 40px; height: 40px; border-radius: 12px; box-shadow: 0 6px 18px -6px rgba(236,30,121,0.45); }
.sidebar-brand .bt{ font-family: var(--display); font-weight: 700; font-size: 15px; line-height: 1.1; }
.sidebar-brand .bs{ font-size: 10.5px; color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase; }

.nav{ display: flex; flex-direction: column; gap: 3px; margin-top: 14px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.nav::-webkit-scrollbar{ width: 6px; }
.nav::-webkit-scrollbar-thumb{ background: var(--line); border-radius: 3px; }
.nav::-webkit-scrollbar-track{ background: transparent; }
.nav-group{ display:flex; flex-direction:column; gap:3px; }
.nav-group-items{ display:flex; flex-direction:column; gap:3px; overflow:hidden; transition: max-height .22s ease, opacity .18s ease; max-height: 600px; opacity:1; }
.nav-group.collapsed .nav-group-items{ max-height: 0; opacity: 0; }
.nav-group.collapsed .nav-section svg{ transform: rotate(-90deg); }
.nav-item{
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-size: 14px;
  font-weight: 500;
  transition: background .14s, color .14s;
  position: relative;
}
.nav-item.nav-sub{ padding-left: 16px; }
.nav-item.nav-sub svg{ width: 16px; height: 16px; }
.nav-item svg{ width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.nav-item:hover{ background: var(--surface-2); color: var(--text-2); }
.nav-item.active{ background: var(--surface-3); color: var(--text); }
.nav-item.active::before{
  content:''; position:absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 3px; background: var(--grad);
}
.nav-section{
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: none; border: none; cursor: pointer; text-align: left;
  font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-4); padding: 16px 13px 7px;
}
.nav-section:hover{ color: var(--text-3); }
.nav-section svg{ width: 13px; height: 13px; opacity: .7; transition: transform .2s ease; }

.sidebar-foot{ margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.user-chip{
  display:flex; align-items:center; gap: 10px;
  padding: 9px 11px; border-radius: var(--r-sm);
  background: var(--surface-2);
}
.user-avatar{
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--grad);
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: 14px; color: #fff;
  flex-shrink: 0;
}
.user-chip .un{ font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-chip .ur{ font-size: 11px; color: var(--text-3); text-transform: capitalize; }
.logout-btn{
  margin-left: auto; color: var(--text-4); padding: 5px;
  border-radius: 7px; transition: color .14s, background .14s;
  display: grid; place-items: center;
}
.logout-btn:hover{ color: var(--bad); background: var(--bad-dim); }
.logout-btn svg{ width: 16px; height: 16px; }

.main{
  flex: 1;
  margin-left: calc(var(--sidebar-w) + 16px);
  min-width: 0;
}

/* Mobile */
.menu-toggle{ display: none; }
@media (max-width: 900px){
  .app{ padding: 0; }
  .sidebar{ transform: translateX(-115%); transition: transform .25s; top: 12px; bottom: 12px; left: 12px; }
  .sidebar.open{ transform: translateX(0); }
  .main{ margin-left: 0; }
  .menu-toggle{
    display: grid; place-items: center;
    position: fixed; top: 16px; left: 16px; z-index: 50;
    width: 42px; height: 42px; border-radius: 11px;
    background: var(--surface-2); border: 1px solid var(--line-2);
  }
  .menu-toggle svg{ width: 20px; height: 20px; }
}

/* ===== System health panel ===== */
.sb-title{ font-size:15px; font-weight:600; margin-bottom:12px; }
.health-row{ display:flex; align-items:center; gap:10px; font-size:14px; margin-bottom:14px; }
.health-dot{ width:10px; height:10px; border-radius:50%; background:#8a93a6; flex:none; }
.health-dot.ok{ background:#2ecf8f; box-shadow:0 0 0 3px rgba(46,207,143,.15); }
.health-dot.warn{ background:#e0a53f; box-shadow:0 0 0 3px rgba(224,165,63,.15); }
.health-dot.err{ background:#e5484d; box-shadow:0 0 0 3px rgba(229,72,77,.15); }
.health-grid{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.health-grid > div{ background:var(--panel-2,#12151c); border:1px solid var(--line); border-radius:8px; padding:10px 12px; display:flex; flex-direction:column; gap:3px; }
.health-grid span{ font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-4,#8a93a6); }
.health-grid b{ font-size:15px; }
.health-events{ margin-top:14px; }
.he-head{ font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-4); margin-bottom:6px; }
.he-row{ display:grid; grid-template-columns:80px 1fr auto; gap:10px; padding:6px 0; border-bottom:1px solid var(--line); font-size:12px; align-items:center; }
.he-row:last-child{ border-bottom:none; }
.he-t{ color:var(--text-4); }
.he-type{ font-family:ui-monospace,monospace; font-size:11px; }
.he-st{ font-size:11px; }
.he-row.ok .he-st{ color:#2ecf8f; }
.he-row.bad .he-st{ color:#e5484d; }
.health-hint{ font-size:12px; color:var(--text-4); margin-top:10px; line-height:1.5; }
.health-hint.err-text{ color:#e5686d; }
.health-progress{ height:8px; background:var(--panel-2,#12151c); border-radius:4px; overflow:hidden; margin:4px 0 8px; }
.hp-bar{ height:100%; background:linear-gradient(90deg,#7c5cff,#e0559b); transition:width .4s ease; }

.health-card{
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 22px;
}

/* dashboard manual refresh + last-synced label */
.hero-sync{ display:flex; align-items:center; gap:8px; width:100%; justify-content:flex-end; margin-bottom:2px; }
.dash-sync-label{ font-size:12px; color:var(--text-4,#8a93a6); }
.hero-sync-btn{ display:inline-flex; align-items:center; justify-content:center; width:26px; height:26px; padding:0; border:1px solid var(--line); background:transparent; color:var(--text-3,#b6bdca); border-radius:7px; cursor:pointer; }
.hero-sync-btn:hover{ background:rgba(255,255,255,.06); color:var(--text-1,#e9edf5); }
.hero-sync-btn svg{ width:14px; height:14px; }
.hero-sync-btn.spinning, .dash-refresh.spinning{ opacity:.6; pointer-events:none; }
.hero-sync-btn.spinning svg, .dash-refresh.spinning svg{ animation:dashSpin 1s linear infinite; }
@keyframes dashSpin{ to{ transform:rotate(360deg); } }

/* view-as (admin testing) switcher */
.viewas{ display:flex; align-items:center; gap:8px; padding:8px 10px; margin-bottom:8px; background:var(--panel-2,#12151c); border:1px solid var(--line); border-radius:8px; }
.viewas label{ font-size:11px; color:var(--text-4,#8a93a6); text-transform:uppercase; letter-spacing:.04em; white-space:nowrap; }
.viewas select{ flex:1; background:transparent; border:1px solid var(--line); border-radius:6px; color:var(--text-1,#e9edf5); font-size:12px; padding:4px 6px; }

/* invite link copy row */
.invite-link-box{ display:flex; align-items:center; gap:10px; margin-top:14px; }
.invite-link-box input{ flex:1; min-width:0; background:var(--panel-2,#12151c); border:1px solid var(--line); border-radius:8px; color:var(--text-1,#e9edf5); padding:10px 12px; font-size:13px; }
