:root {
  --background: 240 30% 97%;
  --foreground: 210 15% 8%;
  --surface: 0 0% 100%;
  --surface-muted: 240 20% 96%;
  --card: 0 0% 100%;
  --card-foreground: 210 15% 8%;
  --primary: 244 73% 62%;
  --primary-foreground: 0 0% 100%;
  --secondary: 240 20% 95%;
  --secondary-foreground: 210 15% 8%;
  --muted: 240 16% 94%;
  --muted-foreground: 215 16% 32%;
  --accent: 244 60% 96%;
  --accent-foreground: 244 73% 45%;
  --destructive: 10 84% 61%;
  --destructive-foreground: 0 0% 100%;
  --success: 172 88% 37%;
  --warning: 38 91% 63%;
  --border: 240 16% 90%;
  --input: 240 16% 90%;
  --ring: 244 73% 62%;
  --radius: 0.5rem;
  --sidebar: 222 47% 11%;
  --sidebar-foreground: 210 40% 96%;
  --sidebar-muted: 215 20% 65%;
  --sidebar-active: 217 33% 17%;
  --shadow-sm: 0 1px 2px 0 hsl(210 11% 15% / 0.04);
  --shadow-md: 0 4px 12px -2px hsl(210 11% 15% / 0.08);
  --shadow-lg: 0 16px 40px -12px hsl(210 11% 15% / 0.12);
  --transition-base: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: Inter, system-ui, sans-serif;
}

html[data-theme="dark"] {
  --background: 222 47% 7%;
  --foreground: 210 40% 96%;
  --surface: 222 47% 11%;
  --surface-muted: 217 33% 14%;
  --card: 222 47% 11%;
  --card-foreground: 210 40% 96%;
  --primary: 244 73% 67%;
  --primary-foreground: 0 0% 100%;
  --secondary: 217 33% 17%;
  --secondary-foreground: 210 40% 96%;
  --muted: 217 33% 17%;
  --muted-foreground: 215 20% 65%;
  --accent: 244 40% 18%;
  --accent-foreground: 244 80% 80%;
  --destructive: 10 84% 61%;
  --destructive-foreground: 0 0% 100%;
  --success: 172 88% 40%;
  --warning: 38 91% 55%;
  --border: 217 25% 20%;
  --input: 217 25% 20%;
  --ring: 244 73% 67%;
  --sidebar: 222 47% 8%;
  --sidebar-foreground: 210 40% 96%;
  --sidebar-muted: 215 16% 55%;
  --sidebar-active: 217 33% 15%;
  --shadow-sm: 0 1px 2px 0 hsl(0 0% 0% / 0.35);
  --shadow-md: 0 4px 12px -2px hsl(0 0% 0% / 0.45);
  --shadow-lg: 0 16px 40px -12px hsl(0 0% 0% / 0.55);
}

* {
  box-sizing: border-box;
  border-color: hsl(var(--border));
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: hsl(var(--foreground));
  background-color: hsl(var(--background));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  line-height: 1.5;
}

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

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  background: hsl(var(--background));
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 2.75rem 3rem 3rem;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, hsl(244 73% 62% / 0.18), transparent 55%),
    radial-gradient(ellipse 70% 50% at 80% 80%, hsl(172 70% 40% / 0.12), transparent 50%),
    hsl(var(--sidebar));
  color: hsl(var(--sidebar-foreground));
}

.auth-brand-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  min-height: 0;
}

.auth-brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0;
  align-self: flex-start;
}

.auth-brand-logo {
  display: block;
  width: 3rem;
  height: 3rem;
  flex-shrink: 0;
  object-fit: contain;
}

