.app-shell {
  height: 100vh;
  display: flex;
  overflow: hidden;
  background: var(--app-bg);
}

.app-shell__sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--sidebar-bg);
  background-image: url('../../assets/images/sidebar.png');
  background-size: cover;
  background-position: bottom left;
  background-repeat: no-repeat;
  border-right: 1px solid var(--sidebar-border);
  padding: var(--space-5) var(--space-3);
}

.app-shell__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-2) var(--space-6);
}

.app-shell__isotype-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--sidebar-border);
}

.app-shell__isotype {
  width: 18px;
  height: 18px;
}

.app-shell__brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: var(--line-height-tight);
}

.app-shell__brand-title {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--sidebar-text);
  letter-spacing: 0.01em;
}

.app-shell__brand-subtitle {
  font-size: var(--font-size-2xs);
  color: var(--sidebar-text-muted);
}

.app-shell__nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
}

.app-shell__nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sidebar-text);
  font-family: var(--font-family-base);
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

/* The [hidden] attribute alone is not enough here: the browser's built-in
   `[hidden] { display: none }` rule and `.app-shell__nav-item`'s own
   `display: flex` above are both single-selector rules of equal
   specificity, and author-origin rules always beat user-agent-origin
   rules regardless of source order — so without this explicit,
   higher-specificity (compound selector) override, a hidden nav item
   would silently keep rendering. Used by Configuración (see
   checkConfigurationAccess in app-shell.js) — no !important needed. */
.app-shell__nav-item[hidden] {
  display: none;
}

.app-shell__nav-item:hover,
.app-shell__nav-item:focus-visible {
  background: var(--sidebar-hover-bg);
}

.app-shell__nav-item--active {
  background: var(--sidebar-active-accent-bg);
  border-color: var(--sidebar-active-accent-border);
  color: var(--sidebar-active-text);
  backdrop-filter: blur(8px);
}

.app-shell__nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  /* Icon files are baked solid white; opacity reproduces the same
     sidebar-text -> sidebar-active-text contrast that currentColor gave
     inline SVGs, since <img> icons cannot inherit currentColor. */
  opacity: 0.86;
}

.app-shell__nav-item--active .app-shell__nav-icon {
  opacity: 1;
}

.app-shell__sidebar-footer {
  border-top: 1px solid var(--sidebar-border);
  padding-top: var(--space-3);
}

.app-shell__nav-item--logout {
  border-color: var(--sidebar-border);
}

.app-shell__nav-item--logout:hover,
.app-shell__nav-item--logout:focus-visible {
  background: var(--sidebar-hover-bg);
  border-color: var(--sidebar-text-muted);
}

.app-shell__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-shell__topbar {
  height: var(--topbar-height);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0 var(--content-padding-x);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--app-border);
}

.app-shell__topbar-workspace {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.app-shell__topbar-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

.app-shell__date {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.app-shell__date-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.app-shell__divider {
  width: 1px;
  height: 24px;
  background: var(--app-border);
  flex-shrink: 0;
}

.app-shell__user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.app-shell__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: var(--text-inverse);
  font-size: var(--font-size-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.app-shell__user-info {
  display: flex;
  flex-direction: column;
  line-height: var(--line-height-tight);
}

.app-shell__user-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.app-shell__user-email {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.app-shell__content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  max-width: var(--content-max-width);
  padding: var(--content-padding-y) var(--content-padding-x);
  background-color: var(--app-bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.55)),
    url('../../assets/images/body.png');
  background-size: cover;
  background-position: top right;
  background-repeat: no-repeat;
}
