html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 16%, rgba(72, 213, 151, 0.10), transparent 28%),
    radial-gradient(circle at 82% 14%, rgba(86, 200, 216, 0.10), transparent 32%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
  color: var(--text);
  overflow: hidden;
}

.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-sidebar);
  backdrop-filter: var(--blur-sidebar);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.skip-link {
  position: absolute;
  top: -44px;
  left: 12px;
  z-index: 100;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
}

.skip-link:focus {
  top: 12px;
}

.sidebar-brand {
  padding: 0 20px 18px;
  border-bottom: 1px solid var(--border);
  margin: 0 0 4px;
}

.sidebar-brand .brand-logo {
  display: block;
  height: 26px;
  width: auto;
  margin-bottom: 14px;
}

.sidebar-brand .brand-kicker {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.sidebar-brand h1 {
  margin-top: 7px;
  font-size: 15px;
  line-height: 1.16;
  letter-spacing: -0.02em;
  color: var(--text);
}

.sidebar-brand p {
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 0 12px;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-section-title {
  margin: 0 8px 2px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 700;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5px;
  border-radius: 20px;
  background: var(--seg-bg);
  border: 1px solid var(--seg-border);
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
}

.nav-item {
  border: 0;
  width: 100%;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 9px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.nav-item:hover {
  background: var(--accent-dim);
  color: var(--text);
}

.nav-item.active {
  background: var(--grad-accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 157, 224, 0.34);
}

.nav-item.active svg { stroke: #fff; }

.nav-item:focus-visible,
.icon-btn:focus-visible,
.subtab:focus-visible,
.program-card:focus-visible,
.node:focus-visible,
.skip-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 14px 20px 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto 1fr;
  max-height: 100vh;
}

.main:focus {
  outline: none;
}

.topbar {
  min-height: 62px;
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 10, 13, 0.34);
  backdrop-filter: blur(12px);
}

body.theme-light .topbar {
  background: rgba(255, 255, 255, 0.58);
}

.page-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 157, 224, 0.14);
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-soft);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--transition);
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.content {
  overflow: auto;
  padding: 26px 28px 36px;
}

/* --- Floating segmented sub-tabs (twin of Plateforme Testing IA) --- */
.subtabs {
  display: inline-flex;
  gap: 4px;
  margin: 14px 28px 0;
  padding: 5px;
  border-radius: 999px;
  background: var(--seg-bg);
  border: 1px solid var(--seg-border);
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  width: fit-content;
  max-width: calc(100% - 56px);
  overflow-x: auto;
}

.subtabs:empty { display: none; }

.subtab {
  padding: 8px 18px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
  font-family: inherit;
  white-space: nowrap;
}

.subtab:hover { color: var(--text); }

.subtab.active {
  color: #fff;
  background: var(--grad-accent);
  box-shadow: 0 4px 14px rgba(0, 157, 224, 0.34);
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-head h2 {
  font-size: 22px;
  letter-spacing: -0.03em;
}

.section-head p {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 84px minmax(0, 1fr); }
  .sidebar-brand p,
  .sidebar-brand h1,
  .sidebar-brand .brand-kicker,
  .sidebar-footer,
  .nav-section-title,
  .nav-label { display: none; }
  .sidebar { align-items: center; }
  .sidebar-nav { padding-inline: 8px; }
  .nav-group { padding: 4px; }
  .nav-item { justify-content: center; padding: 9px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body { overflow: auto; }
  .app-shell { display: block; }
  .sidebar { position: static; flex-direction: row; overflow-x: auto; }
  .main { max-height: none; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .content { padding: 18px; }
  .grid-4,
  .grid-3,
  .grid-2 { grid-template-columns: 1fr; }
}
