.fs-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100vh;
}

.fs-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--fs-titlebar-h);
  padding: 0 8px;
  background: var(--fs-bg-elevated);
  border-bottom: 1px solid var(--fs-border);
  flex-shrink: 0;
  color: var(--fs-fg);
}

.fs-titlebar-drag {
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.fs-titlebar-logo {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--fs-accent), #4fc3f7);
}

.fs-titlebar-title {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.fs-titlebar-brandlink {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.fs-main-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.fs-404-wrap {
  margin: 0;
  max-width: 480px;
  text-align: center;
}

.fs-404-actions {
  margin: 0 0 8px;
}

.fs-404-signin {
  margin: 0;
  font-size: 12px;
}

.fs-titlebar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Ghost actions: icon masks use currentColor — tie to theme tokens (light / dark). */
.fs-titlebar-actions .fs-btn-ghost,
.fs-titlebar-actions a.fs-btn.fs-btn-ghost {
  color: var(--fs-fg-muted);
}

.fs-titlebar-actions .fs-btn-ghost:hover,
.fs-titlebar-actions a.fs-btn.fs-btn-ghost:hover {
  color: var(--fs-fg);
}

.fs-workbench {
  display: flex;
  flex: 1;
  min-height: 0;
}

.fs-activity-bar {
  width: var(--fs-activity-w);
  background: var(--fs-activity-bg);
  border-right: 1px solid var(--fs-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0;
  gap: 2px;
  flex-shrink: 0;
}

.fs-sidebar {
  width: var(--fs-sidebar-w);
  background: var(--fs-sidebar-bg);
  border-right: 1px solid var(--fs-border);
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex-shrink: 0;
}

.fs-sidebar-header {
  height: var(--fs-tab-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px 0 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fs-fg-muted);
  border-bottom: 1px solid var(--fs-border);
}

.fs-sidebar-header-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.fs-sidebar-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.fs-sidebar-pane {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.fs-sidebar-pane[hidden] {
  display: none !important;
}

#sidebar-pane-projects {
  padding: 4px 0;
}

.fs-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--fs-bg);
}

.fs-editor-chrome {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.fs-tab-bar {
  display: flex;
  align-items: stretch;
  height: var(--fs-tab-h);
  background: var(--fs-tab-inactive-bg);
  border-bottom: 1px solid var(--fs-border);
  overflow-x: auto;
  flex-shrink: 0;
}

.fs-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 200px;
  padding: 0 10px;
  border: none;
  border-right: 1px solid var(--fs-border);
  background: var(--fs-tab-inactive-bg);
  color: var(--fs-fg-muted);
  cursor: pointer;
  font-size: 13px;
  flex-shrink: 0;
}

.fs-tab:hover {
  background: var(--fs-bg-hover);
  color: var(--fs-fg);
}

.fs-tab.is-active {
  background: var(--fs-tab-active-bg);
  color: var(--fs-fg);
}

.fs-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fs-tab-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.7;
  flex-shrink: 0;
}

.fs-tab-close:hover {
  opacity: 1;
  background: var(--fs-bg-hover);
}

.fs-worksheet-panels {
  flex: 1;
  min-height: 0;
  position: relative;
}

.fs-worksheet-panel {
  display: none;
  height: 100%;
  min-height: 200px;
  padding: 24px 32px;
  overflow: auto;
}

.fs-worksheet-panel.is-visible {
  display: block;
}

.fs-editor-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* [hidden] alone loses to this rule’s specificity without :not([hidden]) / !important. */
.fs-editor-body > .fs-welcome[hidden] {
  display: none !important;
}

.fs-editor-body > .fs-welcome:not([hidden]) {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 40px;
}

.fs-editor-body > .fs-worksheet-panels[hidden] {
  display: none !important;
}

.fs-editor-body > .fs-worksheet-panels:not([hidden]) {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.fs-statusbar {
  height: var(--fs-status-h);
  background: var(--fs-status-bg);
  color: var(--fs-status-fg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  font-size: 12px;
  flex-shrink: 0;
}

.fs-status-left,
.fs-status-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fs-status-item {
  white-space: nowrap;
}

.fs-statusbar .fs-status-secondary {
  color: var(--fs-status-secondary-fg);
  font-weight: 500;
}
