* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: #0d6efd;
  color: #fff;
  gap: 12px;
  flex-wrap: wrap;
}

.app-logo {
  font-weight: 600;
}

/* NEW: project name badge */
.app-project-name {
  flex: 1;
  text-align: center;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.project-actions,
.auth-actions,
.user-menu {
  display: flex;
  align-items: center;
}

.auth-actions.hidden,
.user-menu.hidden,
.demo-banner.hidden {
  display: none;
}

.demo-banner {
  background: #fff3cd;
  color: #664d03;
  padding: 6px 16px;
  border-bottom: 1px solid #ffe69c;
  font-size: 0.9rem;
}

.app-main {
  flex: 1;
  display: flex;
  min-height: 0;
}

.app-sidebar {
  width: 220px;
  border-right: 1px solid #ddd;
  padding: 8px;
  overflow-y: auto;
}

.app-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #dee2e6;
}

.tab-button {
  border: none;
  background: none;
  padding: 8px 16px;
  cursor: pointer;
  font: inherit;
}

.tab-button.active {
  /* let Bootstrap nav-link active style dominate; minimal override */
  font-weight: 600;
}

.app-tab-content {
  flex: 1;
  position: relative;
}

.tab-panel {
  display: none;
  height: 100%;
}

.tab-panel.active {
  display: block;
}

.modeler-canvas {
  width: 100%;
  height: calc(100vh - 180px); /* adjust if header height changes */
}

/* XML preview panel under each canvas */
.xml-container {
  margin-top: 8px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  background: #f8f9fa;
  padding: 6px;
}

.xml-editor {
  width: 100%;
  height: 200px;
  border: none;
  outline: none;
  resize: vertical;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 12px;
  background: #ffffff;
  padding: 6px;
  box-sizing: border-box;
}

#tab-dmn .modeler-canvas {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 8px;
}

.manifest-editor {
  width: 100%;
  height: 100%;
  border: none;
  padding: 8px;
  font-family: monospace;
  resize: none;
}

.manifest-links {
  padding: 8px;
  border-bottom: 1px solid #eee;
  background: #fafafa;
  font-size: 14px;
}

.manifest-links ul {
  margin: 0;
  padding-left: 16px;
}

.project-item {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.project-item.active {
  background: #e7f1ff;
  font-weight: 600;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: #fff;
  padding: 24px;
  max-width: 520px;
  width: 90%;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.toast-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1100;
}

.toast-item {
  background: #fff;
  border: 1px solid #e3e3e3;
  border-radius: 6px;
  padding: 10px 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  animation: fadeIn 0.2s ease-out;
}

.toast-item.fade-out {
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
