:root{
  --bg:#0a0b0d;
  --bg-elevated:#111214;
  --panel:#151618;
  --panel-2:#1b1c1f;
  --panel-3:#212226;
  --border:rgba(255,255,255,.08);
  --border-strong:rgba(255,255,255,.14);
  --text:#f5f7fa;
  --muted:#9ba1aa;
  --soft:#cfd4db;
  --accent:#4f6ef7;
  --accent-2:#85a4ff;
  --accent-soft:rgba(79,110,247,.16);
  --green:#32c48d;
  --green-soft:rgba(50,196,141,.16);
  --yellow:#c9a85a;
  --yellow-soft:rgba(201,168,90,.16);
  --red:#ef6b6b;
  --red-soft:rgba(239,107,107,.15);
  --shadow:0 22px 60px rgba(0,0,0,.32);
  --radius-sm:12px;
  --radius-md:18px;
  --radius-lg:24px;
  --content-width:100%;
  --shell-pad-x:12px;
  --shell-pad-y:14px;
  --card-pad:clamp(12px, .8vw, 16px);
  --fz-body:clamp(11px, .22vw + 8px, 13px);
  --fz-small:clamp(8px, .1vw + 7px, 10px);
  --fz-title:clamp(18px, .52vw + 12px, 26px);
  --fz-kpi:clamp(18px, .62vw + 13px, 28px);
}

*{box-sizing:border-box}

html,body{
  margin:0;
  min-height:100%;
  width:100%;
  font-size:100%;
  -webkit-text-size-adjust:100%;
}

body{
  min-width:320px;
  overflow-x:hidden;
  background:
    radial-gradient(1100px 520px at 12% -10%, rgba(79,110,247,.16), transparent 55%),
    radial-gradient(900px 560px at 110% 6%, rgba(114,164,255,.10), transparent 52%),
    linear-gradient(180deg, #090b11 0%, #0c1017 100%);
  color:var(--text);
  font-family:"Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size:var(--fz-body);
  line-height:1.45;
}

@keyframes surfaceEnter{
  from{
    opacity:0;
    transform:translateY(10px) scale(.992);
  }
  to{
    opacity:1;
    transform:translateY(0) scale(1);
  }
}

a{
  color:inherit;
  text-decoration:none;
}

button,
input,
select,
textarea{
  font:inherit;
}

.muted{
  color:var(--muted);
}

.page-title{
  margin:0;
  font-size:var(--fz-title);
  font-weight:800;
  letter-spacing:-.03em;
  line-height:1.02;
  transition:letter-spacing 180ms ease, transform 180ms ease;
}

.page-lead{
  margin:6px 0 0;
  color:var(--muted);
  font-size:clamp(13px, .45vw + 11px, 16px);
  line-height:1.6;
  transition:color 180ms ease;
}

.app-shell{
  display:block;
  min-height:100vh;
  width:100%;
  overflow-x:hidden;
}

.sidebar{
  position:fixed;
  top:0;
  left:0;
  bottom:0;
  width:296px;
  display:flex;
  flex-direction:column;
  gap:10px;
  height:100vh;
  padding:var(--shell-pad-y) var(--shell-pad-x) var(--shell-pad-y);
  border-right:1px solid var(--border);
  background:
    radial-gradient(240px 180px at 12% 0%, rgba(79,110,247,.16), transparent 65%),
    radial-gradient(240px 180px at 100% 16%, rgba(255,141,52,.10), transparent 62%),
    linear-gradient(180deg, rgba(13,14,17,.95), rgba(11,13,18,.94));
  backdrop-filter:blur(18px);
  overflow-y:auto;
  box-shadow:24px 0 48px rgba(0,0,0,.22);
  animation:surfaceEnter .42s ease both;
}

.sidebar::before{
  content:"";
  position:absolute;
  inset:10px 10px 10px 10px;
  border-radius:22px;
  background:linear-gradient(180deg, rgba(255,255,255,.028), rgba(255,255,255,.01));
  border:1px solid rgba(255,255,255,.04);
  pointer-events:none;
}

.sidebar-head{
  position:relative;
  display:flex;
  align-items:center;
  gap:11px;
  padding:14px 14px 16px;
  margin:2px 2px 6px;
  border-radius:20px;
  border:1px solid rgba(255,255,255,.05);
  background:linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
  animation:surfaceEnter .5s ease both;
}

.brand-mark{
  width:clamp(40px, 2vw + 20px, 48px);
  height:clamp(40px, 2vw + 20px, 48px);
  border-radius:16px;
  display:grid;
  place-items:center;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.18), transparent 38%),
    linear-gradient(180deg, var(--accent-2), var(--accent));
  color:#fff;
  box-shadow:0 14px 32px rgba(79,110,247,.32);
  font-weight:900;
  border:1px solid rgba(255,255,255,.12);
  transition:transform 220ms ease, box-shadow 220ms ease, filter 220ms ease;
}

