/* App shell layout: sidebar, topbar, content */

.app {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- Sidebar (desktop) ---------- */

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  text-decoration: none;
}

.sidebar-brand .brand-mark {
  width: 28px;
  height: 28px;
  color: var(--foreground);
  flex-shrink: 0;
}

.sidebar-brand .brand-name {
  font-size: var(--text-md);
  line-height: var(--lh-md);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-group-label {
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  font-weight: 500;
  color: var(--foreground-tertiary);
  padding: 16px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: var(--lh-sm);
  font-weight: 500;
  color: var(--foreground-secondary);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--foreground-tertiary);
  transition: color var(--transition-fast);
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--foreground);
}

.nav-item[aria-current="page"] {
  background: var(--surface-tertiary);
  color: var(--foreground);
}

.nav-item[aria-current="page"] svg { color: var(--foreground); }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-footer .product-label {
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  font-weight: 500;
  color: var(--foreground-secondary);
}

.sidebar-footer .version-label {
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  color: var(--foreground-tertiary);
  font-variant-numeric: tabular-nums;
}

/* ---------- Main column ---------- */

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  height: 56px;
  padding: 0 var(--content-gutter);
  background: color-mix(in srgb, var(--background) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  font-size: var(--text-sm);
  line-height: var(--lh-sm);
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.theme-select { display: none; width: auto; min-width: 0; height: 32px; padding: 4px 8px; font-size: var(--text-xs); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--foreground-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.icon-btn:hover { background: var(--surface-hover); color: var(--foreground); }
.icon-btn svg { width: 16px; height: 16px; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface-tertiary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--foreground-secondary);
}

/* ---------- Content ---------- */

.content {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-8) var(--content-gutter) var(--space-12);
  flex: 1;
}

.page-header {
  margin-bottom: var(--space-6);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.page-header .page-titles { flex: 1; min-width: 240px; }

.page-header .page-subtitle {
  margin-top: 4px;
  font-size: var(--text-sm);
  line-height: var(--lh-sm);
  color: var(--foreground-tertiary);
  max-width: 60ch;
}

.page-header .page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Section blocks */

.section { margin-bottom: var(--space-6); }

.section-title {
  font-size: var(--text-md);
  line-height: var(--lh-md);
  font-weight: 600;
  margin-bottom: var(--space-3);
}

/* Two-column generator layout */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

.split .panel-sticky {
  position: sticky;
  top: 72px;
}

/* Mobile drawer */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.4);
  border: 0;
  padding: 0;
  animation: backdrop-in 180ms ease;
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.drawer-backdrop[hidden] { display: none; }

.menu-btn { display: none; }
.sidebar-close { display: none; }
