.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(232px, var(--sidebar-w)) minmax(0, 1fr);
  gap: var(--shell-gap);
  width: min(calc(100vw - 32px), var(--content-max));
  margin: 16px auto;
  align-items: start;
  background: transparent;
}

html,
body {
  overflow-x: hidden;
}

.app-shell-backdrop,
.shell-mobile-toggle,
.mobile-top-app-bar,
.mobile-bottom-nav,
.mobile-more-sheet {
  display: none;
}

.mobile-top-app-bar,
.mobile-bottom-nav {
  --mobile-bar-h: 56px;
}

.app-sidebar {
  position: sticky;
  top: 16px;
  min-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 18px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-shell);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 22%), var(--surface);
  box-shadow: var(--shadow-soft);
}

body.shell-compact {
  --sidebar-w: 68px;
}

body.shell-compact .app-shell {
  grid-template-columns: 68px minmax(0, 1fr);
}

.app-shell-main {
  --shell-content-gutter: 48px;
  min-width: 0;
  background: transparent;
}

.app-main.main {
  max-width: none;
  margin: 0;
  padding: 40px var(--shell-content-gutter) 80px;
  background: transparent;
}

.shell-content-frame {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  min-width: 0;
}

body[data-contexto="dashboard"] .app-main .shell-content-frame,
body[data-contexto="reporte"] .app-main .shell-content-frame {
  max-width: none;
}

.sidebar-brand-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.sidebar-collapse-toggle {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

.sidebar-collapse-toggle span {
  display: block;
}

.collapse-bar {
  width: 7px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(212, 163, 95, 0.95), rgba(212, 163, 95, 0.55));
}

.collapse-chevron {
  width: 8px;
  height: 8px;
  border-top: 1.6px solid var(--muted-strong);
  border-right: 1.6px solid var(--muted-strong);
  transform: rotate(45deg);
}

.shell-brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.shell-brand-mark span {
  color: var(--accent);
}

.sidebar-version-badge {
  flex: 0 0 auto;
}

.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sidebar-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sidebar-link {
  width: 100%;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted-strong);
  text-decoration: none;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.sidebar-link-icon svg {
  width: 18px;
  height: 18px;
}

.sidebar-link-badge {
  display: none;
}

.sidebar-item-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-subnav {
  display: none;
  margin-left: 16px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
  flex-direction: column;
  gap: 6px;
}

.sidebar-item-group.open .sidebar-subnav {
  display: flex;
}

.sidebar-sublink {
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.sidebar-sublink.active {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
}

.sidebar-link:hover .sidebar-link-icon,
.sidebar-link:hover .sidebar-link-badge {
  color: var(--text);
  opacity: 1;
}

.sidebar-link.active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-weight: 600;
}

.sidebar-link.active .sidebar-link-icon,
.sidebar-link.active .sidebar-link-badge {
  color: var(--text);
  opacity: 1;
}

.privacy-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted-strong);
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.privacy-toggle-mobile {
  display: none;
}

.mobile-more-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.privacy-toggle-btn svg,
.mobile-more-item .privacy-eye {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.privacy-toggle-btn:hover,
.privacy-toggle-btn.active {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  color: var(--text);
  background: var(--accent-soft);
}

.privacy-eye-off,
body.hide-amounts .privacy-eye-open {
  display: none;
}

body.hide-amounts .privacy-eye-off {
  display: block;
}

[data-private-value] {
  white-space: nowrap;
}

body.hide-amounts [data-private-value] {
  color: transparent !important;
  position: relative;
  user-select: none;
}

body.hide-amounts [data-private-value]::after {
  content: "\2022\2022\2022\2022";
  position: absolute;
  inset: 0;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: inherit;
  font-family: var(--font-mono);
  white-space: nowrap;
}

body.hide-amounts .green[data-private-value]::after,
body.hide-amounts [data-private-value].green::after {
  color: var(--green);
}

body.hide-amounts [data-private-value].accent::after {
  color: var(--accent-strong);
}

.sidebar-link-kicker {
  display: none;
}

.sidebar-link-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
}

.sidebar-toggle {
  cursor: pointer;
}

body.shell-compact .shell-brand-mark,
body.shell-compact .sidebar-label,
body.shell-compact .sidebar-link-text,
body.shell-compact .sidebar-user-copy,
body.shell-compact .sidebar-foot-note,
body.shell-compact .sidebar-theme-option > span,
body.shell-compact .sidebar-foot-action span {
  display: none;
}

body.shell-compact .sidebar-theme-option {
  padding: 0;
  gap: 0;
}

body.shell-compact .sidebar-brand-block {
  justify-content: center;
}

body.shell-compact .sidebar-brand-actions {
  width: 100%;
  justify-content: center;
}

