:root[data-theme="is-wood"] {
  --bg: #f5ecdf;
  --bg-alt: #eadac4;
  --bg-deep: #d7c2a6;
  --panel: #fffaf4;
  --panel-muted: rgba(255, 255, 255, 0.9);
  --panel-dark: #1b0f08;
  --panel-warm: #2f1d10;
  --ink: #2f261d;
  --ink-soft: rgba(47, 38, 29, 0.72);
  --muted: rgba(47, 38, 29, 0.65);
  --accent: #b87748;
  --accent-strong: #e1974f;
  --accent-soft: rgba(184, 119, 72, 0.18);
  --border: rgba(47, 38, 29, 0.18);
  --border-strong: rgba(47, 38, 29, 0.32);
  --radius-xl: 36px;
  --radius-lg: 24px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-soft: 0 35px 120px rgba(17, 11, 6, 0.15);
  --shadow-card: 0 18px 55px rgba(17, 11, 6, 0.13);
  --shadow-rail: 0 35px 70px rgba(0, 0, 0, 0.35);
  --sidebar-width: 220px;
  --sidebar-collapsed-width: 84px;
  --sidebar-bg: rgba(255, 255, 255, 0.92);
  --sidebar-hover: rgba(47, 38, 29, 0.06);
  --sidebar-active: rgba(184, 119, 72, 0.16);
  --font: "Inter", "Noto Sans TC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Plane-inspired neutral theme */
:root[data-theme="plane"] {
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --bg-deep: #e2e8f0;
  --panel: #ffffff;
  --panel-muted: #ffffff;
  --panel-dark: #0f172a;
  --panel-warm: #1e293b;
  --ink: #0f172a;
  --ink-soft: rgba(15, 23, 42, 0.72);
  --muted: #475569;
  --accent: #6366f1;
  --accent-strong: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.12);
  --border: #e5e7eb;
  --border-strong: #cbd5e1;
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.06);
  --shadow-card: 0 8px 22px rgba(15, 23, 42, 0.08);
  --shadow-rail: none;
  --sidebar-width: 200px;
  --sidebar-collapsed-width: 72px;
  --sidebar-bg: #ffffff;
  --sidebar-hover: rgba(99, 102, 241, 0.06);
  --sidebar-active: rgba(99, 102, 241, 0.14);
  --font: "Inter", "Noto Sans TC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a {
  color: inherit;
}

body.hackitos-shell {
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
}

body.hackitos-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(80rem 60rem at 10% 0%, rgba(255, 255, 255, 0.55), transparent 65%),
    radial-gradient(70rem 55rem at 80% 10%, rgba(255, 255, 255, 0.35), transparent 70%),
    repeating-linear-gradient(
      14deg,
      rgba(47, 38, 29, 0.05) 0 2px,
      rgba(47, 38, 29, 0.03) 2px 6px,
      transparent 6px 16px
    ),
    linear-gradient(180deg, var(--bg), var(--bg-alt));
  background-attachment: fixed;
}

body.hackitos-shell::after {
  content: "";
  position: fixed;
  inset: -15% 10% auto;
  height: 40%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(circle at 50% 0%, rgba(184, 119, 72, 0.22), transparent 65%);
  filter: blur(30px);
}

.page-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-strong), #f5b25d, var(--accent-strong));
  transform-origin: left;
  transform: scaleX(var(--progress, 0));
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.2s ease;
  z-index: 100;
  pointer-events: none;
}

.page-progress.is-active {
  opacity: 1;
}

.page-progress.is-complete {
  opacity: 0;
  transition-duration: 0.25s, 0.35s;
}

.app-shell {
  min-height: 100vh;
  position: relative;
}

.app-shell.is-auth-view {
  padding-left: 0;
}

.nav-rail {
  background: var(--panel);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 14px;
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-rail);
  z-index: 50;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 64px;
  transition: width 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
}

.rail-logo {
  width: 52px;
  height: 52px;
  border-radius: 20px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 25% 15%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.65)),
    linear-gradient(145deg, rgba(232, 227, 244, 0.9), rgba(209, 217, 244, 0.9));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.7),
    0 10px 24px rgba(19, 16, 48, 0.2);
  padding: 4px;
  z-index: 0;
}

.rail-logo__inner {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  padding: 4px;
  background: linear-gradient(160deg, rgba(45, 25, 99, 0.08), rgba(255, 255, 255, 0.08));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    inset 0 0 20px rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  z-index: 1;
}

