:root {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --panel: #ffffff;
  --card: #ffffff;
  --text: #1d1d1f;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --accent: #0071e3;
  --accent-dark: #005ec0;
  --control-height: 32px;
  --control-radius: 10px;
  --control-padding-x: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  padding: 8px 10px;
  background: #ffffff;
  color: var(--text);
}

select {
  height: var(--control-height) !important;
  min-height: var(--control-height) !important;
  border-radius: var(--control-radius) !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  padding-left: var(--control-padding-x);
  padding-right: calc(var(--control-padding-x) + 14px);
}

input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.18);
}

button,
.toolbar-link {
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  padding: 6px var(--control-padding-x);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: #f5f5f7;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

button {
  height: var(--control-height) !important;
  min-height: var(--control-height) !important;
  border-radius: var(--control-radius) !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.toolbar-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

button:hover,
.toolbar-link:hover {
  background: #ffffff;
  border-color: #b8b8bd;
}

button:active,
.toolbar-link:active {
  transform: translateY(1px);
}

button:focus-visible,
.toolbar-link:focus-visible {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.18);
}

button.primary,
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

button.primary:hover,
.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

#auth-topbar {
  height: 24px;
  min-height: 24px;
  max-height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  background: #374151;
  color: #f9fafb;
  border-bottom: 1px solid #4b5563;
  font-size: 11px;
  line-height: 1;
}

#active-flow-name,
#flow-scope {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #f9fafb;
}

.toolbar {
  position: relative;
  z-index: 2000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  height: 42px;
  min-height: 42px;
  max-height: 42px;
  padding: 0 18px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid #e5e5ea;
  color: var(--ink);
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #cfd3d8;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.content {
  max-width: 980px;
  margin: 20px auto;
  padding: 0 16px 20px;
  display: grid;
  gap: 14px;
}

.card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: rgba(99, 99, 99, 0.08) 0px 2px 10px 0px;
}

.action-btn,
.add-node-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.add-icon {
  width: 12px;
  height: 12px;
  display: inline-block;
  background: currentColor;
  clip-path: polygon(40% 0%, 60% 0%, 60% 40%, 100% 40%, 100% 60%, 60% 60%, 60% 100%, 40% 100%, 40% 60%, 0% 60%, 0% 40%, 40% 40%);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, 0.42);
}

.modal-panel {
  position: relative;
  width: min(680px, calc(100vw - 24px));
  max-height: min(90vh, 860px);
  overflow: auto;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #ccd4dd;
  background: #ffffff;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.18);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