body.shell-compact .collapse-chevron {
  transform: rotate(-135deg);
}

body.shell-compact .app-sidebar {
  padding-left: 12px;
  padding-right: 12px;
}

body.shell-compact .sidebar-link {
  position: relative;
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 12px 8px;
  gap: 0;
}

body.shell-compact .sidebar-link:hover::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  z-index: 300;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
}

body.shell-compact .sidebar-link-badge,
body.shell-compact .sidebar-label {
  display: none;
}

body.shell-compact .sidebar-user-card {
  justify-content: center;
  padding: 10px;
}

body.shell-compact .sidebar-theme-switch {
  justify-content: center;
  padding: 6px;
}

body.shell-compact .sidebar-foot-meta {
  justify-content: center;
}

/* ─── VERSION BADGE + CHANGELOG ────────────────────────────────────────── */
.version-badge {
  position: relative;
  background: none;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s, border-color 0.15s;
}
.version-badge:hover { color: var(--text); border-color: var(--muted); }

.version-dropdown {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  width: min(320px, calc(100vw - 24px));
  min-width: 240px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  z-index: 200;
  cursor: default;
  max-height: 60vh;
  overflow-y: auto;
}
.version-dropdown.open { display: block; }

.tooltip-wrap:hover .version-dropdown { display: block; }

.vlog-entry { margin-bottom: 12px; }
.vlog-entry:last-child { margin-bottom: 0; }
.vlog-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.vlog-v {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}
.vlog-date { font-size: 11px; color: var(--muted); }
.vlog-notes { list-style: none; }
.vlog-notes li {
  font-size: 12px;
  color: var(--muted);
  padding: 1px 0 1px 12px;
  position: relative;
}
.vlog-notes li::before {
  content: "·";
  position: absolute;
  left: 2px;
  color: var(--border);
}

body.shell-compact .version-badge {
  padding: 3px 6px;
  font-size: 9px;
  min-width: auto;
}

body.shell-compact .sidebar-foot-actions {
  align-items: center;
}

body.shell-compact .sidebar-foot-action {
  position: relative;
  min-width: 0;
  width: 44px;
  padding: 10px;
}

body.shell-compact .sidebar-foot-action:hover::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  z-index: 300;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
}

body.shell-compact .sidebar-subnav {
  display: none !important;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
}

.sidebar-user-avatar-initial {
  display: inline-block;
}

.sidebar-user-copy {
  min-width: 0;
}

.sidebar-user-label,
.sidebar-foot-note {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-theme-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  justify-content: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  position: relative;
}

.sidebar-theme-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sidebar-theme-switch .theme-track,
.sidebar-theme-switch .theme-icon {
  display: none;
}

.sidebar-theme-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 8px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
  user-select: none;
}

.sidebar-theme-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: currentColor;
}

.theme-switch input:not(:checked) ~ .sidebar-theme-option-dark,
.theme-switch input:checked ~ .sidebar-theme-option-light {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}

.theme-switch input:not(:checked) ~ .sidebar-theme-option-light,
.theme-switch input:checked ~ .sidebar-theme-option-dark {
  background: transparent;
  color: var(--muted);
}

.sidebar-theme-option:hover {
  color: var(--text);
}

.sidebar-foot-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar-foot-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-foot-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sidebar-foot-action svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.sidebar-foot-action-primary {
  background: rgba(255,255,255,0.025);
}

.sidebar-foot-action-primary:hover,
.sidebar-foot-action-secondary:hover {
  border-color: var(--border-strong);
  background: rgba(255,255,255,0.04);
  transform: translateY(-1px);
}

.sidebar-foot-action-secondary {
  justify-content: flex-start;
}

body.light .app-sidebar {
  background: var(--surface);
}

body.light .sidebar-sublink.active,
body.light .sidebar-link:hover,
body.light .sidebar-link.active,
body.light .sidebar-user-card,
body.light .sidebar-theme-switch,
body.light .sidebar-foot-action-primary,
body.light .sidebar-foot-action-primary:hover,
body.light .sidebar-foot-action-secondary:hover {
  background: var(--surface2);
}