.rail-logo__img {
  width: 100%;
  height: 100%;
  border-radius: 11px;
  object-fit: cover;
  box-shadow:
    0 6px 16px rgba(15, 10, 41, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  filter: saturate(1.05) brightness(1.02);
}

.rail-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  align-items: center;
}

.rail-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.2s ease, border 0.2s ease, transform 0.25s ease, color 0.2s ease, box-shadow 0.25s ease;
}

.rail-btn i { line-height: 1; font-size: 18px; }

.rail-btn:hover,
.rail-btn.is-active {
  border-color: var(--border-strong);
  background: var(--accent-soft);
  color: var(--accent-strong);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.15);
}

.rail-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.rail-avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: transparent;
  border: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.rail-avatar__initial {
  font-size: 0.95rem;
  font-weight: 700;
}
.rail-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.rail-avatar:hover {
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
  transform: translateY(-2px);
}

.sidebar-panel {
  background: var(--sidebar-bg);
  color: var(--ink);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-right: 1px solid var(--border);
  box-shadow: none;
  min-width: 0;
  position: fixed;
  left: 64px;
  top: 0;
  height: 100vh;
  width: var(--sidebar-width);
  overflow: visible;
  backdrop-filter: none;
  z-index: 40;
  transition:
    width 0.45s cubic-bezier(0.32, 0.72, 0, 1),
    padding 0.45s cubic-bezier(0.32, 0.72, 0, 1),
    box-shadow 0.32s ease,
    border-color 0.32s ease;
  will-change: width, padding;
}

.sidebar-panel .app-logo,
.sidebar-panel .section-heading,
.sidebar-panel .nav-empty {
  transition:
    opacity 0.25s ease,
    transform 0.35s cubic-bezier(0.32, 0.72, 0, 1),
    max-height 0.35s cubic-bezier(0.32, 0.72, 0, 1),
    margin 0.35s ease,
    padding 0.35s ease;
  max-height: 80px;
}

.sidebar-panel .app-logo,
.sidebar-panel .section-heading {
  overflow: hidden;
}

.sidebar-panel .nav-empty {
  overflow: hidden;
}

body.sidebar-collapsed .sidebar-panel {
  width: var(--sidebar-collapsed-width);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(47, 38, 29, 0.08);
}

.sidebar-search {
  position: relative;
  transition:
    width 0.35s cubic-bezier(0.32, 0.72, 0, 1),
    height 0.35s cubic-bezier(0.32, 0.72, 0, 1),
    margin 0.35s cubic-bezier(0.32, 0.72, 0, 1),
    padding 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}
.sidebar-search input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--ink);
  border-radius: 10px;
  height: 34px;
  padding: 0 10px 0 32px;
  font-size: 13px;
  transition:
    border 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    padding 0.35s cubic-bezier(0.32, 0.72, 0, 1),
    opacity 0.2s ease;
}
.sidebar-search input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 8px 18px rgba(99, 102, 241, 0.1);
}
.sidebar-search .ti {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 16px;
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), left 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.sidebar-toggle {
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 12px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--ink);
  cursor: pointer;
  transition: border 0.2s ease, background 0.2s ease, transform 0.28s ease;
}

.sidebar-toggle:hover {
  border-color: var(--border-strong);
  background: var(--sidebar-hover);
}

.sidebar-toggle .toggle-icon {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  position: relative;
}

.sidebar-toggle .toggle-icon::before,
.sidebar-toggle .toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 0.2s ease, width 0.2s ease, opacity 0.2s ease;
}

.sidebar-toggle .toggle-icon::before {
  top: -6px;
  width: 22px;
}

.sidebar-toggle .toggle-icon::after {
  top: 6px;
  width: 12px;
}

.app-logo {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 32px;
  position: relative;
}

.app-logo strong {
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}

.app-logo small {
  opacity: 0.75;
  font-size: 0.8rem;
}

.sidebar-panel .app-logo--switcher {
  overflow: visible;
  max-height: none;
}

.sidebar-panel .app-logo--switcher .workspace-switcher {
  width: 100%;
}

.workspace-switcher {
  position: relative;
  display: block;
  width: 100%;
  margin-top: 4px;
}