.sidebar-head:hover .brand-mark{
  transform:translateY(-1px) scale(1.02);
  box-shadow:0 18px 36px rgba(79,110,247,.34);
  filter:saturate(1.06);
}

.brand-copy{
  min-width:0;
}

.brand-title{
  font-size:clamp(14px, .35vw + 11px, 16px);
  font-weight:900;
  letter-spacing:-.02em;
}

.brand-sub{
  margin-top:4px;
  color:var(--muted);
  font-size:var(--fz-small);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.side-nav{
  position:relative;
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:2px;
}

.side-link{
  position:relative;
  display:flex;
  align-items:center;
  gap:11px;
  min-height:clamp(46px, 2.2vw, 54px);
  padding:clamp(9px, .55vw, 12px) clamp(12px, .8vw, 16px);
  border:1px solid rgba(255,255,255,.02);
  border-radius:18px;
  color:var(--soft);
  background:rgba(255,255,255,.01);
  transition:180ms ease, box-shadow 220ms ease, transform 220ms ease;
}

.side-link::before{
  content:"";
  position:absolute;
  left:0;
  top:10px;
  bottom:10px;
  width:3px;
  border-radius:999px;
  background:transparent;
  transition:180ms ease;
}

.side-copy{
  min-width:0;
  display:grid;
  gap:2px;
  line-height:1.1;
}

.side-copy strong{
  color:inherit;
  font-size:clamp(9px, .12vw + 8px, 11px);
  font-weight:700;
}

.side-copy small{
  color:var(--muted);
  font-size:clamp(7px, .1vw + 7px, 9px);
  font-weight:600;
}

.side-link:hover{
  transform:translateX(2px);
  background:linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.022));
  border-color:rgba(255,255,255,.08);
  color:var(--text);
  box-shadow:0 12px 24px rgba(0,0,0,.14);
}

.side-link.active{
  background:
    linear-gradient(180deg, rgba(79,110,247,.18), rgba(79,110,247,.07)),
    linear-gradient(90deg, rgba(255,141,52,.07), transparent 55%);
  border-color:rgba(79,110,247,.28);
  color:#d9e3ff;
  box-shadow:inset 0 0 0 1px rgba(79,110,247,.06), 0 14px 28px rgba(13,18,34,.22);
}

.side-link.active .side-copy small{
  color:#9eb1e8;
}

.side-link.active::before{
  background:linear-gradient(180deg, #7ea0ff, #ffb37c);
  box-shadow:0 0 16px rgba(126,160,255,.32);
}

.side-link.logout{
  margin-top:auto;
}

.side-icon{
  width:clamp(30px, .65vw + 22px, 36px);
  height:clamp(30px, .65vw + 22px, 36px);
  flex:0 0 clamp(30px, .8vw + 22px, 36px);
  display:grid;
  place-items:center;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.07);
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  color:#c7d1e3;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
  transition:transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.side-link:hover .side-icon,
.side-link.active .side-icon{
  transform:translateY(-1px);
  border-color:rgba(255,255,255,.12);
  box-shadow:0 12px 18px rgba(0,0,0,.16), inset 0 1px 0 rgba(255,255,255,.05);
}

.side-icon svg{
  width:clamp(14px, .35vw + 11px, 16px);
  height:clamp(14px, .35vw + 11px, 16px);
  stroke:currentColor;
  fill:none;
  stroke-width:1.9;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.sidebar-foot{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-top:auto;
  padding:14px;
  border-radius:20px;
  border:1px solid rgba(255,255,255,.06);
  background:
    radial-gradient(circle at top right, rgba(79,110,247,.14), transparent 42%),
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  box-shadow:0 18px 34px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.03);
  animation:surfaceEnter .58s ease both;
}

.sidebar-actions{
  display:flex;
  align-items:center;
  gap:8px;
}

.user-chip{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}

.user-chip-badge{
  width:clamp(34px, 1vw + 24px, 40px);
  height:clamp(34px, 1vw + 24px, 40px);
  border-radius:12px;
  display:grid;
  place-items:center;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.18), transparent 38%),
    linear-gradient(180deg, var(--accent-2), var(--accent));
  color:#fff;
  font-weight:900;
  font-size:12px;
  border:1px solid rgba(255,255,255,.12);
  box-shadow:0 12px 26px rgba(79,110,247,.26);
}