.sidebar-user-name {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.sidebar-foot-note {
  white-space: nowrap;
}

.shell-header {
  padding: 28px var(--shell-content-gutter);
}

.shell-header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.shell-header-copy {
  min-width: 0;
}

.shell-eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.shell-title {
  margin: 0;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: clamp(36px, 5vw, 58px);
  font-weight: 500;
  line-height: 0.95;
}

.shell-subtitle {
  max-width: 620px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.shell-header-compact {
  padding: 20px var(--shell-content-gutter) 18px;
}

.shell-header-compact .shell-title {
  font-size: clamp(28px, 3.8vw, 44px);
  line-height: 0.98;
}

.shell-header-compact .shell-subtitle {
  margin-top: 10px;
  max-width: 560px;
  font-size: 14px;
}

.shell-header-minimal {
  padding: 0;
  min-height: 0;
}

.shell-footer {
  padding: 18px 4px 28px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.login-shell {
  min-height: 100vh;
  width: min(calc(100vw - 32px), 1240px);
  margin: 0 auto;
  padding: 18px 0 36px;
}

.login-shell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 4px 24px;
}

.login-shell-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.login-theme-toggle:hover {
  background: var(--surface2);
  border-color: var(--border-strong);
}

.login-theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.login-theme-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.login-theme-icon-sun {
  display: none;
}

.login-theme-icon-moon {
  display: block;
}

body.light .login-theme-icon-sun {
  display: block;
}

body.light .login-theme-icon-moon {
  display: none;
}

.login-main.main {
  max-width: none;
  padding: 0;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
    width: min(calc(100vw - 20px), var(--content-max));
    gap: 20px;
    margin: 10px auto;
  }

  .shell-title {
    font-size: clamp(32px, 5vw, 48px);
  }
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
    gap: 14px;
    width: 100%;
    max-width: 100vw;
    margin: 0;
    overflow-x: clip;
  }

  body.shell-compact {
    --sidebar-w: 276px;
  }

  body.shell-compact .app-shell {
    grid-template-columns: 1fr;
  }

  body.shell-compact .shell-brand-mark,
  body.shell-compact .sidebar-label,
  body.shell-compact .sidebar-link-text,
  body.shell-compact .sidebar-user-copy,
  body.shell-compact .sidebar-foot-note,
  body.shell-compact .version-badge,
  body.shell-compact .sidebar-theme-option > span,
  body.shell-compact .sidebar-foot-action span {
    display: initial;
  }

  body.shell-compact .sidebar-theme-option {
    padding: 0 10px;
    gap: 8px;
  }

  body.shell-compact .sidebar-link {
    grid-template-columns: 20px minmax(0, 1fr) auto;
    justify-items: stretch;
    padding: 9px 12px;
    gap: 12px;
  }

  body.shell-compact .sidebar-label {
    display: initial;
  }

  body.shell-compact .sidebar-user-card {
    justify-content: flex-start;
    padding: 12px 14px;
  }

  body.shell-compact .sidebar-theme-switch {
    justify-content: initial;
    padding: 4px;
  }

  body.shell-compact .sidebar-foot-meta {
    justify-content: space-between;
  }

  body.shell-compact .sidebar-foot-actions {
    align-items: stretch;
  }

  body.shell-compact .sidebar-foot-action {
    width: auto;
    padding: 9px 12px;
  }

  .app-main.main {
    padding-bottom: calc(104px + env(safe-area-inset-bottom));
  }

  .app-shell-main {
    --shell-content-gutter: 28px;
    padding-top: calc(56px + env(safe-area-inset-top));
  }

  .mobile-top-app-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-top));
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr) 36px 36px;
    column-gap: 6px;
    align-items: end;
    padding: env(safe-area-inset-top) 12px 8px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(14px);
    z-index: 120;
    transform: translateY(0);
    transition: transform 0.2s ease;
  }

  body.mobile-topbar-hidden:not(.shell-sidebar-open) .mobile-top-app-bar {
    transform: translateY(-100%);
  }

  .mobile-top-menu {
    width: 36px;
    height: 36px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    justify-self: start;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
  }

  .mobile-top-menu span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
  }

  .mobile-top-brand {
    justify-self: center;
    font-size: 14px;
    letter-spacing: 0.08em;
    min-width: 0;
  }

  .privacy-toggle-mobile {
    display: inline-flex;
    justify-self: end;
    width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    border-radius: 10px;
    background: transparent;
  }

  .privacy-toggle-mobile .privacy-toggle-label {
    display: none;
  }

  .privacy-toggle-desktop {
    display: none;
  }

  body[data-privacy-toggle-enabled="false"] .mobile-top-app-bar {
    grid-template-columns: 78px minmax(0, 1fr) 36px;
  }

  .mobile-version-badge {
    justify-self: end;
    min-width: 56px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface2);
    color: var(--muted-strong);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(14px);
    z-index: 70;
  }

  .mobile-bottom-item {
    min-width: 0;
    min-height: 52px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 2px;
    border-radius: 14px;
    color: var(--muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.1;
  }

  button.mobile-bottom-item {
    border: none;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
  }

  button.mobile-bottom-item[aria-expanded="true"] {
    color: var(--text);
    background: var(--accent-soft);
  }

  .mobile-bottom-item.active {
    color: var(--text);
    background: var(--accent-soft);
  }

  .mobile-bottom-icon {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-bottom-icon svg {
    width: 20px;
    height: 20px;
  }

  .mobile-bottom-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-shell-backdrop {
    display: block;
    position: fixed;
    inset: calc(56px + env(safe-area-inset-top)) 0 0;
    background: rgba(10, 8, 7, 0.46);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 85;
  }

  .app-sidebar {
    position: fixed;
    top: calc(66px + env(safe-area-inset-top));
    left: 10px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    width: min(320px, calc(100vw - 20px));
    min-height: auto;
    padding: 14px;
    gap: 14px;
    transform: translateX(calc(-100% - 20px));
    transition: transform 0.22s ease;
    z-index: 95;
    overflow: auto;
  }

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

  .sidebar-link {
    width: 100%;
    min-width: 0;
  }

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

  .shell-header {
    padding: 18px 28px 28px;
  }

  .shell-header-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .shell-header-minimal {
    padding-top: 0;
    padding-bottom: 12px;
  }

  .shell-mobile-toggle {
    display: none;
    flex-direction: column;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    z-index: 75;
    transition: border-color 0.18s ease, background 0.18s ease;
  }

  .shell-mobile-toggle:hover {
    border-color: var(--border-strong);
    background: var(--surface2);
  }

  .shell-mobile-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: var(--text);
    transition: background 0.18s ease;
  }

  .sidebar-collapse-toggle {
    display: none;
  }

  body.shell-sidebar-open {
    overflow: hidden;
  }

  body.shell-sidebar-open .app-shell-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  body.shell-sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  body.shell-sidebar-open .mobile-top-app-bar {
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .app-shell,
  .login-shell {
    width: min(calc(100vw - 12px), var(--content-max));
  }

  .app-sidebar {
    padding: 12px;
    border-radius: 18px;
  }

  .sidebar-brand-block,
  .login-shell-brand {
    flex-wrap: wrap;
    gap: 10px;
  }

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

  .sidebar-subnav {
    margin-left: 10px;
    padding-left: 10px;
  }

  .sidebar-link {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border-radius: 12px;
  }

  .shell-title {
    font-size: clamp(24px, 9vw, 34px);
  }

  .shell-subtitle {
    font-size: 13px;
    max-width: none;
  }

  .shell-header {
    padding: 10px 20px 18px;
    gap: 12px;
  }

  .shell-header-minimal {
    padding: 0 20px 12px;
  }

  .sidebar-user-card {
    padding: 10px 12px;
  }

  .sidebar-foot-action {
    width: 100%;
  }

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

  .sidebar-foot-meta .version-dropdown {
    top: auto;
    bottom: calc(100% + 8px);
    left: auto;
    right: 0;
  }

  .app-main.main {
    padding-top: 20px;
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  .app-shell-main {
    --shell-content-gutter: 20px;
  }
}

@media (max-width: 960px) {
  /* ─── BOTTOM SHEET "MÁS" ─────────────────────────────────────────────── */
  .mobile-more-sheet {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 160;
    pointer-events: none;
    visibility: hidden;
  }

  .mobile-more-sheet.open {
    pointer-events: auto;
    visibility: visible;
  }

  .mobile-more-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 10, 16, 0.5);
    opacity: 0;
    transition: opacity 0.22s ease;
  }

  .mobile-more-sheet.open .mobile-more-backdrop {
    opacity: 1;
  }

  .mobile-more-inner {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    padding: 0 16px calc(72px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.22s ease;
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.3);
  }

  .mobile-more-sheet.open .mobile-more-inner {
    transform: translateY(0);
  }

  .mobile-more-handle {
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-strong, var(--border));
    margin: 14px auto 18px;
  }

  .mobile-more-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 10px;
  }

  .mobile-more-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 12px;
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-more-item:hover,
  .mobile-more-item:active {
    background: var(--surface2);
  }

  .mobile-more-item.active {
    background: var(--accent-soft);
    color: var(--accent-strong, var(--accent));
  }

  .mobile-more-item-icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: var(--muted);
  }

  .mobile-more-item.active .mobile-more-item-icon {
    color: currentColor;
  }

  .mobile-more-item-icon svg {
    width: 20px;
    height: 20px;
  }

  .mobile-more-item-danger {
    color: var(--red, #f87171);
  }

  .mobile-more-item-danger .mobile-more-item-icon {
    color: var(--red, #f87171);
  }
}

@media (max-width: 960px) and (prefers-reduced-motion: reduce) {
  .mobile-top-app-bar,
  .app-shell-backdrop,
  .app-sidebar,
  .mobile-more-inner,
  .mobile-more-backdrop {
    transition: none;
  }
}