.workspace-switcher.is-disabled .workspace-switcher__trigger {
  opacity: 0.55;
  cursor: not-allowed;
}

.workspace-switcher__trigger {
  width: 100%;
  padding: 10px 16px;
  background: var(--panel-muted);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  min-height: 56px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  transition: border 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.workspace-switcher__trigger:hover,
.workspace-switcher__trigger:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
  box-shadow: 0 20px 55px rgba(99, 102, 241, 0.18);
}

.workspace-switcher__text {
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 2px;
  flex: 1;
}

.workspace-switcher__text small {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.workspace-switcher__text strong {
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}

.workspace-switcher__chevron {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: transform 0.25s ease;
}

.workspace-switcher.is-open .workspace-switcher__chevron {
  transform: rotate(180deg);
}

.workspace-switcher__chevron::before {
  content: "▾";
  line-height: 1;
  font-size: 0.9rem;
}

.workspace-switcher__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: clamp(240px, calc(100% + 120px), 420px);
  min-width: 240px;
  box-sizing: border-box;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.15);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 30;
}

.workspace-switcher.is-open .workspace-switcher__menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.workspace-switcher__section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.workspace-switcher__section + .workspace-switcher__section {
  border-top: 1px solid rgba(47, 38, 29, 0.08);
  padding-top: 10px;
}

.workspace-switcher__section-label {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.workspace-switcher__option {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-alt);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  transition: border 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.workspace-switcher__option:hover,
.workspace-switcher__option:focus-visible {
  border-color: rgba(47, 38, 29, 0.3);
  background: #fff;
  outline: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.workspace-switcher__option.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 10px 26px rgba(105, 97, 236, 0.18);
}

.workspace-switcher__option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.workspace-switcher__option-text .title {
  font-size: 0.95rem;
  font-weight: 600;
}

.workspace-switcher__option-text .subtitle {
  font-size: 0.8rem;
  color: var(--muted);
}

.workspace-switcher__badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: rgba(105, 97, 236, 0.12);
  padding: 2px 8px;
  border-radius: 999px;
  transition: opacity 0.2s ease;
}

.workspace-switcher__option:not(.is-active) .workspace-switcher__badge {
  opacity: 0;
}

.workspace-switcher__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 2px;
}

.workspace-switcher__status {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.workspace-switcher-form {
  display: none;
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: sidebar-fade-in 0.4s ease;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 4px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-heading {
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* Collapsible section control */
.section-heading .section-toggle {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: inherit;
  cursor: pointer;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.section-heading .section-toggle .chevron {
  width: 12px;
  height: 12px;
  display: inline-block;
  transform: rotate(0deg);
  transition: transform 0.25s ease;
}

.section-heading .section-toggle .chevron::before {
  content: "▾";
  display: block;
  line-height: 1;
}

.sidebar-section[data-collapsed="true"] .section-toggle {
  opacity: 0.9;
  color: var(--muted);
}

.sidebar-section[data-collapsed="true"] .section-toggle .chevron {
  transform: rotate(-90deg);
}

.sidebar-section[data-collapsed="true"] .sidebar-nav {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 480px;
  overflow: hidden;
  transition: max-height 0.24s ease, opacity 0.2s ease;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-soft);
  text-decoration: none;
  min-height: 40px;
  transition:
    background 0.2s ease,
    border 0.2s ease,
    color 0.2s ease,
    box-shadow 0.25s ease,
    transform 0.25s ease,
    padding 0.35s cubic-bezier(0.32, 0.72, 0, 1),
    gap 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.nav-link .icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: transparent;
  display: grid;
  place-items: center;
  font-size: 16px;
  color: var(--muted);
  transition: width 0.2s ease, height 0.2s ease, font-size 0.2s ease;
}

.nav-link .icon i { line-height: 1; font-size: 18px; }

.nav-link .label {
  flex: 1;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  min-width: 0;
  transition:
    opacity 0.22s ease,
    width 0.35s cubic-bezier(0.32, 0.72, 0, 1),
    margin 0.35s ease;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  border-color: var(--border-strong);
  color: var(--ink);
  transform: translateX(2px);
}

.nav-link:hover .icon { color: var(--accent-strong); }

.nav-link.is-active {
  background: var(--sidebar-active);
  border-color: var(--accent);
  color: var(--ink);
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-link.is-active .icon {
  color: var(--accent-strong);
}

.nav-empty {
  padding: 14px;
  border-radius: 14px;
  border: 1px dashed var(--border);
  font-size: 13px;
  color: var(--muted);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(47, 38, 29, 0.08);
}

/* User popover menu anchored to rail avatar */
.user-menu {
  position: fixed;
  left: 0;
  top: 0;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow:
    0 30px 70px rgba(15, 23, 42, 0.15),
    0 4px 18px rgba(15, 23, 42, 0.06);
  border-radius: 18px;
  padding: 14px;
  min-width: 230px;
  z-index: 60;
  transform-origin: top left;
  opacity: 0;
  visibility: hidden;
  transform: translate(-4px, 12px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.2s ease;
}
.user-menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translate(0, 0);
  pointer-events: auto;
}
.user-menu__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  margin-bottom: 10px;
}
.user-menu__header .avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: transparent;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  overflow: hidden;
}
.user-menu__header .avatar span {
  font-weight: 700;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: var(--bg-alt);
  border: 1px solid var(--border);
}
.user-menu__header .avatar.has-photo {
  border: 0;
  padding: 0;
}
.user-menu__header .avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 14px; display: block; }
.user-menu__header .meta { display: flex; flex-direction: column; gap: 2px; }
.user-menu__header .meta small { color: var(--muted); }
.user-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s ease, transform 0.2s ease;
}
.user-menu__item .ti {
  font-size: 20px;
  color: var(--muted);
}
.user-menu__item span {
  flex: 1;
}
.user-menu__item:hover {
  background: rgba(99, 102, 241, 0.08);
  transform: translateX(3px);
}
.user-menu__divider {
  height: 1px;
  background: rgba(15, 23, 42, 0.06);
  margin: 10px 0;
}

