/* ---- Sidebar ------------------------------------------------------------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-3);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  /* Width (desktop collapse) still transitions in CSS. transform is left
     untransitioned here on purpose: on mobile it's a spring-driven drag
     gesture (scripts/sidebar.js via motion.js) that sets it every frame,
     and a CSS transition racing a JS-driven inline style causes jank. */
  transition: width var(--dur-3) var(--ease-out);
}
.sidebar[data-collapsed="true"] { width: var(--sidebar-mini); }

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-2);
  margin-bottom: var(--sp-3);
  min-height: 44px;
}
.brand-logo {
  flex: 0 0 36px;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: linear-gradient(150deg, var(--accent-strong), var(--accent-quiet));
  color: var(--text-on-accent);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  box-shadow: var(--glow-accent);
}
.brand-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: #fff;
}

.nav-list { display: flex; flex-direction: column; gap: 3px; min-height: 0; overflow-y: auto; }
.nav-section-label {
  padding: var(--sp-4) var(--sp-3) var(--sp-1);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sidebar-text-muted);
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 42px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-md);
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
}
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}
.nav-item.active .icon { color: var(--accent-strong); }
.nav-item .icon {
  flex: 0 0 20px;
  width: 20px; height: 20px;
  fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  color: var(--sidebar-text-muted);
  transition: color var(--dur-2) var(--ease-out);
}
.nav-item.active .icon, .nav-item:hover .icon { color: var(--accent-strong); }
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 14px; font-weight: 500; }
.icon--external {
  flex: 0 0 13px;
  width: 13px; height: 13px;
  margin-left: auto;
  color: var(--sidebar-text-muted);
  opacity: 0.7;
}
.nav-item:hover .icon--external, .nav-item.active .icon--external { color: inherit; opacity: 0.85; }

/* Top row: mobile drawer toggle (outside), collapse toggle */
.sidebar__top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: -4px;
}
.collapse-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--sidebar-text-muted);
  transition: color var(--dur-2) var(--ease-out), background-color var(--dur-2) var(--ease-out);
}
.collapse-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.collapse-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Bottom profile row (ChatGPT-style) */
.sidebar__footer {
  position: relative;
  margin-top: auto;
  padding-top: var(--sp-2);
  border-top: 1px solid var(--sidebar-border);
}
.profile-trigger {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: 52px;
  padding: var(--sp-2) var(--sp-2);
  border-radius: var(--r-md);
  color: var(--sidebar-text);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur-2) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .profile-trigger:hover { background: rgba(255, 255, 255, 0.06); }
}
.profile-trigger[aria-expanded="true"] { background: rgba(255, 255, 255, 0.08); }
.profile-trigger__avatar {
  flex: 0 0 34px;
  width: 34px; height: 34px;
  display: inline-grid; place-items: center;
  border-radius: var(--r-pill);
  background: linear-gradient(150deg, var(--accent-strong), var(--accent-quiet));
  color: var(--text-on-accent);
  font-weight: 700;
  font-size: 14px;
}
.profile-trigger__meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1 1 auto;
}
.profile-trigger__email {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-trigger__plan {
  font-size: 11.5px;
  color: var(--sidebar-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-trigger__chevron {
  flex: 0 0 16px;
  width: 16px; height: 16px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  color: var(--sidebar-text-muted);
  transition: color var(--dur-2) var(--ease-out);
}
.profile-trigger[aria-expanded="true"] .profile-trigger__chevron { color: var(--accent-strong); }

/* Collapsed desktop sidebar */
.sidebar[data-collapsed="true"] .brand-text,
.sidebar[data-collapsed="true"] .nav-label,
.sidebar[data-collapsed="true"] .icon--external,
.sidebar[data-collapsed="true"] .nav-section-label { display: none; }
.sidebar[data-collapsed="true"] .nav-item { justify-content: center; padding-inline: 0; }
.sidebar[data-collapsed="true"] .sidebar__brand { justify-content: center; padding-inline: 0; }
.sidebar[data-collapsed="true"] .sidebar__top { justify-content: center; }
.sidebar[data-collapsed="true"] .profile-trigger { justify-content: center; padding-inline: 0; }
.sidebar[data-collapsed="true"] .profile-trigger__meta,
.sidebar[data-collapsed="true"] .profile-trigger__chevron { display: none; }

/* ---- Telegram connect row ------------------------------------------------ */
.tg-connect {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 46px;
  padding: 6px var(--sp-3);
  border-radius: var(--r-md);
  transition: background-color var(--dur-2) var(--ease-out);
}
.tg-connect:hover { background: var(--surface-3); }
.tg-connect__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(34, 158, 217, 0.35);
}
.tg-connect__badge .tg-glyph {
  width: 32px;
  height: 32px;
}
.tg-connect__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.tg-connect__title { font-weight: 600; font-size: 14px; color: var(--text); line-height: 1.2; }
.tg-connect__state { font-size: 12px; color: var(--text-muted); line-height: 1.2; }
.tg-connect.is-linked .tg-connect__state { color: var(--accent); }
.tg-connect__action { flex: 0 0 auto; margin: 0; }
.tg-connect__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--dur-2) var(--ease-out),
              border-color var(--dur-2) var(--ease-out),
              color var(--dur-2) var(--ease-out),
              transform var(--dur-1) var(--ease-out);
}
.tg-connect__btn:active { transform: scale(0.96); }
.tg-connect__btn--link { background: var(--accent); color: #fff; }
.tg-connect__btn--unlink {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-strong);
}
@media (hover: hover) and (pointer: fine) {
  .tg-connect .tg-connect__btn--link:hover { background: var(--accent); filter: brightness(1.08); }
  .tg-connect .tg-connect__btn--unlink:hover { background: transparent; color: var(--danger); border-color: var(--danger); }
}