.auth-brand-titles {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.auth-brand-name {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #fff;
  margin: 0;
}

.auth-brand-product {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: hsl(var(--sidebar-muted));
}

.auth-story {
  margin: auto 0;
  padding-top: 2.5rem;
  padding-bottom: 1.5rem;
  max-width: 28rem;
  width: 100%;
  align-self: center;
  text-align: center;
}

.auth-story-stage {
  min-height: 8.5rem;
}

.auth-story-kicker {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: hsl(244 80% 78%);
}

.auth-story-title {
  margin: 0;
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: #fff;
}

.auth-story-body {
  margin: 0.75rem auto 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: hsl(var(--sidebar-muted));
  max-width: 26rem;
}

.auth-story-scene {
  position: relative;
  margin-top: 2.25rem;
  height: 5.75rem;
}

.auth-story-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.15rem;
  display: flex;
  align-items: center;
  gap: 0;
}

.auth-story-rail {
  flex: 1;
  height: 1px;
  background: linear-gradient(
    90deg,
    hsl(210 40% 96% / 0.08),
    hsl(210 40% 96% / 0.28),
    hsl(210 40% 96% / 0.08)
  );
}

.auth-story-node {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid hsl(210 40% 96% / 0.14);
  background: hsl(222 47% 14%);
  color: hsl(var(--sidebar-muted));
  transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.auth-story-node svg {
  width: 0.95rem;
  height: 0.95rem;
}

.auth-story-node.is-done {
  color: hsl(172 70% 55%);
  border-color: hsl(172 70% 40% / 0.45);
}

.auth-story-node.is-active {
  color: #fff;
  border-color: hsl(244 73% 62% / 0.7);
  background: hsl(244 50% 28%);
  box-shadow: 0 0 0 4px hsl(244 73% 62% / 0.16);
}

.auth-story-doc {
  position: absolute;
  top: 0;
  left: 0;
  width: 2.15rem;
  height: 2.7rem;
  padding: 0.35rem 0.3rem;
  border-radius: 0.3rem;
  background: hsl(0 0% 100% / 0.96);
  border: 1px solid hsl(210 40% 96% / 0.2);
  box-shadow: 0 8px 20px -10px hsl(0 0% 0% / 0.55);
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  z-index: 2;
  will-change: left, top;
}

.auth-story-doc-line {
  display: block;
  height: 2px;
  border-radius: 999px;
  background: hsl(222 20% 75%);
}

.auth-story-doc-line.short {
  width: 55%;
}

.auth-story-doc-badge {
  margin-top: auto;
  align-self: flex-start;
  font-size: 0.45rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.1rem 0.25rem;
  border-radius: 0.2rem;
  background: hsl(244 73% 62%);
  color: #fff;
}

.auth-story-dots {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 1.75rem;
}

.auth-story-dot {
  width: 0.45rem;
  height: 0.45rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: hsl(210 40% 96% / 0.22);
  cursor: pointer;
  transition: width 0.25s ease, background 0.25s ease;
}

.auth-story-dot.is-active {
  width: 1.15rem;
  background: hsl(244 73% 67%);
}

.auth-form-pane {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  background: hsl(var(--surface));
  border-left: 1px solid hsl(var(--border));
}

.auth-form-card {
  width: min(380px, 100%);
}

.auth-form-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: hsl(var(--foreground));
  margin: 0 0 0.35rem;
}

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .auth-brand {
    min-height: auto;
    padding: 1.75rem 1.5rem 1.5rem;
  }

  .auth-brand-lockup {
    margin-bottom: 0;
  }

  .auth-brand-logo {
    width: 2.5rem;
    height: 2.5rem;
  }

  .auth-brand-name {
    font-size: 1.45rem;
  }

  .auth-story {
    padding-top: 1.75rem;
    padding-bottom: 0.75rem;
  }

  .auth-story-stage {
    min-height: 7rem;
  }

  .auth-story-title {
    font-size: 1.25rem;
  }

  .auth-story-body {
    font-size: 0.875rem;
  }

  .auth-story-scene {
    margin-top: 1.5rem;
    height: 5.25rem;
  }

  .auth-story-doc {
    width: 1.9rem;
    height: 2.4rem;
    padding: 0.28rem 0.24rem;
  }

  .auth-form-pane {
    border-left: none;
    border-top: 1px solid hsl(var(--border));
    align-items: flex-start;
    padding-top: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-story-doc,
  .auth-story-node,
  .auth-story-stage {
    transition: none !important;
  }
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width, 260px) 1fr;
  transition: grid-template-columns 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.shell.is-sidebar-collapsed {
  --sidebar-width: 76px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: hsl(var(--sidebar));
  color: hsl(var(--sidebar-foreground));
  padding: 1rem 0.75rem;
  gap: 1.25rem;
  z-index: 40;
  overflow-x: hidden;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.15rem 0.2rem 0;
  min-height: 2.75rem;
}