@keyframes sidebar-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.sidebar-collapsed .sidebar-panel {
  padding: 24px 12px;
  width: var(--sidebar-collapsed-width);
  gap: 8px;
}

body.sidebar-collapsed .sidebar-header {
  flex-direction: column;
  align-items: center;
  gap: 12px;
  border-bottom: none;
  padding-bottom: 12px;
}

body.sidebar-collapsed .sidebar-toggle {
  background: var(--sidebar-hover);
  width: 46px;
  height: 46px;
  border-radius: 18px;
 }

body.sidebar-collapsed .sidebar-toggle .toggle-icon {
  transform: rotate(180deg);
}

body.sidebar-collapsed .sidebar-toggle .toggle-icon::before {
  width: 12px;
  transform: translateX(6px);
}

body.sidebar-collapsed .sidebar-toggle .toggle-icon::after {
  width: 22px;
  transform: translateX(-4px);
}

body.sidebar-collapsed .sidebar-panel .app-logo,
body.sidebar-collapsed .sidebar-panel .section-heading,
body.sidebar-collapsed .sidebar-panel .nav-empty {
  opacity: 0;
  transform: translateX(-8px);
  max-height: 0;
  height: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
  border: 0;
}

body.sidebar-collapsed .nav-link .label {
  opacity: 0;
  width: 0;
  margin: 0;
  flex: 0 0 auto;
  transition: opacity 0.15s ease;
}

body.sidebar-collapsed .sidebar-scroll {
  padding-right: 0;
  gap: 8px;
}

body.sidebar-collapsed .sidebar-search {
  width: 46px;
  height: 46px;
  padding: 0;
  margin: 0;
  display: none;
}

body.sidebar-collapsed .sidebar-search input {
  width: 100%;
  height: 100%;
  padding: 0;
  opacity: 0;
  text-indent: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    inset 0 0 0 1px rgba(17, 23, 40, 0.08),
    0 3px 8px rgba(15, 16, 41, 0.08);
  pointer-events: none;
}

body.sidebar-collapsed .sidebar-search input:focus {
  box-shadow:
    inset 0 0 0 1px rgba(99, 102, 241, 0.35),
    0 0 0 2px rgba(99, 102, 241, 0.12);
}

body.sidebar-collapsed .sidebar-search .ti {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

body.sidebar-collapsed .sidebar-section {
  gap: 4px;
  margin: 0;
}

body.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 10px;
  gap: 0;
}

body.sidebar-collapsed .nav-link .icon {
  width: 24px;
  height: 24px;
  font-size: 18px;
}

body.sidebar-collapsed .sidebar-footer {
  padding-top: 0;
  border-top: none;
  display: flex;
  justify-content: center;
}