.modal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); }
.modal__head .panel-title { margin: 0; }

/* ---- Profile popover (sidebar footer menu) -------------------------------
   Single panel whose content swaps in place (main <-> accounts), ChatGPT-
   style — there is no second flyout panel with a gap to lose :hover over. */
.profile-popover {
  position: absolute;
  left: var(--sp-2);
  right: var(--sp-2);
  bottom: calc(100% + var(--sp-2));
  border-radius: var(--r-lg);
  background: var(--material-thin-bg);
  backdrop-filter: blur(var(--material-thin-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--material-thin-blur)) saturate(160%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-sticky);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scale(0.96);
  transform-origin: var(--origin-x, 0%) var(--origin-y, 100%);
  pointer-events: none;
  /* Materialize is a JS spring (scripts/motion.js) — see .dropdown above for
     why there's no CSS transition here. */
}
.profile-popover.is-open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); pointer-events: auto; }
.profile-popover__views { position: relative; }
.profile-popover__view { padding: var(--sp-2); display: flex; flex-direction: column; gap: 2px; }
.profile-popover__view[hidden] { display: none; }

.profile-popover__back {
  display: flex; align-items: center; gap: var(--sp-2);
  min-height: 36px; padding: 0 var(--sp-2) 0 6px;
  margin-bottom: 2px;
  border-radius: var(--r-md);
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.profile-popover__back:hover { background: var(--surface-3); color: var(--text); }
.profile-popover__back svg {
  width: 16px; height: 16px; fill: none; stroke: currentColor;
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}

.profile-popover__divider { height: 1px; margin: var(--sp-1) var(--sp-1); background: var(--border); }

.profile-popover__item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: 42px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--dur-1) var(--ease-out);
}
.profile-popover__item:hover { background: var(--surface-3); }
.profile-popover__item-icon {
  flex: 0 0 18px;
  width: 18px; height: 18px;
  fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  color: var(--text-muted);
}
.profile-popover__item--danger { color: var(--danger-text); }
.profile-popover__item--danger .profile-popover__item-icon { color: inherit; }
.profile-popover__item--danger:hover { background: var(--danger-soft); }
.profile-popover__item--switch { min-height: 52px; }
.profile-popover__item--current { cursor: default; }
.profile-popover__item--current:hover { background: transparent; }
.profile-popover__item--add { color: var(--accent); font-weight: 600; }
.profile-popover__form { margin: 0; }