.sidebar-brand-wrap {
  min-width: 0;
  flex: 1;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.sidebar-brand-mark-wrap {
  position: relative;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.sidebar-brand-mark {
  width: 2rem;
  height: 2rem;
  display: block;
  object-fit: contain;
  background: transparent;
  transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1), transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand-expand {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  border-radius: 0.55rem;
  background: hsl(var(--sidebar-active));
  opacity: 0;
  transform: scale(0.82);
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1), transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.1rem;
}

.sidebar-brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.15;
}

.sidebar-brand-sub {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: hsl(var(--sidebar-muted));
  white-space: nowrap;
  line-height: 1.2;
}

.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--sidebar-foreground) / 0.12);
  background: hsl(var(--sidebar-active) / 0.55);
  color: hsl(var(--sidebar-muted));
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-base), color var(--transition-base),
    border-color var(--transition-base), opacity var(--transition-base);
}

.sidebar-toggle:hover {
  color: #fff;
  background: hsl(var(--sidebar-active));
  border-color: hsl(var(--sidebar-foreground) / 0.22);
}

.sidebar-toggle--mobile {
  display: none;
  border-color: hsl(var(--border));
  background: hsl(var(--surface));
  color: hsl(var(--foreground));
  margin-bottom: 0.35rem;
}

.sidebar-toggle-icon {
  display: block;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  padding: 0 0.15rem;
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar-section {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: hsl(var(--sidebar-muted));
  padding: 0.55rem 0.75rem 0.3rem;
  white-space: nowrap;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: hsl(var(--sidebar-muted));
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
  text-decoration: none;
  transition: color var(--transition-base), background var(--transition-base);
  white-space: nowrap;
}

.nav-icon {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-link:hover {
  color: hsl(var(--sidebar-foreground));
  background: hsl(var(--sidebar-active) / 0.65);
}

.nav-link.is-active {
  color: #fff;
  background: hsl(var(--sidebar-active));
}

.shell.is-sidebar-collapsed .sidebar-brand-text,
.shell.is-sidebar-collapsed .sidebar-section,
.shell.is-sidebar-collapsed .nav-label {
  display: none;
}

.shell.is-sidebar-collapsed .sidebar-toggle:not(.sidebar-toggle--mobile) {
  display: none;
}

.shell.is-sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding-inline: 0;
}

.shell.is-sidebar-collapsed .sidebar-brand-wrap {
  flex: 0;
}

.shell.is-sidebar-collapsed .sidebar-brand {
  justify-content: center;
}

.shell.is-sidebar-collapsed .sidebar-brand-mark-wrap {
  width: 1.85rem;
  height: 1.85rem;
}

.shell.is-sidebar-collapsed .sidebar-brand-mark {
  width: 1.85rem;
  height: 1.85rem;
}

.shell.is-sidebar-collapsed .sidebar-brand:hover .sidebar-brand-mark,
.shell.is-sidebar-collapsed .sidebar-brand:focus-visible .sidebar-brand-mark {
  opacity: 0;
  transform: scale(0.78);
}

.shell.is-sidebar-collapsed .sidebar-brand:hover .sidebar-brand-expand,
.shell.is-sidebar-collapsed .sidebar-brand:focus-visible .sidebar-brand-expand {
  opacity: 1;
  transform: scale(1);
}

.shell.is-sidebar-collapsed .sidebar-brand.is-expand-hint {
  cursor: pointer;
}

.shell.is-sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 0.65rem;
}