.app-main {
  padding: 36px 40px 48px;
  margin-left: calc(64px + var(--sidebar-width));
  position: relative;
  z-index: 0;
  transition: margin-left 0.45s cubic-bezier(0.32, 0.72, 0, 1);
}

body.sidebar-collapsed .app-main {
  margin-left: calc(64px + var(--sidebar-collapsed-width));
}

.app-main.is-auth-main {
  padding: 48px 24px;
  margin-left: 0;
}

.app-main::before {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 1px 0 var(--border), 0 8px 24px rgba(15, 23, 42, 0.06);
  z-index: -1;
}

.app-main.is-auth-main::before {
  inset: 0;
  border-radius: 0;
}

.app-content {
  display: flex;
  flex-direction: column;
  gap: 48px;
  position: relative;
  z-index: 1;
}

.auth-content {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 32px 0;
}

.auth-content > * {
  width: min(560px, 100%);
}

.app-toolbar {
  background: var(--panel-muted);
  border-radius: var(--radius-xl);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(255, 255, 255, 0.6);
  position: sticky;
  top: 32px;
  z-index: 3;
}

.workspace-selector {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

.workspace-selector .selector {
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent);
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
}

.btn,
button,
a.btn {
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  padding: 12px 20px;
  cursor: pointer;
  background: rgba(47, 38, 29, 0.08);
  color: inherit;
  text-decoration: none;
}

.btn.ghost,
button.ghost,
a.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}

.ghost.subtle {
  border-color: rgba(47, 38, 29, 0.32);
  opacity: 0.85;
}

button.primary,
a.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 15px 30px rgba(184, 119, 72, 0.35);
  text-decoration: none;
}

.locale-switcher {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.locale-switcher .options {
  display: flex;
  gap: 8px;
}

.locale-switcher .options a {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  text-decoration: none;
  color: inherit;
  opacity: 0.7;
}

.locale-switcher .options a.is-active {
  border-color: var(--accent);
  color: var(--accent);
  opacity: 1;
  background: var(--accent-soft);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(240px, 1fr);
  gap: 36px;
  padding: 28px 32px;
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
}

.hero .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.4em;
  font-size: 0.7rem;
  color: var(--muted);
}

.hero h1 {
  font-size: clamp(2.4rem, 3vw, 3.2rem);
  margin: 10px 0 12px;
}

.hero .lede {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 20px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.hero-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-pill {
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
}

.hero-panel {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hero-panel__stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-panel__stat .label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--muted);
}

.hero-panel__stat strong {
  font-size: 3rem;
  font-weight: 600;
}

.hero-panel__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-panel__list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-panel__list .label {
  font-size: 0.85rem;
  color: var(--muted);
}

.hero-panel__list strong {
  font-size: 1.8rem;
}

.hero-panel__list small {
  color: var(--ink-soft);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.status-card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 28px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.status-card--glow {
  background: linear-gradient(135deg, rgba(184, 119, 72, 0.15), rgba(255, 255, 255, 0.85));
}

.status-card--outline {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.8);
}

.status-card header {
  margin-bottom: 16px;
}

.status-card h2 {
  margin: 6px 0 0;
}

.status-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.8;
}

.section-heading-block {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
}

.section-heading-block .lede {
  color: var(--muted);
  margin-top: 6px;
}

.section-metrics {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.metric {
  background: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  border: 1px solid var(--border);
  text-align: right;
  min-width: 120px;
}

.metric .label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 4px;
}

.metric strong {
  font-size: 1.6rem;
}

.module-board {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 22px;
}

.module-card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.module-card__badge {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.scope-pill {
  border-radius: 999px;
  padding: 4px 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  border: 1px solid var(--border);
}

.scope-pill.is-workspace {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.scope-pill--ghost {
  border-color: rgba(47, 38, 29, 0.25);
  color: var(--muted);
}

.module-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.module-card__header h3 {
  margin: 0 0 6px;
}

.module-card__header p {
  margin: 0;
  color: var(--muted);
}

.module-card__route {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}

.module-meta-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.module-meta-list dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.module-meta-list dd {
  margin: 4px 0 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
}

.module-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feature-pill {
  border-radius: 999px;
  padding: 6px 12px;
  border: 1px dashed var(--border);
  font-size: 0.85rem;
}

.feature-pill.is-faded {
  opacity: 0.65;
}

.identity-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.identity-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--panel-muted);
  color: var(--ink);
}

