:root{
  --bg:#0b0c0e;
  --panel:#121418;
  --panel2:#0f1114;
  --border:#2b2e35;
  --text:#d7dbe2;
  --muted:#9aa3b2;
  --good:#00ff6a;
  --bad:#ff3b3b;
  --accent:#00b7ff;
  --pill:#20242c;
}

*{box-sizing:border-box; -webkit-touch-callout:none;}

/* Prevent long-press text selection and callout on touch devices */
a, button, .btn, .nav-btn, input, select, textarea, .link, [role="button"] {
  touch-action: manipulation;
  -webkit-touch-callout: none;
}
html,body{height:100%}
body{
  margin:0;
  background: radial-gradient(1200px 800px at 30% 10%, #11151c 0%, var(--bg) 55%) fixed;
  color:var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
}

a{color:inherit; text-decoration:none}
.mono{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;}
.muted{color:var(--muted)}
.good{color:var(--good); font-weight:700}
.bad{color:var(--bad); font-weight:700}
.text-small{font-size:12px}

.app-shell{min-height:100%; display:flex; flex-direction:column}

.topbar{
  display:flex;
  align-items:center;
  gap:14px;
  padding:12px 16px;
  border-bottom:1px solid var(--border);
  background: linear-gradient(180deg, #0f1218 0%, #0c0e12 100%);
  position:sticky;
  top:0;
  z-index:10;
}

.brand{min-width:220px; display:flex; align-items:center; gap:10px}
.brand-logo{display:inline-flex; align-items:center; justify-content:center; text-decoration:none}
.brand-logo img{height:34px; width:auto; display:block}
.brand-text{display:flex; flex-direction:column; line-height:1.05}
.brand-title{
  font-weight:900;
  letter-spacing:1px;
  font-size:18px;
}
.brand-sub{color:var(--muted); font-size:12px}
.tier-badge{font-weight:900; letter-spacing:1px; vertical-align:baseline}
.tier-pro{color:#d4a843; text-shadow:0 0 6px rgba(212,168,67,0.3)}
.tier-std{color:#a8b4c4; text-shadow:0 0 6px rgba(168,180,196,0.2)}

.nav{display:flex; gap:10px; flex:1; flex-wrap:wrap}
.nav-btn{
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:10px;
  background: linear-gradient(180deg, #141820 0%, #10131a 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset;
  transition: transform .06s ease, border-color .2s ease, box-shadow .2s ease;
  font-weight:600;
}
.nav-btn:hover{transform: translateY(-1px); border-color:#3a3f49}
.nav-btn:active{transform: translateY(0px)}

/* Active main nav tab — blue border highlight */
.nav-btn.active{
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0,160,255,0.08);
}

/* Community tab — new message notification (gentle green pulse) */
.nav-btn.nav-has-new {
  position: relative;
  animation: nav-new-pulse 1.5s ease-in-out infinite;
}
.nav-btn.nav-has-new .nav-badge-new {
  display: inline-block !important;
  margin-left: 6px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(0, 255, 106, 0.3);
  color: #00ff6a;
  border-radius: 4px;
  animation: nav-badge-illuminate 1.5s ease-in-out infinite;
}
@keyframes nav-new-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 255, 106, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(0, 255, 106, 0.12); }
}
@keyframes nav-badge-illuminate {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

/* Active sub-tabs — blue border highlight (consistent across GPS, Tyres, Suspension, Dash, Data Analysis, Assistant, Video, CAN Live) */
.subtab.active,
.tyres-subtab.active,
.tab-btn.active,
.dm-subtabs .subtab.active,
.ds-inner-tabs .subtab.active,
.da-page .subtab.active,
.cld-tab-btn.cld-tab-active {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px rgba(0,160,255,0.08);
}

.userbox{
  min-width:260px;
  text-align:right;
}
.userline{font-size:13px}
.user-name{font-weight:800}
.user-handle{color:var(--muted); margin-left:6px}
.user-actions{font-size:12px; color:var(--muted); margin-top:4px}
.link{color:var(--accent); text-decoration:none}
.link:hover{text-decoration:underline}

/* Mobile menu toggle — hidden on desktop; drawer uses display:contents so nav/userbox stay in topbar row */
.topbar-menu-btn{
  display:none;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border:1px solid var(--border);
  border-radius:10px;
  background: linear-gradient(180deg, #141820 0%, #10131a 100%);
  color:var(--text);
  font-weight:700;
  font-size:13px;
  cursor:pointer;
  flex-shrink:0;
}
.topbar-menu-btn:hover{border-color:#3a3f49}
.topbar-menu-btn[aria-expanded="true"]{
  border-color:var(--accent);
  box-shadow:0 0 0 2px rgba(0,160,255,0.08);
}
.topbar-menu-icon{
  width:16px; height:12px; position:relative; display:inline-block;
}
.topbar-menu-icon::before,
.topbar-menu-icon::after,
.topbar-menu-icon{
  background:currentColor;
}
.topbar-menu-icon::before,
.topbar-menu-icon::after{
  content:'';
  position:absolute; left:0; right:0; height:2px; border-radius:1px;
}
.topbar-menu-icon::before{ top:0; box-shadow:0 5px 0 currentColor; }
.topbar-menu-icon::after{ bottom:0; }
.topbar-drawer{display:contents}
.topbar-menu-backdrop{
  display:none;
  position:fixed; inset:0;
  background:rgba(0,0,0,0.45);
  z-index:98;
}
body.topbar-menu-open .topbar-menu-backdrop{display:block}
body.topbar-menu-open{overflow:hidden}
.sep{margin:0 6px; color:#596070}

.content{flex:1; padding:18px}
.footer{padding:10px 16px; border-top:1px solid var(--border); background:#0b0d11}
.footer-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 16px;
  align-items: start;
  line-height: 1.35;
}
.footer-col{
  display:grid;
  grid-auto-rows: min-content;
  row-gap: 2px;
}
.footer-row{
  display:grid;
  grid-template-columns: 140px 1fr;
  column-gap: 12px;
  align-items: baseline;
}
.footer-grid .k{
  color: rgba(154,163,178,0.95);
  font-size: 12px;
}
.footer-grid .v{
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.footer-grid .v.mono{
  letter-spacing: 0.2px;
}
.footer-kv{
  display:grid;
  grid-template-columns: 140px 1fr;
  column-gap: 12px;
  row-gap: 2px;
  align-items: baseline;
  line-height: 1.35;
}
.footer-kv .k{
  color: rgba(154,163,178,0.95);
  font-size: 12px;
}
.footer-kv .v{
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.footer-kv .v.mono{
  letter-spacing: 0.2px;
}

/* --- Login page focus treatment --- */
body.login-page .topbar{display:none;}
body.login-page .content{padding-top:0;}
body.login-page .login-screen{position:relative; min-height: calc(100vh - 80px); display:flex; align-items:center; justify-content:center;}

/* HF294: Simulated checkout modal polish */
#vcCheckoutModal .panel{max-height: calc(100vh - 80px); overflow:auto; border:1px solid rgba(255,255,255,0.10);}
#vcCheckoutModal input[disabled]{opacity:0.75; cursor:not-allowed;}
body.login-page .login-dimmer{position:fixed; inset:0; background: rgba(0,0,0,0.50); z-index:25; pointer-events:none;}
body.login-page .login-panel{position:relative; z-index:30;}
body.login-page .login-card{padding:32px 28px 24px; max-width:420px;}
body.login-page .login-brand{display:flex; align-items:center; gap:14px; margin-bottom:24px;}
body.login-page .login-logo{width:52px; height:52px; border-radius:12px; flex-shrink:0; filter: drop-shadow(0 2px 10px rgba(0,0,0,0.5));}
body.login-page .login-brand-text{display:flex; flex-direction:column; line-height:1.1;}
body.login-page .login-brand-title{font-weight:900; letter-spacing:1px; font-size:22px; color:var(--text);}
body.login-page .login-brand-sub{color:var(--muted); font-size:12px; margin-top:3px;}
body.login-page .login-footer-links{text-align:center; margin-top:16px;}
body.login-page .login-footer-links .link{color:var(--accent); font-size:13px; font-weight:600;}
body.login-page .login-footer-links .link:hover{text-decoration:underline;}
body.login-page .login-legal{text-align:center; margin-top:18px; padding-top:14px; border-top:1px solid rgba(255,255,255,0.06); font-size:11px;}
body.login-page .login-legal a{color:var(--accent); text-decoration:none;}
body.login-page .login-legal a:hover{text-decoration:underline; color:var(--text);}
body.login-page .login-legal-sep{margin:0 8px; color:var(--muted); opacity:0.4;}
body.login-page .login-copyright{text-align:right; margin-top:10px; font-size:10px; color:var(--muted); opacity:0.45;}
body.landing-page .landing-tagline{text-align:center; margin:0 0 20px; font-size:14px; line-height:1.5;}
body.landing-page .landing-logo-knock{cursor:pointer;}
body.landing-page .landing-signin-wrap{text-align:center; margin-bottom:8px;}
body.landing-page .landing-signin-btn{display:inline-block; min-width:180px; text-align:center; text-decoration:none;}

.panel{
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel2) 100%);
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.panel h1{margin:0 0 10px 0; font-size:20px}
.panel h2{margin:0 0 10px 0; font-size:14px; letter-spacing:.2px; color:#cdd3df}
.narrow{max-width:520px; margin:0 auto}

.form{display:flex; flex-direction:column; gap:10px}
input{
  width:100%;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#0b0d12;
  color:var(--text);
}
input:disabled{opacity:.6}

/* Radios/checkboxes should not inherit text-input sizing/padding (fixes misaligned option rows in modals). */
input[type="radio"],
input[type="checkbox"]{
  width:auto;
  padding:0;
  border:0;
  background:transparent;
  box-shadow:none;
  vertical-align:middle;
  display:inline-block;
}

.btn{
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#0b0d12;
  color:var(--text);
  cursor:pointer;
  font-weight:700;
}
.btn.primary{
  background: linear-gradient(180deg, #1a2530 0%, #121b24 100%);
  border-color:#2d3a4a;
}
.btn.primary:hover{border-color:#3f5772}

.flash-wrap{display:flex; flex-direction:column; gap:8px; margin-bottom:12px}
.flash{
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#0c1016;
}
.flash-error{border-color:#4a2d2d; color:#ffbdbd}
.flash-success{border-color:#234a2d; color:#bfffd0}
.flash-info{border-color:#2d3a4a; color:#cfe7ff}

.grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:14px;
}
@media (max-width: 1100px){
  .grid{grid-template-columns:1fr}
}

.module-list{display:grid; grid-template-columns:1fr 1fr; gap:10px}
@media (max-width: 900px){
  .module-list{grid-template-columns:1fr}
}

.module-tile{
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px;
  background:#0c0f15;
  transition: border-color .2s ease, transform .06s ease;
}
.module-tile:hover{border-color:#3a3f49; transform: translateY(-1px)}
.module-title{font-weight:800}
.module-sub{font-size:12px}

.card{
  margin-top:10px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#0c0f15;
}
.card-title{font-weight:800; margin-bottom:8px}
.kv{display:flex; justify-content:space-between; gap:10px; padding:4px 0}
.kv span:first-child{color:var(--muted)}

.module-shell{display:flex; flex-direction:column; gap:12px}
.module-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
}
.pill{
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:999px;
  background: var(--pill);
  color: #c9d2e0;
  font-weight:800;
  font-size:12px;
}

.module-grid{
  display:grid;
  grid-template-columns: 320px 1fr 320px;
  gap:14px;
}
@media (max-width: 1200px){
  .module-grid{grid-template-columns:1fr}
}

.placeholder-canvas{
  margin-top:10px;
  height:380px;
  border:1px dashed #2a2f3a;
  border-radius:12px;
  background: radial-gradient(900px 500px at 20% 30%, rgba(0,183,255,0.08) 0%, rgba(0,0,0,0) 60%);
}

.swirl-box{
  height:200px;
  border:1px solid var(--border);
  border-radius:12px;
  background:
    url("../img/topo.svg"),
    radial-gradient(900px 400px at 20% 30%, rgba(255,255,255,0.03) 0%, rgba(0,0,0,0) 70%);
  background-size: cover;
  background-position:center;
  opacity: 0.95;
  padding:12px;
}

/* Embedded tooling container (e.g., chassis program) */
.embed-frame{
  width:100%;
  height:70vh;
  min-height:520px;
  border:1px solid var(--border);
  border-radius:12px;
  overflow:hidden;
  background:#0b0d12;
}
.embed-iframe{
  display:block;
  width:100%;
  height:100%;
  border:0;
  background:#0b0d12;
}

.assistant-grid{
  display:grid;
  grid-template-columns: 360px 1fr;
  gap:14px;
}
@media (max-width: 1200px){
  .assistant-grid{grid-template-columns:1fr}
}
.assistant-panel{display:flex; flex-direction:column; min-height:520px}
.chat{
  flex:1;
  overflow:auto;
  padding:10px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#0b0d12;
}
.chat-msg{margin:8px 0; padding:10px 12px; border-radius:12px; max-width:78%}
.chat-user{background:#122231; border:1px solid #22394d; margin-left:auto}
.chat-bot{background:#10151f; border:1px solid #273042}
.chat-form{display:flex; gap:10px; margin-top:10px}
.chat-form input{flex:1}

/* Save Config status */
#saveConfigStatus{font-size:12px; opacity:0.9}
#saveConfigStatus.ok{color:#7CFF9E}
#saveConfigStatus.err{color:#FF8A8A}


/* Button interaction feedback */
.btn {
  transition: filter 0.12s ease, border-color 0.12s ease, background 0.12s ease, transform 0.04s ease;
}
.btn:hover {
  filter: brightness(1.08);
  border-color: var(--border-strong);
}
.btn:active {
  transform: translateY(1px);
  filter: brightness(0.95);
}
.btn:focus-visible {
  outline: 2px solid rgba(78,161,255,0.65);
  outline-offset: 2px;
}
.btn:disabled,
.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

/* Utility helpers */
.hidden{display:none !important;}

/* Smaller button variant used heavily in the Video module */
.btn-small{
  padding:6px 10px;
  font-size:12px;
  border-radius:10px;
}

/* Added by apply_podium_hotfixes_v1.py: danger button styling */
.btn.danger{
  background: linear-gradient(180deg, #2a1515 0%, #1b1010 100%);
  border-color:#4a2d2d;
  color:#ffbdbd;
}
.btn.danger:hover{
  border-color:#6a3a3a;
}

/* ================================================================
   HF133: Mobile-responsive tables — global base
   Two modes:
   1) .mob-cards on <table>  — rows become stacked cards (narrow tables)
   2) .mob-scroll on wrapper — horizontal touch-scroll (wide tables)
   data-label attr on <td> supplies header text in card mode.
   ================================================================ */

@media (max-width: 768px) {
  /* ── Scroll wrappers: touch-friendly ── */
  .mob-scroll,
  .p2p-table-wrap,
  .gps-table-wrap,
  .bugs-table-wrap,
  .table-wrap,
  .sector-wrap {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    position: relative;
  }

  .mob-scroll { position: relative; }
  .mob-scroll::after {
    content: '';
    position: sticky;
    right: 0;
    top: 0;
    float: right;
    width: 28px;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(11,12,14,0.85));
    pointer-events: none;
    z-index: 4;
  }

  /* ── Wide tables: enforce min-width so columns don't crush ── */
  .mob-scroll table,
  .p2p-table-wrap table,
  .gps-table-wrap table,
  .bugs-table-wrap table {
    min-width: 600px;
  }

  /* ── All tables: mobile base sizing ── */
  table th,
  table td {
    font-size: 12px;
    padding: 6px 8px;
  }

  /* ── Card-layout tables ── */
  table.mob-cards thead {
    display: none;
  }
  table.mob-cards,
  table.mob-cards tbody {
    display: block;
    width: 100%;
  }
  table.mob-cards tbody tr {
    display: block;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    background: var(--panel2);
  }
  table.mob-cards tbody tr:last-child { margin-bottom: 0; }
  table.mob-cards tbody td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 4px 0;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 13px;
    min-height: 32px;
  }
  table.mob-cards tbody td:last-child {
    border-bottom: none;
  }
  table.mob-cards tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--muted);
    margin-right: 10px;
    flex-shrink: 0;
    font-size: 12px;
    max-width: 45%;
  }
  table.mob-cards tbody td input {
    max-width: 55%;
    min-height: 34px;
    font-size: 13px;
  }

  /* ── Admin .table class ── */
  .panel table.table {
    min-width: 500px;
  }
}

/* ================================================================
   HF111: Mobile-responsive header
   Stacks topbar vertically, compact brand, scrollable nav strip,
   collapsible user actions.  Desktop is unchanged.
   ================================================================ */
@media (max-width: 768px) {
  .topbar {
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 6px;
  }

  /* Brand: shrink, hide subtitle */
  .brand { min-width: unset; gap: 6px; }
  .brand-logo img { height: 28px; }
  .brand-title { font-size: 14px; }
  .brand-sub { display: none; }

  /* Nav: horizontal scroll strip, no wrapping */
  .nav {
    order: 3;
    flex: 0 0 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding: 4px 0;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-btn {
    flex: 0 0 auto;
    padding: 8px 14px;
    font-size: 13px;
    white-space: nowrap;
    min-height: 40px;
  }

  /* Userbox: compact, right-aligned, wraps neatly */
  .userbox {
    min-width: unset;
    flex: 1;
    text-align: right;
  }
  .userline { font-size: 12px; }
  .user-actions {
    font-size: 11px;
    line-height: 2;
  }
  .user-actions .sep { margin: 0 3px; }

  /* Content area: reduce side padding */
  .content { padding: 8px; }

  /* ── HF134: Full mobile layout stacking ── */

  /* Footer: single column */
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .footer-row,
  .footer-kv {
    grid-template-columns: 100px 1fr;
    column-gap: 8px;
  }
  .footer { padding: 8px 10px; }

  /* Module head: stack title and pills */
  .module-head {
    flex-direction: column;
    gap: 6px;
  }

  /* All 2-col grids stack */
  .grid { grid-template-columns: 1fr; }

  /* Module list (home page tiles) */
  .module-list { grid-template-columns: 1fr; }

  /* Module grid (3-col with sidebars) */
  .module-grid { grid-template-columns: 1fr !important; }

  /* Assistant grid (sidebar + content) */
  .assistant-grid { grid-template-columns: 1fr !important; }

  /* Panels breathe more */
  .panel { padding: 10px; border-radius: 10px; }
  .panel h1 { font-size: 17px; }
  .panel h2 { font-size: 13px; }

  /* Pill tags compact */
  .pill { font-size: 11px; padding: 6px 8px; }

  /* Buttons: touch-friendly minimum size */
  .btn, .btn-small {
    min-height: 42px;
    font-size: 13px;
    padding: 8px 12px;
  }

  /* Inputs: touch-friendly */
  input, select, textarea {
    min-height: 42px;
    font-size: 14px;
  }

  /* Narrow constraint: full width on mobile */
  .narrow { max-width: 100%; }

  /* kv rows: stack if very narrow */
  .kv { flex-wrap: wrap; }
}

/* ================================================================
   HF310: Portrait orientation — compact header so it doesn't eat
   half the viewport. Applies to narrow+tall screens (tablets
   rotated to portrait, phones).
   ================================================================ */
@media (max-width: 768px) and (orientation: portrait) {
  .topbar {
    flex-wrap: nowrap;
    align-items: center;
    padding: 6px 8px;
    gap: 4px;
    overflow: visible;
  }

  .brand { min-width: unset; gap: 4px; flex-shrink: 0; }
  .brand-logo img { height: 24px; }
  .brand-title { font-size: 12px; letter-spacing: 0.5px; }
  .brand-sub { display: none; }

  .nav {
    order: 0;
    flex: 1 1 0%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    padding: 0;
    scrollbar-width: none;
    min-width: 0;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-btn {
    flex: 0 0 auto;
    padding: 6px 10px;
    font-size: 11px;
    white-space: nowrap;
    min-height: 34px;
    border-radius: 8px;
  }

  .userbox {
    min-width: unset;
    flex-shrink: 0;
  }
  .userline { display: none; }
  .user-actions {
    font-size: 11px;
    white-space: nowrap;
    line-height: 1.6;
  }
  .user-actions .sep { margin: 0 2px; }
}

/* Wider tablets in portrait (e.g. 768-1024px wide) */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait) {
  .topbar {
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 6px;
  }
  .brand { min-width: unset; gap: 6px; }
  .brand-logo img { height: 28px; }
  .brand-title { font-size: 14px; }
  .brand-sub { display: none; }

  .nav {
    order: 3;
    flex: 0 0 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding: 2px 0;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-btn {
    flex: 0 0 auto;
    padding: 7px 12px;
    font-size: 12px;
    white-space: nowrap;
    min-height: 36px;
  }

  .userbox { min-width: unset; flex: 1; text-align: right; }
  .userline { font-size: 12px; }
  .user-actions { font-size: 11px; line-height: 1.8; }
}

/* ================================================================
   HF446: Mobile header drawer — module nav + account links collapse
   into a Menu dropdown so visual pages keep the viewport.
   Desktop unchanged (drawer uses display:contents).
   ================================================================ */
@media (max-width: 900px) {
  .topbar {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
  }

  .brand {
    min-width: 0;
    flex: 1 1 auto;
    gap: 8px;
  }
  .brand-logo img { height: 28px; }
  .brand-title { font-size: 14px; }
  .brand-sub { display: none; }

  .topbar-menu-btn {
    display: inline-flex;
    margin-left: auto;
    min-height: 40px;
  }

  .topbar-drawer {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    top: var(--topbar-mobile-height, 52px);
    max-height: calc(100vh - var(--topbar-mobile-height, 52px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 99;
    padding: 10px 12px 16px;
    background: linear-gradient(180deg, #0f1218 0%, #0c0e12 100%);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  }

  .topbar.is-menu-open .topbar-drawer { display: block; }

  .topbar-drawer .nav {
    order: unset;
    flex: unset;
    flex-direction: column;
    flex-wrap: nowrap;
    overflow: visible;
    gap: 8px;
    padding: 0;
  }

  .topbar-drawer .nav-btn {
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    white-space: normal;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 14px;
  }

  .topbar-drawer .userbox {
    min-width: unset;
    width: 100%;
    text-align: left;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

  .topbar-drawer .userline {
    display: block;
    margin-bottom: 8px;
  }

  .topbar-drawer .user-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    font-size: 13px;
    line-height: 1.5;
    white-space: normal;
  }

  .topbar-drawer .user-actions .sep { display: none; }

  .topbar-drawer .user-actions .link {
    display: block;
    width: 100%;
    padding: 10px 4px;
    min-height: 44px;
    box-sizing: border-box;
  }
}