:root {
  --brand-accent: #fa233b;
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --bg-main: #f5f5f7;
}

html {
  color-scheme: light;
}

html.dark {
  color-scheme: dark;
}

:root.dark {
  --text-primary: #f5f5f7;
  --text-secondary: #b6bcc6;
  --bg-main: #0f1115;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--text-primary);
  background: var(--bg-main);
}

button {
  font: inherit;
  cursor: pointer;
}

code {
  font-family: "SFMono-Regular", ui-monospace, "Cascadia Code", "Roboto Mono", Consolas, monospace;
}

.glass {
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  background: rgba(255, 255, 255, 0.72);
}

.dark .glass {
  background: rgba(15, 18, 26, 0.78);
  border-color: rgba(255, 255, 255, 0.08);
}

.app-frame {
  min-height: 100vh;
  display: flex;
  background: var(--bg-main);
}

.shell-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 16rem;
  border-right: 1px solid rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
  display: none;
  overflow-x: hidden;
}

.shell-brand {
  margin-bottom: 2rem;
}

.shell-brand-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  border-radius: 0.75rem;
}

.shell-brand-button:hover {
  background: rgba(0, 0, 0, 0.05);
}

.dark .shell-brand-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.shell-brand-badge {
  display: flex;
  height: 2rem;
  width: 2rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: white;
  color: #1d1d1f;
  font-size: 11px;
  font-weight: 700;
}

.dark .shell-brand-badge {
  background: #151a22;
  border-color: rgba(255, 255, 255, 0.12);
  color: #f3f4f6;
}

.shell-brand-name {
  display: none;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.shell-nav {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 1.5rem;
}

.shell-nav-group {
  min-width: 0;
}

.shell-nav-label {
  display: none;
  margin: 0 0 0.5rem;
  padding: 0 0.75rem;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #86868b;
}

.shell-nav-item {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  border: 0;
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.05);
  color: var(--brand-accent);
}

.dark .shell-nav-item {
  background: rgba(255, 255, 255, 0.08);
}

.shell-nav-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.shell-nav-icon svg,
.shell-icon-button svg,
.shell-mobile-nav-icon svg {
  width: 100%;
  height: 100%;
}

.shell-nav-text {
  display: none;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shell-main {
  flex: 1;
  min-width: 0;
  padding: 0 1rem 1rem;
}

.shell-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 1rem;
  background: white;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.dark .shell-topbar {
  background: #151a22;
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.shell-topbar-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #1d1d1f;
}

.dark .shell-topbar-title {
  color: #f3f4f6;
}

.shell-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.shell-icon-button {
  position: relative;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
  color: #4b5563;
}

.shell-icon-button:hover {
  background: rgba(0, 0, 0, 0.1);
}

.dark .shell-icon-button {
  background: rgba(255, 255, 255, 0.08);
  color: #c3cad5;
}

.dark .shell-icon-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.theme-icon {
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.shell-icon-button svg {
  width: 1rem;
  height: 1rem;
}

html.dark .theme-icon-sun,
html:not(.dark) .theme-icon-moon {
  opacity: 0;
}

.workspace {
  padding-top: 4rem;
  display: grid;
  gap: 1.5rem;
}

.workspace-card,
.rail-card {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 1.5rem;
  background: white;
  padding: 1.5rem;
}

.dark .workspace-card,
.dark .rail-card {
  background: #151a22;
  border-color: rgba(255, 255, 255, 0.12);
}

.workspace-kicker {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-accent);
}

.composer-panel {
  margin-top: 1rem;
  border-radius: 1rem;
  background: #f3f4f7;
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 1.25rem;
}

.dark .composer-panel {
  background: #11151d;
  border-color: rgba(255, 255, 255, 0.1);
}

.composer-copy h2,
.rail-card h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.composer-note {
  margin: 0.5rem 0 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.placeholder-block {
  margin-top: 1rem;
  min-height: 18rem;
  border-radius: 1rem;
  border: 1px dashed rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
}

.dark .placeholder-block {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(17, 21, 29, 0.65);
}

.workspace-rail {
  display: grid;
  gap: 1rem;
}

.stack-list {
  list-style: none;
  margin: 0.875rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.stack-list li {
  border-radius: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #f8f9fb;
  padding: 0.875rem;
}

.dark .stack-list li {
  background: #11151d;
  border-color: rgba(255, 255, 255, 0.12);
}

.stack-list li strong {
  display: block;
  font-weight: 700;
}

.stack-list li span {
  display: block;
  margin-top: 0.35rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.shell-mobile-nav {
  position: fixed;
  inset: auto 0 0;
  z-index: 50;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(17, 19, 21, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.shell-mobile-nav-grid {
  display: grid;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem max(0.35rem, env(safe-area-inset-bottom));
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.shell-mobile-nav-item {
  height: 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  border: 0;
  border-radius: 0.75rem;
  background: rgba(250, 35, 59, 0.12);
  color: var(--brand-accent);
}

.shell-mobile-nav-icon {
  width: 22px;
  height: 22px;
}

.shell-mobile-nav-text {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

@media (min-width: 768px) {
  .shell-sidebar {
    display: flex;
    flex-direction: column;
    width: 5rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .shell-brand-button {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .shell-main {
    margin-left: 5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    padding-bottom: 1.5rem;
  }

  .shell-topbar {
    left: 5rem;
    height: 3.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .workspace {
    padding-top: 5rem;
  }

  .shell-mobile-nav {
    display: none;
  }
}

@media (min-width: 1024px) {
  .shell-sidebar {
    width: 16rem;
    padding: 1.5rem;
  }

  .shell-main {
    margin-left: 16rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .shell-topbar {
    left: 16rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .shell-brand-name,
  .shell-nav-label,
  .shell-nav-text {
    display: inline;
  }

  .shell-brand-button {
    justify-content: flex-start;
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
  }

  .shell-nav-item {
    justify-content: flex-start;
  }

  .shell-nav-text {
    display: inline-block;
    flex: 1 1 auto;
    min-width: 0;
  }

  .workspace {
    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
    align-items: start;
  }
}