.sidebar-footer {
  margin-top: auto;
  padding: 0.75rem 0.35rem 0.25rem;
  border-top: 1px solid hsl(var(--sidebar-foreground) / 0.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  padding: 0.35rem 0.25rem;
}

.sidebar-user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  gap: 0.1rem;
}

.sidebar-user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: hsl(var(--sidebar-foreground));
  line-height: 1.25;
  text-transform: capitalize;
  word-break: break-word;
}

.sidebar-user-email {
  font-size: 0.65rem;
  color: hsl(var(--sidebar-muted));
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.sidebar-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: hsl(var(--destructive));
  cursor: pointer;
  transition: color var(--transition-base), background var(--transition-base), border-color var(--transition-base);
}

.sidebar-logout:hover {
  color: hsl(var(--destructive));
  background: hsl(var(--destructive) / 0.18);
  border-color: hsl(var(--destructive) / 0.35);
}

.shell.is-sidebar-collapsed .sidebar-footer {
  padding-inline: 0;
  display: flex;
  justify-content: center;
}

.shell.is-sidebar-collapsed .sidebar-user {
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.25rem 0;
}

.shell.is-sidebar-collapsed .sidebar-user-meta {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.topbar {
  background: hsl(var(--surface) / 0.9);
  border-bottom: 1px solid hsl(var(--border));
  backdrop-filter: blur(8px);
}

.topbar-firm {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  max-width: min(320px, 55vw);
}

.topbar-firm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: hsl(var(--primary));
  line-height: 0;
}

.topbar-firm-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.topbar-firm-name {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: hsl(var(--foreground));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--surface));
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: background var(--transition-base), border-color var(--transition-base), color var(--transition-base);
}

.icon-btn:hover {
  background: hsl(var(--secondary));
  border-color: hsl(var(--ring) / 0.35);
}

html[data-theme="dark"] .theme-icon--sun {
  display: none;
}

html:not([data-theme="dark"]) .theme-icon--moon {
  display: none;
}

html[data-theme="dark"] .theme-icon--moon {
  display: block;
}

.notif-menu {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: -0.2rem;
  right: -0.2rem;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: hsl(var(--destructive));
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.05rem;
  text-align: center;
}

.notif-badge[hidden] {
  display: none;
}

.notif-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: min(360px, calc(100vw - 1.5rem));
  max-height: min(420px, 70vh);
  display: flex;
  flex-direction: column;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 2px);
  background: hsl(var(--surface));
  box-shadow: var(--shadow-lg);
  z-index: 50;
  overflow: hidden;
}

.notif-panel[hidden] {
  display: none;
}

.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid hsl(var(--border));
}

.notif-panel-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.notif-mark-all {
  padding: 0.3rem 0.55rem;
  font-size: 0.75rem;
}

.notif-list {
  overflow-y: auto;
  padding: 0.35rem;
}

.notif-empty {
  margin: 0;
  padding: 1.25rem 0.75rem;
  text-align: center;
}

.notif-item {
  border-radius: var(--radius);
}

.notif-item.is-unread {
  background: hsl(var(--accent));
}

.notif-item-link {
  display: block;
  padding: 0.7rem 0.75rem;
  text-decoration: none;
  color: inherit;
}

.notif-item-link:hover {
  background: hsl(var(--secondary) / 0.7);
  border-radius: var(--radius);
}

.notif-item-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
}

.notif-item-body {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.4;
}

.notif-item-meta {
  margin: 0.35rem 0 0;
  font-size: 0.68rem;
  color: hsl(var(--muted-foreground));
}

.profile-menu {
  position: relative;
}

.profile-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  max-width: 240px;
  padding: 0.3rem 0.55rem 0.3rem 0.3rem;
  border-radius: 999px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--secondary));
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: background var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
}

.profile-trigger:hover,
.profile-menu.is-open .profile-trigger {
  background: hsl(var(--surface));
  border-color: hsl(var(--ring) / 0.35);
  box-shadow: var(--shadow-sm);
}