.identity-chip--core {
  background: rgba(15, 61, 62, 0.1);
  border-color: rgba(15, 61, 62, 0.28);
  color: #0f3d3e;
}

.identity-chip--partner {
  background: rgba(217, 121, 65, 0.12);
  border-color: rgba(217, 121, 65, 0.35);
  color: #a0461a;
}

.identity-chip--catalyst {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
  color: #4338ca;
}


.module-access {
  border-top: 1px dashed var(--border);
  padding-top: 8px;
  margin-top: 4px;
}

.module-access__label {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.module-capabilities {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.module-capability {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--panel-muted);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.module-capability__text {
  max-width: 520px;
}

.module-capability__text strong {
  display: block;
  margin-bottom: 4px;
}

.module-capability__text p {
  margin: 0;
  color: var(--muted);
}

.module-capability__text small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.module-empty {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

.module-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.module-card__links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.module-card__links:empty {
  display: none;
}

.module-card__nav {
  font-size: 0.85rem;
  color: var(--muted);
}

.access-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.workspace-access-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
}

.access-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.access-card__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.access-card .muted {
  margin: 6px 0 0;
}

.access-capability-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.access-capability {
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--panel-muted);
}

.empty-state {
  padding: 32px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
  text-align: center;
  color: var(--muted);
}

.env-board {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.env-table-wrapper {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.env-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
}

.env-table th,
.env-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid rgba(47, 38, 29, 0.08);
  vertical-align: top;
}

.env-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}

.env-table code {
  background: var(--bg-alt);
  padding: 2px 6px;
  border-radius: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
}

.chip-required {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.chip-optional {
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.login-page,
.error-page {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-content .login-page,
.auth-content .error-page {
  min-height: 100vh;
}

.login-card,
.error-card {
  width: min(520px, 100%);
  background: var(--panel);
  border-radius: var(--radius-xl);
  padding: 48px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  text-align: center;
}

.login-card h1,
.error-card h1 {
  margin-bottom: 12px;
}

.login-card p,
.error-card p {
  color: var(--muted);
  margin-bottom: 24px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.grid {
  display: grid;
  gap: 22px;
}

.card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
}

.card.gradient {
  background: linear-gradient(135deg, rgba(184, 119, 72, 0.15), rgba(255, 255, 255, 0.85));
}

.card.outline {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.8);
}

@media (max-width: 1200px) {
  .sidebar-panel {
    padding: 16px 12px;
  }

  .app-main {
    padding: 36px 28px 48px;
  }

  .app-main::before {
    inset: 12px;
  }

  .app-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 900px) {
  .nav-rail {
    position: static;
    flex-direction: row;
    justify-content: space-between;
    padding: 12px 16px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    box-shadow: none;
    width: 100%;
    height: auto;
  }

  .rail-buttons {
    flex-direction: row;
  }

  .sidebar-panel {
    position: relative;
    left: 0;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    box-shadow: none;
    border-radius: 0;
    padding: 20px 18px;
    width: 100%;
  }

  .sidebar-scroll {
    overflow: visible;
    max-height: none;
  }

  .sidebar-section {
    min-width: auto;
  }

  body.sidebar-collapsed .sidebar-panel {
    padding: 20px 18px;
    width: 100%;
  }

  body.sidebar-collapsed .sidebar-panel .app-logo,
  body.sidebar-collapsed .sidebar-panel .section-heading,
  body.sidebar-collapsed .sidebar-panel .nav-empty {
    opacity: 1;
    transform: none;
    max-height: none;
    height: auto;
    margin: initial;
    padding: initial;
    pointer-events: auto;
  }

  body.sidebar-collapsed .nav-link .label {
    opacity: 1;
    width: auto;
    flex: 1;
  }

  .app-toolbar {
    position: static;
  }

  .app-main {
    margin-left: 0;
    padding: 32px 20px 40px;
  }

  body.sidebar-collapsed .app-main {
    margin-left: 0;
  }

  .hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-main {
    padding: 24px 18px 36px;
  }

  .app-main::before {
    inset: 12px;
  }

  .hero {
    padding: 32px;
  }

  .hero-actions {
    flex-direction: column;
  }

  .section-heading-block {
    flex-direction: column;
  }
}
