/* ══════════════════════════════════════════════════════════════════
   LUMEN — app shell: sidebar, account menu, users admin, auth screen
   ══════════════════════════════════════════════════════════════════ */

/* ── sidebar ── */
.nav .brand-mobile { display: none; }
body.sb-collapsed { --sb-w: 76px; }
.view { margin-left: var(--sb-w); }
body.sb-ready .view { transition: margin-left .35s var(--ease), opacity .17s ease, transform .17s ease; }
body.sb-ready .sidebar { transition: width .35s var(--ease), transform .4s var(--ease-out); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sb-w); z-index: 150; display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(13, 13, 20, .96), rgba(9, 9, 14, .98)); border-right: 1px solid var(--line);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); overflow: hidden;
}
.sidebar::before { content: ''; position: absolute; left: -40%; top: -10%; width: 120%; height: 40%; background: radial-gradient(closest-side, rgba(255, 61, 90, .14), transparent); pointer-events: none; }
.sb-head { height: var(--nav-h); flex: none; display: flex; align-items: center; padding: 0 20px; }
.sb-head .brand { gap: 12px; }
.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 12px 12px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: none; }
.sb-nav::-webkit-scrollbar { display: none; }
.sb-label { font-size: 10.5px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); padding: 16px 12px 6px; white-space: nowrap; }
.sb-nav a { position: relative; display: flex; align-items: center; gap: 14px; height: 44px; padding: 0 14px; border-radius: 12px; font-weight: 600; font-size: 14.5px; color: var(--text-2); white-space: nowrap; transition: background .2s, color .2s; flex: none; }
.sb-nav a .i { width: 21px; height: 21px; flex: none; transition: color .2s, transform .3s var(--ease); }
.sb-nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.sb-nav a:hover .i { transform: scale(1.08); }
.sb-nav a.active { color: #fff; background: linear-gradient(90deg, rgba(255, 61, 90, .2), rgba(255, 159, 67, .06)); }
.sb-nav a.active .i { color: var(--accent-2); }
.sb-nav a.active::before { content: ''; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
.sb-count { margin-left: auto; font-style: normal; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--live); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.sb-count:empty { display: none; }
.sb-foot { flex: none; padding: 10px 12px 14px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.sb-user, .sb-collapse { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border-radius: 12px; text-align: left; white-space: nowrap; transition: background .2s; }
.sb-user:hover, .sb-collapse:hover { background: rgba(255, 255, 255, .06); }
.sb-user-text { display: grid; min-width: 0; }
.sb-user-text b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.sb-user-text small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.sb-collapse { color: var(--muted); font-weight: 600; font-size: 14px; padding-left: 14px; height: 42px; }
.sb-collapse .i { width: 20px; height: 20px; transition: transform .4s var(--ease); }
.avatar.sm { width: 34px; height: 34px; border-radius: 10px; margin: 0; flex: none; font-size: 12px; }
.avatar.lg { width: 48px; height: 48px; border-radius: 14px; font-size: 17px; margin: 0; flex: none; }
.sb-scrim { position: fixed; inset: 0; z-index: 140; background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .3s; }

/* collapsed rail (desktop) */
@media (min-width: 901px) {
  body.sb-collapsed .brand-word, body.sb-collapsed .sb-nav a span, body.sb-collapsed .sb-count, body.sb-collapsed .sb-user-text, body.sb-collapsed .sb-collapse span { display: none; }
  body.sb-collapsed .sb-label { font-size: 0; padding: 10px 0 4px; }
  body.sb-collapsed .sb-label::after { content: ''; display: block; height: 1px; margin: 0 14px; background: var(--line); }
  body.sb-collapsed .sb-head { justify-content: center; padding: 0; }
  body.sb-collapsed .sb-nav a, body.sb-collapsed .sb-collapse { justify-content: center; padding: 0; }
  body.sb-collapsed .sb-user { justify-content: center; padding: 8px 0; }
  body.sb-collapsed .sb-collapse .i { transform: rotate(180deg); }
  body.has-live.sb-collapsed .sb-nav a[data-nav=live]::after { content: ''; position: absolute; top: 9px; right: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 2px #0d0d14; }
  /* rail tooltips — fixed so the sidebar's overflow doesn't clip them */
  body.sb-collapsed .sidebar [data-tip]:hover::after { content: attr(data-tip); position: fixed; left: 84px; padding: 6px 10px; border-radius: 8px; background: rgba(20, 20, 30, .96); box-shadow: 0 8px 24px rgba(0, 0, 0, .5), 0 0 0 1px var(--line-2); font-size: 12.5px; font-weight: 650; color: #fff; white-space: nowrap; pointer-events: none; z-index: 300; animation: fadeUp .2s var(--ease-out); }
}

/* drawer (tablet / mobile) */
@media (max-width: 900px) {
  :root, body.sb-collapsed { --sb-w: 0px; }
  .sidebar { width: 280px; transform: translateX(-102%); box-shadow: 30px 0 80px rgba(0, 0, 0, .6); z-index: 260; }
  .sb-scrim { z-index: 250; }
  body.sb-open .sidebar { transform: none; }
  body.sb-open .sb-scrim { opacity: 1; pointer-events: auto; }
  .sb-collapse { display: none; }
  .nav .brand-mobile { display: flex; }
  .nav .brand-mobile .brand-word { font-size: 24px; }
}

/* ── account menu ── */
.acct-menu { position: fixed; z-index: 600; width: 270px; padding: 8px; border-radius: 16px; background: var(--menu-bg); backdrop-filter: blur(20px); box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 0 1px var(--line-2); opacity: 0; transform: translateY(-6px) scale(.98); transition: opacity .2s, transform .3s var(--ease-out); }
.acct-menu.in { opacity: 1; transform: none; }
.acct-head { display: flex; gap: 12px; align-items: center; padding: 10px 10px 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.acct-head div { display: grid; min-width: 0; }
.acct-head b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-head small { color: var(--muted); font-size: 12.5px; }
.role-badge { display: inline-flex; align-items: center; gap: 3px; color: var(--accent-2); font-weight: 700; }
.role-badge .i { width: 13px; height: 13px; }
.acct-menu > button, .acct-menu > a { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 550; text-align: left; }
.acct-menu > button:hover, .acct-menu > a:hover, .acct-menu > button:focus-visible { background: rgba(255, 255, 255, .07); }
.acct-menu .i { width: 19px; height: 19px; opacity: .85; }
.acct-menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.acct-menu .danger { color: #ff6b81; }
body:not(.is-admin) .admin-only { display: none !important; }
body.app-fs #fsBtn { color: var(--accent-2); }

/* ── users admin ── */
.table-wrap { overflow-x: auto; }
.users-table td { vertical-align: middle; padding: 10px 12px 10px 0; white-space: nowrap; }
.users-table th { padding: 8px 12px 8px 0; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.users-page .panel + .panel { margin-top: 16px; }
.user-cell { display: flex; align-items: center; gap: 12px; }
.user-cell div { display: grid; }
.user-cell .chip { height: 20px; font-size: 10.5px; padding: 0 7px; margin-left: 4px; }
.select.sm { height: 34px; width: auto; min-width: 100px; border-radius: 10px; }
.row-actions { text-align: right; }
.row-actions .btn { padding: 0 9px; }

/* ── auth screen ── */
body.auth-mode .sidebar, body.auth-mode .nav, body.auth-mode .tabbar, body.auth-mode .sb-scrim, body.auth-mode #mini { display: none !important; }
body.auth-mode .view { margin-left: 0; }
body.auth-mode { padding-bottom: 0 !important; }
.auth { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-columns: 1.15fr minmax(380px, 520px); overflow: auto; animation: viewIn .8s var(--ease-out); }
.auth.leaving { animation: none; opacity: 0; transform: scale(1.02); transition: opacity .45s, transform .45s; }
.auth-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: #050508; }
.auth-bg i { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .6; animation: aurora 16s ease-in-out infinite alternate; }
.auth-bg i:nth-child(1) { width: 55vw; height: 55vw; left: -10vw; top: -15vw; background: var(--accent); }
.auth-bg i:nth-child(2) { width: 45vw; height: 45vw; left: 25vw; bottom: -20vw; background: var(--violet); animation-delay: -6s; }
.auth-bg i:nth-child(3) { width: 35vw; height: 35vw; left: 5vw; bottom: 5vw; background: var(--accent-2); opacity: .35; animation-delay: -10s; }
.auth-bg i:nth-child(4) { width: 30vw; height: 30vw; right: -8vw; top: 10vw; background: #1fd1a3; opacity: .18; animation-delay: -3s; }
.auth-bg::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 4px), radial-gradient(120% 80% at 30% 50%, transparent 30%, rgba(5, 5, 8, .85)); }
.auth-side { display: flex; align-items: center; padding: clamp(30px, 6vw, 90px); }
.auth-quote { display: grid; gap: 20px; max-width: 620px; }
.auth-quote .display { font-size: clamp(54px, 7vw, 110px); }
.auth-quote p { color: var(--text-2); font-size: 17px; max-width: 480px; }
.auth-points { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; }
.auth-points li { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text-2); }
.auth-points .i { color: var(--accent-2); }
.auth-panel { display: grid; place-items: center; padding: 30px; background: linear-gradient(90deg, transparent, rgba(7, 7, 11, .75) 18%); }
.auth-card { width: 100%; max-width: 420px; display: grid; gap: 18px; padding: 34px 30px; border-radius: 26px; background: rgba(16, 16, 24, .78); backdrop-filter: blur(24px) saturate(1.3); -webkit-backdrop-filter: blur(24px) saturate(1.3); box-shadow: 0 40px 100px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .09); }
.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-brand .brand-mark { width: 34px; height: 34px; }
.auth-title { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.auth-sub { margin-top: -10px; }
.auth-tabs { width: 100%; }
.auth-tabs button { flex: 1; }
.auth-form { display: grid; gap: 14px; }
.auth-form.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.field-hint { font-size: 12px; font-weight: 500; color: var(--dim); }
.auth .reg-only { display: none; }
.auth.is-register .reg-only { display: grid; }
.input-ico { position: relative; display: flex; align-items: center; }
.input-ico > .i { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--dim); pointer-events: none; }
.input-ico .input { padding-left: 42px; height: 48px; font-size: 15px; }
.input-ico:focus-within > .i { color: var(--accent-2); }
.pw-eye { position: absolute; right: 6px; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--dim); }
.pw-eye:hover, .pw-eye.on { color: var(--text); background: rgba(255, 255, 255, .06); }
.pw-meter { gap: 6px; margin-top: -4px; }
.pw-meter div { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.pw-meter i { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .1); transition: background .3s; }
.pw-meter small { font-size: 12px; color: var(--muted); min-height: 1em; }
.pw-meter[data-level='1'] i:nth-child(-n+1) { background: #ff5a6e; }
.pw-meter[data-level='2'] i:nth-child(-n+2) { background: #ffb347; }
.pw-meter[data-level='3'] i:nth-child(-n+3) { background: #d4e157; }
.pw-meter[data-level='4'] i { background: var(--ok); }
.auth-error { padding: 10px 14px; border-radius: 12px; background: rgba(255, 61, 90, .14); color: #ff8a9a; font-size: 13.5px; font-weight: 600; }
.auth-submit { width: 100%; margin-top: 4px; }
.auth-submit.loading { color: transparent; }
.auth-submit.loading::after { content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid rgba(0, 0, 0, .2); border-top-color: #0a0a0f; animation: spin .7s linear infinite; }
.auth-foot { display: flex; align-items: center; gap: 6px; justify-content: center; text-align: center; }
.auth-foot a { color: var(--accent-2); font-weight: 650; }
.auth-foot .i { width: 16px; height: 16px; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-panel { background: none; padding: 20px 16px; }
  .auth-card { padding: 28px 22px; }
}

body.embed .sidebar, body.embed .sb-scrim { display: none !important; }
body.embed .view { margin-left: 0; }

/* ── two-step verification ── */
.modal-tfa { width: min(640px, 100%); }
.tfa-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; }
.recovery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.recovery code { padding: 10px; border-radius: 10px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); font: 600 14px ui-monospace, Consolas, monospace; text-align: center; letter-spacing: .08em; }
.otp-input { font: 700 22px ui-monospace, Consolas, monospace; letter-spacing: .4em; text-align: center; height: 56px; }
.menu-badge { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .1); color: var(--muted); }
.menu-badge.on { background: rgba(61, 220, 151, .18); color: var(--ok); }
.chip.ok { color: var(--ok); border-color: rgba(61, 220, 151, .35); }
@media (max-width: 560px) { .tfa-grid { grid-template-columns: 1fr; justify-items: center; } }

.qr-card { max-width: 200px; }
.tfa-grid { grid-template-columns: 190px minmax(0, 1fr); }
.modal-tfa .copy-field code { white-space: normal; word-break: break-all; }