.profile-trigger-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  text-align: left;
}

.profile-trigger-email {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.2;
  max-width: 140px;
}

.profile-trigger-hint {
  font-size: 0.65rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.2;
  text-transform: capitalize;
}

.profile-chevron {
  color: hsl(var(--muted-foreground));
  flex-shrink: 0;
  transition: transform var(--transition-base);
  margin-left: auto;
}

.profile-menu.is-open .profile-chevron {
  transform: rotate(180deg);
}

.user-avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.user-avatar--lg {
  width: 2.25rem;
  height: 2.25rem;
  font-size: 0.85rem;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: min(260px, calc(100vw - 2rem));
  padding: 0.65rem;
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--surface));
  box-shadow: var(--shadow-lg);
  z-index: 50;
}

.profile-dropdown[hidden] {
  display: none;
}

.profile-dropdown-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.35rem 0.55rem;
}

.profile-dropdown-email {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.profile-dropdown-role {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  color: hsl(var(--muted-foreground));
  text-transform: capitalize;
}

.profile-dropdown-divider {
  height: 1px;
  background: hsl(var(--border));
  margin: 0.15rem 0 0.35rem;
}

.profile-dropdown-item {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.65rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: hsl(var(--destructive));
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}

.profile-dropdown-item:hover {
  background: hsl(var(--destructive) / 0.08);
}

@media (max-width: 1023px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
  }

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

  .shell.is-sidebar-collapsed {
    --sidebar-width: 260px;
  }

  .shell.is-sidebar-collapsed .sidebar-brand-text {
    display: flex;
  }

  .shell.is-sidebar-collapsed .nav-label {
    display: inline;
  }

  .shell.is-sidebar-collapsed .sidebar-section {
    display: block;
  }

  .shell.is-sidebar-collapsed .sidebar-header {
    justify-content: space-between;
    padding-inline: 0.2rem;
  }

  .shell.is-sidebar-collapsed .sidebar-brand-wrap {
    flex: 1;
  }

  .shell.is-sidebar-collapsed .sidebar-brand {
    justify-content: flex-start;
  }

  .shell.is-sidebar-collapsed .sidebar-brand:hover .sidebar-brand-mark,
  .shell.is-sidebar-collapsed .sidebar-brand:focus-visible .sidebar-brand-mark {
    opacity: 1;
    transform: none;
  }

  .shell.is-sidebar-collapsed .sidebar-brand:hover .sidebar-brand-expand,
  .shell.is-sidebar-collapsed .sidebar-brand:focus-visible .sidebar-brand-expand {
    opacity: 0;
    transform: scale(0.82);
  }

  .shell.is-sidebar-collapsed .nav-link {
    justify-content: flex-start;
    padding: 0.55rem 0.7rem;
  }

  .sidebar-toggle:not(.sidebar-toggle--mobile) {
    display: none;
  }

  .sidebar-toggle--mobile {
    display: inline-flex;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: hsl(210 15% 8% / 0.45);
    z-index: 35;
  }

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

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 2.5rem;
  height: 2.5rem;
  object-fit: contain;
  flex-shrink: 0;
  background: transparent;
}

.brand-mark {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: hsl(var(--foreground));
}

.brand-sub {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  letter-spacing: 0.01em;
}

.page-title {
  font-size: clamp(1.5rem, 2.4vw, 1.875rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: hsl(var(--foreground));
}

.panel {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.hairline {
  border-color: hsl(var(--border));
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: var(--radius);
  padding: 0.55rem 0.95rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--transition-base), color var(--transition-base),
    box-shadow var(--transition-base), border-color var(--transition-base);
}

.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: 0 4px 12px -4px hsl(var(--primary) / 0.35);
}

.btn-primary:hover {
  filter: brightness(0.95);
}

.btn-ghost {
  background: hsl(var(--surface));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
}

.btn-ghost:hover {
  background: hsl(var(--secondary));
}