.profile-popover__avatar {
  flex: 0 0 32px;
  width: 32px; height: 32px;
  display: inline-grid; place-items: center;
  border-radius: var(--r-pill);
  background: linear-gradient(150deg, var(--accent-strong), var(--accent-quiet));
  color: var(--text-on-accent);
  font-weight: 700;
  font-size: 13px;
}
.profile-popover__account-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
.profile-popover__account-email {
  flex: 1 1 auto;
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.profile-popover__account-hint { font-size: 11.5px; color: var(--text-muted); }
.profile-popover__chevron {
  flex: 0 0 16px; width: 16px; height: 16px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  color: var(--text-muted);
}
.profile-popover__check {
  flex: 0 0 16px; width: 16px; height: 16px;
  fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
}
.profile-popover__add-icon {
  flex: 0 0 32px; width: 32px; height: 32px;
  display: inline-grid; place-items: center;
  border-radius: var(--r-pill);
  border: 1px dashed var(--border-strong);
  color: var(--accent);
}
.profile-popover__add-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Settings modal (two-pane, fixed height across all tabs) ------------- */
.settings-modal__dialog {
  width: min(100%, 680px);
  padding: 0;
  gap: 0;
  overflow: hidden;
}
.settings-modal__dialog .modal__head {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.settings-modal__body { display: flex; height: min(560px, 72vh); min-width: 0; }
.settings-nav {
  flex: 0 0 208px;
  display: flex; flex-direction: column;
  padding: var(--sp-3);
  border-right: 1px solid var(--border);
  background: var(--surface-2, transparent);
}
.settings-nav__tabs { display: flex; flex-direction: column; gap: 2px; }
.settings-nav__tab {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 40px; padding: 0 var(--sp-3);
  border-radius: var(--r-md);
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  text-align: left; cursor: pointer;
  transition: background-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.settings-nav__tab:hover { background: var(--surface-3); color: var(--text); }
.settings-nav__tab.is-active { background: var(--accent-soft); color: var(--accent); }
.settings-nav__icon {
  flex: 0 0 18px; width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.settings-nav__account {
  display: flex; align-items: center; gap: var(--sp-2);
  margin-top: auto; padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}
.settings-nav__avatar {
  flex: 0 0 34px; width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  background: linear-gradient(150deg, var(--accent-strong), var(--accent-quiet));
  color: var(--text-on-accent); font-weight: 700; font-size: 14px;
}
.settings-nav__id { min-width: 0; }
.settings-nav__email {
  margin: 0; font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.settings-nav__plan { font-size: 11px; color: var(--text-muted); }

.settings-panels { flex: 1 1 auto; min-width: 0; height: 100%; overflow-y: auto; }
.settings-panel {
  display: none;
  flex-direction: column;
  gap: 0;
  height: 100%;
  padding: var(--sp-5);
}
.settings-panel.is-active { display: flex; }

.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4);
  min-height: 64px;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}
.settings-panel > .settings-row:first-child { padding-top: 0; }
.settings-row:last-of-type { border-bottom: none; }
.settings-row__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
.settings-row__label { font-size: 14px; font-weight: 600; color: var(--text); }
.settings-row__hint { font-size: 12px; color: var(--text-muted); }
.settings-row__control { display: flex; align-items: center; gap: var(--sp-2); flex: 0 0 auto; }
.settings-row__control .custom-select { width: 168px; }

/* Toast — inline-save confirmation. A pill slides up from the bottom centre,
   holds briefly, then fades out. Lives above the settings modal (--z-toast).
   Multiple toasts stack upward via the flex column. */
.toast-stack {
  position: fixed;
  left: 50%;
  bottom: max(var(--sp-6), env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: var(--sp-2);
  pointer-events: none;
  width: max-content;
  max-width: min(92vw, 420px);
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 11px var(--sp-4);
  border-radius: var(--r-pill);
  background: var(--material-regular-bg);
  backdrop-filter: blur(var(--material-regular-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--material-regular-blur)) saturate(160%);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  /* Materialize is a JS spring with a touch of bounce (momentum preset) —
     see .dropdown above for why there's no CSS transition here. */
}
.toast.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.toast__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 50%;
}
.toast__icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.toast--success .toast__icon { background: var(--success-soft); color: var(--success-text); }
.toast--error .toast__icon { background: var(--danger-soft); color: var(--danger-text); }
.toast__label { min-width: 0; }

@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity var(--dur-2) linear; transform: none; }
  .toast.is-visible { transform: none; }
}

/* Accent colour swatch picker — a row of round colour buttons instead of a
   dropdown, so the choice is visible at a glance. Each swatch paints its own
   colour via the --swatch custom property set inline in the markup. */
.accent-swatches { display: flex; align-items: center; gap: var(--sp-2); }
.accent-swatch {
  --swatch: var(--accent);
  width: 26px;
  height: 26px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--r-pill);
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.accent-swatch::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: var(--r-pill);
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14);
}
.accent-swatch:hover { transform: scale(1.08); }
.accent-swatch:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.accent-swatch.is-selected { border-color: var(--swatch); }

