.mobile-nav, .mobile-tools, .mobile-quick, .mobile-account { display:none; }
.mobile-panel:not([open]), .mobile-overview[hidden] { display:none; }
.mobile-overview > summary { display:none; }
.mobile-icon { display:block; width:22px; height:22px; flex:0 0 22px; background:currentColor; mask:var(--mobile-icon) center/contain no-repeat; -webkit-mask:var(--mobile-icon) center/contain no-repeat; }
@media (max-width:900px) {
  html { scroll-padding-bottom:90px; }
  body > header, body.theme-dark > header { display:flex; flex-direction:column; gap:8px; padding:10px 12px; }
  .app-brand { width:100%; padding:0; gap:8px; }
  .app-brand > div:not(.mobile-tools) { flex:1; }
  .app-brand img { width:30px; height:30px; flex-basis:30px; }
  .app-brand h1 { font-size:16px; line-height:22px; }
  .app-brand .subtitle { display:none; }
  .mobile-account { display:block; color:var(--muted); font-size:12px; line-height:18px; overflow-wrap:anywhere; }
  .mobile-tools { display:flex; align-items:center; gap:4px; flex-shrink:0; }
  .mobile-tools button, .mobile-close { width:44px; height:44px; padding:10px; display:grid; place-items:center; border:0; border-radius:6px; background:var(--panel-2); color:var(--text); }
  .mobile-tools #loginAuditBell { margin:0; height:44px; width:44px; }
  .mobile-tools #loginAuditBell[hidden] { display:none; }
  .mobile-tools #loginAuditBell img { width:22px; height:22px; }
  body > header .toolbar { display:none; }
  .mobile-quick { display:flex; }
  .mobile-quick:has(#trafficPlayback[hidden]) { display:none; }
  .mobile-quick #trafficPlayback { width:100%; min-width:0; display:flex; align-items:center; gap:8px; }
  .mobile-quick #trafficPlayback[hidden] { display:none; }
  .mobile-quick #trafficPlayback button { height:40px; min-width:66px; border:1px solid var(--line); border-radius:5px; color:var(--text); background:var(--panel-2); font-size:13px; }
  .mobile-quick #trafficPlayback #trafficLiveBtn { color:#fff; background:var(--nav-active); border-color:var(--nav-active); }
  .mobile-quick #trafficPlaybackStatus { margin-left:auto; color:var(--muted); font-size:11px; text-align:right; }
  body > main { padding:12px 12px calc(88px + env(safe-area-inset-bottom)); }
  .status-line { font-size:11px; margin-bottom:8px; }
  .summary { grid-template-columns:repeat(3,minmax(0,1fr)); row-gap:12px; margin-bottom:12px; padding:0 0 12px; }
  .summary .metric { padding:2px 8px; }
  .summary .metric:nth-child(3n) { border-right:0; }
  .summary .metric:nth-child(3n+1) { padding-left:0; }
  .summary .value { font-size:20px; }
  .mobile-nav { display:flex; justify-content:space-around; position:fixed; z-index:80; bottom:0; left:0; right:0; background:var(--panel); border-top:1px solid var(--line); padding:4px max(8px,env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); }
  .mobile-nav button { flex:1; min-width:0; max-width:140px; height:54px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; border:0; border-radius:5px; background:transparent; color:var(--muted); padding:4px; font-size:11px; line-height:14px; }
  .mobile-nav button span { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .mobile-nav button.active { color:var(--accent); background:var(--nav); }
  .mobile-nav button.active .mobile-icon { width:24px; height:24px; }
  body.locked .mobile-nav, body.locked .mobile-tools, body.locked .mobile-quick { display:none; }
  body.mobile-panel-open { overflow:hidden; }
  .mobile-panel { box-sizing:border-box; position:fixed; inset:auto 0 0; width:100%; max-width:760px; max-height:88vh; max-height:88dvh; margin:0 auto; padding:0 16px calc(20px + env(safe-area-inset-bottom)); border:1px solid var(--line); border-radius:8px 8px 0 0; background:var(--panel); color:var(--text); overflow-y:auto; overscroll-behavior:contain; }
  .mobile-panel::backdrop { background:#0008; }
  .mobile-panel-head { display:flex; align-items:center; justify-content:space-between; gap:12px; position:sticky; top:0; z-index:4; padding:12px 0; background:var(--panel); border-bottom:1px solid var(--line); margin-bottom:12px; }
  .mobile-panel-head h2 { margin:0; font-size:18px; line-height:24px; }
  .mobile-panel .control-bar { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; padding:0; border:0; }
  .mobile-panel .control-bar > * { min-width:0; max-width:100%; width:100%; }
  .mobile-panel .control-bar > [hidden] { display:none; }
  .mobile-panel .control-bar #routerSelect, .mobile-panel #partnerRouterBadge, .mobile-panel #interfaceTools, .mobile-panel .custom-select, .mobile-panel #currentAccount { grid-column:1/-1; }
  .mobile-panel #interfaceTools { display:grid; gap:12px; grid-template-columns:minmax(0,1fr); }
  .mobile-panel #interfaceTools[hidden] { display:none; }
  .mobile-panel .control-bar input, .mobile-panel .control-bar select, .mobile-panel .control-bar button { min-width:0; width:100%; height:44px; font-size:16px; font-weight:500; }
  .mobile-panel .custom-select-menu { position:static; margin:6px 0 0; max-height:240px; overflow:auto; box-shadow:none; }
  .mobile-panel .custom-select-option { text-align:left; }
  .mobile-menu-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .mobile-menu-list[hidden], .mobile-controls[hidden] { display:none; }
  .mobile-menu-list button { display:flex; gap:12px; align-items:center; min-height:52px; padding:12px; border:1px solid var(--line); border-radius:5px; background:var(--panel); color:var(--text); font-size:13px; text-align:left; overflow-wrap:anywhere; }
  .mobile-menu-list button.active { color:var(--accent); background:var(--nav); border-color:var(--accent); }
  .mobile-overview { border-bottom:1px solid var(--line); margin:0 0 14px; }
  .mobile-overview > summary { display:flex; align-items:center; gap:8px; min-height:46px; cursor:pointer; font-weight:600; color:var(--text); list-style:none; }
  .mobile-overview > summary::-webkit-details-marker { display:none; }
  .mobile-overview > summary::after { content:'+'; margin-left:auto; font-size:22px; font-weight:400; }
  .mobile-overview[open] > summary::after { content:'-'; }
  .mobile-overview #topTraffic { margin:8px 0 0; border-bottom:0; }
  #topTraffic .tt-interface { height:auto; min-height:36px; white-space:normal; overflow-wrap:anywhere; }
  body.traffic-view #cards { grid-template-columns:minmax(0,1fr); }
  body.traffic-view .card { padding:14px; }
  body.traffic-view .card-head { min-height:48px; }
  .admin-panel { grid-template-columns:minmax(0,1fr); }
  .admin-panel input, .admin-panel select, .admin-panel textarea, .settings-fields input, .settings-fields select, .vpn input, .vpn select, .ipam input, .ipam select, .login-field input { font-size:16px; }
  .vpn-tabs, .ipam-tabs { overflow-x:auto; flex-wrap:nowrap; }
  .vpn-tabs button, .ipam-tabs button { white-space:nowrap; min-height:44px; }
  .login-screen { min-height:100dvh; }
}
@media (max-width:360px) { .mobile-tools { gap:2px; } .app-brand h1 { font-size:14px; } .summary .value { font-size:18px; } }
@media print { .mobile-nav,.mobile-tools,.mobile-quick,.mobile-panel,.mobile-overview > summary { display:none !important; } }