.btn-danger {
  background: transparent;
  border: 1px solid hsl(var(--destructive) / 0.35);
  color: hsl(var(--destructive));
}

.field {
  width: 100%;
  border: 1px solid hsl(var(--input));
  background: hsl(var(--surface));
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  color: hsl(var(--foreground));
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.field:focus {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.18);
}

.field-with-icon {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 28rem;
}

.integration-fields .field-with-icon {
  max-width: none;
  width: 100%;
}

.integration-auth-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

.integration-field .label {
  margin-bottom: 0.35rem;
}

@media (max-width: 768px) {
  .integration-auth-row {
    grid-template-columns: 1fr;
  }
}

.integration-fields > :not(.integration-auth-row) .field-with-icon {
  max-width: 26rem;
}

.field-icon {
  position: absolute;
  left: 0.75rem;
  display: inline-flex;
  color: hsl(var(--muted-foreground));
  pointer-events: none;
  z-index: 1;
}

.field--icon {
  padding-left: 2.35rem;
  padding-right: 2.6rem;
}

.field--dual {
  padding-right: 4.5rem;
}

.field--triple {
  padding-right: 6.35rem;
}

.field-action {
  position: absolute;
  right: 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: color var(--transition-base), background var(--transition-base);
}

.field-with-icon--dual .field-action--reveal {
  right: 2.15rem;
}

.field-with-icon--dual .field-action--copy {
  right: 0.35rem;
}

.field-with-icon--triple .field-action--reveal {
  right: 3.95rem;
}

.field-with-icon--triple .field-action--rotate {
  right: 2.15rem;
}

.field-with-icon--triple .field-action--copy {
  right: 0.35rem;
}

.field-action:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--secondary));
}

.field[readonly] {
  background: hsl(var(--surface-muted));
  cursor: default;
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.8125rem;
}

.label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.35rem;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: hsl(var(--foreground));
}

.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  display: inline-block;
}

.status-ok {
  background: hsl(var(--success));
}

.status-bad {
  background: hsl(var(--destructive));
}

.status-warn {
  background: hsl(var(--warning));
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--secondary));
}

.badge-ok {
  border-color: hsl(var(--success) / 0.3);
  color: hsl(var(--success));
  background: hsl(var(--success) / 0.08);
}

.badge-warn {
  border-color: hsl(var(--warning) / 0.35);
  color: hsl(38 91% 40%);
  background: hsl(var(--warning) / 0.12);
}

.badge-danger {
  border-color: hsl(var(--destructive) / 0.3);
  color: hsl(var(--destructive));
  background: hsl(var(--destructive) / 0.08);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  border-bottom: 1px solid hsl(var(--border));
  padding: 0.65rem 0.5rem;
}

.table td {
  border-bottom: 1px solid hsl(var(--border));
  padding: 0.75rem 0.5rem;
  vertical-align: top;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  max-width: 22rem;
  padding: 0.85rem 1rem;
  background: hsl(var(--foreground));
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: 0.875rem;
}

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

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
}

pre.json-block {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1.45;
  color: hsl(var(--muted-foreground));
}

.fade-enter {
  opacity: 0;
  transform: translateY(10px);
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.skeleton {
  border-radius: 0.35rem;
  background: linear-gradient(
    90deg,
    hsl(var(--muted)) 0%,
    hsl(var(--surface-muted)) 45%,
    hsl(var(--muted)) 90%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.skeleton-line {
  height: 0.7rem;
  margin-bottom: 0.65rem;
}

.skeleton-line--sm {
  height: 0.55rem;
}

.skeleton-line--lg {
  height: 1.5rem;
  margin-bottom: 0;
}

.skeleton-block {
  height: 2.25rem;
  width: 55%;
}

.skeleton-row td {
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

html[data-theme="dark"] .skeleton {
  background: linear-gradient(
    90deg,
    hsl(var(--muted)) 0%,
    hsl(217 28% 22%) 45%,
    hsl(var(--muted)) 90%
  );
  background-size: 200% 100%;
}