.settings-password {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-2);
  padding-top: var(--sp-4);
}
.settings-password label { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.settings-password .input-with-action + label { margin-top: var(--sp-1); }
.settings-password .btn-block { margin-top: var(--sp-2); }
.settings-subhead { margin: 0 0 var(--sp-1); font-size: 13px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: var(--text-muted); }

@media (max-width: 760px) {
  .settings-modal__body { flex-direction: column; height: min(100%, 88vh); }
  .settings-nav {
    flex: 0 0 auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .settings-nav__tabs { flex-direction: row; overflow-x: auto; }
  .settings-nav__tab { flex: 0 0 auto; }
  .settings-nav__tab span { white-space: nowrap; }
  .settings-nav__account { display: none; }
  .settings-panel { padding: var(--sp-4); }
  .settings-row { flex-direction: column; align-items: stretch; min-height: 0; gap: var(--sp-2); }
  .settings-row__control { justify-content: stretch; }
  .settings-row__control .custom-select { width: 100%; }
  .accent-swatches { gap: var(--sp-3); }
}

/* ---- Mobile navigation --------------------------------------------------- */
.mobile-nav-toggle, .mobile-nav-backdrop { display: none; }

@media (max-width: 1160px) {
  .main-area { padding-inline: var(--sp-5); }
}

@media (max-width: 760px) {
  .sidebar, .sidebar[data-collapsed="true"] {
    width: min(84vw, 310px);
    transform: translateX(-100%);
    padding-top: var(--sp-4);
  }
  .app-shell.mobile-nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  /* Restore full labels inside the drawer */
  .sidebar .brand-text, .sidebar .nav-label, .sidebar .nav-section-label,
  .sidebar[data-collapsed="true"] .brand-text, .sidebar[data-collapsed="true"] .nav-label { display: block; }
  .sidebar .nav-item, .sidebar[data-collapsed="true"] .nav-item { justify-content: flex-start; padding-inline: var(--sp-3); }
  .sidebar .sidebar__brand { justify-content: flex-start; padding-inline: var(--sp-2); }

  .app-content { margin-left: 0; }
  .main-area { padding: calc(var(--sp-8) + 42px + var(--sp-4)) var(--sp-4) var(--sp-8); }

  /* Collapsing makes no sense inside the drawer; the mobile toggle lives outside the sidebar */
  .sidebar__top { display: none; }
  .sidebar[data-collapsed="true"] .profile-trigger { justify-content: flex-start; padding-inline: var(--sp-2); }
  .sidebar[data-collapsed="true"] .profile-trigger__meta { display: flex; }
  .sidebar[data-collapsed="true"] .profile-trigger__chevron { display: block; }

  /* Standalone toggle fixed above the drawer, visible while it's closed */
  .app-shell > .mobile-nav-toggle {
    display: inline-grid;
    place-items: center;
    position: fixed;
    top: var(--sp-4);
    left: var(--sp-4);
    z-index: var(--z-sticky);
    width: 42px; height: 42px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--material-thin-bg);
    backdrop-filter: blur(var(--material-thin-blur));
    -webkit-backdrop-filter: blur(var(--material-thin-blur));
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: transform var(--dur-1) var(--ease-out);
  }
  .app-shell > .mobile-nav-toggle:active { transform: scale(0.92); }
  .app-shell > .mobile-nav-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .app-shell.mobile-nav-open > .mobile-nav-toggle { display: none; }

  /* Drawer surface itself: JS drives --drawer-x (px) every frame while
     dragging or springing; this is just the closed/open resting fallback
     for before JS attaches (or if it's ever disabled). touch-action lets
     the nav list still scroll vertically while a horizontal drag is
     captured by the pointer handlers in scripts/sidebar.js. */
  .sidebar, .sidebar[data-collapsed="true"] {
    touch-action: pan-y;
  }

  /* Scrim: continuous opacity (not display) so its darkness can track the
     drag progress 1:1 instead of snapping on/off at the end of the
     gesture (skill §2 — feedback must be continuous through the whole
     interaction, not just at completion). */
  .mobile-nav-backdrop {
    display: block;
    position: fixed; inset: 0;
    z-index: var(--z-backdrop);
    background: var(--scrim);
    backdrop-filter: blur(var(--scrim-blur));
    -webkit-backdrop-filter: blur(var(--scrim-blur));
    opacity: 0;
    pointer-events: none;
  }
  .app-shell.mobile-nav-open .mobile-nav-backdrop { opacity: 1; pointer-events: auto; }
  .app-shell.mobile-nav-open .sidebar { z-index: var(--z-modal); }
  body.mobile-nav-lock { overflow: hidden; }
}