.user-chip-text{
  min-width:0;
}

.user-chip-title{
  font-size:clamp(12px, .3vw + 10px, 14px);
  font-weight:800;
  letter-spacing:-.02em;
}

.user-chip-sub{
  margin-top:2px;
  color:var(--muted);
  font-size:var(--fz-small);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.icon-btn,
.btn,
.linkbtn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:clamp(40px, 2.2vw, 46px);
  padding:0 clamp(14px, .8vw + 10px, 18px);
  border-radius:clamp(12px, .8vw + 8px, 14px);
  border:1px solid var(--border-strong);
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.025));
  color:var(--text);
  cursor:pointer;
  transition:180ms ease;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
}

.icon-btn:hover,
.btn:hover,
.linkbtn:hover{
  transform:translateY(-1px);
  border-color:rgba(255,255,255,.2);
  background:linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.04));
  box-shadow:0 12px 24px rgba(0,0,0,.15);
}

.icon-btn:active,
.btn:active,
.linkbtn:active{
  transform:translateY(0);
}

.icon-btn-square{
  width:40px;
  min-width:40px;
  padding:0;
}

.icon-btn-square svg{
  width:16px;
  height:16px;
  stroke:currentColor;
  fill:none;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.btn-primary,
.linkbtn{
  border-color:rgba(79,110,247,.35);
  background:linear-gradient(180deg, var(--accent), #3958dd);
  color:#fff;
  box-shadow:0 14px 30px rgba(79,110,247,.22);
}

.btn-primary:hover,
.linkbtn:hover{
  border-color:rgba(133,164,255,.45);
  background:linear-gradient(180deg, var(--accent-2), #3958dd);
}

.content-shell{
  min-width:0;
  width:calc(100% - 296px);
  max-width:none;
  margin:0 0 0 296px;
  min-height:100vh;
  padding:clamp(14px, .9vw, 20px) clamp(16px, 1.2vw, 24px) clamp(20px, 1.4vw, 24px);
  animation:surfaceEnter .42s ease both;
}

.shell-topbar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  width:100%;
  max-width:none;
  margin:0 auto 18px;
  padding:clamp(14px, .8vw + 10px, 18px) clamp(16px, 1vw + 10px, 22px);
  border:1px solid rgba(255,255,255,.08);
  border-radius:24px;
  background:
    radial-gradient(circle at top right, rgba(79,110,247,.12), transparent 32%),
    linear-gradient(180deg, rgba(21,22,27,.90), rgba(17,18,23,.88));
  box-shadow:0 24px 52px rgba(0,0,0,.28);
  backdrop-filter:blur(14px);
  animation:surfaceEnter .5s ease both;
  transition:transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.shell-topbar:hover{
  transform:translateY(-1px);
  box-shadow:0 28px 58px rgba(0,0,0,.30);
  border-color:rgba(255,255,255,.10);
}

.shell-topbar-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.top-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:clamp(36px, 2vw, 40px);
  padding:0 clamp(12px, .7vw + 9px, 14px);
  border-radius:999px;
  border:1px solid rgba(255,255,255,.08);
  background:linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
  color:var(--soft);
  font-size:var(--fz-small);
  font-weight:700;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
  transition:transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.top-pill:hover{
  transform:translateY(-1px);
  border-color:rgba(255,255,255,.12);
}

.top-pill-dot{
  width:8px;
  height:8px;
  border-radius:999px;
  background:var(--green);
  box-shadow:0 0 0 5px rgba(22,199,132,.12);
}

.top-pill-accent{
  color:#d8e2ff;
  border-color:rgba(79,110,247,.24);
  background:
    radial-gradient(circle at top right, rgba(79,110,247,.20), transparent 52%),
    linear-gradient(180deg, rgba(79,110,247,.14), rgba(79,110,247,.05));
}

.surface-main{
  width:100%;
  max-width:none;
  margin:0 auto;
  min-width:0;
  display:grid;
  gap:16px;
}

.surface-main > *{
  animation:surfaceEnter .52s ease both;
}

.surface-main > *:nth-child(2){ animation-delay:.04s; }
.surface-main > *:nth-child(3){ animation-delay:.08s; }
.surface-main > *:nth-child(4){ animation-delay:.12s; }

.modal-open{
  overflow:hidden;
}

.modal-backdrop{
  position:fixed;
  inset:0;
  z-index:90;
  display:grid;
  place-items:center;
  padding:20px;
  background:rgba(5,8,12,.62);
  backdrop-filter:blur(6px);
}

.modal-backdrop[hidden]{
  display:none !important;
}

.modal-card{
  width:min(100%, 400px);
  border:1px solid var(--border-strong);
  border-radius:20px;
  background:linear-gradient(180deg, rgba(38,39,43,.98), rgba(28,29,33,.98));
  box-shadow:0 26px 70px rgba(0,0,0,.44);
  overflow:hidden;
}

.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:18px 18px 16px;
  border-bottom:1px solid var(--border);
}

.modal-head h3{
  margin:0;
  font-size:16px;
  font-weight:800;
}

.modal-close{
  width:36px;
  height:36px;
  border-radius:10px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.03);
  color:var(--soft);
  font-size:24px;
  line-height:1;
  cursor:pointer;
}

.modal-body{
  padding:18px;
}

.modal-form{
  display:grid;
  gap:12px;
}

.modal-divider{
  height:1px;
  margin:16px 0;
  background:var(--border);
}

.modal-field{
  display:grid;
  gap:6px;
}

.modal-field span{
  font-size:12px;
  font-weight:700;
  color:var(--soft);
}

.modal-field input{
  min-height:42px;
  padding:0 14px;
  border-radius:12px;
  border:1px solid var(--border-strong);
  background:rgba(255,255,255,.03);
  color:var(--text);
  outline:none;
}

.modal-field input::placeholder{
  color:#7e858f;
}

.modal-field input:focus{
  border-color:rgba(79,110,247,.36);
  box-shadow:0 0 0 4px rgba(79,110,247,.12);
}

.modal-submit{
  min-height:44px;
  border:0;
  border-radius:12px;
  background:linear-gradient(180deg, var(--accent), #3958dd);
  color:#fff;
  font-size:14px;
  font-weight:800;
  box-shadow:0 14px 28px rgba(79,110,247,.24);
  cursor:pointer;
}

.modal-submit:disabled{
  opacity:.7;
  cursor:wait;
}

.modal-alert{
  margin-bottom:12px;
  padding:11px 12px;
  border-radius:12px;
  font-size:12px;
  font-weight:700;
}

.modal-alert.error{
  border:1px solid rgba(239,107,107,.28);
  background:rgba(239,107,107,.10);
  color:#ffd0d0;
}

.modal-alert.success{
  border:1px solid rgba(50,196,141,.28);
  background:rgba(50,196,141,.10);
  color:#d7ffef;
}

.twofa-panel{
  display:grid;
  gap:12px;
}

.twofa-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.twofa-title{
  font-size:13px;
  font-weight:800;
  color:var(--text);
}

.twofa-copy{
  margin-top:4px;
  color:var(--muted);
  font-size:11px;
  line-height:1.5;
}

.twofa-copy-tight{
  margin-top:0;
}

.twofa-badge{
  display:inline-flex;
  align-items:center;
  min-height:24px;
  padding:0 10px;
  border-radius:999px;
  border:1px solid var(--border);
  font-size:11px;
  font-weight:800;
}

.twofa-badge.is-on{
  color:#d7ffef;
  border-color:rgba(50,196,141,.28);
  background:rgba(50,196,141,.10);
}

.twofa-badge.is-off{
  color:#d7dde6;
  background:rgba(255,255,255,.03);
}

.twofa-setup{
  display:grid;
  gap:8px;
  padding:12px;
  border-radius:12px;
  border:1px solid rgba(79,110,247,.20);
  background:rgba(79,110,247,.08);
}

.twofa-qr-wrap{
  display:flex;
  justify-content:center;
}

.twofa-qr{
  width:148px;
  height:148px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.08);
  background:#fff;
  padding:8px;
}

.twofa-secret-label{
  color:#cdd6ff;
  font-size:11px;
  font-weight:800;
}

.twofa-secret-box{
  padding:10px 12px;
  border-radius:10px;
  background:rgba(8,12,20,.36);
  border:1px solid rgba(255,255,255,.08);
  color:#fff;
  font-size:14px;
  font-weight:800;
  letter-spacing:.14em;
  word-break:break-all;
}

.twofa-actions{
  display:flex;
  align-items:center;
  gap:10px;
}

.twofa-code-input{
  flex:1 1 auto;
  min-height:40px;
  padding:0 12px;
  border-radius:12px;
  border:1px solid var(--border-strong);
  background:rgba(255,255,255,.03);
  color:var(--text);
  outline:none;
}

.twofa-code-input::placeholder{
  color:#7e858f;
}

.twofa-code-input:focus{
  border-color:rgba(79,110,247,.36);
  box-shadow:0 0 0 4px rgba(79,110,247,.12);
}

.twofa-btn{
  min-height:40px;
  padding:0 14px;
  border-radius:12px;
  border:1px solid rgba(79,110,247,.28);
  background:rgba(79,110,247,.12);
  color:#dce4ff;
  font-size:12px;
  font-weight:800;
  cursor:pointer;
}

.twofa-btn:disabled{
  opacity:.7;
  cursor:wait;
}

.content-card,
.card{
  border:1px solid var(--border);
  border-radius:var(--radius-lg);
  background:linear-gradient(180deg, rgba(26,27,31,.96), rgba(19,20,23,.96));
  box-shadow:var(--shadow);
  transition:transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.content-card:hover,
.card:hover{
  transform:translateY(-2px);
  box-shadow:0 28px 64px rgba(0,0,0,.34);
  border-color:rgba(255,255,255,.1);
}

.content-card{
  padding:var(--card-pad);
}

.grid{
  display:grid;
  gap:16px;
}

.grid-2{
  grid-template-columns:repeat(2, minmax(0, 1fr));
}

.grid-3{
  grid-template-columns:repeat(3, minmax(0, 1fr));
}

.grid-4{
  grid-template-columns:repeat(4, minmax(0, 1fr));
}

.row{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.row-end{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.badge,
.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:30px;
  padding:0 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.04);
  color:var(--soft);
  font-size:12px;
  font-weight:700;
}

.dot{
  width:8px;
  height:8px;
  border-radius:999px;
  background:rgba(255,255,255,.28);
}

.dot.ok{ background:var(--green); }
.dot.warn{ background:var(--yellow); }
.dot.bad{ background:var(--red); }

.wrap{
  width:100%;
}

table.ui-table{
  width:100%;
  table-layout:fixed;
  border-collapse:separate;
  border-spacing:0;
  border:1px solid var(--border);
  border-radius:18px;
  overflow:hidden;
  background:rgba(255,255,255,.02);
}

table.ui-table th,
table.ui-table td{
  padding:clamp(12px, .65vw + 8px, 15px) clamp(12px, .7vw + 8px, 16px);
  text-align:left;
  vertical-align:middle;
}

table.ui-table thead th{
  background:rgba(255,255,255,.04);
  color:#b8bec7;
  font-size:clamp(11px, .2vw + 10px, 12px);
  letter-spacing:.08em;
  text-transform:uppercase;
  border-bottom:1px solid var(--border);
}

table.ui-table tbody td{
  border-bottom:1px solid rgba(255,255,255,.05);
}

table.ui-table tbody tr:hover td{
  background:rgba(255,255,255,.03);
}

table.ui-table tbody tr:last-child td{
  border-bottom:0;
}

.users-page .ui-table{
  table-layout:auto;
}

.users-page .ui-table th,
.users-page .ui-table td{
  word-break:normal;
  overflow-wrap:anywhere;
  white-space:nowrap;
}

.users-page .ui-table td.email{
  max-width:320px;
  overflow:hidden;
  text-overflow:ellipsis;
}

.auth-shell{
  min-height:100vh;
}

body.auth-mode .content-shell{
  padding:0;
}

@media (max-width: 1180px){
  .page-title{
    font-size:clamp(28px, 2vw + 14px, 34px);
  }

  .page-lead{
    font-size:13px;
  }

  .app-shell{
    display:block;
  }

  .sidebar{
    position:relative;
    left:auto;
    bottom:auto;
    width:auto;
    height:auto;
    gap:12px;
    padding:14px;
    overflow:visible;
  }

  .sidebar-head{
    padding:8px 10px 14px;
  }

  .side-nav{
    display:grid;
    grid-template-columns:repeat(2, minmax(0, 1fr));
    gap:10px;
  }

  .side-link{
    min-height:52px;
  }

  .sidebar-foot{
    margin-top:0;
  }
}

@media (max-width: 900px){
  .content-shell{
    width:100%;
    margin:0;
    padding:14px;
  }

  .sidebar{
    position:sticky;
    top:0;
    z-index:20;
    left:auto;
    bottom:auto;
    border-right:0;
    border-bottom:1px solid var(--border);
    border-radius:0 0 18px 18px;
    height:auto;
    overflow:visible;
  }

  .shell-topbar{
    padding:14px;
    flex-direction:column;
    align-items:flex-start;
  }

  .shell-topbar-right{
    width:100%;
    justify-content:flex-start;
  }

  .grid-4,
  .grid-3,
  .grid-2{
    grid-template-columns:1fr;
  }

  .side-nav{
    grid-template-columns:1fr;
  }

  .sidebar-foot{
    flex-direction:column;
    align-items:stretch;
  }

  .icon-btn{
    width:100%;
  }
}

@media (max-width: 640px){
  .app-shell{
    display:block;
  }

  .sidebar{
    gap:10px;
    padding:10px;
  }

  .sidebar-head{
    padding:6px 6px 10px;
    gap:9px;
  }

  .brand-copy{
    min-width:0;
  }

  .brand-title{
    font-size:14px;
  }

  .side-nav{
    display:flex;
    gap:8px;
    overflow-x:auto;
    padding-bottom:2px;
    scrollbar-width:none;
  }

  .side-nav::-webkit-scrollbar{
    display:none;
  }

  .side-link{
    min-width:148px;
    flex:0 0 auto;
    padding:10px 12px;
  }

  .side-copy strong{
    font-size:10px;
  }

  .side-copy small{
    font-size:8px;
  }

  .sidebar-foot{
    flex-direction:row;
    align-items:center;
    justify-content:space-between;
    padding:10px;
  }

  .user-chip{
    gap:8px;
    min-width:0;
    max-width:calc(100% - 110px);
  }

  .user-chip-sub{
    max-width:100px;
  }

  .sidebar-actions{
    flex:0 0 auto;
  }

  .icon-btn{
    min-height:38px;
  }

  .content-shell{
    width:100%;
    margin:0;
    padding:10px;
  }

  .page-title{
    font-size:24px;
  }

  .shell-topbar{
    margin-bottom:12px;
    padding:12px;
    border-radius:16px;
  }

  .shell-topbar-right{
    gap:8px;
  }

  .top-pill{
    min-height:34px;
    padding:0 10px;
  }

  .modal-backdrop{
    align-items:end;
    padding:10px;
  }

  .modal-card{
    width:100%;
    max-height:min(92vh, 820px);
    border-radius:18px;
  }

  .modal-body{
    max-height:calc(92vh - 70px);
    overflow:auto;
    -webkit-overflow-scrolling:touch;
  }

  .twofa-actions{
    flex-direction:column;
    align-items:stretch;
  }

  .twofa-btn{
    width:100%;
  }
}

@media (prefers-reduced-motion: reduce){
  *,
  *::before,
  *::after{
    animation:none !important;
    transition:none !important;
    scroll-behavior:auto !important;
  }
}


